Object Detection OpenCV Python | Easy and Fast (2020)

Поділитися
Вставка
  • Опубліковано 29 сер 2020
  • In this tutorial, we are going to learn how to detect objects using OpenCV and python. The Object Detection OpenCV method we will use is a sweet balance between speed and accuracy. Unlike many other object detection methods, we will be able to run this in real-time with a good amount of accuracy.
    🚀🚀 My Urdu/Hindi AI UA-cam Channel 🚀🚀
    / @murtazahassan01
    Download Code:
    www.computervision.zone/cours...
    Premium Courses:
    ✔️ Computer Vision Game Development Course:
    bit.ly/3ttLZ2s
    ✔️ Computer Vision with Arduino Course:
    bit.ly/3wzLB4m
    ✔️ Advanced Drone Programming Course:
    bit.ly/3qs3v5g
    ✔️ Learn to Build Computer Vision Mobile Apps:
    bit.ly/3uioY1J
    ✔️ Jetson Nano Premium Course:
    bit.ly/3L8uIlF
    ⚙️⚙️⚙️--My Gear - ⚙️⚙️⚙️
    👉 Complete Gear 💈: www.computervision.zone/tech-...
    👉 My PC Specs 🖥️: www.computervision.zone/tech-...
    👉 My Video Shooting Gear📽️ : www.computervision.zone/tech-...
    👉 My Laptops 💻: www.computervision.zone/tech-...
    👉 Educational Products🧑‍🎓: www.computervision.zone/tech-...
    👉 UA-cam Starter Kit 🔴: www.computervision.zone/tech-...
    Follow Me:
    TikTok: bit.ly/3Vo76OQ
    Facebook Group: bit.ly/3irDcb7
    Discord: bit.ly/3JvyxAM
    Facebook Page: bit.ly/3IvpU7W
    Instagram : bit.ly/3NdGME3
    Website: bit.ly/3ICFTS0
    Github: bit.ly/3woU6PS
    #ComputerVision
    #OpenCV
    #CVZone

КОМЕНТАРІ • 723

  • @pete1231
    @pete1231 3 роки тому +46

    This was great, so easy and quick. I watched so many other tutorials and there are always a million dependencies and errors, this was awesome, thanks!

    • @_BENJOSEPH
      @_BENJOSEPH 2 роки тому +2

      how to download COCO dataset?

    • @karatekidj1380
      @karatekidj1380 2 роки тому

      Peter, could you possibly help me with fixing my error?

    • @parthverma7089
      @parthverma7089 Рік тому

      i am having issues in getting the resource files such as ssd mobile net v3 and frozen inference....can u plz help me

  • @shepbryan4315
    @shepbryan4315 2 роки тому +3

    This was super helpful! Your live coding is very impressive. Thanks!

  • @bryanirvine3914
    @bryanirvine3914 3 роки тому +64

    Wonderful tutorial. Thank you so much for sharing your knowledge for free, you make the world a better place.

  • @qweqwe-kd4yc
    @qweqwe-kd4yc 3 роки тому +2

    Good Job Murtaza. Hello from Turkiye to Pakistan

  • @hilmannaufal7128
    @hilmannaufal7128 3 роки тому +14

    8:48 "Sometime time it good to be lazy" quote of the day😁

  • @universalduggal1708
    @universalduggal1708 3 роки тому +42

    I went on your website to see the weight files and couldn't find them. Where are they?

    • @ddtdilireba
      @ddtdilireba 2 роки тому +1

      yes...I also couldn't find it

    • @mark_coker
      @mark_coker 2 роки тому +1

      www.computervision.zone/topic/basic-code/

    • @am_editz9145
      @am_editz9145 Рік тому +2

      Those are paid 😥

  • @hackercop
    @hackercop 3 роки тому

    Thanks so much for making this, I learn't a lot from you.

  • @alasthereshopeforyou.1719
    @alasthereshopeforyou.1719 11 місяців тому

    Thank you very Much. This has been very very helpful!

  • @atulchandradash8477
    @atulchandradash8477 3 роки тому

    Awesome Sir ...... This the one of the best video i seen in youtube......you code are esay to understand.....thank so much sir... That One is really esay to use .....

  • @vyjayanthiseshadri4318
    @vyjayanthiseshadri4318 2 роки тому +1

    thank you soo muchh!Very informative and detailed video

  • @albertjackinson
    @albertjackinson 3 роки тому +2

    I will definitely put this to use in my own project sometime! Thank you for making this tutorial.

    • @shova524
      @shova524 2 роки тому

      Can i get your project name?

  • @luisfernandomanzano9953
    @luisfernandomanzano9953 2 роки тому +1

    This is just gold. Thank you so much Murtaza I'm a broke student but eager to dive into Computer Vision and thanks to your altruism in making this content I am can to learn something that otherwise I would not be able to. Thank you

    • @parthverma7089
      @parthverma7089 Рік тому

      i am having issues in getting the resource files such as ssd mobile net v3 and frozen inference....can u plz help me

  • @dennisasamoah2213
    @dennisasamoah2213 3 роки тому

    great tutorial from a great teacher

  • @hilary410
    @hilary410 10 місяців тому +2

    Thanks for the video! Love it! Can you do a tutorial on adding custom classes to the coco dataset for Object Detection with OpenCV Python? :)

  • @hiteshsingh2222
    @hiteshsingh2222 3 роки тому

    Incredible... Thanks for the effort and time

  • @mmf3775
    @mmf3775 3 роки тому

    Great Tutorial Murtaza .from Iran to Pakistan

  • @bhubeshsr6281
    @bhubeshsr6281 3 роки тому

    need weekly thrice videos like these please I am sharing this with all my friends

  • @allenqueen
    @allenqueen Рік тому

    You sir, are a god amongst men.

  • @mcmouli2002
    @mcmouli2002 2 роки тому

    Excellent explanation. You made me to fell in love with openCV.

    • @Idan_Nesimov
      @Idan_Nesimov 2 роки тому

      what means box[2] and box[3] ?

  • @Python-eu7ok
    @Python-eu7ok 2 роки тому

    Thanks Really Helpful
    I love 🌹 your videos

  • @overflow5027
    @overflow5027 3 роки тому

    Interesting cant wait!

  • @ofekyofi
    @ofekyofi 3 роки тому

    Great video!! everything worked perfectly

  • @2000varma
    @2000varma 3 роки тому +8

    Excellet tutorial! Can you please explain why we have set the input parameters(Size, Scale, Mean, SwapRB) to the net object?

    • @parthverma7089
      @parthverma7089 Рік тому

      i am having issues in getting the resource files such as ssd mobile net v3 and frozen inference....can u plz help me

  • @mhmaryam9359
    @mhmaryam9359 3 роки тому

    Merciiiiii pour votre effort

  • @kanonghaemi2444
    @kanonghaemi2444 3 роки тому

    you are BEST . tanx for sharing .

  • @murtazasworkshop
    @murtazasworkshop  3 роки тому +11

    If you would like to follow along, here are the prerequisites:
    1. Pycharm IDE with opencv installed
    2. Coco.names file
    3. Config and Weights file
    4. Test image or webcam
    All the files can be downloaded from the below link under the "Intermediate" section by the heading "Object Detection Opencv"
    www.murtazahassan.com/courses/opencv-projects

    • @LearningTechCom
      @LearningTechCom 3 роки тому

      " classIds, confs, bbox = net.detect(img,confThreshold=thres" this code getting error" what can i do

    • @mrSolo295
      @mrSolo295 3 роки тому +1

      there is nothing inside "-----Intermediate----" section??

    • @yunusemre9044
      @yunusemre9044 3 роки тому

      I can't find the files under the intermediate section. Can u please share them again? We love the video, it rocks!

    • @bobyau8755
      @bobyau8755 10 місяців тому +1

      The weights Are in the dataset folder downloaded from kaggle

    • @yenupurigyaneswarasaikumar650
      @yenupurigyaneswarasaikumar650 9 місяців тому

      classIds, confs, bbox = net.detect(img, confThreshold=thres)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      i am getting error

  • @general.1233
    @general.1233 2 роки тому

    Nice Doing! Thank you!

  • @Java-fj3mk
    @Java-fj3mk Рік тому

    Thanks a lot for this great tutorial. I have watched couple of the videos here in UA-cam, but no one make it straight forward like you. In line 22 why you didn't flatten the bbox when you use it with the zip function?

  • @muhammadshifa4886
    @muhammadshifa4886 3 роки тому

    That great. very nice. I have one question how we can compute its confusion matrix, precision, recall with intersection over union IoU in Python?

  • @alexandrpetrov1110
    @alexandrpetrov1110 3 роки тому +2

    Thanks!

  • @edSabio572
    @edSabio572 3 роки тому

    Thanks for your great work! Your videos never disappoint...

  • @FaisalR
    @FaisalR 3 роки тому

    awesome thanks for the tutorial

  • @hackercop
    @hackercop 3 роки тому

    You are a hero!

  • @cybercity2374
    @cybercity2374 2 роки тому

    For real man you inspired many of my main projects on AI. Thank you

  • @edSabio572
    @edSabio572 3 роки тому +1

    Dr. Murtaza, I need to know how to close up the 'complete' course in your website. At times, I play the video straight from youtube. when I log in in my account it is showing not complete. My question is, do I have to log in to continue the lesson? there is no option to 'continue' later...

  • @StormRaider2010
    @StormRaider2010 2 роки тому +8

    Thanks a lot for the tutorial, as usual well explained and straight to the point. Can you please point me to where I can download all the files you have imported at the start of the lesson. I can't find them. Thanks

  • @amirhosseinesteghamat7621
    @amirhosseinesteghamat7621 3 роки тому +5

    Can you please give straight link to the dataset and the files you add to project at the start of video

  • @ezzeldin101
    @ezzeldin101 3 роки тому +24

    Sir can you put the links of the resources files in the description, please?
    We cannot perform anything without these files.

  • @lorddevincecifra3200
    @lorddevincecifra3200 2 роки тому +1

    How to connect the camera to the laptop? In order for it to access the program. And does this needs a microcontroller?

  • @Maihoe1
    @Maihoe1 3 роки тому +1

    Can I do this using a hikvision IP camera rather than webcam? If so then can you do a quick tutorial on this? Thanks for your hard work. It is much appreciated

  • @jeremypei3610
    @jeremypei3610 2 роки тому

    Thank you so much sir!!!!!!!

  • @sohailali5741
    @sohailali5741 3 роки тому +47

    Excellent tutorial.! Can you please make a tutorial on how to train Object Detection models using our own dataset?

    • @shaik.gulshanmohiddin5966
      @shaik.gulshanmohiddin5966 3 роки тому +11

      towardsdatascience.com/creating-your-own-object-detector-ad69dda69c85 u can check here!!

    • @gameempire8872
      @gameempire8872 3 роки тому

      Chekc the ai guy gethub he is explaining everything good but not perfect,
      I need a video as you said to

    • @brokeunistudent2474
      @brokeunistudent2474 3 роки тому +1

      @@shaik.gulshanmohiddin5966 hey shaik, im having some issues with the installation, could you help me solve it?
      cannot import name 'model_lib_v2' from 'object_detection"

  • @cealisher
    @cealisher 2 роки тому

    It worked thanks alot

  • @cyberthunder1012
    @cyberthunder1012 3 роки тому

    love your work from bangladesh

  • @nadeemshaikh9257
    @nadeemshaikh9257 3 роки тому +1

    Assalamualykm bro yr videos help me alot ♥

  • @rhalppalanca3273
    @rhalppalanca3273 3 роки тому +1

    Hello, sir a nice tutorial. but can ask if object detection can light LED after the detection is done? I'm trying to apply it in RPI and in real-time

  • @Bianchi77
    @Bianchi77 2 роки тому

    Nice, thanks :)

  • @kelixoderamirez
    @kelixoderamirez Рік тому

    permisiion to learn sir. thank you

  • @patelgaurang8766
    @patelgaurang8766 Рік тому +2

    I'm getting error in net = cv2.dnn_DetectionModel....... what should i do?

  • @nobody-kn9kw
    @nobody-kn9kw 4 місяці тому

    I gotta say, this video was just what I was searching for, great work man!!!

    • @contentkaali
      @contentkaali 4 місяці тому

      I have error in classIds,confs,bbox=net.detect(img,confThresholf=thres)
      Assertion failed, !ssize.empty() in function
      What should I do?

  • @cryptogh2797
    @cryptogh2797 3 роки тому

    i dont understand why videos like this still get people who dislike it......

  • @thinhtruong5831
    @thinhtruong5831 3 роки тому

    Thanks you very much for this video. I hope you will guide custom Data Mobile net ssd

  • @user-uz5co3qf1k
    @user-uz5co3qf1k 2 роки тому

    Thank u verry much i love you❤️❤️

  • @mr.anonymous8410
    @mr.anonymous8410 3 роки тому

    Thanks a lot bro.

  • @zahra_koohestani
    @zahra_koohestani 3 роки тому +1

    thank u sm!

  • @michaelderamus662
    @michaelderamus662 2 роки тому +1

    Does this work anymore? I'm getting an error for the following.
    net = cv2.dnn.DetectionModel(weightsPath, configPath)
    AttributeError: module 'cv2.dnn' has no attribute 'DetectionModel'

  • @vinayakdhinde5606
    @vinayakdhinde5606 3 роки тому +1

    which function I need to add if I want to count how many times I lost my object from screen

  • @aydnaltun2573
    @aydnaltun2573 3 роки тому

    Sir , what if we wanna detect only a spesific object such as pedestrian or car
    what kind of methot should we use ?

  • @JH-on1rw
    @JH-on1rw 2 роки тому

    Thanks for lecture, Did you run Pycharm to using code?

  • @baitywahidiah2313
    @baitywahidiah2313 3 роки тому

    Hi can i know, how to make object identification for trash bin, example, my camera detects platics,the shutter for plastics compartment will open. And vice versa

  • @amjadmoughal
    @amjadmoughal Рік тому

    Good work keep it up bro.

  • @Renatic123
    @Renatic123 3 роки тому +2

    Where can we found the fronzen_interference_graph? Thank you

  • @aykutsirma4260
    @aykutsirma4260 3 роки тому +2

    I am getting this error:
    net = cv2.dnn_DetectionModel(weightsPath,configPath)
    AttributeError: module 'cv2.cv2' has no attribute 'dnn_DetectionModel'
    Do you know or anyone know how to solve this problem? thank you.

  • @laurajanenunez1234
    @laurajanenunez1234 3 роки тому

    is there any way to train new image, or for example i want to classify different types of cakes, please reply sir I really want this for my project

  • @pseudohawk1656
    @pseudohawk1656 Рік тому

    How can i get the width or height of the rectangle in pixel? I want to use it to measure distance along with detetecting the object

  • @davidmayorga3997
    @davidmayorga3997 3 роки тому

    I love your videos, maybe do you have a video of cross line detection?

  • @salmankhan24
    @salmankhan24 3 роки тому

    simply awesome

  • @eslammedhat7151
    @eslammedhat7151 3 роки тому +1

    How can I Apply this object detection model on a reception robot and detect the floor to be able to walk and avoid objects ?? Any idea :) Thanks

  • @dinmalikogli5983
    @dinmalikogli5983 2 роки тому

    jazakallahu khoyron bro

  • @jaymenon3693
    @jaymenon3693 3 роки тому

    Can I use my custom objects for detection like Nuts and Bolts? And can I use that model in R-Pi 4GB?

  • @user-mc9rt9eq5s
    @user-mc9rt9eq5s 3 роки тому +6

    Thank you! I have a question. How can I get the config and weight files?

  • @patrickpuentelml4958
    @patrickpuentelml4958 3 роки тому +1

    I love it this video. GREAT JOB :)
    Murtaza's you are an expert in this field I need your help How can I custom and training my own SSD MOBILENET ? I want to recognize my own object but with a CNN like this video i don't want to use the Haar Cascade method. Plese I'm working in my last project and for me is more cool using SSD MOBILENET with a predictions instead using HaarCascade. Please could you made a video training your own SSD MOBILE NET please, please, please

  • @sayanmondal161
    @sayanmondal161 Рік тому +1

    SystemError: returned a result with an exception set
    Sir can you help me out with this? I've searched for this error in several places but can't seem to be of help...
    I'm using VS Code as a platform...
    Thank You

  •  2 роки тому +1

    How to get the initial files you put in to project? Coco names and SSD files.

  • @ilkeraykut7064
    @ilkeraykut7064 3 роки тому

    I wanna detect some electronic materials like mosfet or transistor or resistor.What should I do for this?Thank you.

  • @anggingwahyuwibowo114
    @anggingwahyuwibowo114 3 роки тому +2

    Request Tutorial:
    - Detect rotation angle from template.

  • @tinmar8164
    @tinmar8164 2 роки тому

    is it possible to include more objects to be detected? like some custom trained objects

  • @datexland
    @datexland 3 роки тому +1

    As always You're Crack !! @Murtaza's .....

  • @zerlinalilin
    @zerlinalilin 3 місяці тому

    It's work! thanks a lot!!!

  • @venrajful
    @venrajful 3 роки тому +1

    Excellent tutorial. I'm currently working on a project that requires an ai to be able to recognize 4 different objects and then determine their orientation orientation this helped a lot with recognition.

    • @murtazasworkshop
      @murtazasworkshop  3 роки тому +2

      Glad it was helpful!

    • @venrajful
      @venrajful 3 роки тому

      @@murtazasworkshop It indeed was. The big challenge is now how to determine how the object is oriented relative to the camera. Found a lot of papers online but no real explanation on how to do it.

    • @edimameyanga3884
      @edimameyanga3884 3 роки тому +1

      @@murtazasworkshop Where can i download the coco dataset from? And the .pb file? please

    • @krizz5825
      @krizz5825 Рік тому

      I am also working on a project, will this program work on Arduino?please reply

    • @contentkaali
      @contentkaali 4 місяці тому

      I have error in classIds,confs,bbox=net.detect(img,confThresholf=thres)
      Assertion failed, !ssize.empty() in function
      What should I do?

  • @dompower500
    @dompower500 3 роки тому +8

    Since your videos are always easy to follow and efficient, we are eagerly waiting sir. Thsnk you for working hard to bring excellent tutorials. Can you pls cover a subject how to control relay or any device from pyCharm running on windows? (Bcs of GPIO, I will be able to do in Raspberry)

    • @murtazasworkshop
      @murtazasworkshop  3 роки тому

      Hi . There is a similar tutorial i have done that communicates with arduino using serial communication and controls a servo . You can check that. ua-cam.com/video/TymXJVk-I6Q/v-deo.html

    • @dompower500
      @dompower500 3 роки тому

      @@murtazasworkshop Thank you very much sir.

    • @parthverma7089
      @parthverma7089 Рік тому

      i am having issues in getting the resource files such as ssd mobile net v3 and frozen inference....can u plz help me

    • @mohammedazzan7529
      @mohammedazzan7529 Рік тому

      @@parthverma7089 did you get the solution? i too am having problems

    • @yenupurigyaneswarasaikumar650
      @yenupurigyaneswarasaikumar650 9 місяців тому

      classIds, confs, bbox = net.detect(img, confThreshold=thres) i am getting error over here
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^@@murtazasworkshop

  • @gabrielaz.4792
    @gabrielaz.4792 Рік тому

    Is it possible to extract the deteted box with an object as a separate image? I need it for my project and hoped it could work this way but I am lost....

  • @freemanwong106
    @freemanwong106 3 роки тому

    thank you the video. I wonder where we train the model?

  • @mrclash1357
    @mrclash1357 2 роки тому +1

    hi its good tutorual but can you tell me how I add anthor coco names like names that were not in coco name if I add that can be destroy the code?

  • @junkmauler
    @junkmauler 2 роки тому +2

    Can you do a video on how to train new objects from a collection of images? Your content is great!

    • @parthverma7089
      @parthverma7089 Рік тому

      i am having issues in getting the resource files such as ssd mobile net v3 and frozen inference....can u plz help me

  • @irvinsanchez3405
    @irvinsanchez3405 2 роки тому +1

    What cam are you using?, Are you using a ESP32?

  • @reold
    @reold 3 роки тому +9

    Good Job from India to Pakistan!
    (Others are saying you live in pakistan)

  • @rajvindermann7655
    @rajvindermann7655 2 роки тому

    Hi, is it possible to use opencv to do custom object detection? Thank you.

  • @yotte8846
    @yotte8846 Рік тому

    Is coco dataset tuple and can i modify it as i need to person to be detected like person one and person two so is that possible ?

  • @aradhyaupadhyay3518
    @aradhyaupadhyay3518 2 роки тому +1

    Sir after starting first 4 line it shows an error imshow() takes 1 positional arguments but 2 were given ....
    Sir plz solve my problem

  • @h-electronics602
    @h-electronics602 2 роки тому

    what is the difference between your method and tensorflow?

  • @nogafathi2359
    @nogafathi2359 3 роки тому

    My research in Fully convolution Network.. in small object detection
    so from. where I should be start.. please help me...
    give me some advices

  • @emadtayefeh514
    @emadtayefeh514 3 роки тому +1

    Can you please make a video about scanning the area by LIDAR?

  • @burakm.431
    @burakm.431 3 роки тому +2

    What is the algorithm used (cascade classifier etc.)? How does it detect objects?
    Can it be used for a specific object? Thank you, good job.

    • @huseyinozker2100
      @huseyinozker2100 3 роки тому

      it can be used for a specific object. For only one object you can create your own haar cascade or for a lot of object you can train your own dataset.

    • @contentkaali
      @contentkaali 4 місяці тому

      I have error in classIds,confs,bbox=net.detect(img,confThresholf=thres)
      Assertion failed, !ssize.empty() in function
      What should I do?

  • @Be_Wondered
    @Be_Wondered 3 роки тому +9

    SystemError: returned a result with an error set
    Can you please help me in this case.

    • @501ismail501
      @501ismail501 3 роки тому +2

      I solved it by downloading same files as Murtaza used (there is a link in the descriptions)

    • @pranavsundriyal1251
      @pranavsundriyal1251 3 роки тому

      I am not able to open any file from the link in the description, please help

    • @501ismail501
      @501ismail501 3 роки тому

      @@pranavsundriyal1251 you need to enroll the course first

    • @dhaneshkumareswaran1758
      @dhaneshkumareswaran1758 3 роки тому

      @@501ismail501 where

    • @mohammedazzan7529
      @mohammedazzan7529 Рік тому

      @@501ismail501 where is it man wtf>?????????

  • @radatechnologies5844
    @radatechnologies5844 2 роки тому +1

    Hi! it was such a great tutorial but you haven't attached the .pb and .pbtxt files link, it will be great if you can provide the link.

  • @Damirnah
    @Damirnah 3 роки тому +2

    Help pls. When it detects more than one object in gives out an error: cv2.putText(img, classNames[classId-1].upper(), (box[0]+50, box[1]+30), cv2.FONT_ITALIC, 1,
    IndexError: list index out of range
    Edited: in fact it shows few objects (with bad accuracy) for a few secs and then gives an error because classIds has index 90 and that is out of coco.names range

    • @JMRVRGS
      @JMRVRGS 2 роки тому

      same
      is there any fix?

    • @dans-designs
      @dans-designs 2 роки тому

      I am getting the same error but with numbers 44 and 77... which is definitely within the coco.names range.... for those having issues with over 90 being detected, make an entry in coco.names for that number and see if it fixes it??

  • @mohsinrasul7140
    @mohsinrasul7140 3 роки тому +1

    where are you getting the coco.names file from? I cant locate your files directly from the link you have provided in the video desciption.

    • @murtazasworkshop
      @murtazasworkshop  3 роки тому +1

      Follow the link in the description and enroll in the course at the top of the page to get access.

  • @mohammedsadiq69
    @mohammedsadiq69 Рік тому

    This is my first video of its and it's the third time in watching it today so I pressed the big red button directly

  • @atulchandradash8477
    @atulchandradash8477 3 роки тому +1

    i also Get This Problem
    SystemError: returned a result with an error set
    how to slove it ...??

    • @ritikamangla1778
      @ritikamangla1778 3 роки тому

      install package opencv-contrib-python and then it works

    • @501ismail501
      @501ismail501 3 роки тому

      @@juanpablomarintrujillo6838 I solved it by downloading same files as Murtaza used (there is a link in the descriptions)