Expand description
Baklava is a rust wrapper around the InsightFace library to perform face comparison It returns a cosine and percentage similarity between the given image’s face against a target face.
The cosine similarity could be either positive or negative, depending on the orientation of the faces and how close they are to each other. Usually, a cosine similarity of 0.7 or higher is considered a good match.
The library can be used as simple as the example below.
use baklava::{InsightFace, Methodology};
let (cosine, percentage) = InsightFace::new("./Megatron", Some(3))
.unwrap()
.prepare_images(&[
"./face1_test.png",
"./face2_test.png",
]).unwrap()
.prepare_target_image("./face1_test.png").unwrap()
.compare_images(Methodology::Mean).unwrap();To perform the comparison baklava required you to downlaod a model from the InsightFace repository that can be found at this link: https://github.com/HyperInspire/InspireFace?tab=readme-ov-file#resource-package-list
Modules§
Structs§
- Insight
Face - InsightFace is a struct which handle the internal pointers to compare two faces and returns the cosine value
Enums§
- Methodology
- Methodology to use to compute get the cosine accross the selected image sources