Postprocess supplied object boxes
Map synthetic detector rows to original frame coordinates and apply class aware deterministic non maximum suppression.
// Synthetic supplied detector rows; no pretrained detector is executed.
import aner.video
import aner.vision
import aner.tensor
let source = video.synthetic(width: 64, height: 32, frames: 1)
let frame = video.frame_slot()
let plan = vision.preprocess(width: 64, height: 64)
let input = vision.input_slot(plan)
let objects = vision.detections(max_detections: 10)
let detector_rows: Tensor = [
[8.0, 20.0, 40.0, 44.0, 0.9, 0.0],
[9.0, 21.0, 39.0, 43.0, 0.8, 0.0],
[8.0, 20.0, 40.0, 44.0, 0.7, 1.0]]
if source.read_into(frame) == "ready" {
plan.prepare_into(frame, input)
vision.postprocess_into(detector_rows, input, objects)
print(objects.count())
print(objects.class_id(0))
print(objects.y1(0))
print(objects.source_id())
}
source.close()
Make it your experiment.
Use Aner 0.1.0 or newer. Save this program as examples/vision_postprocess.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.
aner check examples/vision_postprocess.aner
aner run examples/vision_postprocess.anerThe aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.
Requires Aner 0.1.0 or newer. Synthetic capture and CPU vision examples need no external source; cameras, remote media and encoded recording require optional FFmpeg support and explicit inputs. Checking opens no camera, network connection or recording.
aner check examples/vision_postprocess.aner
aner run examples/vision_postprocess.anerBundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.
Dataset sources & attribution