Cochlear Synapse ROI Segmentation
MONAI/PyTorch implementation of a two-stage 2D U-Net pipeline for ROI instance segmentation in single-channel cochlear microscopy TIFF images. This model was trained for the segmentation of fluorescently-labelled putative cochlear synaptic boutons.
The model uses:
- a binary foreground U-Net
- a center heatmap U-Net whose peaks are used as watershed markers
The final ROI labels are produced by marker-controlled watershed using the heatmap-derived markers inside the binary foreground prediction.
Model
- Input: single-channel 2D TIFF image
- Output: instance-label ROI mask (
0 = background,1..N = predicted ROIs) - Optional outputs: binary foreground mask, center heatmap, marker image
- Architecture: MONAI U-Net, defined by the two YAML config files
- Binary config:
config/binary_model_v5_synaptic.yml - Heatmap config:
config/heatmap_model_v5_synaptic.yml - Weights:
best_model_binary_heatmap_v5_synaptic.pth
Use
Run inference on a TIFF image:
python infer_rois.py input_Avg.tif --output input_rois.tif
The script loads:
best_model_binary_heatmap_v5_synaptic.pth
config/binary_model_v5_synaptic.yml
config/heatmap_model_v5_synaptic.yml
If --output is omitted, the script writes <input>_rois.tif.
To also save the intermediate binary mask, heatmap, and marker image:
python infer_rois.py input_Avg.tif --output input_rois.tif --save-intermediates
Useful inference parameters can be overridden from the command line:
python infer_rois.py input_Avg.tif \
--output input_rois.tif \
--binary-threshold 0.5 \
--heatmap-threshold 0.3 \
--min-size 20 \
--min-distance 5
Training Data
The model was trained on manually annotated cochlear microscopy TIFF images with ROI masks and annotation-filtered center heatmaps generated from those masks.
The training pipeline and dataset preparation code are available in the GitHub repository: https://github.com/fedeceri85/cochlea-synapses-binary-segmentation-unet2d
Evaluation
The repository contains notebooks for checking binary predictions, heatmap predictions, and the combined ROI output:
binary_check_predictions.ipynb
heatmap_check_predictions.ipynb
binary_heatmap_check_predictions.ipynb
The combined ROI check notebook reports binary Dice for the foreground prediction and panoptic-quality components RQ/SQ for final ROI predictions.
Limitations
- Manual labels contain subjective decisions, so boundary and ROI-count disagreements can reflect annotation ambiguity.
- Research use only.
Code
Training and inference code: https://github.com/fedeceri85/cochlea-synapses-binary-segmentation-unet2d
