The majority of quality control for packaged fruit is still done manually and varies widely depending upon the operator. If there are just a few moldy or rotten fruits in a punnet, then that punnet will likely never be sold to consumers. Therefore, it would seem that the effectiveness at which an individual piece of fruit is checked by an operator directly affects how many pieces of the product ultimately make it to the consumer. This dissertation investigates if unsupervised anomaly detection could perform this check on actual images from production. The initial dataset is comprised of punnet photos, where raspberries are close together and partially block each other. Therefore, the first step is segmentation: separating individual raspberries so they can be combined into a single-fruit dataset. We benchmark several Segment Anything Model variants (SAM [1], MobileSAM [2], SAM3 [3], Grounded SAM [4]) zero-shot, and use SAM3 outputs as pseudo-labels to fine-tune a YOLO [5] segmentation model (YOLO26n-seg). The goal was something accurate enough to trust but still deployable on production-line hardware. Mask quality is improved by post-processing: filtering by color and size, cleaning up holes and islands, and handling masks that cover more than one raspberry. The fine-tuned YOLO model gives the best performance/efficiency trade-off, at 378MB and 0.55s per punnet with an IoU of 91.79% and F1 of 94.52%. Its masks are used to create the single-fruit dataset. On this dataset, we benchmark seven unsupervised anomaly detection methods: PatchCore [6], STFPM [7], RD4AD [8], CFA [9], FastFlow [10], GANomaly [11], and SuperSimpleNet [12]. Alongside that, we test a number of optimizations: image size, backbone choice (DINOv2 [13], WideResNet-50-2 [14], MobileNetv2 [15]) and block selection, a few filtering steps (deblurring, removing raspberry protrusions, dropping overly dark samples), and a synthetic occlusion algorithm written specifically for this task to mimic the occlusion patterns seen in the data. Most anomaly detection research focuses on local anomalies, and all the methods above score an image by its single most anomalous patch. That kind of anomaly does occur here too, mold being one example, but raspberry defects are more often diffuse rather than local: the fruit is anomalous as a whole, not because of one identifiable spot. We therefore add StructCore [16], a global scoring scheme, and SINBAD [17], a global scoring AD model, to the benchmark to see whether scoring the fruit as a whole helps with these diffuse cases. PatchCore (87.88% AUROC, 531MB, 0.14s per punnet) and STFPM (91.66% AUROC, 449MB, 0.09s per punnet) come out as the best-performing models in this benchmark. Combined, the two stages yield a 909MB pipeline at 0.69s per punnet with PatchCore, or 827MB at 0.64s with STFPM (evaluated on a RTX A6000). This gives a compact end-to-end pipeline from raw conveyor-belt punnet images to per-fruit anomaly scores.

A pipeline for single-item raspberry quality grading: Dataset Construction and Anomaly Detection Benchmarking

HELBING, MARLON JOSHUA
2025/2026

Abstract

The majority of quality control for packaged fruit is still done manually and varies widely depending upon the operator. If there are just a few moldy or rotten fruits in a punnet, then that punnet will likely never be sold to consumers. Therefore, it would seem that the effectiveness at which an individual piece of fruit is checked by an operator directly affects how many pieces of the product ultimately make it to the consumer. This dissertation investigates if unsupervised anomaly detection could perform this check on actual images from production. The initial dataset is comprised of punnet photos, where raspberries are close together and partially block each other. Therefore, the first step is segmentation: separating individual raspberries so they can be combined into a single-fruit dataset. We benchmark several Segment Anything Model variants (SAM [1], MobileSAM [2], SAM3 [3], Grounded SAM [4]) zero-shot, and use SAM3 outputs as pseudo-labels to fine-tune a YOLO [5] segmentation model (YOLO26n-seg). The goal was something accurate enough to trust but still deployable on production-line hardware. Mask quality is improved by post-processing: filtering by color and size, cleaning up holes and islands, and handling masks that cover more than one raspberry. The fine-tuned YOLO model gives the best performance/efficiency trade-off, at 378MB and 0.55s per punnet with an IoU of 91.79% and F1 of 94.52%. Its masks are used to create the single-fruit dataset. On this dataset, we benchmark seven unsupervised anomaly detection methods: PatchCore [6], STFPM [7], RD4AD [8], CFA [9], FastFlow [10], GANomaly [11], and SuperSimpleNet [12]. Alongside that, we test a number of optimizations: image size, backbone choice (DINOv2 [13], WideResNet-50-2 [14], MobileNetv2 [15]) and block selection, a few filtering steps (deblurring, removing raspberry protrusions, dropping overly dark samples), and a synthetic occlusion algorithm written specifically for this task to mimic the occlusion patterns seen in the data. Most anomaly detection research focuses on local anomalies, and all the methods above score an image by its single most anomalous patch. That kind of anomaly does occur here too, mold being one example, but raspberry defects are more often diffuse rather than local: the fruit is anomalous as a whole, not because of one identifiable spot. We therefore add StructCore [16], a global scoring scheme, and SINBAD [17], a global scoring AD model, to the benchmark to see whether scoring the fruit as a whole helps with these diffuse cases. PatchCore (87.88% AUROC, 531MB, 0.14s per punnet) and STFPM (91.66% AUROC, 449MB, 0.09s per punnet) come out as the best-performing models in this benchmark. Combined, the two stages yield a 909MB pipeline at 0.69s per punnet with PatchCore, or 827MB at 0.64s with STFPM (evaluated on a RTX A6000). This gives a compact end-to-end pipeline from raw conveyor-belt punnet images to per-fruit anomaly scores.
2025
A pipeline for single-item raspberry quality grading: Dataset Construction and Anomaly Detection Benchmarking
Anomaly Detection
Segmentation
Benchmark
File in questo prodotto:
File Dimensione Formato  
Helbing_Marlon.pdf

accesso aperto

Dimensione 25.08 MB
Formato Adobe PDF
25.08 MB Adobe PDF Visualizza/Apri

The text of this website © Università degli studi di Padova. Full Text are published under a non-exclusive license. Metadata are under a CC0 License

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/20.500.12608/110924