Skip to content

chriamue/hog-detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hog-detector

Github Repo Github Pages Build Benchmarks codecov License: MIT Demo Doc

Histogram of Oriented Gradients and Object Detection

This project uses support vector machines (SVM) and histogram of oriented gradients (HOG) to detect objects in images. The SVM classifier is trained on HOG features extracted from training images to identify the objects in new images. The project is written in Rust and can be compiled to WebAssembly (WASM) for use in web applications.

You can find a demo here

HogDetector

How it works

  1. A training dataset with positive and negative samples is given.
  2. HOG descriptors of the samples are calculated.
  3. A Linear Support Vector Machine is trained on the positive and negative samples.
  4. Using a sliding window, the svm classifier detects bounding boxes.
  5. Applying non-maximum suppression removes some of the bounding boxes.

Requirements

  • Rust
  • wasm-pack (for compiling to WASM)

Usage

  1. Clone the repository:

    git clone https://github.com/chriamue/hog-detector
    cd hog-detector
  2. Compile the code to WASM:

    trunk build --release
  3. Run the Web version in your browser

    trunk serve --release

Open your browser on Localhost

Examples

You can find examples in example folder. The mnist example loads the mnist dataset and trains hog on the numbers.

cargo run --features mnist --example mnist

Testing

The project includes a test suite that can be run with:

cargo test

Benchmarks can be run with:

cargo bench

Train data preparation

Find a minimal annotation tool in the demo.

References

https://pyimagesearch.com/2014/11/10/histogram-oriented-gradients-object-detection/

Hard Negative Mining

Eye Dataset