Skip to main content

Crate yscv_detect

Crate yscv_detect 

Source
Expand description

§yscv-detect

Object detection pipeline: YOLOv8/v11 decoding, NMS, heatmap detection, ROI pooling, and anchor generation.

use yscv_detect::*;

let detections = detect_people_from_rgb8(width, height, &rgb_data, 0.5, 3, 0.45, 100)?;
for det in &detections {
    println!("{}: {:.0}% at ({}, {}, {}, {})",
        det.label, det.score * 100.0, det.x, det.y, det.w, det.h);
}

§Features

  • YOLO decoding: YOLOv8 and YOLOv11 output tensor parsing with letterbox preprocessing
  • NMS: standard, soft-NMS, batched (class-aware), with early exit optimization
  • Heatmap detection: keypoint-based detection with local maxima suppression
  • ROI ops: ROI pooling and bilinear ROI align
  • Anchors: multi-scale anchor generation for SSD/Faster R-CNN
  • Scratch buffers: zero-alloc detection with reusable scratch objects

§Optional Features

[features]
onnx = []  # ONNX model inference via yscv-onnx

§Tests

60 tests covering decoding, NMS edge cases, ROI alignment.

Structs§

BoundingBox
Axis-aligned box in image coordinates.
Detection
One detection with score and class id.
FrameFaceDetectScratch
Reusable scratch storage for frame-based face detection.
FramePeopleDetectScratch
Reusable scratch storage for frame-based people detection.
HeatmapDetectScratch
Reusable scratch storage for connected-component heatmap detection.
ModelDetectorConfig
Configuration for a model-based detector.
Rgb8FaceDetectScratch
Reusable scratch storage for RGB8 face detection.
Rgb8PeopleDetectScratch
Reusable scratch storage for RGB8 people detection.
YoloConfig
YOLO model configuration.

Enums§

DetectError

Constants§

CLASS_ID_FACE
CLASS_ID_PERSON
CRATE_ID

Traits§

ModelDetector
Abstract interface for model-backed object detectors.

Functions§

batched_nms
Per-class (batched) NMS.
coco_labels
Returns the 80 COCO class labels.
decode_yolov8_output
Decode YOLOv8 raw output tensor into detections.
decode_yolov11_output
Decode YOLOv11 output tensor into detections.
detect_faces_from_frame
Heuristic face detector over RGB frames using a skin-probability heatmap.
detect_faces_from_frame_with_scratch
Heuristic face detector over RGB frames with reusable scratch storage.
detect_faces_from_rgb8
Heuristic face detector over raw RGB8 bytes.
detect_faces_from_rgb8_with_scratch
Heuristic face detector over raw RGB8 bytes with reusable scratch storage.
detect_from_heatmap
Connected-component detector over heatmaps [H, W, 1].
detect_from_heatmap_with_scratch
Connected-component detector over heatmaps [H, W, 1] with reusable scratch storage.
detect_people_from_frame
Convenience adapter from frame to heatmap-based detection.
detect_people_from_frame_with_scratch
Convenience adapter from frame to heatmap-based detection with reusable scratch storage.
detect_people_from_rgb8
People detector over raw RGB8 bytes.
detect_people_from_rgb8_with_scratch
People detector over raw RGB8 bytes with reusable scratch storage.
detect_yolov8_from_rgb
Run the full YOLOv8 detection pipeline on an HWC image.
detect_yolov8_onnx
Run YOLOv8 inference using an ONNX model.
generate_anchors
Generates anchor boxes for a feature map.
iou
Computes IoU for two axis-aligned boxes.
letterbox_preprocess
Apply letterbox preprocessing: resize an image to a square with padding.
non_max_suppression
Standard score-sorted NMS.
postprocess_detections
Post-processes raw model output into final detections.
preprocess_rgb8_for_model
Preprocess an RGB8 image for model input.
roi_align
RoI Align: bilinear-interpolation version of RoI pooling (no quantisation).
roi_pool
RoI Pooling: for each RoI, divides the region into an output_size grid and max-pools each cell.
soft_nms
Soft-NMS with Gaussian decay.
yolov8_coco_config
Returns the default YOLOv8 config for the COCO 80-class dataset.
yolov11_coco_config
Default COCO config for YOLOv11 models.