SeetaFace detection library for the Rust programming language

Example of demo program output

Rustface


SeetaFace detection library for the Rust programming language

Example of demo program output

  • SEETAFACE C++ – Github repository for the original library
  • PYTHON BINDINGS – call Rustface from Python code
  • LICENSE – licensed under permissive BSD 2-Clause

About

SeetaFace Detection is an implementation of Funnel-Structured cascade, which is designed for real-time multi-view face detection. FuSt aims at a good trade-off between accuracy and speed by using a coarse-to-fine structure. It consists of multiple view-specific fast LAB cascade classifiers at early stages, followed by coarse Multilayer Perceptron (MLP) cascades at later stages. The final stage is one unified fine MLP cascade, processing all proposed windows in a centralized style.

Read more...

Performance

You can run the criterion benchmarks using cargo bench.

Using nightly Rust

The nightly branch contains a slightly (~20%) faster version of rustface. This speedup is made possible by using explicit SIMD intrinsics. If you want to use this branch, you need an older nightly toolchain.

Regarding the performance of the nightly branch: crude manual benchmarking showed that this nightly Rust version of SeetaFace is slightly faster than the original C++ version. In this particular test the Rust version has been 4% faster on average than its C++ counterpart. When using multiple threads and enabling LTO (link-time optimization), Rust performance is a tad better (I observe a 8% boost):

Usage example

How to build

The project is a library crate and also contains a runnable example for demonstration purposes.

Then just use the standard Cargo build command:

Run demo

Code for the demo is located in examples/image_demo.rs file. It performs face detection for a given image and saves the result into a file in the working directory.

You can run the demo using:

Please note that this library makes use of Rayon framework to parallelize some computations. By default, Rayon spawns the same number of threads as the number of CPUs (logicals cores) available. Instead of making things faster, the penalty of switching between so many threads may severely hurt the performance, so it's strongly advised to keep the number of threads small by manually setting RAYON_NUM_THREADS environment variable.

Note that Rayon can be disabled entirely at compile time by providing the --no-default-features flag.

TODO

  • Use stable SIMD intrinsics when available
  • Benchmark benefit of parallelisation. Compiler improvements may have reduced the relative benefit of parallel processing, especially when running on smaller images. Simplify where possible.
  • Parallelize remaining CPU intensive loops
  • Tests (it would make sense to start with an integration test for Detector::detect, based on the results retrieved from the original library)

Authors

  • Andrei Tomashpolskiy @atomashpolskiy

    Original developer and maintainer

  • Jurriaan BW @jjhbw

    Contributor and chief maintainer

  • Ashley @expenses

    Contributor. Added the switch from OpenCV to Image.

This library is based on the following works:

  • Face detection method described in the paper: "Funnel-structured cascade for multi-view face detection with alignment awareness, Shuzhe Wu, Meina Kan, Zhenliang He, Shiguang Shan, Xilin Chen. In Neurocomputing (under review)"

  • original C++ implementation

License

Original SeetaFace Detection is released under the BSD 2-Clause license. This project is a derivative work and uses the same license as the original.

Issues

Collection of the latest Issues

jjhbw

jjhbw

performance
0

Seems lik the --no-default-features flag (which disables Rayon multiprocessing) actually leads to a serious speedup of detect(), from ~1000 ms to ~700 ms on the scientists.jpg image. Likely due to shaving off threading overhead. This is on a noisy dual core 2018 MBP, so YMMV.

I think larger images may benefit more from parallel processing, let's test that first. We may need to re-evaluate whether we want parallel processing on by default.

atomashpolskiy

atomashpolskiy

enhancement
0

The original version uses OpenMP for parallelization, in 6 places in total. So far I've been able to use Rayon to modify the corresponding code in the Rust version, in 2 places:

Here are the remaining places:

Versions

Find the latest versions by id

v0.1.6 - Nov 02, 2020

  • Made model struct immutable and Clone-able so it can be re-used (issue #12) (thanks @kornelski!)
  • Made Rectangle public (thanks @kornelski!).

v0.1.5 - Oct 28, 2020

  • Reduced use of unsafe (thanks @kornelski !).
  • Performance improvements (thanks @kornelski !).

v0.1.4 - Oct 01, 2020

  • Made Rayon an optional dependency using a feature flag. It is enabled by default. Parallel processing can now be disabled by providing the --no-default-features flag at build time.

Information - Updated May 13, 2022

Stars: 297
Forks: 27
Issues: 4

GraphQL server library for Rust

GraphQL is a data query language developed by Facebook intended to

GraphQL server library for Rust

This library is a pull parser for CommonMark, written

Further, it optionally supports parsing footnotes,

This library is a pull parser for CommonMark, written

This library is a Rust port of Dropbox's zxcvbn Javascript library

The following description is borrowed from their Readme:

This library is a Rust port of Dropbox's zxcvbn Javascript library

A library for parsing Backus–Naur form context-free grammars

Wikipedia page on Backus-Naur form

A library for parsing Backus–Naur form context-free grammars

Library for safe and correct Unix signal handling in Rust

Unix signals are inherently hard to handle correctly, for several reasons:

Library for safe and correct Unix signal handling in Rust

Library for traversing & reading GameCube and Wii disc images

Based on the C++ library MIT license (LICENSE-MIT or

Library for traversing & reading GameCube and Wii disc images

Library that implements low-level protocol to the Hitachi HD44780-compatible LCD device

by default (only uses 4 data pins) plus two control pins (R/S and EN)

Library that implements low-level protocol to the Hitachi HD44780-compatible LCD device

Library that implements low-level protocol to the Hitachi HD44780-compatible LCD device

by default (only uses 4 data pins) plus two control pins (R/S and EN)

Library that implements low-level protocol to the Hitachi HD44780-compatible LCD device

Library crate for common tasks when building rust projects

Intended for use with cargo-auto

Library crate for common tasks when building rust projects
Facebook Instagram Twitter GitHub Dribbble
Privacy