Computer Vision with Neural Networks

Measure the overlap of two seed rectangles

BOTIE

Add both box areas and subtract their intersection once.
Ready to test
0 passed · 0 failed · 3 not run

An empty floor. Start with the information your machine needs.

Received result

Your answer will arrive here.

Examples, experiments and workspace controls
Live values

Connect a tool's inputs to see what it produces. You can try a branch before connecting it to Result.

Try your own inputs

Use a copy of the example to try your own data. Keep the problem's assumptions in mind, and predict the effect of a change before checking the output. You can also add another branch to compare two ways of doing the calculation.

Start at an output arrow, then click or drag to an input. Drag empty space to pan. Delete removes a selection. Ctrl/Cmd+Z undoes a change.
Context for this challenge

Add both box areas and subtract their intersection once.

Botie has a predicted rectangle and a labelled rectangle. Calculate their intersection over union using continuous boundary coordinates.

Inspect the component calculation
Subtract(
  Starting value: Add(
    First contribution: Measure a rectangle's area(
      Rectangle boundaries: Predicted rectangle
    )
    Second contribution: Measure a rectangle's area(
      Rectangle boundaries: Labelled rectangle
    )
  )
  Value to remove: Measure two rectangles' intersection(
    First rectangle: Predicted rectangle
    Second rectangle: Labelled rectangle
  )
)
Examples and results
Predicted rectangle
  1. 00
  2. 10
  3. 24
  4. 34
Labelled rectangle
  1. 02
  2. 10
  3. 26
  4. 34
Required result
24
Predicted rectangle
  1. 00
  2. 10
  3. 22
  4. 32
Labelled rectangle
  1. 03
  2. 13
  3. 25
  4. 35
Required result
8
Predicted rectangle
  1. 01
  2. 12
  3. 24
  4. 36
Labelled rectangle
  1. 01
  2. 12
  3. 24
  4. 36
Required result
12
Try a fresh construction

This clears this draft, including its undo history. Earlier successful attempts stay recorded. Build again without opening hints to record an independent attempt.

Stuck? Inspect a worked construction

The tools below form one possible solution. You can assemble it, follow its signals, and undo that change to return to your own construction.

Assumptions and test precision

All rectangles must have positive width and height. This calculation is one pairwise localisation measure, not a complete detection evaluation. Numerical tests allow a difference of 0.001. Lists and structures must also have the right shape.

Your last tested pieces can start the full construction. An existing draft there keeps its own pieces.

Two rectangles touch along an edge

This check uses the pieces from “Count the shared area once in the union”.

BOTIE

Rectangles use continuous coordinates [left, top, right, bottom]. Return intersection over union when the predicted and labelled rectangles touch along one edge but share no area.
Predicted rectangle
  1. 00
  2. 10
  3. 23
  4. 32
Labelled rectangle
  1. 03
  2. 10
  3. 25
  4. 32

Use a number, text, or an array matching the requested result. For a matrix, put each row in brackets. Saving your prediction runs your current construction on these inputs and checks the earlier examples too.

Build a construction in the workspace above first. This case will test those pieces.

Which cases distinguish disjoint boxes, containment and exact agreement?

Use the declared coordinate convention; continuous box areas do not add an extra pixel to each side length.

All rectangles must have positive width and height. This calculation is one pairwise localisation measure, not a complete detection evaluation.

Work through the Python challenges →
Continue the courseNon-Maximum Suppression →
← Transfer Learning