Skip to content

[DEPRECATED] Traffic sign detector and classifier that uses dlib and its implementation of the Felzenszwalb's version of the Histogram of Oriented Gradients (HoG) detector

Notifications You must be signed in to change notification settings

fabioperez/transito-cv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note: this repository was created for the final project of an undergraduate course and won't receive any major updates. There are methods with better results than HoG for traffic sign detector, such as Deep Learning architectures. Still, you can use this repository as a study reference or for some practical purposes.

This is a traffic sign detector and classifier that uses dlib and its implementation of the Felzenszwalb's version of the Histogram of Oriented Gradients (HoG) detector.

The training examples used in this repository are from Brazilian road signs, but the classifier should work with any traffic signs, as long as you train it properly. Google Street View images can be used to train the detectors. 25~40 images are sufficient to train a good detector.

Note: all programs accept -h as command-line parameter to show a help message.

Build

mkdir build
(cd build; cmake .. && cmake --build .)

If you want to enable AVX instructions (make sure you have compatibility):

(cd build; cmake .. -DUSE_AVX_INSTRUCTIONS=ON && cmake --build .)

Mark signs on images

  1. Compile imglab:
cd dlib/tools/imglab
mkdir build
cd build
cmake ..
cmake --build .
  1. Create XML from sample images:
dlib/tools/imglab/build/imglab -c images/pare/training.xml images/pare/train/*.(jpg|jpeg|png)
dlib/tools/imglab/build/imglab images/pare/training.xml
dlib/tools/imglab/build/imglab -c images/pare/testing.xml images/pare/test/*.(jpg|jpeg|png)
dlib/tools/imglab/build/imglab images/pare/testing.xml
  1. Use shift+click to draw a box around signs.

Train the fHOG detector

To train a fHOG detector, run build/hog_detector. For example, to run the detector on the image/pare/ folder in the verbose mode, upsampling each image once, with a threshold filter with value 0.4, execute the following command:

build/hog_detector -v -u1 --filter 0.4 images/pare/

The detector will be saved to the file detector.svm. To change the file, use the --detector-name option.

Run build/hog_detector -h for more details.

Visualize HOG detectors

To visualize detectors, use the program view_hog. Usage:

build/view_hog svm_detectors/pare_detector.svm

image

Detect and Classify

To detect and classify frames of a video, run detect with the video frames as parameters:

build/detect examples/video/*.png

If your images are not in sequence (i.e. frames of a video), use the parameter --wait to wait for user input to show next image.

build/detect --wait examples/images/*.jpg

Examples

To run the examples:

build/detect examples/video/*
build/detect --wait -u1 examples/images/*

image6 image7 image8

About

[DEPRECATED] Traffic sign detector and classifier that uses dlib and its implementation of the Felzenszwalb's version of the Histogram of Oriented Gradients (HoG) detector

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published