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.
- 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
# 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.
▲▼▲
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?