一个基于 rustface 的人脸检测服务。
- 使用 Unix Domain Socket 进行通信
- 多线程处理请求,默认最大支持5个并发工作线程,通过设置环境变量 FACE_DETECT_MAX_WORK 修改最大的线程数
- 支持 base64 编码的图片输入
- 返回检测到的人脸数量和检测耗时
- 启动服务:
./face-detect
- 发送请求:
echo -n "{\"image\":\"data:image/jpeg;base64,...\"}" | nc -U /tmp/face_detect.sock
服务以 JSON 格式返回结果:
{
"face_count": 2,
"detect_time_ms": 156
}
- 安装 Rust 工具链:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- 编译项目:
cargo build --release
编译后的二进制文件位于 target/release/face-detect
- Linux (x86_64, aarch64, armv7)
- macOS (x86_64, arm64)
- Windows (x86_64)
MIT