MediumSquare
Artificial Intelligence

Teaching a Model to Spot Mould on Aged Cheese Was Harder Than It Sounds

Some mould is a defect, some is a feature, and the cheesemakers could tell the difference by smell.

209

I work as a machine learning researcher for a food producer in Emilia-Romagna. Two years ago, our quality team asked whether a camera system could help inspect wheels of aged hard cheese for surface defects. Each wheel is checked by hand several times during ageing, and our aging rooms hold about 18,000 wheels. The inspectors are excellent and slow, and two of them were close to retirement.

I said yes too quickly.

Not all mould is bad

The first surprise was that the problem is not "mould or no mould". During ageing, wheels develop a natural rind, and some surface mould is normal and gets brushed off routinely. What the inspectors care about is a specific set of defects: mould in cracks, unusual colours that suggest contamination, soft spots, and cracks that go deeper than the rind.

A senior inspector named Franco walked me through the aging room on my first visit. He would pick up a wheel, glance at it, and say "fine", "brush", or "set aside". When I asked how he knew, he often said he could smell it before he could see it. Cameras do not smell.

Inspector's hands examining a cheese wheel
Inspector's hands examining a cheese wheel

Building the dataset

We installed cameras on the robotic arm that already turns and brushes the wheels. Over four months we collected about 62,000 images. Then came labelling, which took far longer than training ever did.

I asked three inspectors to label the same 500 images independently. They agreed on only 71 percent of them. On the disagreements, we sat together and discussed each case. Many were genuinely ambiguous from a photo alone. Some depended on how the wheel had looked the week before.

That meeting changed the project. We stopped trying to predict the inspector's final decision and instead asked the model to flag wheels that deserved a closer look.

Camera on a robotic arm above a cheese wheel
Camera on a robotic arm above a cheese wheel

What the model does now

The final system is a fairly standard image classifier fine-tuned on our data, with three outputs: normal, needs brushing, and check by hand. We tuned it to be cautious. It sends about 9 percent of wheels to the "check by hand" pile, and in a six-month evaluation it missed 4 wheels that inspectors later set aside, out of roughly 1,100 true defects.

That recall, a bit over 99.6 percent, sounds impressive. The honest framing is that the model reduced the number of wheels an inspector must examine closely by about 85 percent. It did not replace inspectors. It moved their attention.

What I learned from Franco

Before he retired, Franco started using the model's flags as a kind of second opinion. Occasionally he disagreed with it, and those disagreements became our most valuable training examples. In one case, the model kept flagging a harmless pattern caused by the wooden shelves. Franco recognised it immediately.

I used to think of expert labels as ground truth. Now I think of them as the best available opinion, and I treat the disagreements between experts as the most interesting part of the data. That is where the actual knowledge lives.

209
18 people clapped
Written byElena Marchetti

Machine learning researcher at a food producer near Bologna. I teach models about cheese and learn humility from data.

More to read