A comprehensive tool built on top of Ultralytics YOLO that provides both automatic image detection and model comparison capabilities. This software allows you to select from multiple trained models, process images with detection, and compare model performance across different datasets.
- π― Dynamic Model Selection - Choose from multiple model folders and files
- π Automatic Image Detection - Process images with selected YOLO models
- π Model Comparison - Compare performance of multiple models
- π Organized Output - All results saved in structured output folder
- π¬ Video Generation - Create videos from detection results
- π§ Dynamic Class Loading - Automatically loads classes from model folders
- π YOLO Format Support - Generates standard YOLO annotation files
- Python 3.13.2
- Ultralytics YOLO
- OpenCV
- Pandas (for model comparison)
Install dependencies:
pip install ultralytics opencv-python pandas pyyamlFirst, create and activate a virtual environment:
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activateOrganize your trained models in the following structure:
models/
βββ cars/
β βββ best1.pt
β βββ best2.pt
β βββ best3.pt
β βββ classes.txt
βββ receipts/
βββ best1.pt
βββ classes.txt
Place your images and labels in the dataset/ folder:
dataset/
βββ image1.jpg
βββ image1.txt
βββ image2.jpg
βββ image2.txt
βββ ...
Make sure your virtual environment is activated, then run:
# Ensure virtual environment is activated (you should see (venv) in your terminal)
python main.pyChoose between two main features:
- Process Images (Detection) - Run object detection on your dataset
- Compare Models - Compare performance of multiple models
Select the model folder (e.g., "cars" or "receipts") containing your trained models.
- Select specific model file (e.g., "best1.pt")
- System loads model and classes automatically
- Processes all images in dataset folder
- Generates results in organized output structure
- System automatically finds all models in selected folder
- Creates comparer dataset structure
- Evaluates each model on validation data
- Generates comparison report
project/
βββ main.py # Main entry point
βββ Engine/ # Core engine files
β βββ start.py # Detection processing
β βββ yolo_detection.py # YOLO detection logic
β βββ create_video.py # Video generation
β βββ compare.py # Model comparison
β βββ data.yaml # Dynamic data configuration
β βββ comparer/ # Comparison dataset (auto-created)
β βββ images/val/ # Validation images
β βββ labels/val/ # Validation labels
βββ models/ # Your trained models
β βββ cars/
β β βββ best1.pt
β β βββ best2.pt
β β βββ classes.txt
β βββ receipts/
β βββ best1.pt
β βββ classes.txt
βββ dataset/ # Input images and labels
βββ output/ # All generated results
β βββ saved/ # Images with detections
β βββ labels/ # YOLO annotation files
β βββ output_video.mp4 # Generated video
β βββ model_comparison.csv # Comparison results
βββ README.md
- Saved in
output/saved/ - Shows detected objects with confidence scores
- Color-coded by class
- Saved in
output/labels/ - Standard YOLO format:
<class_id> <x_center> <y_center> <width> <height> - Normalized coordinates (0-1)
output/labels/classes.txt- Lists all class names used by the model
- Saved as
output/model_comparison.csv - Contains metrics: Precision, Recall, mAP50, mAP50-95
- Easy to analyze in Excel or other tools
1. Run: python main.py
2. Select: "1. Process Images (Detection)"
3. Select: "1. cars" (model folder)
4. Select: "1. best1.pt" (specific model)
5. Results: Images with detections in output/saved/
1. Run: python main.py
2. Select: "2. Compare Models"
3. Select: "1. cars" (model folder)
4. Results: Comparison report in output/model_comparison.csv
- Reads
classes.txtfrom model folder - Automatically configures detection classes
- No manual class configuration needed
- Creates
data.yamlautomatically for model comparison - Uses classes from selected model folder
- Configures validation paths correctly
- All results saved in
output/folder - Automatic folder creation and cleanup
- Consistent file organization
The system includes comprehensive error handling:
- Model validation before processing
- Class file verification
- Dataset folder existence checks
- Clear error messages for troubleshooting
MIT License
Built with β€οΈ in Pakistan
