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.
- 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
- 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
- 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
- Python 3.10 or higher (recommended version 3.12.10)
- Git (for cloning the repository)
- CUDA-compatible GPU (optional, for faster inference)
git clone https://github.com/UGarCil/vIR-OLO.git
cd vIR-OLOChoose either venv or conda based on your preference:
# Create virtual environment
python -m venv .venv
# Activate on Windows
.venv\Scripts\activate
# Activate on Linux/macOS
source .venv/bin/activateImportant: 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 viroloInstall PyTorch with CUDA support for GPU acceleration (recommended for faster inference) or CPU-based:
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu126pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu118pip3 install torch torchvisionNote: Visit PyTorch's official website to find the installation command for your specific CUDA version.
From PyPI:
pip install viroloOr, 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)
Installing the package puts a virolo command on your PATH:
viroloEquivalent 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- 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
- Go to File β Download Default Models
- The application will download pre-trained models from Hugging Face
- Go to Models β Load Model
- Select a folder containing:
- A
.ptYOLO model file - A
dataset.yamlfile with label definitions
- A
-
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
- Use Previous/Next buttons or enter image numbers to navigate
- Annotations are automatically saved when switching images or closing the application
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
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
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)
- Create custom labels specific to your IR analysis needs
- Labels are stored in
dataset.yamlformat - When loading models, labels automatically merge with existing ones
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.
- 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)
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.
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
This project is available for research and educational purposes. Please contact the repository owner for commercial use inquiries.
- 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 β
For questions, issues, or feature requests, please open an issue on the GitHub repository.
Made with β€οΈ for the spectroscopy research community

