NanoSeg is a one-shot nanoparticle segmentation framework for electron microscopy images based on the Segment Anything Model (SAM). The pipeline integrates automatic prompt generation, prompt-guided segmentation, postprocessing, and particle-level descriptor extraction for reproducible catalyst microscopy analysis.
The framework supports:
- one-shot SAM segmentation
- automatic bbox prompt generation
- reference image selection
- segmentation benchmarking
- particle descriptor extraction
All dependencies are provided in requirements.txt.
Create a new environment and install dependencies:
conda create -n nanoseg python=3.10
conda activate nanoseg
pip install -r requirements.txtNanoSeg/
├── train_integrated_clean.py
├── datasets_clean.py
├── prompt_flow.py
├── global_point_flow.py
├── bbox_generation.py
├── GradCAM.py
├── benchmark_unet.py
├── benchmark_ham.py
├── benchmark_sam_variants.py
├── simple_point.py
├── ref_pick.py
├── particle_db.py
├── metrics.py
├── postprocess.py
├── utils.py
└── requirements.txt
python train_integrated_clean.py \
--data_root path/to/dataset \
--results_dir path/to/outputpython GradCAM.py \
--image_dir path/to/images \
--checkpoint path/to/checkpoint.pt \
--output_dir path/to/cam_outputpython bbox_generation.py \
--image_dir path/to/cam_images \
--output_dir path/to/promptspython prompt_flow.pypython run_batch.pypython particle_db.py \
--mask_dir path/to/masks \
--output_dir path/to/outputbenchmark_unet.py # One-shot U-Net baseline
benchmark_ham.py # Fully supervised baseline
benchmark_sam_variants.py # MicroSAM / MedSAM comparison
simple_point.py # Single-point SAM baseline
artifacts_augmentation.py # Robustness evaluation
If you use NanoSeg in your research, please cite the corresponding work.