← All blogs

Computer vision

Why a vision model fails on real phone photos

In a research experiment, our breed classifier named the right species, cat or dog, on 99.76% of held-out test photos it had never seen in training. Then we tried a small set of our own phone photos: 18 pictures of cats. The detector found one animal in all 18 and called 17 of them cats. The classifier's species guess said 'dog' five times. Most of what went wrong had little to do with model size.

Rubix Labs4 min read
Comparison: on 6,182 held-out photos where the detector found one animal, the classifier's cat-or-dog guess was right 6,167 times (99.76%). On 18 of our own phone photos of cats, the detector found one animal in all 18 and called 17 cats, while the classifier's species guess said dog 5 times. Below: no mixed or domestic shorthair class, a 1.95% retake rate, and 22 of 144 multi-animal photos treated as one.
From our research experiment. Eighteen photos are far too few to set a rate; the figure shows a gap worth testing for, not a measured real-world error rate.

Held-out photos aren't your camera roll

Our held-out set was 6,449 photos the model never saw in training, checked against the training photos by byte hash, perceptual hash and duplicate group. On the 6,182 where the detector found exactly one animal, the classifier's breed head implied the right species 6,167 times.

Those photos came from the same kinds of sources as the training data, which makes them easier than a stranger's phone photo. A clean held-out score told us the model had learned its training distribution well. It couldn't tell us how far that distribution sat from our own photos.

Eighteen photos can't give you an error rate, and we won't pretend they do. Five wrong species calls out of 18 was still enough to change how we'd design around the model.

Sometimes the right answer isn't in the label set

Our model scores 99 cat breeds and 254 dog breeds. It has no class for a mixed-breed dog, and 28 cat labels in its taxonomy get no score at all, including domestic shorthair, mediumhair and longhair, household cat, mixed or non-pedigree, Bengal, Burmese, Scottish Fold and Exotic.

For an ordinary non-pedigree cat, all five suggestions are wrong by design, and the model still produces five breeds that look plausible. On our phone photos it mostly suggested British Longhair, Persian, Maine Coon, Siberian and Ragamuffin. We don't know those cats' breeds, so we didn't score the suggestions.

This fix needs no new model. Put 'Domestic or non-pedigree' and 'Mixed breed' among the choices, and always offer 'None of the above' after the five suggestions. Then a person can say the list is wrong without being forced to pick one of five.

When the detector and the classifier disagree

The detector has its own cat and dog classes. On the held-out photos it matched the true species 98.22% of the time, and the classifier's breed head did better at 99.76%, so our first design used the classifier's guess. On our phone photos the detector got 17 of 18 cats right while the classifier missed five.

When two models disagree about something as basic as species, we'd stop asserting and ask: 'Is this a cat or a dog?' Confirming the species first, then showing that species' five breeds, costs one extra question and removes the most embarrassing error. A confirmed species is also a fact you can store separately from the model's guess.

Raw scores won't settle the argument. The returned probabilities are relative to the labels the service returned, not calibrated confidence. An earlier model we audited made 109 wrong predictions among 290 high-scoring cat predictions, so a '90% sure' badge would have misled people.

Two animals in one photo

Our pipeline asks for a retake when it finds no animal or more than one, instead of guessing which one you meant. On held-out photos with a single animal it asked for a retake 1.95% of the time: 11 with nothing found and 112 read as several animals.

The opposite failure is quieter. Of 144 held-out photos with more than one animal, 22 (15%) were treated as a single animal and classified anyway. That's a threshold question we'd study on photos with real multi-animal scenes, because moving the threshold trades one error for the other.

What we'd change before trusting it

None of these changes touch the weights.

  • Build a small panel of real photos from the cameras and conditions that matter, with stated labels, and use it only for evaluation. For this task we'd plan on two to three hundred.
  • Add the classes real photos need, such as mixed or non-pedigree, and an explicit 'None of the above'.
  • Ask for the coarse class (here, cat or dog) whenever two models disagree, and store the answer apart from the model's guess.
  • Show ranked suggestions without percentages unless you've calibrated them.
  • Count retakes and wrongly accepted multi-animal photos separately, so one can't hide behind the other.

Start from the photos people take

Rubix's Shazam for Food work started from the same kind of problem: a photo taken in ordinary conditions, turned into something a person can check. If you're planning to read photos people take themselves, we'd start with the real-photo panel and the answer design, then pick the model. You can try the prepared food recognition demo to see that kind of flow with sample data.