Code Monkey home page Code Monkey logo

transito-cv's Introduction

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

transito-cv's People

Contributors

fabioperez avatar orbaruk avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.