Skip to content

Object Detection Framework using HOG as descriptor and Linear SVM as classifier.

License

Notifications You must be signed in to change notification settings

michaelholm-ce/object-detector

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

object-detector

Object Detector using HOG as descriptor and Linear SVM as classifier. | Video

Run the code

I have created a single python script that can be used to test the code. To test the code, run the lines below in your terminal.

git clone https://github.com/bikz05/object-detector.git
cd object-detector/bin
test-object-detector

The test-object-detector will download the UIUC Image Database for Car Detection and train a classifier to detect cars in an image. The SVM model files will be stored in data/models, so that they can be resused later on.

Configuration File

All the configurations are in the data/config/config.cfg configuration files. You can change it as per your need. Here is what the default configuration file looks like (which I have set for Car Detector)-

[hog]
min_wdw_sz: [100, 40]
step_size: [10, 10]
orientations: 9
pixels_per_cell: [8, 8]
cells_per_block: [3, 3]
visualize: False
normalize: True

[nms]
threshold: .3

[paths]
pos_feat_ph: ../data/features/pos
neg_feat_ph: ../data/features/neg
model_path: ../data/models/svm.model

About the modules

  • extract-features.py -- This module is used to extract HOG features of the training images.
  • train-classifier.py -- This module is used to train the classifier.
  • nms.py -- This module performs Non Maxima Suppression.
  • test-classifier.py -- This module is used to test the classifier using a test image.
  • config.py -- Imports the configuration variables from config.cfg.

Some of the results

Test Image 1

Detections before NMS

Image 1

Detections after NMS

Test Image 2

Detections before NMS

Detections after NMS

Test Image 3

Detections before NMS

Detections after NMS

Test Image 4

Detections before NMS

Detections after NMS

TODO

Here is list of tasks that I am planning to implement in the future -

  • Optimize code to use more numpy vectorized codes.
  • Faster NMS code.
  • Add bootstrapping (Hard Negative Mining) code.

Useful tutorials

  1. Histogram of Oriented Gradients and Object Detection
  2. Image Pyramids with Python and OpenCV
  3. Sliding Windows for Object Detection with Python and OpenCV
  4. Non-Maximum Suppression for Object Detection in Python
  5. (Faster) Non-Maximum Suppression in Python
  6. Texture Matching using Local Binary Patterns (LBP), OpenCV, scikit-learn and Python
  7. Detección de objetos Course by Coursera

About

Object Detection Framework using HOG as descriptor and Linear SVM as classifier.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%