PMPedro Masi Burgos
← Projects

Automated morphometry with AI and image processing

PER BlueRev pipeline to automate geometric feature extraction from microscopy images of nematodes and copepods, supporting analysis of seabed impacts from activities such as dredging, fishing, and ocean warming.

Multicultural team internship (PER BlueRev). My focus: labelled dataset, synthetic image generation, and UNet segmentation masks; teammates handled geometric feature extraction from those masks.

  • Python
  • PyTorch
  • PyTorch Lightning
  • U-Net
  • TensorBoard
  • OpenCV/PIL
  • Synthetic data

Objective

Automate morphometric analysis of marine microorganisms (nematodes and copepods) so geometric features can be extracted at scale and used to study how human and climate pressures—such as dredging, fishing, and ocean warming—affect marine soils. Binary segmentation masks of the organism (debris excluded) feed that downstream feature pipeline.

Initial state

Microscopy frames often mix the target organism with attached debris. Early image–mask pairs made that ambiguity explicit: the model must learn a clean organism silhouette so geometric features are not polluted by waste.

Initial microscopy images with organism–debris ambiguity and early masks
Initial examples: debris near or on the organism complicates clean binary masks.

Dataset and synthetic data

Built a labelled set of microscopy images, binary masks, and held-out test images (~100 real pairs). Ground truth uses white for the organism and black for background and attached debris. To enlarge training data, composited synthetic scenes (~300) by separately extracting microorganisms and debris from real images and reassembling them at random on empty microscopy backgrounds.

Example of synthetic compositing: background, organism cutout, debris cutout, synthetic image and organism mask
One compositing example: background + organism + debris → synthetic RGB; the label keeps the organism only.

Segmentation pipeline

Implemented a custom UNet in PyTorch Lightning for binary segmentation: BCEWithLogits loss, Accuracy / F1 / Jaccard metrics, EarlyStopping, best-checkpoint saving, TensorBoard logging, and learning-rate scheduling. Compared multiple training configurations (RGB vs grayscale, schedulers) and selected masks that keep the organism while excluding debris—inputs for the team’s geometric feature extraction.

U-Net encoder–decoder architecture diagram
U-Net used for organism vs debris binary segmentation.
TensorBoard training and validation loss curves
Training monitored in TensorBoard across checkpoint versions.

Results

Delivered debris-aware organism masks suitable for automated morphometry. Side-by-side checkpoint comparisons on test images validated that stronger runs isolate the microorganism and leave attached waste out of the mask—unblocking the team’s AI and image-processing feature pipeline.

Comparison of UNet checkpoint masks against originals with debris
Checkpoint comparison: organism retained, debris excluded from the mask.