An open API service indexing awesome lists of open source software.

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.

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
[![Try Online](https://img.shields.io/badge/TRY%20ONLINE-Available%20at%20sem.rybakov--k.ru-brightgreen)](https://sem.rybakov-k.ru/)
[![Download from PyPI](https://img.shields.io/pypi/v/particleanalyzer?label=Download%20from%20PyPI)](https://pypi.org/project/particleanalyzer/)
[![Downloads per month](https://static.pepy.tech/badge/particleanalyzer/month)](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


Example

*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


Statistics 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


Distribution Plots

*Normal distribution fitting for all measured parameters showing particle population characteristics*

## Advanced Settings Panel


Settings Menu

*Configuration options include:*
- **Model Selection**: YOLOv11, YOLOv12, Detectron2
- **SAHI Mode**: Enable/disable sliced inference for large images


SAHI Mode

- **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


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


Real Scale

*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