feat: Added nms
This commit is contained in:
20
src/main.rs
20
src/main.rs
@@ -25,25 +25,15 @@ pub fn main() -> Result<()> {
|
||||
.change_context(errors::Error)
|
||||
.attach_printable("Failed to convert image to ndarray")?;
|
||||
let output = model
|
||||
.detect_faces(array.clone())
|
||||
.detect_faces(
|
||||
array.clone(),
|
||||
FaceDetectionConfig::default().with_threshold(detect.threshold),
|
||||
)
|
||||
.change_context(errors::Error)
|
||||
.attach_printable("Failed to detect faces")?;
|
||||
// output.print(20);
|
||||
let faces = output
|
||||
.postprocess(FaceDetectionConfig::default().with_threshold(detect.threshold))
|
||||
.change_context(errors::Error)
|
||||
.attach_printable("Failed to attach context")?;
|
||||
for bbox in faces.bbox {
|
||||
for bbox in output.bbox {
|
||||
tracing::info!("Detected face: {:?}", bbox);
|
||||
use bounding_box::draw::*;
|
||||
let bbox = bbox
|
||||
.denormalize(nalgebra::SVector::<f32, 2>::new(
|
||||
array.shape()[1] as f32,
|
||||
array.shape()[0] as f32,
|
||||
))
|
||||
.try_cast()
|
||||
.ok_or(errors::Error)
|
||||
.attach_printable("Failed to cast f32 to usize")?;
|
||||
array.draw(bbox, color::palette::css::GREEN_YELLOW.to_rgba8(), 10);
|
||||
}
|
||||
let v = array.view();
|
||||
|
||||
Reference in New Issue
Block a user