Skip to content

AdrianSLopez/ObjectDetectionStopSign

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ObjectDetectionStopSign

A project using OpenCV, Ubuntu, and python for detecting Stop Signs on videos.

Process

1. Data Collecting

- Collected 150 positive images. *Positive images are images that contain the object you want to label/detect.

- Resized 150 images to 256x256 pixels.\n

- Download Negative images from https://github.com/JoakimSoderberg/haarcascade-negatives/tree/master/images. *Negative images are images that should not contain your object

- Created a txt file that has all the negative images' filepath, by using the following command:

ls (folder that stores all negative images)/* > (.txt file name thats going to be created)

Ex: ls negativeImages/* > negativeImagesFilePath.txt

2. Labeling

- Labeled my positive images using the following command:

- opencv_annotation -images=(filepath of positive images) -annotations (.txt filename, thats going to be created, to save the labeling ) *My annotation file name is "a.txt"

Ex: opencv_annotation -images=PositiveImages/ -annotations a.txt

- The process of labeling is just creating a box/square around the object you want to detect

3. Training

- Run the following command:

opencv_createsamples -num (number of objects in your annotations file) -vec samples.vec(name of file that is going to be created) -info (annotations file/.txt file that saved the labeling) -bg (.txt file that has the negative images' filepath)

Ex: opencv_createsamples -num 145 -vec samples.vec -info a.txt -bg negativeImagesFilePath.txt

What this command basically does is it puts your positive images on top of the negative images. It gives your object different backgrounds.

- Then Run the final command:

opencv_traincascade -featureType LBP -numPos (85% of positive files that was put in the .vec file; which is the number after -num in the opencv_creatsamples command) -data (filepath to store the file that will be createdd) -bg (.txt file that has the negative images' filepath) -acceptanceRatioBreakValue 0.00001 -vec (.vec file that was created from opencv_createsamples)

Ex: opencv_traincascade -featureType LBP -numPos 123 -data home/CV/Result/ -bg negativeImagesFilePath.txt - acceptanceRatioBreakValue 0.00001 -vec samples.vec

Result:

- "cascade.xml" is created after using opencv_traincascade command.

- Used python code with OpenCV, to use the cascade file on a video, and potentially live through a webcam/camera, and detect Stop Signs.

About

A project using OpenCV for detecting Stop Signs. Work soon to be posted.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages