Training a Cascade Classifier - OpenCV Object Detection in Games #8

Learn Code By Gaming · 168K views · 2020 · 32:29

Open on YouTube

Computer vision, speech & NLPMachine learning & deep learningtutorial

Why Stack Overflow recommends it

Stack Overflow users link it when they are stuck on the opencv_annotation, opencv_createsamples or opencv_traincascade command-line steps for training a cascade classifier on Windows.

Recommended by 1 people across 1 different months, 2022 to 2023.

What it is

A 32-minute tutorial from the Learn Code By Gaming series on training an OpenCV Haar Cascade Classifier on Windows to detect objects in a video game. It covers machine learning basics, gathering positive and negative images, using opencv_annotation, opencv_createsamples and opencv_traincascade, and then running the trained model in Python.

What people said

Recommends Paul Lam · 2022-01 · Stack Overflow · on “opencv_annotation error message; 'opencv_annotation' is not recognized as an internal or external command, operable program or batch file”

( Please Note That The Following Solution is based on Windows OS , Other Platforms may Not be Compatible with the Following Solution ) I think the opencv_annotation is excluded in opencv 4.5.1 ? I'm also using opencv 4.5.3 and the opencv_annotation is not a command-line tool ( I think ) Maybe you can follow this youtube video ( Training a Cascade Classifier - OpenCV Object Detection in Games #8 [this video] ) or the same text-based tutorial [LINK] to create positive and negative samples. I'll also describe how I make these samples below ( the “ Handling Positive Samples ” section may solve your issue ( maybe ) ) : My Dir. Structure main.py img_source Source1 Positive img1.png img2.png ... Negativ

Cites Ankit_Gunner · 2022-08 · Stack Overflow · on “OpenCV Createsamples - Error: Assertion failed ROI error”

I am trying to run the following command in my VB Code terminal C:\Ankit\VirEnv\opencv\build\x64\vc14\bin\opencv_createsamples.exe -info C:\Ankit\VirEnv\pos.txt -w 20 -h 20 -num 1000 -vec pos.vec my pos.txt file looks like this [LINK] My output Info file name: C:\Ankit\VirEnv\pos.txt Img file name: (NULL) Vec file name: pos.vec BG file name: (NULL) Num: 1000 BG color: 0 BG threshold: 80 Invert: FALSE Max intensity deviation: 40 Max x angle: 1.1 Max y angle: 1.1 Max z angle: 0.5 Max z angle: 0.5 Show samples: FALSE Width: 20 Height: 20 Max Scale: -1 RNG Seed: 12345 Create training samples from images collection... Unable to open image: C:\Ankit\VirEnv\C:\Ankit\VirEnv\Test\Positive\opencv_fram

Cites Q_Q_ · 2023-07 · Stack Overflow · on “No output after running opencv cascade command”

I am trying to make a cascade after a tutorial on [this video] (at this point I am at minute 18:30z) and everything up until this point is working, but if I run the command: D:/OpenCV/build/x64/vc15/bin/opencv_traincascade.exe -data 008_cascade_classifier/cascade -vec pos.vec -bg 008_cascade_classifier/neg.txt -w 300 -h 300 -numPos 200 -numNeg 100 -numStages 10 I get no output, no error, no success. Here's how the output looks in full: PS C:\Users\VM\Documents\GitHub\opencv_tutorials> D:/OpenCV/build/x64/vc15/bin/opencv_traincascade.exe -data 008_cascade_classifier/cascade -vec pos.vec -bg 008_cascade_classifier/neg.txt -w 300 -h 300 -numPos 200 -numNeg 100 -numStages 10 PS C:\Users\VM\Documents\