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
- A training dataset with positive and negative samples is given.
- HOG descriptors of the samples are calculated.
- A Linear Support Vector Machine is trained on the positive and negative samples.
- Using a sliding window, the svm classifier detects bounding boxes.
- Applying non-maximum suppression removes some of the bounding boxes.
- Rust
- wasm-pack (for compiling to WASM)
-
Clone the repository:
git clone https://github.com/chriamue/hog-detector cd hog-detector
-
Compile the code to WASM:
trunk build --release
-
Run the Web version in your browser
trunk serve --release
Open your browser on Localhost
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
The project includes a test suite that can be run with:
cargo test
Benchmarks can be run with:
cargo bench
Find a minimal annotation tool in the demo.
https://pyimagesearch.com/2014/11/10/histogram-oriented-gradients-object-detection/