Microplastic Identification Using AI-Driven Image Segmentation with Synthetic Ecological Context

Quality-controlled inpainting improves transfer to held-out ecological microscopy.

Alex Dils1, David Raymond2, Jack Spottiswood1, Samay Kodige1, Dylan Karmin3, Rikhil Kokal1, Win Cowger4,†, Christoph Sadée5,†
1 University of California, Berkeley 2 Dartmouth College 3 Massachusetts Institute of Technology 4 Moore Institute for Plastic Pollution Research 5 Division of Computational Medicine, Stanford University
 Co-corresponding and senior authors

Source microscopy, transformed masks, and synthetic ecological inpainting examples show how real labels are carried into more realistic training contexts.

Abstract

Conventional methods for microplastic identification in water samples are costly, slow, and dependent on specialized expertise. We present a deep learning segmentation framework for identifying microplastic foreground in microscopy images and evaluate whether synthetic ecological context can improve model performance when labeled real data are limited. We also contribute a curated image dataset with manually segmented microplastic masks, adding paired image-mask examples for supervised training and held-out ecological evaluation.

The workflow combines manually labeled laboratory microplastic images with generated inpainting examples selected for visible foreground change, non-empty masks, plausible object scale, and background diversity. In our results, adding verified synthetic examples improves segmentation across architectures by increasing exposure to diverse ecological scenarios while preserving pixel-level labels. The strongest synthetic-assisted model reaches Dice 0.817, IoU 0.704, and boundary F1 0.858 on the held-out ecological evaluation set, compared with Dice 0.743, IoU 0.619, and boundary F1 0.809 for the strongest real-only model.

Dataset

Three cohorts, one held-out ecological test set

The manuscript assembles 1,198 microscopy images: 368 laboratory microplastic image-mask pairs, 733 unlabeled ecological background images, and 97 ecological microplastic image-mask pairs held out for final testing. Cohort 3 is never used during training, so the reported metrics measure transfer to real ecological samples rather than synthetic validation performance.

Cohort 1

Training labels
368

Laboratory microplastic images paired with manual masks for supervised training and synthetic mask templates.

368 images 368 masks

Cohort 2

Context bank
733

Unlabeled ecological microscopy backgrounds supplying sediment, fibers, bubbles, and organic matter.

733 images 0 masks

Cohort 3

Held-out test
97

Ecological microplastic image-mask pairs reserved for final segmentation metrics and never used for training.

97 images 97 masks

Method

Synthetic ecological context with quality control

The study treats synthetic data as a controlled fusion problem. Real manually segmented masks preserve the pixel-level labels, ecological microscopy images provide the background distribution, and Stable Diffusion inpainting regenerates plausible foreground appearance inside transformed mask regions. The generator produced 10,000 candidate synthetic image-mask pairs, but the final training condition admits only candidates that pass the manuscript's quality-control ranking and diversity constraints.

1. Preserve real labels

Cohort 1 masks are transformed and retained as the ground-truth segmentation labels.

2. Add ecological context

Transformed masks are placed into unlabeled ecological backgrounds from Cohort 2.

3. Inpaint foregrounds

Stable Diffusion regenerates the masked particle region while preserving surrounding background pixels.

4. Filter before training

Examples are ranked for visible mask-region change, non-empty masks, plausible scale, and background diversity.

Synthetic inpainting quality-control score
Quality-control score used to retain visibly changed, plausible, and diverse synthetic inpainting examples.

Results

Verified synthetic examples improve held-out ecological segmentation

The strongest verified-inpainting checkpoint is U-Net++ at seed 37, with Dice 0.817, IoU 0.704, boundary F1 0.858, precision 0.802, and recall 0.846. The strongest real-only checkpoint reaches Dice 0.743, IoU 0.619, and boundary F1 0.809. The top synthetic-assisted run therefore improves Dice by 0.074 and IoU by 0.085 over the strongest real-only run.

The effect is not limited to one model family. All retained semantic segmentation architectures improve under verified inpainting, with U-Net++ showing the largest architecture-level Dice gain at +0.102.

Best checkpoint U-Net++ seed 37 with verified inpainting

Quality-controlled synthetic examples improve held-out ecological transfer over the strongest real-only checkpoint.

Dice
0.817
IoU
0.704
Boundary F1
0.858
IoU gain vs. real only
+0.085
Training condition Runs Dice IoU Boundary F1 Best validation Dice
Real only180.641 +/- 0.1610.519 +/- 0.1380.7030.758
Real + unfiltered inpainting180.586 +/- 0.1430.462 +/- 0.1320.6420.928
Real + verified inpainting180.735 +/- 0.0610.608 +/- 0.0580.7970.846
Half real + top inpainting pilot30.754 +/- 0.0280.627 +/- 0.0310.8140.812

Figures

Manuscript figures

Representative source masks, transformed masks, and inpainted ecological microplastic examples
Representative source microplastic examples, transformed masks, and inpainted ecological images.
Held-out ecological segmentation metrics by training condition
Held-out ecological segmentation metrics by training condition.
Architecture-level Dice change after verified inpainting
Architecture-level Dice gains after verified inpainting.
Strongest real-only checkpoint compared with strongest synthetic-assisted checkpoint
Strongest real-only checkpoint versus strongest synthetic-assisted checkpoint.
Synthetic ecological context generation and evaluation pipeline
End-to-end synthetic ecological context generation and evaluation pipeline.

Availability

Manuscript, code, and data