oa::vision

vision module in the OA Vision public surface.

MdRust public API

Public Types

Public Functions

pub fn binary_mask_counts(predicted: &Matrix, target: &Matrix) -> Result<Matrix>
pub fn box_iou(boxes_a: &Matrix, boxes_b: &Matrix) -> Result<Matrix>
pub fn confusion_matrix( predicted: &Matrix, target: &Matrix, class_count: i32, ) -> Result<Matrix>
pub fn evaluate( predicted_boxes: &Matrix, predicted_scores: &Matrix, predicted_classes: &Matrix, predicted_image_ids: &Matrix, target_boxes: &Matrix, target_classes: &Matrix, target_image_ids: &Matrix, iou_thresholds: &Matrix, class_count: i32, score_threshold: f32, ) -> Result<DetectionMetricsResult>
pub fn evaluate_segmentation( predicted: &Matrix, target: &Matrix, class_count: i32, ) -> Result<SegmentationMetricsResult>
pub fn nms( boxes: &Matrix, scores: &Matrix, classes: &Matrix, config: NmsConfig, ) -> Result<NmsResult>

Function Documentation

pub fn binary_mask_counts( predicted: &Matrix, target: &Matrix ) -> Result<Matrix>
Count [true_positive, false_positive, false_negative, true_negative] for two equally-shaped U8 masks. Every nonzero byte is true. Errors Returns an error unless inputs are nonempty, equal-shaped U8 matrices on one engine and their element count fits the shader ABI.
pub fn box_iou( boxes_a: &Matrix, boxes_b: &Matrix ) -> Result<Matrix>
Compute every pairwise intersection-over-union for center-coordinate boxes. boxes_a and boxes_b must be nonempty FP32 matrices shaped [N, 4] and [M, 4]. Each row is [center_x, center_y, width, height]; negative widths and heights are clamped to zero, matching donor OA. A pair with no positive finite union produces zero. The returned matrix has shape [N, M]. The call records asynchronously and returns its output immediately. Reading the result is an explicit submission and observation point. Errors Returns an error when an input has the wrong rank, extent, dtype, or engine, a shader-ABI size overflows, allocation fails, or runtime recording fails.
pub fn confusion_matrix( predicted: &Matrix, target: &Matrix, class_count: i32 ) -> Result<Matrix>
Accumulate an integer classification confusion matrix. Rows are targets and columns are predictions. Either label being outside [0, class_count) ignores that element. Errors Returns an error unless inputs are equal nonempty I32 vectors on one engine, class_count is positive, and all sizes fit the shader ABI.
pub fn evaluate( predicted_boxes: &Matrix, predicted_scores: &Matrix, predicted_classes: &Matrix, predicted_image_ids: &Matrix, target_boxes: &Matrix, target_classes: &Matrix, target_image_ids: &Matrix, iou_thresholds: &Matrix, class_count: i32, score_threshold: f32 ) -> Result<DetectionMetricsResult>
Evaluate object-detection precision, recall, F1, AP, and mAP. Matching is class-aware, image-aware, greedy by descending score, and uses 101-point interpolated average precision. Classes without targets do not contribute to mAP. Scratch and outputs remain GPU-resident. Errors Returns an error when any shape, dtype, ownership, class-count, score-threshold, or 32-bit scratch-size contract is invalid.
pub fn evaluate_segmentation( predicted: &Matrix, target: &Matrix, class_count: i32 ) -> Result<SegmentationMetricsResult>
Evaluate multiclass semantic-segmentation labels. Labels outside [0, class_count) are ignored. The operation records a confusion accumulator followed by a metrics kernel as one semantic Vision operation. Errors Returns an error unless inputs are equal-shaped nonempty I32 matrices on one engine, class_count is positive, and all sizes fit the shader ABI.
pub fn nms( boxes: &Matrix, scores: &Matrix, classes: &Matrix, config: NmsConfig ) -> Result<NmsResult>
Select score-ranked boxes with deterministic class-aware suppression. Equal scores select the smaller source index. NaN or infinite scores are ignored. All outputs remain device-resident and the operation never sorts or compacts on the host. Errors Returns an error unless boxes are nonempty FP32 [N, 4], scores are FP32 [N], classes are I32 [N], all inputs share an engine, thresholds are finite, iou_threshold is in [0, 1], and max_detections is positive.