Code Monkey home page Code Monkey logo

object-detector's Introduction

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

object-detector's People

Contributors

bikz05 avatar pangtouyu avatar

Watchers

James Cloos avatar  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.