A small classification task
Buttons come in many designs, but a common way to classify sew-through buttons is by the number of holes: two or four. A factory, a recycling project or a craft shop might want a camera to sort buttons automatically. A computer vision model would learn from labelled photographs.
Thread hides evidence
On a loose button, all the holes are visible and counting them is easy. But once the button is sewn onto fabric, thread passes over and through the holes. It can cover one or more holes completely, or make two holes look like one. The evidence that defines the button's class is partly hidden.
Paired images
A useful dataset includes paired images of the same button, one before sewing and one after. The true number of holes does not change; only the visibility of the holes does. These pairs allow a direct test of how sewing affects the model's predictions.
Measuring consistency
For each pair, check whether the model gives the same answer before and after sewing. The proportion of pairs where the prediction changes shows how sensitive the model is to thread. Changes always mean at least one of the predictions is wrong, since the button is the same.
Including hard cases
The test set should include buttons with thread covering one hole, two holes or more, and with different thread colours. Thread that matches the button's colour may be harder to see. Glare from shiny surfaces can also hide holes, and should be included in tests.
When to say uncertain
Sometimes thread or glare hides so much of the button that even a careful person could not tell how many holes it has. In such cases, it is reasonable for a model to give an uncertain answer, rather than guessing. A model that can flag uncertain cases is often more useful than one that always gives a confident answer.
Measuring uncertainty
If a model can output uncertain, its performance should be measured in two parts: how accurate it is when it does make a prediction, and how often it declines to decide. A model that declines too often is unhelpful, while one that never declines may make many confident mistakes.
Buttons and materials
In modern clothing, buttons are commonly made of plastic, but also of metal, wood, shell and other materials. Vegetable ivory, made from the hard seeds of certain palm trees, was once widely used and is still valued for its natural look. Different materials reflect light differently, which can affect how holes appear in photographs.
Lessons beyond buttons
The same challenge appears in many real tasks, where key evidence can be partly hidden: labels obscured by dirt, faces turned away, parts covered by other objects. Testing with paired images, where only visibility changes, is a powerful way to understand how a model behaves when evidence is missing.
Responsible design
The NIST AI Risk Management Framework encourages AI systems to communicate uncertainty and limitations. A button classifier that can say when it is unsure is a small example of this principle in practice.
Shank buttons
Not all buttons have holes through their faces. Shank buttons have a small loop on the back, so the thread does not show on the front. A model meant only for sew-through buttons should be tested on shank buttons too, to see whether it correctly recognises them as a different kind rather than forcing them into the two-hole or four-hole class.
Lighting the holes
Light from behind makes holes stand out clearly.
Try the arithmetic
If a model gives the same answer for 170 of 200 button pairs, its predictions change in 30 pairs, or 15 per cent, showing how often thread disrupts its judgement.
The idea to take away
Thread can hide the holes that define a button's class. Paired images before and after sewing show how often predictions change when the true count is fixed. When too much is hidden, an uncertain answer is reasonable.
Sources & further reading
Figures in the example are illustrative. Photograph: Three holes buttons.jpg by Marco Bernardini, CC BY-SA 3.0, via Wikimedia Commons; cropped and resized. Reference organisations do not endorse this website.

