6 min read · Machine vision

One box of cherry tomatoes holds a mix of deep red, orange-red, orange and not-quite-ripe fruit. Different sorters do not judge the same way every time, especially in the evening or after several hours of work. A camera helps by judging colour and size against the same yardstick for every fruit. But the camera does not know by itself what Grade A looks like. People have to tell it first.
The examples in this article are hypothetical. Every number is made up to show the way of thinking. They are not results from a real packing house or a customer project.
What a camera can and cannot see
| Item | Can an ordinary colour camera see it? | Notes |
|---|---|---|
| Skin colour (ripeness as seen from colour) | Yes | Lighting must be kept constant, otherwise the same colour will look different |
| Size and roundness | Yes | Camera distance must be fixed and the size calibrated against real fruit |
| Split fruit, skin bruises, black spots | Partly | Marks on the underside or back of a fruit may be missed if only one side is photographed |
| Calyx and stem | Partly | Some buyers want the calyx attached and some do not, so ask first |
| Sweetness, firmness | No | Needs a meter or spot checks off the belt |
| Internal rot, insect damage inside | No | If the skin still looks normal, an ordinary camera cannot see it |
Choosing a camera type from what you need to measure is covered in the article on RGB versus hyperspectral for agricultural produce. This article focuses on the workflow with an ordinary colour camera.
Agree the rules with the buyer before collecting images
A common mistake is to start collecting images and training the AI first, and only later find that the buyer wants different criteria from what the packing house uses. The result is collecting images and training all over again. Write the agreement down on one page, and have the buyer and the packing house’s quality lead sign to acknowledge it.
- The acceptable colour range for each grade. It is best to have real fruit or a standard colour strip to look at rather than words, because everyone reads “bright red” differently.
- The size range for each grade, for example measured by fruit diameter.
- Acceptable and unacceptable blemishes, for example splits, bruises, black spots and rough skin.
- The proportion of other grades allowed in one box, and how it is counted.
- Who decides when the camera and a person disagree.
Produce changes with lot and season
Tomatoes from different plots, different varieties or harvested in different seasons differ in skin colour and gloss, even when the buyer calls them the same grade. Images from the rainy season may differ from the hot season in both colour and the blemishes found. If the AI is trained on images from one period only, the system may grade wrongly when another season arrives.
- Collect images from several lots, several plots and several periods before concluding the system works.
- Collect extra images of borderline fruit near the grade boundary, because errors usually occur there.
- Set a time frame for rechecking, for example at the start of each season or when the source of produce changes.
- Track whether the camera and the human judge are drifting further apart. This is the same idea as models degrading over time in the article on AI model drift.
Human spot checks, and finding where the camera goes wrong
Deciding whether the system passes requires comparison with a human judge, not just looking at the score the system reports itself. Have a person the buyer accepts grade a set of samples without knowing what the camera said, then compare. Look at why they differ. Setting acceptance criteria, and the consequences of wrongly accepting or wrongly rejecting, are explained in the article on false accept versus false reject.
- Sample fruit from each lot in the agreed number, for example 200 fruit per lot during the trial.
- Have a person grade each fruit without looking at the camera result and record it in a table.
- Have the camera judge the same set and record the result.
- Count the matches and mismatches, separated by grade.
- Look at the image of each mismatched fruit and see whether it comes from colour, size, blemish or lighting.
- Decide whether to adjust the criteria, collect more images or fix the lighting.
Hypothetical example: a 200-fruit test set
Suppose the packing house samples 200 fruit from one lot. A person judges 150 as Grade A, 36 as Grade B and 14 to be discarded, which totals 200. When the camera judges the same set, 178 fruit match the person, which is 89 percent of the test set, and 22 do not match.
Looking at the mismatches, 15 are orange-red fruit that the camera put in Grade A but the person put in Grade B. The other 7 have marks on the underside, which a camera shooting from above cannot see. That makes 22 fruit.
What to do next is not to rush to change the threshold numbers. Go back to the buyer about the orange-red fruit and which grade they belong in, then make a new colour reference strip. For the marks on the underside, consider adding a camera angle or flipping the fruit, or having a person spot-check at the end of the belt. All of these numbers are only an example, not values to expect.
Common mistakes
- Training the AI on images graded by one person, then finding that another person judges differently. Have at least two people judge and discuss only the fruit where they disagree.
- Collecting images on one day with good light, but using the system all day while the light changes.
- Counting agreement across all grades together and looking at a single number, without looking at how badly the borderline fruit are misjudged.
- Not keeping the images the camera judged wrongly to train the next round.
- Not naming who is responsible when the camera and a person disagree.
Limits and cautions
A colour camera judges what it sees on the surface. It does not know sweetness, firmness or internal condition. Fruit that passes the camera still needs spot checks by people, according to the agreement with the buyer and the packing house’s food safety requirements, and the people responsible for that should be consulted. All the numbers in this article, such as 200 fruit, 178 fruit, 89 percent, and 15 and 7 fruit, are hypothetical examples to explain the way of thinking. They are not results BT San has obtained from a project and not values to expect. Real results depend on the variety, the season, the lighting and the criteria agreed with the buyer.
Starting references
- Wikipedia — Cherry tomato
- Wikipedia — Optical sorting
- Wikipedia — Color difference
- Wikipedia — Machine vision




