Multi-modal Plant Segmentation Suite for Agricultural Research
A web-based platform that makes AI-powered plant segmentation accessible to agronomists and researchers without programming expertise.
AgriSegment provides four specialized tools for different segmentation workflows:
Hybrid SegFormer + SAM Workflow
- Best for: Research projects requiring highest accuracy
- Method: Automatic detection with interactive refinement
- Key feature: Feedback loop where corrections improve AI performance
- Output: High-quality masks with editable point annotations
Interactive SAM Segmentation
- Best for: Quick single-image tasks
- Method: Point-based interactive segmentation
- Key feature: Real-time mask generation from user clicks
- Output: Binary masks, overlays, transparent PNGs
Automated SegFormer Processing
- Best for: Large-scale batch processing
- Method: Fully automatic plant detection
- Key feature: Multi-image upload with ZIP download
- Output: 2x3 visualization grid with statistics
Advanced Mask2Former Analysis
- Best for: Detailed multi-modal segmentation analysis
- Method: Semantic, instance, and panoptic segmentation modes
- Key feature: Comprehensive statistics and confidence thresholds
- Output: Labeled segments with coverage percentages
| Your Need | Recommended Tool | Why |
|---|---|---|
| Highest accuracy for research | hybrid/ | Manual refinement + feedback loop |
| Quick single-image segmentation | interactive/ | Fast, interactive, no setup |
| Process 100+ images | semantic/ | Automated bulk processing |
| Instance-level detection | panoptic/ | Multiple segmentation modes |
| Learning/experimenting | interactive/ → hybrid/ | Start simple, then advanced |
| Production pipeline | semantic/ → hybrid/ | Auto-process, refine when needed |
# Navigate to desired tool
cd hybrid/ # Port 8000
cd interactive/ # Port 8001
cd semantic/ # Port 8002
cd panoptic/ # Port 8003
# Install and run
bash installer.sh
python server.pyAccess: http://localhost:PORT
- hybrid/: 8000
- interactive/: 8001
- semantic/: 8002
- panoptic/: 8003
# Start all four tools simultaneously
docker-compose up
# Or run in detached mode
docker-compose up -dAccess all tools:
- hybrid/: http://localhost:8000
- interactive/: http://localhost:8001
- semantic/: http://localhost:8002
- panoptic/: http://localhost:8003
AgriSegment hybrid/ implements a continuous improvement cycle:
┌─────────────────────────────────────────────┐
│ 1. SegFormer detects plant regions │
│ ↓ │
│ 2. User refines with SAM (click points) │
│ ↓ │
│ 3. Refined masks = better training data │
│ ↓ │
│ 4. Retrain SegFormer with improved data │
│ ↓ │
│ 5. Better automatic detection │
│ ↓ │
│ (cycle repeats) │
└─────────────────────────────────────────────┘
This feedback loop enables continuous dataset improvement and model refinement.
- OS: Linux, macOS, Windows 10+
- Python: 3.8 or higher
- RAM: 8GB
- Storage: 10GB free space
- Internet: Required for model downloads
- RAM: 16GB or more
- GPU: CUDA-capable (NVIDIA) for faster processing
- Storage: 20GB SSD
# Verify Python version
python --version # Should be 3.8+
# Verify pip
pip --version# Clone repository
git clone https://github.com/mehran-tarif/AgriSegment.git
cd AgriSegment
# Install specific tool
cd [tool-folder] # hybrid, interactive, panoptic, or semantic
bash installer.sh# Navigate to each folder and install
cd hybrid && bash installer.sh && cd ..
cd interactive && bash installer.sh && cd ..
cd panoptic && bash installer.sh && cd ..
cd semantic && bash installer.sh && cd ..Models download automatically on first startup (5-10 minutes depending on internet speed).
- Drag & drop files into the upload area
- Or click "Upload" button to browse
- Supported formats: JPG, PNG, JPEG, BMP
- Max size: 50MB per image (recommended: under 10MB)
- hybrid/: Adjust point generation parameters
- panoptic/: Select segmentation mode (semantic/instance/panoptic)
- interactive/: Choose model size (base/large/huge)
- semantic/: Set number of concurrent processes
- Click "Generate" or "Segment" button
- Wait for processing (1-30 seconds depending on image size and tool)
- View results in real-time
- Individual files: Click download icon on each result
- Batch download: Click "Download All as ZIP"
- Available formats:
- Binary masks (PNG)
- Colored overlays (PNG)
- Transparent backgrounds (PNG)
- Statistics (JSON/CSV)
- ✅ Original image
- ✅ Segmentation mask
- ✅ Overlay visualization
- ✅ Downloadable files
- ✅ Confidence scores
- ✅ Area measurements (pixels & percentage)
- ✅ Class labels
- ✅ Point coordinates (
hybrid/)
results/
├── session_[id]/
│ ├── original_image.jpg
│ ├── mask.png
│ ├── overlay.png
│ ├── transparent.png
│ └── statistics.json
Edit server.py in any tool folder:
if __name__ == "__main__":
uvicorn.run(
app,
host="0.0.0.0",
port=8000 # Change this number
)For low-memory systems, reduce batch size:
# In server.py
BATCH_SIZE = 1 # Default: 4GPU automatically detected if CUDA available. To force CPU mode:
# In server.py
device = "cpu" # Default: "cuda" if available else "cpu"# Find and kill process using port
lsof -ti:8000 | xargs kill -9
# Or change port in server.pySolutions:
- Reduce image size (resize to 1024x1024 or smaller)
- Close other applications
- Set
BATCH_SIZE=1in configuration - Use CPU mode instead of GPU
Causes:
- Internet connection interrupted
- Firewall blocking Hugging Face
- Insufficient disk space
Solutions:
# Manually download models
python -c "from transformers import AutoModel; AutoModel.from_pretrained('nvidia/segformer-b4-finetuned-ade-512-512')"
# Check available disk space
df -h# Reinstall dependencies
pip install -r requirements.txt --force-reinstall
# Or use installer
bash installer.shDetailed guides for each tool:
- 📖 hybrid/ Documentation
- 📖 interactive/ Documentation
- 📖 semantic/ Documentation
- 📖 panoptic/ Documentation
Additional resources:
We welcome contributions! Here's how you can help:
Open an issue with:
- Tool name and version
- Steps to reproduce
- Expected vs actual behavior
- Screenshots if applicable
Open an issue with:
- Clear feature description
- Use case explanation
- Potential implementation approach
- Fork the repository
- Create feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open Pull Request
Tarif, M., & Quaglia, D. (2025). AgriSegment: A Deep Learning–Based Multi-Modal Plant Segmentation Suite for Agricultural Research. University of Verona, Department of Computer Science. https://doi.org/10.5281/zenodo.17237438
@software{tarif_agrisegment,
author = {Tarif, Mehran and
Quaglia, Davide},
title = {AgriSegment: A Deep Learning–Based Multi-Modal
Plant Segmentation Suite for Agricultural Research},
year = 2025,
publisher = {University of Verona, Department of Computer Science},
doi = {10.5281/zenodo.17237438}, % Concept DOI (always resolves to the latest version)
url = {https://doi.org/10.5281/zenodo.17237438}
}Tarif Mehran
Department of Computer Science
University of Verona, Italy
📧 mehran.tarifhokmabadi@univr.it
Davide Quaglia
Department of Computer Science
University of Verona, Italy
This project is licensed under the MIT License - see the LICENSE file for details.
Funding:
This work was supported by:
-
Italian Space Agency (ASI) - Project: "An Open, Efficient, and Customizable Pipeline for the Automated Processing of Remote Sensed Data for Computational Agro-Ecology"
-
Regione del Veneto - PR FESR 2021-2027, Action 1.1.1 - Project: "AGRIFUTURE: Il Futuro della Sostenibilità per le Sfide Competitive delle Aziende Agroalimentari Venete" (Project ID: 24279_001587_04499230235)
The funders had no role in study design, data collection and analysis, decision to publish, or preparation of this work.
Institutional Support:
University of Verona, Department of Computer Science
Built with open-source technologies:
- SegFormer by NVIDIA
- Segment Anything (SAM) by Meta AI
- Mask2Former by Meta AI
- FastAPI web framework
- PyTorch deep learning framework
- Transformers by Hugging Face
Need help?
- 📖 Check Documentation
- 🐛 Report Issues
- 💬 Join Discussions
- 📧 Email: mehran.tarifhokmabadi@univr.it
- First time? Start with interactive/ - it's the simplest
- Need accuracy? Use hybrid/ with manual refinement points
- Processing many images? Use semantic/ for automated workflows
- Research paper? Use panoptic/ for detailed statistics
- Production deployment? Combine semantic/ + hybrid/ pipeline
- Project Homepage (coming soon)
- GitHub Repository
- ICROPM 2026 Paper
- University of Verona
Made with 🌱 for agricultural research