Kumita← Open visual lesson

Search the picture

The math behind the picture

The classifier knows how to examine a crop. It does not automatically know where the interesting crop is in a larger picture.

Connection 1 of 4

Turn a crop classifier into a search

The existing crop classifier examines the contents of one window.
From guided stage 2 · Static lesson frame

The existing crop classifier examines the contents of one window.

At each window location, take the pixels inside the window and send that crop through the same saved classifier. The parameters remain fixed. Only the input pixels change.

Moving the window is repeated inference, not repeated training.

Connection 2 of 4

Count positions before counting predictions

Consider an illustrative image 100 pixels wide and a window 20 pixels wide. With stride 20, the left edges are 0,20,40,60,80: five positions. If there are four vertical positions, we examine 5 × 4 = 20 crops at that scale.

positions across = floor((image width − window width) / stride) + 1

Read it as: The window must fit entirely inside the image in this counting rule.

Connection 3 of 4

Smaller steps mean more opportunities and more work

The same examination repeats across image positions.
From guided stage 3 · Static lesson frame

The same examination repeats across image positions.

A smaller stride tests more nearby crops, which may help a window line up with an object. Additional window sizes also add crops. Each crop incurs processing work, so coverage has a cost.

Several windows can include the same object; their predictions are not automatically different objects.

Connection 4 of 4

The arithmetic inside the classifier is still familiar

The crop becomes features, those features become class scores, and softmax turns the scores into shares. Searching wraps a repeated loop around that calculation.

Finding plausible windows is not yet precise box fitting or duplicate removal; those later operations solve different problems.

Connect it back to the picture

Searching answers “which crops should we inspect?” by trying locations and scales. The classifier supplies an answer for each crop it receives.

Full notation and technical reference

The expressions below collect the operations discussed above. You can return here when you want the compact notation.

f = featureExtractor(crop)
z = Wf + b
pₖ = exp(zₖ − max(z)) / Σⱼ exp(zⱼ − max(z))
  • Each candidate window supplies its own pixels. Two convolution-and-pooling stages extract 216 features for the final linear classifier.
  • The saved classifier has object categories and a no-target category; window stride determines how densely the picture is searched.

Numerical reference

With 5 horizontal positions and 4 vertical positions at one scale, the classifier evaluates 20 crops. Adding another scale adds another set of candidate crops.

Where this explanation stops

The model is trained beforehand. Moving a window does not retrain it. A plausible class score alone does not resolve overlapping duplicate detections or guarantee a correct box.

Follow the same idea in the Python or JavaScript notebook →