Skip to content

Releases: prabhat0206/scrfd

V1.1.0

01 Dec 07:58
da8802d
Compare
Choose a tag to compare

SCRFD v1.1.0 Release Notes 🎉

  • Improved preprocessing image performance using opencv

Full Changelog: v1.0.0...v1.1.0

v1.0.0

28 Nov 08:47
574109c
Compare
Choose a tag to compare

SCRFD v1.0.0 Release Notes 🎉

We are excited to announce the first release of SCRFD, a high-performance Rust library for face detection. This release provides a robust and efficient foundation for face detection applications, leveraging ONNX Runtime for fast inference and supporting both synchronous and asynchronous workflows.


🚀 Features

  • Face Detection:
    • Detect bounding boxes for faces in input images.
    • Optional keypoint detection for facial landmarks.
  • Customizable Parameters:
    • Adjustable input size, confidence threshold, and IoU threshold.
  • Optimized Processing:
    • Anchor-based detection with caching for anchor centers.
    • Preprocessing for efficient inference.
  • Synchronous and Asynchronous Support:
    • Enable async workflows with the async feature flag.

📦 Installation

Add SCRFD to your Rust project:

[dependencies]
rusty_scrfd = { version = "0.1.0", features = ["async"] } # Optional async support

🛠️ Usage Examples

Synchronous Detection

use rusty_scrfd::SCRFD;
use image::open;
use ort::session::SessionBuilder;
use std::collections::HashMap;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let model_path = "path/to/scrfd_model.onnx";
    let session = SessionBuilder::new()?.with_model_from_file(model_path)?;

    let mut scrfd = SCRFD::new(session, (640, 640), 0.5, 0.4)?;

    let image = open("path/to/image.jpg")?.into_rgb8();
    let mut center_cache = HashMap::new();

    let (bboxes, keypoints) = scrfd.detect(&image, 5, "max", &mut center_cache)?;

    println!("Bounding boxes: {:?}", bboxes);
    if let Some(kps) = keypoints {
        println!("Keypoints: {:?}", kps);
    }

    Ok(())
}

Asynchronous Detection

use rusty_scrfd::SCRFDAsync;
use image::open;
use ort::session::SessionBuilder;
use std::collections::HashMap;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let model_path = "path/to/scrfd_model.onnx";
    let session = SessionBuilder::new()?.with_model_from_file(model_path)?;

    let scrfd = SCRFDAsync::new((640, 640), 0.5, 0.4, session)?;

    let image = open("path/to/image.jpg")?.into_rgb8();
    let mut center_cache = HashMap::new();

    let (bboxes, keypoints) = scrfd.detect(&image, 5, "max", &mut center_cache).await?;

    println!("Bounding boxes: {:?}", bboxes);
    if let Some(kps) = keypoints {
        println!("Keypoints: {:?}", kps);
    }

    Ok(())
}

🛠️ Bug Fixes and Improvements

  • Initial release with a solid base for face detection and landmark prediction.
  • Optimized for speed and flexibility.

🔖 Documentation

Full documentation is available in the README.


🛡️ License

This project is licensed under the MIT License.


❤️ Contributions

Contributions are welcome! Feel free to open issues or submit pull requests for any bugs, improvements, or features.


Enjoy using SCRFD! 🚀