High-performance instance segmentation for automated tomato ripeness classification using YOLO11
This project implements state-of-the-art instance segmentation for classifying tomato ripeness stages using YOLO11. The model achieves 90.1% mAP@0.5 and 89.8% mask mAP@0.5 on the Laboro Tomato dataset, making it suitable for real-world agricultural applications.
- Robotic Harvesting: Automated fruit picking systems
- Yield Estimation: Greenhouse monitoring and analytics
- Sorting Systems: Post-harvest quality control
- Mobile Apps: Farm management tools
- Research: Agricultural computer vision studies
- π’ Green: Unripe tomatoes
- π‘ Half-ripened: Partially ripe tomatoes
- π΄ Fully-ripened: Ready-to-harvest tomatoes
| Metric | Box Detection | Instance Segmentation |
|---|---|---|
| mAP@0.5 | 90.1% | 89.8% |
| mAP@0.5:0.95 | 80.5% | 77.1% |
| Inference Speed | 28ms | 28ms |
| Class | Precision | Recall | mAP@0.5 |
|---|---|---|---|
| Fully Ripened | 91.4% | 91.4% | 91.3% |
| Green | 86.8% | 91.8% | 91.8% |
| Half Ripened | 85.0% | 87.1% | 87.1% |
- Python 3.10+
- NVIDIA GPU with CUDA support (recommended)
- 8GB+ RAM
- Clone the repository
git clone https://github.com/Fonyuy45/yolo11-tomato-segmentation.git
cd yolo11-tomato-segmentation- Set up environment
chmod +x scripts/setup_environment.sh
./scripts/setup_environment.sh
source venv/bin/activate- Download pre-trained model
# Download our trained model
wget -O models/best.pt "https://github.com/Fonyuy45/yolo11-tomato-segmentation/releases/download/v1.0/best.pt"Single Image Prediction
python src/predict.py --model models/best.pt --source data/sample_images/tomato1.jpgBatch Processing
python src/predict.py --model models/best.pt --source data/sample_images/ --save-dir results/batch_predictionsPython API
from ultralytics import YOLO
# Load model
model = YOLO('models/best.pt')
# Run inference
results = model('path/to/your/tomato_image.jpg')
# Display results
results[0].show()- Download Laboro Tomato Dataset
python scripts/download_data.py- Train from scratch
python src/train.py --data data/data_config.yaml --model x --epochs 100 --batch 4- Resume training
python src/train.py --resume tomato_segmentation/training_run/weights/last.pt- Model: YOLO11x-seg (62M parameters)
- Input Size: 640Γ640
- Batch Size: 4
- Epochs: 100
- Optimizer: AdamW
- GPU Memory: ~6GB (RTX 4060)
Laboro Tomato Dataset from Roboflow Universe
- Training Images: 2,001
- Validation Images: 86
- Total Instances: 898
- Annotation Format: YOLO segmentation masks
- License: CC BY 4.0
- Backbone: YOLO11x-seg
- Input Resolution: 640Γ640
- Parameters: 62,053,721
- GFLOPs: 319.7
- Output: Bounding boxes + segmentation masks
- GPU: GTX 1060 6GB / RTX 3050
- RAM: 8GB+
- Storage: 5GB free space
- GPU: RTX 4060+ / RTX 3070+
- RAM: 16GB+
- Storage: 10GB+ SSD
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your 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 licensed under the MIT License - see the LICENSE file for details.
- Ultralytics for the YOLO11 framework
- Roboflow for the Laboro Tomato dataset
- Jalal's Lab for dataset curation
- Author: dieudonne Fonyuy Y.
- Email: dieudonne.yufonyuy@gmail.com
- LinkedIn: www.linkedin.com/in/dieudonne-yufonyuy
- Project Link: https://github.com/Fonyuy45/yolo11-tomato-segmentation
β Star this repository if you found it helpful!







