This project builds an image-analysis pipeline for automatically quantifying the crystal size distribution (CSD) of acicular Ag crystals from optical microscope images.
The workflow combines image preprocessing, Tuned MobileSAM instance segmentation, geometry/ridge-based filtering, skeletonization, and statistical calibration against Morphologi measurements.
- Target material: 0.3 wt% Ag Long-Needle crystals
- Dataset: OpenCrystalDataset, optical microscope images
- Goal: Estimate particle length distribution from microscope images without relying on expensive particle analysis equipment
- Core method: MobileSAM-based mask generation + domain-specific filtering + skeleton length measurement
- Validation reference: Morphologi static image analysis measurements
-
Preprocessing
- White Top-Hat correction for uneven illumination
- Gaussian blur for noise suppression
- CLAHE for local contrast enhancement
-
Tuned MobileSAM Segmentation
- Automatic mask generation
- Bright-region positive prompt generation using the top 2% intensity regions
- Prompt-limited inference for computational efficiency
-
Post-processing and Filtering
- Aspect-ratio and solidity-based filtering
- Sato ridge filter validation for linear crystal structures
- IoU-based non-maximum suppression for duplicate masks
-
Skeletonization
- Zhang-Suen thinning extracts 1-pixel centerlines
- Skeleton length is used as the pixel-level crystal length estimate
-
Statistical Calibration
- Pixel lengths are calibrated to micrometers using Morphologi D50
- Estimated scale: 1 pixel ~= 0.53 um
The low-concentration image set produced 800 detected crystal centerline lengths across 10 images.
| Metric | This project | Morphologi | Error |
|---|---|---|---|
| D10 | 30.1 um | 20.1 um | +10.0 um / 49.8% |
| D50 | 67.3 um | 67.3 um | 0.0 um / 0.0% |
| D90 | 135.7 um | 141.8 um | -6.1 um / 4.3% |
D50 was used as the calibration anchor, so D10 and D90 are more meaningful for independent distribution-shape validation.
.
|-- notebooks/
| `-- ag_crystal_csd_mobilesam.ipynb
|-- src/
| `-- ag_crystal_csd_pipeline.py
|-- results/
| |-- comparison/
| |-- limitation/
| |-- mask_results/
| |-- tables/
| |-- crystal_lengths.csv
| |-- csd_histogram.png
| `-- image_summary.csv
`-- docs/
|-- final_presentation_ko.pptx
`-- project_summary_ko.docx
notebooks/ag_crystal_csd_mobilesam.ipynb: full annotated experimental workflowsrc/ag_crystal_csd_pipeline.py: exported code cells for quick reviewresults/tables/csd_summary.csv: summary statistics for the detected crystal length distributionresults/csd_histogram.png: final CSD histogramdocs/final_presentation_ko.pptx: Korean final presentation deckdocs/project_summary_ko.docx: Korean project summary report
The original experiment was executed on Google Colab with a T4 GPU.
Install the main Python dependencies with:
pip install -r requirements.txtMobileSAM weights are downloaded automatically by the notebook if mobile_sam.pt is not present.
- High-concentration images show under-segmentation when crystals overlap or cross heavily.
- Short crystals in the D10 region are more difficult to preserve because aspect-ratio filtering can remove small particles.
- Current physical-scale calibration depends on Morphologi D50; future work should use microscope images with scale bars or multi-point calibration.
- Barhate et al., OpenCrystalData, Digital Chemical Engineering, 2024.
- Kirillov et al., Segment Anything, arXiv, 2023.
- Zhang et al., Faster Segment Anything, arXiv, 2023.