vIR-OLO (ScpectrAI)
vIR-OLO is an intelligent annotation and inference tool for IR spectroscopy analysis. This project was born from the necessity of researchers to identify peaks in IR spectra, with the ultimate goal of assisting technicians and accelerating the analysis process.
The application provides a complete PyQt5-based GUI for creating YOLO-format annotations and integrating pre-trained YOLO models for AI-assisted peak detection in infrared spectra images.
๐ฏ Key Features
Annotation Capabilities
- Interactive bounding box annotation with intuitive two-click drawing interface
- YOLO-format compatibility for seamless integration with YOLO training pipelines
- Custom label management - define and edit label sets for your specific peak types
- Project-based workflow - organized structure for images and annotations
- Multiple interaction modes:
- BOX mode: Draw new bounding boxes
- ERASE mode: Delete existing annotations
- UPDATE mode: Modify box labels
AI-Assisted Workflow
- Load pre-trained YOLO models from Hugging Face or local filesystem
- One-click prediction on loaded spectra images
- Automatic label merging when integrating models with different label sets
- Default model downloader from the Hugging Face repositories
ChemAI-Lab/vIR-OLO-10FG,ChemAI-Lab/vIR-OLO-12FGandChemAI-Lab/vIR-OLO-13FG - Hybrid annotation: Combine AI predictions with manual corrections
User Interface
- Image navigation - browse through multiple spectra with prev/next controls
- Visual feedback - color-coded bounding boxes (green=selected, red=unselected)
- Real-time preview during box creation
- Status indicators for project state and active models
๐ฆ Installation
Prerequisites
- Python 3.10 or higher (recommended version 3.12.10)
- Git (for cloning the repository)
- CUDA-compatible GPU (optional, for faster inference)
Step 1: Clone the Repository
git clone https://github.com/UGarCil/vIR-OLO.git
cd vIR-OLO
Step 2: Create a Virtual Environment and install dependencies
Choose either venv or conda based on your preference:
Option A: Using venv
# Create virtual environment
python -m venv .venv
# Activate on Windows
.venv\Scripts\activate
# Activate on Linux/macOS
source .venv/bin/activate
Important: Always ensure your virtual environment (venv or conda) is activated before running the application.
# Create conda environment
conda create -n virolo python=3.12.10
conda activate virolo
Install PyTorch
Install PyTorch with CUDA support for GPU acceleration (recommended for faster inference) or CPU-based:
For CUDA 12.6 (Windows/Linux):
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu126
For CUDA 11.8:
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu118
For CPU only:
pip3 install torch torchvision
Note: Visit PyTorch's official website to find the installation command for your specific CUDA version.
Step 3: Install vIR-OLO
From PyPI:
pip install virolo
Or, for development, with your virtual environment activated and inside the repository directory:
pip install -e .
This will install all required dependencies including:
- PyQt5 (GUI framework)
- Pillow (Image processing)
- opencv-python (Computer vision utilities)
- numpy (Numerical operations)
- PyYAML (Configuration files)
- huggingface_hub (Model downloads)
- ultralytics (YOLO inference)
- requests (HTTP requests to connect with Hugging Face API)
๐ Quick Start
1. Launch the Application
Installing the package puts a virolo command on your PATH:
virolo
Equivalent alternatives:
python -m virolo # same entry point, useful when PATH is not set up
python main.py # runs straight from a checkout, no install needed
virolo --version # print the version and exit
2. Create a New Project
- Go to File โ New Project
- Select a folder containing your IR spectra images (PNG, JPG, JPEG formats)
- The application will create the necessary project structure
3. Load a Model (Optional)
Download Default Model:
- Go to File โ Download Default Models
- The application will download pre-trained models from Hugging Face
Load Custom Model:
- Go to Models โ Load Model
- Select a folder containing:
- A
.ptYOLO model file - A
dataset.yamlfile with label definitions
- A
4. Start Annotating
-
Manual annotation:
- Ensure BOX mode is active (Edit button)
- Click once to set the first corner
- Click again to complete the bounding box
-
AI-assisted annotation:
- Click the Predict button to run model inference
- Review and correct predicted boxes as needed
5. Navigate & Save
- Use Previous/Next buttons or enter image numbers to navigate
- Annotations are automatically saved when switching images or closing the application
๐ Project Structure
vIR-OLO/
โโโ main.py # Development launcher (runs without installing)
โโโ pyproject.toml # Project configuration, dependencies, `virolo` entry point
โโโ README.md # This file
โโโ INTEGRATION_GUIDE.md # Integration documentation
โโโ logo/ # Application logo assets
โโโ src/ # Source code (src layout)
โโโ virolo/ # The installable package
โโโ __init__.py # Package metadata (__version__)
โโโ __main__.py # Supports `python -m virolo`
โโโ cli.py # `virolo` console script entry point
โโโ constants.py # Global configuration dictionary
โโโ dataset.yaml # Label definitions template
โโโ spectrai.py # Main application controller (App class)
โโโ models/
โ โโโ __init__.py
โ โโโ predict.py # PredictorManager for YOLO inference
โโโ tools/
โ โโโ __init__.py
โ โโโ image_loader.py # ImageManager for image loading & transformations
โ โโโ donwload_default_models.py # ModelManager for Hugging Face downloads
โโโ ui/
โโโ __init__.py
โโโ main_ui.py # Auto-generated UI code from Qt Designer
โโโ main.ui # Qt Designer UI definition
โโโ canvas_widget.py # Interactive annotation canvas (CanvasWidget)
โโโ box_manager.py # BoxManager for annotation storage
โโโ bounding_box.py # BoundingBox data class
โโโ label_editor_dialog.py # Label editing dialog
โโโ label_new_dialog.py # New label creation dialog
โโโ icons/ # UI icon assets
๐ง How It Works
Architecture Overview
vIR-OLO follows a modular architecture with clear separation of concerns:
-
Application Layer (spectrai.py)
- Main
Appclass coordinates all components - Manages project lifecycle and user interactions
- Connects UI signals to business logic
- Main
-
Image Management (image_loader.py)
ImageManagerhandles image loading and display- Manages coordinate transformations between screen and image space
- Maintains scaling metadata for accurate annotation positioning
-
Annotation Management (box_manager.py, bounding_box.py)
BoxManagerstores collections of bounding boxes per imageBoundingBoxrepresents individual annotations- Converts between YOLO format (normalized) and pixel coordinates
-
Model Inference (predict.py)
PredictorManagerruns YOLO model predictions- Maps model labels to workspace labels
- Converts inference results to annotation format
-
UI Layer (canvas_widget.py, main_ui.py)
CanvasWidgetprovides interactive annotation canvas- Real-time drawing preview and box selection
- PyQt5-based modern interface
Data Flow
User Creates/Loads Project
โ
ImageManager loads spectra images
โ
User Action (Manual or AI-assisted)
โ
โโ Manual: CanvasWidget captures clicks โ BoxManager stores annotation
โโ AI: PredictorManager runs inference โ BoxManager stores predictions
โ
Annotations saved in YOLO format (.txt files)
๐ Usage Tips
Label Management
- Create custom labels specific to your IR analysis needs
- Labels are stored in
dataset.yamlformat - When loading models, labels automatically merge with existing ones
Coordinate Systems
The application handles two coordinate systems:
- Screen coordinates: Widget display space (includes padding/offset)
- Image coordinates: Original image pixel space (used for storage)
All conversions are handled automatically by ImageManager.
Annotation Workflow Best Practices
- Start with AI predictions if you have a pre-trained model
- Review predictions and correct any errors
- Add missing annotations manually
- Use consistent labeling across your dataset
- Regularly save your work (automatic on navigation)
YOLO Format Output
Annotations are saved as .txt files with the format:
<class_id> <x_center> <y_center> <width> <height>
All values are normalized to [0, 1] relative to image dimensions.
๐ค Contributing
Contributions are welcome! If you'd like to improve vIR-OLO:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
๐ License
This project is available for research and educational purposes. Please contact the repository owner for commercial use inquiries.
๐ Acknowledgments
- Built with PyQt5 for the GUI framework
- Powered by Ultralytics YOLO for object detection
- Default models hosted on Hugging Face under the ChemAI-Lab organization:
- vIR-OLO-10FG โ
vIR-OLO-10FG.pt+dataset.yaml - vIR-OLO-12FG โ
vIR-OLO-12FG.pt+dataset.yaml - vIR-OLO-13FG โ
vIR-OLO-13FG.pt+dataset.yaml
- vIR-OLO-10FG โ
๐ Support
For questions, issues, or feature requests, please open an issue on the GitHub repository.
Made with โค๏ธ for the spectroscopy research community
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file virolo-1.0.0.tar.gz.
File metadata
- Download URL: virolo-1.0.0.tar.gz
- Upload date:
- Size: 359.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30d7504c35d2de2877c0e2a55dd86a997d21a93192770cfa22c7b36881ca3566
|
|
| MD5 |
80e844e318ec6d27eb9619052de5be16
|
|
| BLAKE2b-256 |
be2ff07e252f891da5d364a723a6ff3755e1f62cf30e46d9df8bb9be85b78c1c
|
File details
Details for the file virolo-1.0.0-py3-none-any.whl.
File metadata
- Download URL: virolo-1.0.0-py3-none-any.whl
- Upload date:
- Size: 359.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65cb01845585b5c58f448e799aff8589c2ee07190af0e895b07421010e9f4a85
|
|
| MD5 |
b4d8ad76e702ea985ebb1eec716eb981
|
|
| BLAKE2b-256 |
7591bdcf09c455052d7d99c8da218d6771efc7a5a886f10d195dbbb605e5e40e
|