Pseudo-nitzschia Cell Counter β YOLO11s-seg
A YOLO11s instance segmentation model fine-tuned to detect and count individual Pseudo-nitzschia cells within chain colonies in Imaging FlowCytobot (IFCB) images.
Try it out: Interactive demo on HF Spaces
Performance
| Metric | Box | Mask |
|---|---|---|
| Precision | 0.983 | 0.983 |
| Recall | 0.965 | 0.965 |
| mAP50 | 0.976 | 0.973 |
| mAP50-95 | 0.706 | 0.659 |
Trained for 100 epochs on Apple MPS (M-series GPU). Training time: ~1.5 hours.
Training Curves
Confusion Matrix
Quick Start
from ultralytics import YOLO
from huggingface_hub import hf_hub_download
# Download model
model_path = hf_hub_download("patcdaniel/pseudo-nitzschia-yolo11s-seg", "best.pt")
model = YOLO(model_path)
# Run inference
results = model("image.png", conf=0.25)
# Count cells
for r in results:
n_cells = len(r.masks) if r.masks is not None else 0
print(f"Detected {n_cells} cells")
Training
1. Download the dataset
huggingface-cli download patcdaniel/pseudo-nitzschia-cell-segmentation \
--repo-type dataset --local-dir ./dataset
2. Train
python scripts/train_yolo.py \
--config configs/cell_seg.yaml \
--model yolo11s-seg.pt \
--epochs 100 \
--batch 24 \
--name pn_cell_seg_yolo11s
3. Evaluate
python scripts/inference.py \
--weights runs/segment/pn_cell_seg_yolo11s/weights/best.pt \
--source dataset/data/images/ \
--conf 0.25 \
--save_viz
Model Details
- Architecture: YOLO11s-seg (Ultralytics)
- Base weights:
yolo11s-seg.pt(COCO pre-trained) - Input size: 640x640
- Classes: 1 (
Pseudo_nitzschia_cell) - Parameters: ~11.8M
- Model size: 20 MB
Training Hyperparameters
| Parameter | Value |
|---|---|
| Epochs | 100 |
| Batch size | 24 |
| Image size | 640 |
| Optimizer | auto (SGD) |
| Initial LR | 0.01 |
| Final LR factor | 0.01 |
| Weight decay | 0.0005 |
| Warmup epochs | 3.0 |
| Patience (early stopping) | 30 |
| IoU threshold (NMS) | 0.7 |
| Augmentation | hsv, translate, scale, fliplr, erasing |
Repository Structure
βββ best.pt # Model weights
βββ configs/
β βββ cell_seg.yaml # Dataset config (relative paths)
βββ scripts/
β βββ train_yolo.py # Training script
β βββ inference.py # Inference & cell counting
β βββ prepare_dataset.py
β βββ coco_to_yolo_seg.py
β βββ utils.py
β βββ sample_inference.py
β βββ run_inference_on_dataset.py
βββ results/ # Training metrics & curves
βββ args.yaml # Full training arguments
βββ requirements.txt
Dataset
Trained on patcdaniel/pseudo-nitzschia-cell-segmentation β 302 annotated IFCB images from IFCB104 (Santa Cruz Municipal Wharf).
Citation
@model{pseudo_nitzschia_yolo11s_seg,
author = {Daniel, Patrick C.},
title = {Pseudo-nitzschia Cell Counter β YOLO11s-seg},
year = {2025},
publisher = {Hugging Face},
url = {https://huggingface.co/patcdaniel/pseudo-nitzschia-yolo11s-seg}
}
- Downloads last month
- 5

