BlyxDocumentation
Browse chapters
Documentation / Workflow recipes

Osprey · Score detections at the edge of a camera frame

Score a detection against a reference after clipping both to the camera frame.

Score detections at the edge of a camera frame

An out-of-frame detection can change IoU even when the visible pixels agree. Clip both boxes before evaluating their overlap. Clipping the predicted box gives four visible intersection pixels and a union of eight. IoU reaches the inclusive 0.5 threshold.

Run the framework with your own input

Install Blyx 0.2.1 and a Rust toolchain with a host linker, then run the versioned project. Each positional argument is a number or a comma-separated numerical vector. The CLI accepts up to 16 entries per vector. The imported module accepts longer inputs.

git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-osprey.git
cd blyx-osprey
blyxc native-run project.blyx -- "-2,0,2,2" "0,0,4,2" 4 4 0.5

API and return values

Returns [visible IoU, matched, visible intersection area]. Match requires positive overlap and a score at least equal to the threshold. Invalid input returns an empty vector.

ArgumentAccepted input
predVector of: finite number
truthVector of: finite number
widthpositive finite number
heightpositive finite number
thresholdprobability in [0,1]

Use the libraries independently

The framework vendors the same library source published in these two repositories. Each module has its own package page, input contract and regression suite.

Try the program

Output Ready
Expected output
0.5
1
4
Open in the full playground →

Practice

Change pred = [0, 0, 1, 1], truth = [1, 0, 2, 1], threshold = 0.0. Predict the result, then run the program.

Hint

Returns [visible IoU, matched, visible intersection area]. Match requires positive overlap and a score at least equal to the threshold.

Worked solution

The result vector is [0, 0, 0]. Compare its fields with the return layout in the API section.

Find

    let pred = [-2, 0, 2, 2];

Replace with

    let pred = [0, 0, 1, 1];

Find

    let truth = [0, 0, 4, 2];

Replace with

    let truth = [1, 0, 2, 1];

Find

    let threshold = 0.5;

Replace with

    let threshold = 0.0;

Output after the change

0
0
0