facegrep
I want to learn Rust and found about Rustface (which is a port of C++ SeetaFace Engine). It detects faces in a picture. What interesting is it doesn't need external dependencies (eg. opencv).
I think it'll be a good exercise.
Goal
- Use the example code from rustface as base
- Get model path from environment variable so users don't have to put it as argument
- Show output file (image file with bounding boxes)
- Add json support
Usage
# Clone repo
git clone --depth 1 https://github.com/wzulfikar/facegrep
# Download model from Rustface repo
curl -L -O --output-dir /tmp https://github.com/atomashpolskiy/rustface/raw/master/model/seeta_fd_frontal_v1.0.bin
# Expose the model as environment variable
export RUSTFACE_MODEL=/tmp/seeta_fd_frontal_v1.0.bin
# Run the binary with the test image
cargo run assets/test/scientists.jpg
# Use --json flag to show json output
cargo run assets/test/scientists.jpg --json
If you don't want to install Rust cargo:
- for M1, try use the binary at
bin/facegrep-m1
- for Windows (Rust target x86_64-pc-windows-gnu), try use
bin/facegrep-win
You'll still need to download the model and expose its path as environment variable.
Preview
▲▼▲
Note to self:
- JSON should be properly handled instead of just string-concatenated (main.rs#L57, L69)
- If I want to reuse the code in web, how difficult is it to port to wasm? Would there be performance penalty?
- Took me 1 hour to put this together. How long will it take me to do similar thing after I learn more Rust?