Classical Machine Learning
Locate the reference pattern
BOTIE
Examples, experiments and workspace controls
Connect a tool's inputs to see what it produces. You can try a branch before connecting it to Result.
Try your own inputs
Change one pixel in the camera image. Can you make a different window become the best match? Inspect the distances to see whether the winner is convincing or only slightly better than another window.
Context for this challenge
Extract 2 by 2 windows at stride 1 and calculate each window's squared distance from the flattened reference.
We are looking for a known visual pattern inside a larger image. The reference patch tells us what to look for. Let's compare it with each possible window and return the location with the smallest discrepancy, keeping the reference and the image as separate inputs.
Inspect the component calculation
Squared distances(
Query vector: Flattened reference pixels
Candidate rows: Slide a square window(
Image: Camera image
Window size: 2
Stride: 1
)
)Examples and results
- Flattened reference pixels
- 01
- 11
- 21
- 30
- Camera image
0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 - Required result
- 03
- 14
- 23
- 32
- 43
- 53
- 60
- 72
- 83
- 92
- 102
- 113
- 123
- 133
- 143
- 153
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
This is a small construction problem. The lesson explains the assumptions and the parts of the full method that this example leaves out. 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.
The matching patch moves in a narrower image
This check uses the pieces from “Return the location of the least discrepant window”.
BOTIE
- Camera image
0 0 0 0 0 1 0 0 0 1 1 0 - Flattened reference pixels
- 01
- 10
- 21
- 31
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 two inputs define a match, and why would a rotated or resized reference need more than this sliding comparison?
A matching score and its selected location depend on the representation and transformations the search permits.
This is a small construction problem. The lesson explains the assumptions and the parts of the full method that this example leaves out.
Work through the Python challenges →