Metadata-Version: 2.4
Name: ParticleAnalyzer
Version: 1.2.0
Summary: SEM Image Analysis Tool
Home-page: https://github.com/rybakov-ks/ParticleAnalyzer
Author: Kirill Rybakov
Author-email: rybakov-ks@ya.ru
Project-URL: Bug Reports, https://github.com/rybakov-ks/ParticleAnalyzer/issues
Project-URL: Source, https://github.com/rybakov-ks/ParticleAnalyzer
Keywords: SEM,microscopy,image-analysis,particle-analysis,materials-science,nanoparticles,computer-vision,opencv,python,scientific-computing,microstructure,particle-size,image-processing,detectron2,YOLO,deep-learning,microscope-images,material-characterization,automated-measurements,research-tools
Classifier: Programming Language :: Python :: 3.10
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: gradio==5.35.0
Requires-Dist: gradio-rangeslider
Requires-Dist: matplotlib
Requires-Dist: opencv-python
Requires-Dist: opencv-python-headless
Requires-Dist: Pillow
Requires-Dist: plotly
Requires-Dist: sahi
Requires-Dist: scipy
Requires-Dist: tqdm
Requires-Dist: ultralytics
Requires-Dist: huggingface_hub
Requires-Dist: openai
Requires-Dist: Requests
Requires-Dist: numpy
Requires-Dist: pandas
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# ParticleAnalyzer

[![Online Demo](https://img.shields.io/badge/DEMO-Available%20at%20particleanalyzer.ru-brightgreen)](https://particleanalyzer.ru/)


<div align="left">
  <a href="https://sem.rybakov-k.ru/">
    <img src="https://raw.githubusercontent.com/rybakov-ks/ParticleAnalyzer/refs/heads/main/Images/Logo.png" alt="ParticleAnalyzer Logo" width="300"/>
  </a>
</div>

**ParticleAnalyzer** is a computer vision tool for automatic particle segmentation and size analysis in Scanning Electron Microscope (SEM) images.

---

## 🎬 Demonstration

<p align="center">
  <strong>Video demonstrations:</strong><br>
  <a href="https://github.com/rybakov-ks/ParticleAnalyzer/blob/main/Images/ParticleAnalyzer.mp4">▶️ Local video (MP4)</a> | 
  <a href="https://youtu.be/qlCuZDjDyqk">▶️ YouTube demonstration</a>
</p>

<p align="center">
  <img src="https://raw.githubusercontent.com/rybakov-ks/ParticleAnalyzer/main/Images/example.gif" alt="Example" width="600">
</p>

---

## 🛠 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—however, in this case, ParticleAnalyzer will run significantly slower:
   ```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'
```
> [!WARNING]
> *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 --upgrade ParticleAnalyzer
```
✅ Now you're ready to run the application:
```python
ParticleAnalyzer run
```
Open in browser: http://127.0.0.1:8000 

You can specify the port if necessary:
```python
ParticleAnalyzer run --port 5000
```

Launch with LLM support ([OpenRouter](https://openrouter.ai/settings/keys) or [Hugging Face](https://huggingface.co/settings/tokens) API key required):
```python
ParticleAnalyzer run --port 5000 --api-key YOUR_OPENROUTER_API_KEY
```
