COMPLETE DETECTRON2 TUTORIAL | Instance Segmentation, Object Detection, Keypoints Detection and more

  Рет қаралды 60,489

TheCodingBug

3 жыл бұрын

This is a complete detectron2 tutorial for setting up detectron2, running it on images and videos. Detectron2 is FacebookAI's framework for object detection, instance segmentation, and keypoints detection written in PyTorch. Detectron2 makes it convenient to run pre-trained models or train the models from scratch. In this Detectron2 tutorial, pre-trained Instance Segmentation, Object detection, keypoints detection, panoptic segmentation, and LVIS segmentation models are covered.
In detectron2, MaskRCNN is used for semantic segmentation while Faster RCNN is used for object detection. You do not need to download any pre-trained model. The detectron2 takes care of it automatically.
** Code is available for our Patreon Supporters**
www.patreon.com/TheCodingBug
---------------------------------------------
► Time Stamps:
Introduction: (0:00)
Setup Detectron2: (0:25)
Object Detection: (2:45)
Instance Segmentation: (6:55)
Keypoints Detection: (8:49)
LVIS Segmentation: (9:29)
Panoptic Segmentation: (11:02)
Detectron2 on Videos: (12:41)
---------------------------------------------
► Commands:
git clone github.com/facebookresearch/detectron2.git
pip install -e .
conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c pytorch
pip install opencv-python
---------------------------------------------
► Links:
github.com/facebookresearch/detectron2/blob/master/MODEL_ZOO.md
github.com/facebookresearch/detectron2
---------------------------------------------
Want to discuss more?
►Join my discord: discord.gg/kUUvTQTTau
#TheCodingBug
---------------------------------------------
► My Other Tutorials:
○ Instance Segmentation as Rendering: kzbin.info/www/bejne/nZ-7nXhvd7RjotE
○ Detectron2 Complete Tutorial: kzbin.info/www/bejne/hpOWoKN7e7Vsarc
○ Colorize Black and White Images and Videos using Python OpenCV: kzbin.info/www/bejne/e4u6eXSaZa57Z68
○ Face Detection Using OpenCV Python with CUDA GPU Acceleration: kzbin.info/www/bejne/fYnGqmp6npair9U
○ Build and Install OpenCV 4.5.1 With CUDA GPU Support on Windows 10: kzbin.info/www/bejne/j6TQmX6Xp52ihcU
○ Install TensorFlow Under 90 Seconds
kzbin.info/www/bejne/qqCtlmuQl6ube8U
○ Install PyTorch Under 90 Seconds
kzbin.info/www/bejne/qJKlnJuLpMqCftU
○ YOLOv4 On Android Using TFLite: kzbin.info/www/bejne/j6ukm3SJa7SmbsU
○ Custom YOLOv4 Object Detection with TensorFlow and TFLite : kzbin.info/www/bejne/rKu3dH2DZp2opa8
○ Darknet YOLOv4 Custom Object Detection: Part 2 (Training YOLOv4 Darknet): kzbin.info/www/bejne/Y3-oc2iGYrh_n5I
○ Darknet YOLOv4 Custom Object Detection: Part 1 (Preparing Custom Dataset): kzbin.info/www/bejne/qXynqqaEqdObgJY
○ YOLOv4 Object Detection with TensorFlow, TFLite and TensorRT: kzbin.info/www/bejne/qnTQdGqkrst9ppo
○ Darknet YOLOv4 Object Detection for Windows 10 on Images, Videos, and Webcams: kzbin.info/www/bejne/fHaVeHWbgNqkpsU
○ Real-Time Object Detection on Webcam and Videos Using OpenCV With YOLOv3 and YOLOv4 | Windows Linux: kzbin.info/www/bejne/fJvcd2NpqsaqqaM
○ Build and Install OpenCV 4.4.0 With CUDA (GPU) Support on Windows 10: kzbin.info/www/bejne/qpu7nIpmYpmag6c
○ Install TensorFlow GPU and PyTorch with CUDA on Windows 10 Anaconda | CUDA 10.1 cuDNN 7.6: kzbin.info/www/bejne/hp26aq13nJmWrpo
○ Real-time Multiple Object Tracking with YOLOv4 TensorFlow and Deep Sort | Linux, Windows: kzbin.info/www/bejne/fZLKenxrhaaYgck
---------------------------------------------
► Follow us on Twitter: BugCodingThe
► Support us on Patreon: www.patreon.com/TheCodingBug
---------------------------------------------
DISCLAIMER: Links included in this description might be affiliate links. If you purchase a product or service with the links that I provide I may receive a small commission. There is no additional charge to you!

Пікірлер: 123
@TheCodingBug
@TheCodingBug 3 жыл бұрын
► My Other Tutorials: Instance Segmentation as Rendering kzbin.info/www/bejne/nZ-7nXhvd7RjotE Colorize Black and White Images and Videos using Python OpenCV kzbin.info/www/bejne/e4u6eXSaZa57Z68 Build and Install OpenCV 4.5.1 With CUDA GPU Support on Windows 10 kzbin.info/www/bejne/j6TQmX6Xp52ihcU Face Detection Using OpenCV Python with CUDA GPU Acceleration kzbin.info/www/bejne/fYnGqmp6npair9U YOLOv4 On Android Using TFLite kzbin.info/www/bejne/j6ukm3SJa7SmbsU Install TensorFlow Under 90 Seconds kzbin.info/www/bejne/qqCtlmuQl6ube8U Custom YOLOv4 Object Detection with TensorFlow and TFLite kzbin.info/www/bejne/rKu3dH2DZp2opa8 Darknet YOLOv4 Custom Object Detection: Part 2 (Training YOLOv4 Darknet) kzbin.info/www/bejne/Y3-oc2iGYrh_n5I Darknet YOLOv4 Custom Object Detection: Part 1 (Preparing Custom Dataset) kzbin.info/www/bejne/qXynqqaEqdObgJY YOLOv4 Object Detection with TensorFlow, TFLite and TensorRT kzbin.info/www/bejne/qnTQdGqkrst9ppo Darknet YOLOv4 Object Detection for Windows 10 on Images, Videos, and Webcams kzbin.info/www/bejne/fHaVeHWbgNqkpsU Real Time Object Detection on Webcam and Videos Using OpenCV With YOLOv3 and YOLOv4 | Windows Linux kzbin.info/www/bejne/fJvcd2NpqsaqqaM Build and Install OpenCV 4.4.0 with CUDA (GPU) Support on Windows 10 kzbin.info/www/bejne/qpu7nIpmYpmag6c Install TensorFlow GPU and PyTorch with CUDA on Windows 10 Anaconda | CUDA 10.1 cuDNN 7.6 kzbin.info/www/bejne/hp26aq13nJmWrpo Real-time Multiple Object Tracking with YOLOv4 TensorFlow and Deep Sort | Linux, Windows kzbin.info/www/bejne/fZLKenxrhaaYgck
@coder5199
@coder5199 Жыл бұрын
You mentioned semantic segmentation at 0:09 . How to do semantic segmentation? It is not shown in this tutorial. Help!
@TheCodingBug
@TheCodingBug Жыл бұрын
@@coder5199 Use panoptic segmentation as it's unified method for instance and semantic segmentation in detectron2.
@coder5199
@coder5199 Жыл бұрын
@@TheCodingBug How can I turn off the number of instance segmentation for panoptic segmentation? My project do not want individual instances. It wants a single coloured masks for each category.
@ricala9063
@ricala9063 2 ай бұрын
hey man thanks, you saved me, i been trying to install this for 3 days and nothing looks to work but with your video i finally got it, thank you so much!!!
@garyhuntress6871
@garyhuntress6871 2 жыл бұрын
This was SO much better than the documentation!! I'm up and running again!
@TheCodingBug
@TheCodingBug 2 жыл бұрын
I am glad it was helpful.
@madhavgupta1212
@madhavgupta1212 9 ай бұрын
Crisp and informative, nice work. Thanks a lot for this video.
@bithigh8301
@bithigh8301 2 жыл бұрын
THIS. IS. THE. BEST. DETECTRON2. TUTORIAL. EVER! Thanks for sharing, very neat and good tutorial!
@TheCodingBug
@TheCodingBug 2 жыл бұрын
I'm glad you found it useful.
@coder5199
@coder5199 Жыл бұрын
Strongly Agree!
@SanjeetKumar-nt3zo
@SanjeetKumar-nt3zo 2 жыл бұрын
Awesome explanation ..Thanks for sharing
@find127
@find127 2 жыл бұрын
Dude great stuff!! Thank you
@mohammadrajabi3152
@mohammadrajabi3152 2 жыл бұрын
YESSSIR, i appreciate it man
@amandarosa4653
@amandarosa4653 2 жыл бұрын
Very good video, thank you!!
@TheCodingBug
@TheCodingBug 2 жыл бұрын
I am glad it was helpful.
@sevemz3359
@sevemz3359 Жыл бұрын
Hi thanks for the detailed tutorial, how do I disable the name classes or label and the percentages from showing? Thanks
@zunayedmahmud3515
@zunayedmahmud3515 Жыл бұрын
Thank you for the excellent explanations! I have implemented detectron2 myself but the inference speed seems very slow for videos. I'm getting around 2 fps on a Tesla V100 for videos with resolution 1920x480. I was hoping you might have an idea.
@geonovelty
@geonovelty 3 жыл бұрын
with visual studio code at the "output" i get error plus that conda is not recognized
@AaronFhd
@AaronFhd 11 ай бұрын
Quick Question how would I save a black and white image for just the detection of people? I want automate a task. Thanks
@MuhammadHamza-rk1im
@MuhammadHamza-rk1im 2 жыл бұрын
kindly make a video for training custom semantic/instant segmentation dataset using detectron2
@emmanuelkoupoh7979
@emmanuelkoupoh7979 2 жыл бұрын
Hello, how to finetune on my own keypoints dataset ??? I don't find any tutorial that works for me. I need help please. I have a dataset with 4 keypoints per image
@meiketas2293
@meiketas2293 2 жыл бұрын
What is the format of the detector = Detector(model_type="OD")? Is this an array or a dictionary?
@joewong7035
@joewong7035 2 жыл бұрын
Thanks for the tutorial! Just one problem, when I run it on video, the video’s frame rate become very slow, causing it to be very laggy. May I know how do I fix it?
@HarithaWeerathunga
@HarithaWeerathunga 2 жыл бұрын
you need better gpu
@discovertop10any
@discovertop10any 2 жыл бұрын
Hey, how to resume training in detectron2, i am using kaggle for training
@ankitbatra270
@ankitbatra270 3 жыл бұрын
Is there a way to only segment one of the classes without changing the model? For example, in the instance segmentation model it detected sheep and person is there a way to do person only?
@shubhamchoudhary5461
@shubhamchoudhary5461 2 жыл бұрын
Yup , you can apply if else condition there to segment only one class..... I'm writing sudo code here.. If detect-op == car : Visulize this Else: pass
@ManuelHernandez-zq5em
@ManuelHernandez-zq5em 2 жыл бұрын
When I ran any of the tests python programs, I get this error: "ImportError: DLL load failed while importing win32file: The specified module could not be found." Any idea how to resolve this issue? 😕
@Fernandomoraes13
@Fernandomoraes13 2 жыл бұрын
I don't even know what is Conda, but I need to use detectron2. What can I do? I couldn't install it the usual way... (file -> settings -> python interpreter -> serach for package)
@deidy2005
@deidy2005 2 жыл бұрын
Man, I created a customized model with 3 classes (A, B and C). And I would like to take especific masks for a especific object. And I use this code: mask_A = outputs['instances'].pred_masks.cpu().numpy()[0]
@jubayerhossainarnob9935
@jubayerhossainarnob9935 2 жыл бұрын
how do I get an extracted list of segmented classes?
@sachinpr7148
@sachinpr7148 2 жыл бұрын
I am not able to install detectron in windows as detectron2 is asking for torch version 1.8 or above with 1.8 still getting errors
@gardief29
@gardief29 2 жыл бұрын
very nice tutorial, I would like know how to do object detection of a specific class (for example person)?
@TheCodingBug
@TheCodingBug 2 жыл бұрын
Model returns dictionary as detections. You can actually find the class labels from those dictionary. I guess class index for person is 1. So you can put a check that if class ==1, visualize the object, otherwise continue. Let me know if you are able to achieve that. Otherwise, I will make a small tutorial on how to do that.
@vincentdupuis8134
@vincentdupuis8134 2 жыл бұрын
Amazing! Question for video panoptic segmentation, how to do for an object to keep its colour from frame to frame
@isaacjacobharris
@isaacjacobharris Жыл бұрын
Might be a bit late but I'd assume if you record the centre of mass of each object then the next frame when things have moved a little rerecord the centre of mass and assign the the new centre of masses to the closest old centre of massed
@evanshlom1
@evanshlom1 Жыл бұрын
@@isaacjacobharris sounds like K-means is a useful tool. I've heard of people using clustering for computer vision but haven't looked into it
@ashishnarvekar2051
@ashishnarvekar2051 9 ай бұрын
Hi. How to use the detectron2 repository? I want to try this demo
@modassirafzal9560
@modassirafzal9560 2 жыл бұрын
Can you make a tutorial for Semantic Segmentation because this is a really good tutorial
@TheCodingBug
@TheCodingBug 2 жыл бұрын
I'll try to make one in November.
@annmaryjose6786
@annmaryjose6786 Жыл бұрын
how can we use detectron2 to segment ultrasound images
@snazalsingh2465
@snazalsingh2465 Жыл бұрын
can we give the same color to each object through the video??
@manojbs5736
@manojbs5736 2 жыл бұрын
How to add conda in visual studio code terminal
@anissarker8543
@anissarker8543 2 жыл бұрын
Can you make a video on densepose from detectron2?
@adityasprojects7126
@adityasprojects7126 2 жыл бұрын
Thanks for the awesome video. However, the inferencing part runs on CPU and not on cuda. It throws error if I change cpu to cuda - "output = viz.draw_instance_predictions(predictions["instances"].to("cuda"))" . How do i run videos/images on cuda
@vy1w1yv
@vy1w1yv Жыл бұрын
did you resolve your issue with cuda?
@nkchaitanya6980
@nkchaitanya6980 6 ай бұрын
How to print classes in list after detection or segmentation
@muddassarjilani4637
@muddassarjilani4637 2 жыл бұрын
how can find the area of each mask, any code
@sufailmuhammed9670
@sufailmuhammed9670 Жыл бұрын
during installing the pytorch toolkit etc..CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required to download and install packages.error is happening. How can i fix that
@Mr.Esmaily
@Mr.Esmaily 2 жыл бұрын
Dose detectron2 runs on rtx3090 ?
@dheerajk1469
@dheerajk1469 Жыл бұрын
I wanted to ask how can I perform Multitask learning using detectron2 , i mean i need to perform Obj Detection, Semantic segmentation and Depth estimation using a single network. Can you throw some ideas how I can I do this, how can I fuse the specific task heads to perform all the tasks together when I pass in an image.
@yasminebaroud3965
@yasminebaroud3965 Жыл бұрын
did you can make it in one model ?
@VBFilms
@VBFilms 2 жыл бұрын
I keep getting the error: "ImportError: DLL load failed while importing win32file". I reinstalled the whole thing several times but I can't figure out why it's not working.
@deepdiver4130
@deepdiver4130 2 жыл бұрын
just do conda install pywin32 It should solve your problem
@abdelkarimlahmdani6793
@abdelkarimlahmdani6793 Жыл бұрын
Thanks you, just were can i get the code colab please?
@TheCodingBug
@TheCodingBug Жыл бұрын
I have another video for colab kzbin.info/www/bejne/mJvEqmqciZ5mars
@discovertop10any
@discovertop10any 2 жыл бұрын
Hey is it possible for training detectron2 cascade rcnn on custom dataset?
@TheCodingBug
@TheCodingBug 2 жыл бұрын
Kindly check our detectron2 custom object detection videos. It's possible to train any detectron2 model using custom dataset.
@discovertop10any
@discovertop10any 2 жыл бұрын
@@TheCodingBug thank you for you lightning support :-)
@joaopedropatricio6016
@joaopedropatricio6016 3 жыл бұрын
Is this using gpu? or cuda? Can I run this on AMD graphics card? Can I get higher frame rates by doing parallel processing? Is it possible ?
@TheCodingBug
@TheCodingBug 3 жыл бұрын
Yes it's using GPU. You cannot use GPU acceleration if you have AMD GPU. However, you can use it with CPU or Google colab in that case.
@joaopedropatricio6016
@joaopedropatricio6016 3 жыл бұрын
@@TheCodingBug why Google colab? How can I get higher frame rates ir video analysis?
@muddassarjilani4637
@muddassarjilani4637 2 жыл бұрын
sir, while running this code on mac m1 pro, I am getting the following error height, width = original_image.shape[:2] AttributeError: 'NoneType' object has no attribute 'shape' kindly guide me
@TheCodingBug
@TheCodingBug 2 жыл бұрын
You have a problem with reading the image.
@tanujkhandelwal5306
@tanujkhandelwal5306 3 жыл бұрын
I'm getting the error "No module named Detectron2" after following your installation steps. Got this error while running a test file in the detectron2's test folder.
@TheCodingBug
@TheCodingBug 3 жыл бұрын
Try importing it in command line while at main folder.
@DManniex
@DManniex 2 жыл бұрын
I had this error too, you need to change your enviroment to the detectron enviroment (in anaconda you select the enviroment before you launch your IDE)
@Samurai-in5nr
@Samurai-in5nr 2 жыл бұрын
Is it possible to use detectron2 for my own custom dataset. I want to use it for finding dog keypoints? If yes can u please suggest how can i acheive that and if not then where can i start with?
@TheCodingBug
@TheCodingBug 2 жыл бұрын
Yes it's possible. I have made video for custom detectron2 also. You would be able to find it on the channel.
@Samurai-in5nr
@Samurai-in5nr 2 жыл бұрын
@@TheCodingBug yes sir I have seen that video, you have used it for image segmentation but how can I use it for keypoints. As I have went through the code I am not able to find where I have to make the changes.
@johngrabner
@johngrabner 3 жыл бұрын
Predictor takes an BGR image not RGB according to the class DefaultPredictor comments. Unless cfg.INPUT.FORMAT is set to RGB.
@TheCodingBug
@TheCodingBug 3 жыл бұрын
That's true. Therefore, we are converting the input image to BGR by the command "image[:,:,::-1]" and then the result back to RGB format.
@johngrabner
@johngrabner 3 жыл бұрын
@@TheCodingBug Your code is correct. Did not realize that cv2.imread inputs as BGR. DefaultPredictor takes cfg.INPUT.FORMAT that defaults to BGR, consistent with cv2. But Visualizer wants RGB. Hence why you reverse the order when Visualizer is called.
@paulyiu6389
@paulyiu6389 2 жыл бұрын
Thanks a lot for your video, but i face an error with the pip install -e. Building wheel for pycocotools (setup.py) ... error ERROR: Command errored out with exit status 1:
@TheCodingBug
@TheCodingBug 2 жыл бұрын
You need to install pycocotools before building detectron2.
@paulyiu6389
@paulyiu6389 2 жыл бұрын
@@TheCodingBug Thanks a lot for your comment, and the previous problem has been solved but a new problem occurs: ERROR: Command errored out with exit status 1: command: 'E:\anaconda3\envs\detectron_env\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User\\detectron2\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\detectron2\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"' '"'"', '"'"' '"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps cwd: C:\Users\User\detectron2\
@karthickraja1026
@karthickraja1026 2 жыл бұрын
@@paulyiu6389 Paul, I have faced same issue on install -e.How could resolve it?
@dhlee2272
@dhlee2272 2 жыл бұрын
Thank you for your good tutorial Could you help me with my problem? I have error that "COCO-Detection.faster_rcnn_R_101_FPN_3x.yaml not available in Model Zoo" How can I solve this problem?
@pankajdeoli3889
@pankajdeoli3889 2 жыл бұрын
Put / instead of . after COCO-Detection
@k2no548
@k2no548 2 жыл бұрын
Have you solved the problem ?
@k2no548
@k2no548 2 жыл бұрын
@@pankajdeoli3889 I get the same issue even tho the expression is correct
@aishwaryapanampilly5993
@aishwaryapanampilly5993 Жыл бұрын
@@pankajdeoli3889 I did this but still have the same error
@aishwaryapanampilly5993
@aishwaryapanampilly5993 Жыл бұрын
Have you managed to solve the problem?
@ilyassziz5
@ilyassziz5 2 жыл бұрын
hy, i get an error while executing the code. No module named 'detectron2.engine'. please help???
@TheCodingBug
@TheCodingBug 2 жыл бұрын
You haven't installed detectron2 in the environment you're using.
@ilyassziz5
@ilyassziz5 2 жыл бұрын
@@TheCodingBug i install it but i get the error!!
@malyaj.mishra
@malyaj.mishra Жыл бұрын
Hi. Thanks a ton for your tutorial. Really appreciate your hard work. Just a small query. I am getting below error while using the command: pip install -e . error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\link.exe' failed with exit code 1120 Can you please tell me how to fix this? PS: Searched and tried many things, but couldn't find any solution.
@bryanwang85
@bryanwang85 Жыл бұрын
Same, any solution?
@adampetit7020
@adampetit7020 6 сағат бұрын
@@bryanwang85 @malyaj.mishra same, did u find a solution ?
@geonovelty
@geonovelty 3 жыл бұрын
I get an error with the pip install -e .
@TheCodingBug
@TheCodingBug 3 жыл бұрын
What's the error?
@gabrielprocopenco
@gabrielprocopenco 3 жыл бұрын
@@TheCodingBug ERROR: File "setup.py" or "setup.cfg" not found. Directory cannot be installed in editable mode: C:\Users\Gabriel\PycharmProjects\detectron\detectron2
@gabrielprocopenco
@gabrielprocopenco 3 жыл бұрын
this command must not be executed in the detectron2 folder
@zenilgosher772
@zenilgosher772 2 жыл бұрын
How to use this with Google colab?
@TheCodingBug
@TheCodingBug 2 жыл бұрын
I'll upload video on Monday.
@welsonfy5246
@welsonfy5246 9 ай бұрын
erreur install after pip install -e . : RuntimeError: Error compiling objects for extension [end of output] note: This error originates from a subprocess, and is likely not a problem with pip.
@chelappankumar3187
@chelappankumar3187 9 ай бұрын
Yeah I also got the same error i didn't get solution
@AbdulHaseeb-um8gn
@AbdulHaseeb-um8gn Ай бұрын
yup same error though need solution did u find any ??
@saikoushik7026
@saikoushik7026 2 жыл бұрын
waiting for instance segmentation in google colab sir
@TheCodingBug
@TheCodingBug 2 жыл бұрын
It' uploaded: kzbin.info/www/bejne/mJvEqmqciZ5mars
@user-wz4xz1dl6h
@user-wz4xz1dl6h 3 ай бұрын
What am I doing wrong? File "c:\Users\User\.vscode\Detectron2\Main.py", line 5, in detector.onImage("Images/1.jpg") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\User\.vscode\Detectron2\Detector.py", line 24, in onImage prediction = self.predictor(image) ^^^^^^^^^^^^^^ AttributeError: 'Detector' object has no attribute 'predictor'
@najmeb1786
@najmeb1786 2 жыл бұрын
can you please not use any musical background?
@TheCodingBug
@TheCodingBug 2 жыл бұрын
Sure.
@generalroboskel
@generalroboskel 2 ай бұрын
Alot people don't get how distracting the musical background is. Thanks for bringing it up...why do people think it improves it, I'll never understand.
@harshmankodiya9397
@harshmankodiya9397 Жыл бұрын
why is the detectron2 documentation so bad and non detailed....
@TheCodingBug
@TheCodingBug Жыл бұрын
Perhaps they abandoned the project.
@marverickbin
@marverickbin Жыл бұрын
I followed exactly like discribed, but Im stuck because of this error, when running the main.py (in 6:33s): RuntimeError: COCO-Detection/faster_rcnn_R_101_FPN_3x.yaml not available in Model Zoo! I checked for typos, there are none. (my code is exactly like the video: self.cfg.merge_from_file(model_zoo.get_config_file("COCO-Detection/faster_rcnn_R_101_FPN_3x.yaml")) self.cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url("COCO-Detection/faster_rcnn_R_101_FPN_3x.yaml") Help? EDIT: I complete deleted the detectron folder and cloned and instaled again and it worked.
@sohailali5741
@sohailali5741 2 жыл бұрын
I am getting errors here, can you please let me know the solution? viz = Visualizer(image[:,:,::-1], metadata = MetadataCatalog.get(cfg.DATASETS.TRAIN[0]) NameError: name 'cfg' is not defined
@TheCodingBug
@TheCodingBug 2 жыл бұрын
You need to import and initialize cfg
@sohailali5741
@sohailali5741 2 жыл бұрын
@@TheCodingBug Thanks, just solve the error by replacing MetadataCatalog.get(cfg.DATASETS.TRAIN[0]) with MetadataCatalog.get(self.cfg.DATASETS.TRAIN[0])
@darrenho9564
@darrenho9564 Жыл бұрын
good tutorial. though if anyone got the "IndexError: too many indices for tensor of dimension 2" error for the panoptic segmentation code like i did, i managed to resolve it by replacing the original lines of code: else: predictions, segmentInfo = self.predictor(image)["panoptic_seg"] viz = Visualizer(image[:,:,::-1], MetadataCatalog.get(self.cfg.DATASETS.TRAIN[0])) output = viz.draw_instance_predictions(predictions["instances"].to("cpu")) with these lines of code instead: else: panoptic_result = self.predictor(image) panoptic_seg, segments_info = panoptic_result["panoptic_seg"] viz = Visualizer(image[:,:,::-1], MetadataCatalog.get(self.cfg.DATASETS.TRAIN[0])) output = viz.draw_panoptic_seg(panoptic_seg.to("cpu"), segments_info) hope it helps anyone who faces this issue
World’s Deadliest Obstacle Course!
28:25
MrBeast
Рет қаралды 160 МЛН
Always be more smart #shorts
00:32
Jin and Hattie
Рет қаралды 47 МЛН
World’s Deadliest Obstacle Course!
28:25
MrBeast
Рет қаралды 160 МЛН