100 thoughts on “Making your own Haar Cascade Intro – OpenCV with Python for Image and Video Analysis 17

  1. can I create a cascade for detecting elephants by using this haar classifier or is there any advanced versions of classifier that can be used??

  2. Good job, with your video. I have one question.

    If your first picture (the watch) have no background and you training your cascade like he had one, can he think you want the arrow or something inside the watch?

    That's why he put a square on a arrow (or close), not on the watch himself.
    I have no idea 🙂

    But great job 🙂

  3. First congratulations for the work!
    Does anyone know if there is square haarcascade and / or circle, I am looking for but only encounter .xml files of face, eyes, car plate, cats face ….. and where I can download the of the circles or squares. I realize they are basic shapes and so I would not like to do my own HaarCascade .xml
    Thank you!

  4. Hi @sentdex Harrison, great series, i have followed till this video in this series. I want to detect a customized object and don't want to use image net.
    I am thinking to take a minimum of 1500 positive images and 3000 negative images by myself.
    can i make a Haar classifier with them?

  5. hello tank you very much – can i ask you please ?
    haw can i glow a LED when camera detected a red color

  6. Hello, could you explain how to create haar cascade on windows, I would like to know how to do that as well, or if you know some resource for that?

  7. Small tip: in Linux, when prompted for an Yes-No input [Y/n], for yes just press enter. The letter that is capitalized is the default answer (just watch for y/N, this is when No is the default)

  8. Hey, First of all thanks a million for this nice tutorial. However I had tried with 50 X 50 and it took ages I was using digital ocean 2GB but its not helping me, Do you have a suggestion for me. What server or tricks I can do to make it faster from 24 hours to at least 12 hours. I very much appreciate your kind help!

  9. Great video, but are there any websites that work like image-net? The site seems like it was shut down or something, and I can't access it to search or access any of the links that you have posted. Would rather not go and download all the images one by one and resize them, so was just wondering if anyone knows, are there any sites that work the same way?

  10. * Error in `opencv_createsamples': free(): corrupted unsorted chunks: 0x08d7f5 c8 *

    i followed your guide step by step ,but finally igot a mistake jut like above,what should i do to figure it out ?

  11. Hey Sentex,

    Thanks for this video. Really appreciate your material.

    I tried installing on ubuntu 14 on an AWS EC instance.
    after installing as described I get the error below.
    Seems the python interpreter cannot find cv2.

    A little confused: 'import urllib.request' is apparently written for python3
    the instructions make no mention of running on python 3.x vs python 2.7.x


    import cv2
    ImportError: No module named 'cv2'

    found a much easier method : install anaconda, then
    pip install opencv-python

    much easier to use the package managers than a custom script. (suspect the package managers were not mature when this video was created.)

    again thanks.

  12. I would like to know how can I detect my eyes when my face is left to right(leaning to side).
    The program keeps stops when I do my face like 🙂

  13. Hello Sentdex. I need a little help here. I want to recognize or classify objects like boxes, bottles etc. Can u tell me which method i should use . I am thinking of bag of feature using surf and sift descriptors, haar cascade. Which one is better.

  14. first of all thanks a lot , i want to make a program to detect pineapple fruit in the field by a camera video, so, what type of positive or negative pic i need to use , if you can help somehow any hint or more details, thanks in advance hopefully pls give some suggestions

  15. sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
    Ok I installed the others ones but just for the libjasper-dev;
    I'm getting an error it says 'Unable to locate package libjasper-dev' pls help !

  16. I actually wanted to train a Haar cascade for it to detect multiple watches but its not even detecting my own watch.
    PLEASE HELP !! As I rely on getting atleast 1 of my own object being detected

  17. So ideally, you would like to make 10 or 20 pictures or so from ur watch from different angles to gather higher succes rate in detecting the watch?

  18. Whats/where is the best way/place to store a library of pictures if you want to build your own neg image set? Any pointers?

  19. Just in case if anyone is looking for a free linux server, you can try search Codenvy or visit https://codenvy.com/. Their free plan provide 3Gb ram.

  20. Hi there
    Great explanation but if possible could you provide a link with the whole code and the training set you used? I'm trying to do something similar as well for a personal project.

  21. Hello ,
    Thank you very much for your interesting and useful video!I would like to implement it for my project for detection of verious kinds of objects i needed;How could train the objects which i need ? and how to train with my own objects ?

  22. how long does haar cascade require for detect an object in a image including feature extract? how long in milli/micro/nanosecond? i assume after train it is fast. but feature extract might be slow. i want to do detect object at 50hz.

  23. this error is that ?
    POS count : consumed 55 : 55
    Train dataset for temp stage can not be filled. Branch training terminated.
    Cascade classifier can't be trained. Check the used training parameters.

  24. Great tutorial! How to increase the accuracy of Haar cascades? There's a lot of false positives, especially for live video :/

  25. in the video u have given an example for positive image i.e. pos/1.jpg 1 0 0 50 50, the 1 that u have specified tells about the number of objects in the image, what about i don't have the count for the number of objects i want to detect, then what should i write??

  26. super explanation sentdex u r vedio is so awesome I request u to do a project which differentiate plants using the haar cascade methodology

  27. Hello,
    I am trying to train a classifier for Detection of Stop Sign.
    I created 1000 positive images and I have around 3100 negative images.
    I have created .vec file and then I was trying to start training the classifier but I am getting the following error –

    command – $ – opencv_traincascade -data classifier -vec positives.v
    ec -bg bg.txt -numP 800 -numNeg 400 -numStages 10 -w -h 20
    error I'm getting –
    terminate called after throwing an instance of 'std::logic_error'
    what(): basic_string::_M_construct null not valid
    Aborted (core dumped)

    Can you please tell me the fix for the same. Thank you.

  28. hello i'm your new fanboi i have answer that libjasper-dev its doesn't in ubuntu 18 how do i solve this? thx

  29. can anyone tell me how to install the createsamples on windows? this is racking my mind and I Dont get it in the slightest everything i read makes no sense whats so ever

  30. i want recognize objects , for eg: Apple , Dog image should show with their names , is it possible with Opencv , without tensorflow ? , kindly let me tell

  31. Hey, I want some help. I want to create Sky Extractor that would subtract the sky from the image and what is left is only the objects like buildings ,etc. So I am confused about which would be the positive and negative part of the image. please help.

  32. Hey sentdex, just saying, you can make a cross-platform tutorial if you use this link; https://github.com/mrnugget/opencv-haar-classifier-training – I've just tested it on Windows and it seems to be working flawlessly 😀

  33. Hi bro i have a low resultion 352 * 288 collection of images that containes trees, roads, grass, cars and sky and i want way to detect trees regions on thoes images .. what the best way to do that ?

  34. is there any haarcascade that classify dog created ? I found that they only have the classifier for cat (haarcascde_frontalcatface.xml) only. can anyone help out?

  35. hello , i have some question on step one ,about install build-essential & install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev , are these two python module? i have only used win7 system ,now i clone it up and crash on next step for install these two ,should i just pip install at cmd?

  36. @sentdex You need to see this https://youtu.be/ydSXgBZ1ybk

    It's a new method using GUI and completely on Windows.

    It took me just 10mins to train too!

  37. sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
    sudo apt update
    sudo apt install libjasper1 libjasper-dev

  38. Hello, everyone, try googling Train Cascade GUI for windows, link: http://amin-ahmadi.com/cascade-trainer-gui/

  39. Successfully implemented my own haarcascade by following your videos. Along the line, I did pick up some efficiencies (using more arguments), which might enhance building haarcascades. I offer these in the spirit of sharing information.
    When running the traincascade command, here's the extra parameters and arguments I added to wind up with a robust haarcascade that built faster than when I ran with just the "stock" parameters.
    -mode ALL -functionType LBP -minhitrate 0.95 -maxfalsealarm 0.5.
    In closing, keep up the great work! I am amazed you do not charge for your videos, as your content surpasses what I am being taught in school.

  40. can you please tell me the way of detecting and identification fruit from images or real-time videos… is there any cascade for the fruit images ??
    thank you!! 🙂

  41. mageNet is under maintenance. Only ILSVRC synsets are included in the search results. it's been like that for a while

  42. In the video, 11:30 you paste a line of codo to download Build-essential, i'm making that but in Windows cmd with Chocolatey, have you someting to download Build-essential on Windows ?

  43. Hi Sentdex – I want to create a Haar cascade but my OpenCV dosn't have the apps needed (e.g. createsamples or annotation). Do I need to re-install OpenCV? If so, what should I do different this time? I'm running Windows 8 and programming in Python. I've been using OpenCV version 3.6.4. Thanks for sooo many awesome lessons!

  44. Note that libjasper has been removed from Ubuntu's library, so use this to install it from an earlier version:

    sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
    sudo apt update
    sudo apt install libjasper1 libjasper-dev

  45. I am really not able to find contour from this type of video the that rod type of structure. I actually wanted to measure the length of the bars from that video. Contour is identified if I take only an image but in case of video it is not working. I really need help. It is my project work, if possible please help me to find out this. I can share my code and video if you kindly share your email ID. video link is : https://www.youtube.com/watch?v=PHbLT0dFDh4

  46. how did you get that info.lst file in info folder? because i can't , i only have bgr.txt and info.dat in the root folder

  47. I am unable to download image urls from imagenet.org. Can you please suggest me alternate ways to download the image urls?

  48. Hello.I want to try create my own .xml file for my graduation project with this reference:
    But I have a problem which stage 6 doesn't work.It gives error such as:
    Traceback (most recent call last):
    File "./tools/mergevec.py", line 170, in <module>
    merge_vec_files(vec_directory, output_filename)
    File "./tools/mergevec.py", line 120, in merge_vec_files
    val = struct.unpack('<iihh', content[:12])
    TypeError: a bytes-like object is required, not 'str'
    Can you help about this please.I really need help for this.I didn't find any solution on the internet.

Leave a Reply

Your email address will not be published. Required fields are marked *