Train a detector that works in murky water
YOLOv8s, fine-tuned as a single-class “garbage” detector on 12,177 terrestrial and underwater images, reaching 92.1% precision.
Why this stage exists
Underwater imagery is degraded by light attenuation, scattering, turbidity, and colour shift, and debris looks like almost anything. A detector trained on clean terrestrial litter photos does not transfer to a basin floor.
How it was done
- 1
Start with a terrestrial baseline and watch it fail
The first baseline was YOLOv8n trained on TACO (~1,500 terrestrial litter images) with its original fine-grained categories. It reached mAP50 = 0.27 with 0.37 precision, mostly because the model spent its capacity separating bottle from can from cup.
- 2
Collapse the taxonomy to one class
A swimmer about to pick up a wrapper does not need to know whether it is a bottle or a can. Merging every category into a single garbage label (single_cls=True) nearly doubled mAP50 on the TACO validation split, from 0.27 to 0.49, and lifted precision from 0.37 to 0.71.
- 3
Assemble a dataset that actually looks underwater
The final training set combines TACO (~1,500 terrestrial images), the TrashCan underwater marine-debris dataset, roughly 1,000 underwater garbage images collected by our own team in the field, and additional underwater imagery from public repositories: 12,177 images in total, of which 5,720 are underwater scenes. All annotations were converted to YOLO format and unified under the single garbage class.
- 4
Fine-tune from COCO weights
Training started from COCO-pretrained YOLOv8s weights with batch size 8 at 640 × 640 input, using the standard YOLOv8 augmentation stack: mosaic, random flipping, HSV perturbation, and random erasing. The final model reached 92.1% precision on the combined validation set.
- 5
Verify on real deployment footage, not just the validation split
Field frames from the basin show what the numbers hide: packaging debris found in turbid green light, and small objects detected at range near the basin floor with very little contrast against sediment.

Decisions and trade-offs
Where the code lives
garbage-detection/Dataset assembly and label unification, YOLOv8 training configuration, and inference used by the live pipeline.
- taco_yolo (TACO preparation and training)
What still bites
- Low-contrast and heavily occluded items still produce false negatives.
- Precision on a combined validation set mixes terrestrial and underwater imagery, so it flatters underwater-only performance.