https://github.com/rybakov-ks/particleanalyzer
A Computer Vision-based tool for automatic segmentation and size analysis of particles in Scanning Electron Microscope (SEM) images.
https://github.com/rybakov-ks/particleanalyzer
computer-vision data-analysis deep-learning detectron2 electron-microscopy image-segmentation materials-characterization microscopy-images nanotechnology object-detection particle-analysis scanning-electron-microscopy scientific-research sem sem-image-analysis yolo
Last synced: 30 days ago
JSON representation
A Computer Vision-based tool for automatic segmentation and size analysis of particles in Scanning Electron Microscope (SEM) images.
- Host: GitHub
- URL: https://github.com/rybakov-ks/particleanalyzer
- Owner: rybakov-ks
- License: gpl-3.0
- Created: 2025-05-03T19:46:57.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-13T19:57:15.000Z (12 months ago)
- Last Synced: 2025-06-15T03:01:47.264Z (12 months ago)
- Topics: computer-vision, data-analysis, deep-learning, detectron2, electron-microscopy, image-segmentation, materials-characterization, microscopy-images, nanotechnology, object-detection, particle-analysis, scanning-electron-microscopy, scientific-research, sem, sem-image-analysis, yolo
- Language: Python
- Homepage: https://sem.rybakov-k.ru
- Size: 104 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## π Table of Contents
1. π [ParticleAnalyzer](#particleanalyzer)
2. β¨ [Key Features](#-key-features)
3. π₯ [Installation Guide](#-installation-guide)
4. π [Segmentation Optimization Guide](#-segmentation-optimization-guide)
5. π [Analysis Outputs](#-analysis-outputs)
6. βοΈ [Advanced Settings](#-advanced-settings)
7. π [Scale Calibration](#-scale-calibration)
8. π§ [Contributors](#-contributors)
## ParticleAnalyzer
[](https://sem.rybakov-k.ru/)
[](https://pypi.org/project/particleanalyzer/)
[](https://pepy.tech/project/particleanalyzer)
A Computer Vision Tool for Automatic Particle Segmentation and Size Analysis in Scanning Electron Microscope (SEM) Images.
Video demonstrations:
Local video (MP4) |
YouTube demonstration
*If you encounter any errors while using ParticleAnalyzer, please open an issue in our GitHub repository or contact us directly at rybakov-ks@ya.ru for support.
If the model fails to segment your images correctly, please send them to rybakov-ks@ya.ru. Your submissions will be used to retrain and improve the modelβs performance.*
## β¨ Key Features
- Automated particle segmentation in SEM images
- SAHI mode enables accurate detection of small particles in high-resolution images via a sliding window method
- Comprehensive statistical analysis of particle characteristics
- Interactive visualization of size distributions
- Dual unit support β switch between pixels and micrometers (Β΅m)
- Supports multiple AI models: YOLOv11, YOLOv12, and Detectron2
- Advanced configuration options for fine-tuning detection accuracy
- Multi-language interface: English, Russian, Simplified Chinese, Traditional Chinese (en, ru, zh-CN, zh-TW)
- Try it online: [sem.rybakov-k.ru](https://sem.rybakov-k.ru/)
## π Installation Guide
### 1. π₯ Install PyTorch with CUDA support
Make sure your system has an NVIDIA GPU with CUDA. Install [PyTorch](https://pytorch.org/get-started/locally/) using the appropriate CUDA version (e.g., CUDA 11.8):
```python
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
```
If you do not have a CUDA-capable GPU, use the CPU version instead:
```python
pip install torch torchvision torchaudio
```
### π§ͺ 2. Install Detectron2 (Optional)
If you want to enable advanced instance segmentation, install Detectron2:
```python
pip install 'git+https://github.com/facebookresearch/detectron2.git'
```
β οΈ *There may be problems installing Detectron2. Use the official [documentation](https://detectron2.readthedocs.io/en/latest/tutorials/install.html).*
### π¦ 3. Install ParticleAnalyzer
Finally, install ParticleAnalyzer from PyPI:
```python
pip install ParticleAnalyzer
```
β
Now you're ready to run the application:
```python
ParticleAnalyzer run
```
Open in browser: http://127.0.0.1:8000
## π Segmentation Optimization Guide
π§ Core Parameters:
- Model Selection
- Detection Confidence Threshold (0-1)
- Increase (e.g., 0.7β0.85) to reduce false positives
- Decrease (e.g., 0.5β0.3) to detect faint particles
- IoU Threshold (0-1)
- Increase (e.g., 0.5β0.7) to eliminate duplicate detections
- Decrease for dense particle fields
- Enable SAHI Processing (split-analyze-merge)
π§© SAHI Configuration (for large images):
- Slice Size: Start with 400Γ400
- Overlap Ratio: 0.2-0.3 (prevents edge artifacts)\
*SAHI mode helps detect small objects in high-resolution images by using a sliding window approach*
π Model Selection:
| Model | Best For | Speed | Recommended Use Case |
|-------------|----------------------------|-----------|------------------------------------|
| **YOLOv11** | General use (balanced) | β‘β‘β‘ Fast | Quick analysis of standard samples |
| **YOLOv12** | High precision detection | β‘β‘ Medium | Critical measurements |
| **Cascade_X152** | Challenging morphology | β‘ Slow | Irregular/overlapping particles |
## π Analysis Outputs
### Statistical Data Table
*Comprehensive metrics including mean, median, min/max, standard deviation values for:*
- Area (pxΒ² or Β΅mΒ²)
- Perimeter (px or Β΅m)
- Equivalent diameter (px or Β΅m)
- Eccentricity (unitless)
- Intensity values (grayscale units)
### Size Distribution Visualization
*Normal distribution fitting for all measured parameters showing particle population characteristics*
## Advanced Settings Panel
*Configuration options include:*
- **Model Selection**: YOLOv11, YOLOv12, Detectron2
- **SAHI Mode**: Enable/disable sliced inference for large images
- **Detection Threshold**: Confidence level (0-1)
- **IOU Threshold**: Overlap threshold for NMS (0-1)
- **Max Detections**: Maximum number of particles to detect
- **Scaling Mode**: Pixel/Β΅m unit selection
- **Image Resolution**: Output resolution control
- **Result Rounding**: Decimal places for metrics
- **Single Particle Mode**: Detailed individual analysis
- **Histogram Bins**: Number of intervals for distribution plots
## π Scale Calibration
Micrometer values are calculated by:
1. Identifying the SEM image's scale bar using two marker points
2. Manually specifying the known real-world distance between markers
3. Automatically computing the pixel-to-Β΅m conversion ratio
*Note: For accurate Β΅m measurements, please ensure:*
- The scale bar is clearly visible in your image
- You input the correct reference distance when prompted
- The scale bar was created at the same magnification as your particles
## π§ Contributors
Rybakov Kirill (Saratov State University): rybakov-ks@ya.ru