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

Поделиться
HTML-код
  • Опубликовано: 1 окт 2024

Комментарии • 130

  • @TheCodingBug
    @TheCodingBug  3 года назад +3

    ► My Other Tutorials:
    Instance Segmentation as Rendering
    ruclips.net/video/gnXlE9BO0lo/видео.html
    Colorize Black and White Images and Videos using Python OpenCV
    ruclips.net/video/EZWHAd0IH1M/видео.html
    Build and Install OpenCV 4.5.1 With CUDA GPU Support on Windows 10
    ruclips.net/video/YsmhKar8oOc/видео.html
    Face Detection Using OpenCV Python with CUDA GPU Acceleration
    ruclips.net/video/GXcy7Di1oys/видео.html
    YOLOv4 On Android Using TFLite
    ruclips.net/video/YzAjAS6Os8c/видео.html
    Install TensorFlow Under 90 Seconds
    ruclips.net/video/toJe8ZbFhEc/видео.html
    Custom YOLOv4 Object Detection with TensorFlow and TFLite
    ruclips.net/video/vzTCJM18uoM/видео.html
    Darknet YOLOv4 Custom Object Detection: Part 2 (Training YOLOv4 Darknet)
    ruclips.net/video/-NEB5P-SLi0/видео.html
    Darknet YOLOv4 Custom Object Detection: Part 1 (Preparing Custom Dataset)
    ruclips.net/video/sKDysNtnhJ4/видео.html
    YOLOv4 Object Detection with TensorFlow, TFLite and TensorRT
    ruclips.net/video/tCmC7nyfJp8/видео.html
    Darknet YOLOv4 Object Detection for Windows 10 on Images, Videos, and Webcams
    ruclips.net/video/FE2GBeKuqpc/видео.html
    Real Time Object Detection on Webcam and Videos Using OpenCV With YOLOv3 and YOLOv4 | Windows Linux
    ruclips.net/video/FjyF03uawsA/видео.html
    Build and Install OpenCV 4.4.0 with CUDA (GPU) Support on Windows 10
    ruclips.net/video/tjXkW0-4gME/видео.html
    Install TensorFlow GPU and PyTorch with CUDA on Windows 10 Anaconda | CUDA 10.1 cuDNN 7.6
    ruclips.net/video/PlW9zAg4cx8/видео.html
    Real-time Multiple Object Tracking with YOLOv4 TensorFlow and Deep Sort | Linux, Windows
    ruclips.net/video/GagII5PAeKg/видео.html

    • @coder5199
      @coder5199 2 года назад +1

      You mentioned semantic segmentation at 0:09 . How to do semantic segmentation? It is not shown in this tutorial. Help!

    • @TheCodingBug
      @TheCodingBug  2 года назад

      @@coder5199 Use panoptic segmentation as it's unified method for instance and semantic segmentation in detectron2.

    • @coder5199
      @coder5199 2 года назад

      @@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 5 месяцев назад +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!!!

  • @NO_NAME-fe6dj
    @NO_NAME-fe6dj День назад

    height, width = original_image.shape[:2]
    AttributeError: 'NoneType' object has no attribute 'shape'

  • @ДмитрийКуриленко-о3о
    @ДмитрийКуриленко-о3о 6 месяцев назад

    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'

  • @VBFilms
    @VBFilms 2 года назад +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

  • @Umesh-lz2ro
    @Umesh-lz2ro 8 дней назад +1

    Can you share your code or github?

    • @TheCodingBug
      @TheCodingBug  8 дней назад

      The code is available for our patreon supporters.

  • @ManuelHernandez-zq5em
    @ManuelHernandez-zq5em 2 года назад +1

    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? 😕

  • @joewong7035
    @joewong7035 3 года назад +3

    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?

  • @joaopedropatricio6016
    @joaopedropatricio6016 3 года назад +2

    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 года назад +1

      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?

  • @dhlee2272
    @dhlee2272 2 года назад +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 года назад +1

      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?

  • @geonovelty
    @geonovelty 3 года назад +1

    with visual studio code at the "output" i get error plus that conda is not recognized

  • @ankitbatra270
    @ankitbatra270 3 года назад +2

    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

  • @Lilina3456
    @Lilina3456 Месяц назад

    Amazing, thank you

  • @bithigh8301
    @bithigh8301 2 года назад +4

    THIS. IS. THE. BEST. DETECTRON2. TUTORIAL. EVER!
    Thanks for sharing, very neat and good tutorial!

  • @welsonfy5246
    @welsonfy5246 Год назад +1

    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 Год назад

      Yeah I also got the same error i didn't get solution

    • @AbdulHaseeb-um8gn
      @AbdulHaseeb-um8gn 4 месяца назад

      yup same error though need solution did u find any ??

  • @dheerajk1469
    @dheerajk1469 2 года назад +1

    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.

  • @AaronFhd
    @AaronFhd Год назад

    Quick Question how would I save a black and white image for just the detection of people? I want automate a task. Thanks

  • @adityasprojects7126
    @adityasprojects7126 2 года назад +1

    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?

  • @harshmankodiya9397
    @harshmankodiya9397 Год назад +1

    why is the detectron2 documentation so bad and non detailed....

  • @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

  • @vincentdupuis8134
    @vincentdupuis8134 2 года назад +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

  • @najmeb1786
    @najmeb1786 3 года назад +2

    can you please not use any musical background?

    • @TheCodingBug
      @TheCodingBug  3 года назад

      Sure.

    • @generalroboskel
      @generalroboskel 5 месяцев назад

      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.

  • @yuvrajkukreja9727
    @yuvrajkukreja9727 Месяц назад

    Awesome🙂

  • @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)

  • @abdelkarimlahmdani6793
    @abdelkarimlahmdani6793 2 года назад +1

    Thanks you, just were can i get the code colab please?

    • @TheCodingBug
      @TheCodingBug  2 года назад

      I have another video for colab
      ruclips.net/video/bjay7fT934Y/видео.html

  • @ilyassziz5
    @ilyassziz5 2 года назад +1

    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!!

  • @paulyiu6389
    @paulyiu6389 3 года назад +1

    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  3 года назад +1

      You need to install pycocotools before building detectron2.

    • @paulyiu6389
      @paulyiu6389 3 года назад

      @@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?

  • @sachinpr7148
    @sachinpr7148 3 года назад

    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

  • @tanujkhandelwal5306
    @tanujkhandelwal5306 3 года назад +1

    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)

  • @meiketas2293
    @meiketas2293 2 года назад

    What is the format of the detector = Detector(model_type="OD")? Is this an array or a dictionary?

  • @meet_gondaliya
    @meet_gondaliya 2 года назад

    Hey, how to resume training in detectron2, i am using kaggle for training

  • @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.

  • @ashishnarvekar2051
    @ashishnarvekar2051 Год назад

    Hi. How to use the detectron2 repository? I want to try this demo

  • @meet_gondaliya
    @meet_gondaliya 2 года назад +1

    Hey is it possible for training detectron2 cascade rcnn on custom dataset?

    • @TheCodingBug
      @TheCodingBug  2 года назад +1

      Kindly check our detectron2 custom object detection videos. It's possible to train any detectron2 model using custom dataset.

    • @meet_gondaliya
      @meet_gondaliya 2 года назад +1

      @@TheCodingBug thank you for you lightning support :-)

  • @marverickbin
    @marverickbin 2 года назад

    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.

  • @snazalsingh2465
    @snazalsingh2465 Год назад

    can we give the same color to each object through the video??

  • @nkchaitanya6980
    @nkchaitanya6980 9 месяцев назад

    How to print classes in list after detection or segmentation

  • @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]

  • @annmaryjose6786
    @annmaryjose6786 Год назад

    how can we use detectron2 to segment ultrasound images

  • @saikoushik7026
    @saikoushik7026 3 года назад +1

    waiting for instance segmentation in google colab sir

    • @TheCodingBug
      @TheCodingBug  3 года назад +2

      It' uploaded: ruclips.net/video/bjay7fT934Y/видео.html

  • @emmanuelkoupoh7979
    @emmanuelkoupoh7979 3 года назад

    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

  • @manojbs5736
    @manojbs5736 2 года назад

    How to add conda in visual studio code terminal

  • @zenilgosher772
    @zenilgosher772 3 года назад +1

    How to use this with Google colab?

  • @sevemz3359
    @sevemz3359 Год назад

    Hi thanks for the detailed tutorial, how do I disable the name classes or label and the percentages from showing? Thanks

  • @MuhammadHamza-rk1im
    @MuhammadHamza-rk1im 3 года назад

    kindly make a video for training custom semantic/instant segmentation dataset using detectron2

  • @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

  • @madhavgupta1212
    @madhavgupta1212 Год назад

    Crisp and informative, nice work. Thanks a lot for this video.

  • @anissarker8543
    @anissarker8543 2 года назад

    Can you make a video on densepose from detectron2?

  • @jubayerhossainarnob9935
    @jubayerhossainarnob9935 2 года назад

    how do I get an extracted list of segmented classes?

  • @muddassarjilani4637
    @muddassarjilani4637 2 года назад

    how can find the area of each mask, any code

  • @Mr.Esmaily
    @Mr.Esmaily 3 года назад

    Dose detectron2 runs on rtx3090 ?

  • @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

  • @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.

  • @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 2 месяца назад

      @@bryanwang85 @malyaj.mishra same, did u find a solution ?

  • @SanjeetKumar-nt3zo
    @SanjeetKumar-nt3zo 2 года назад

    Awesome explanation ..Thanks for sharing

  • @find127
    @find127 2 года назад

    Dude great stuff!! Thank you

  • @geonovelty
    @geonovelty 3 года назад +1

    I get an error with the pip install -e .

    • @TheCodingBug
      @TheCodingBug  3 года назад

      What's the error?

    • @gabrielprocopenco
      @gabrielprocopenco 3 года назад +2

      @@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 года назад +2

      this command must not be executed in the detectron2 folder

  • @mohammadrajabi3152
    @mohammadrajabi3152 2 года назад

    YESSSIR, i appreciate it man

  • @gardief
    @gardief 2 года назад

    very nice tutorial, I would like know how to do object detection of a specific class (for example person)?

    • @TheCodingBug
      @TheCodingBug  2 года назад +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.

  • @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.

  • @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.

  • @garyhuntress6871
    @garyhuntress6871 2 года назад

    This was SO much better than the documentation!! I'm up and running again!

  • @amandarosa4653
    @amandarosa4653 3 года назад

    Very good video, thank you!!

  • @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])