BioViT3R-Beta is a comprehensive plant analysis platform that combines cutting-edge computer vision, 3D reconstruction, and AI technologies to provide advanced agricultural insights. The platform integrates VGGT 3D reconstruction, multi-dataset fruit detection, plant health assessment, and IBM Granite AI assistance.
- VGGT 3D Reconstruction: Single-image to 3D point cloud conversion
- Multi-Dataset Fruit Detection: Trained on ACFR + MinneApple datasets (41,000+ annotations)
- Plant Health Assessment: Disease and stress detection using computer vision
- Growth Stage Classification: Automated phenological analysis
- Biomass Estimation: Volumetric calculations from 3D reconstructions
- IBM Granite AI Assistant: Agricultural expertise and intelligent insights
- Deep Learning: PyTorch, Transformers, Detectron2
- 3D Processing: Open3D, Trimesh, Point Cloud Library
- Computer Vision: OpenCV, Albumentations, Scikit-image
- Web Interface: Gradio, Streamlit
- AI Integration: IBM Watsonx.ai, Granite models
- Data Processing: NumPy, Pandas, SciPy
- Python 3.8 or higher
- CUDA-compatible GPU (recommended for optimal performance)
- Git LFS for model files
# Clone the repository
git clone https://github.com/amasuba/BioViT3R-Beta.git
cd BioViT3R-Beta
# Create virtual environment
python -m venv biovitr_env
source biovitr_env/bin/activate # On Windows: biovitr_env\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Install package in development mode
pip install -e .pip install biovitr-beta# Build the Docker image
docker build -t biovitr-beta .
# Run with GPU support
docker run --gpus all -p 7860:7860 biovitr-betaLaunch the Gradio web interface:
python app.pyVisit http://localhost:7860 in your browser to access the interactive interface.
Process a single image:
python main.py single /path/to/plant/image.jpg /path/to/output/Batch process multiple images:
python main.py batch /path/to/images/ /path/to/output/ --analysis-type completefrom src.models.vggt_reconstructor import VGGTReconstructor
from src.models.plant_analyzer import PlantAnalyzer
# Initialize models
reconstructor = VGGTReconstructor('models/vggt/')
analyzer = PlantAnalyzer({'health_classification_path': 'models/health_classification/'})
# Load and analyze image
import cv2
image = cv2.imread('path/to/plant/image.jpg')
# 3D reconstruction
point_cloud, mesh = reconstructor.reconstruct_3d(image)
# Health analysis
health_results = analyzer.analyze_health(image)
print(f"Health Score: {health_results['health_score']}")
print(f"Detected Issues: {health_results['detected_issues']}")Performs all available analyses including 3D reconstruction, health assessment, fruit detection, and biomass estimation.
# Via CLI
python main.py single image.jpg output/ --analysis-type complete
# Via API
results = app.analyze_plant(image, analysis_type="complete")python main.py single image.jpg output/ --analysis-type 3dpython main.py single image.jpg output/ --analysis-type healthpython main.py single image.jpg output/ --analysis-type fruits- JPEG/JPG
- PNG
- BMP
- TIFF
- WebP
Process video files frame by frame:
from src.utils.video_processor import VideoProcessor
processor = VideoProcessor()
results = processor.process_video('path/to/video.mp4', 'output_dir/')models:
vggt_model_path: "models/vggt/"
fruit_detection_path: "models/fruit_detection/"
health_classification_path: "models/health_classification/"
processing:
input_size: [224, 224]
batch_size: 32
device: "cuda" # or "cpu"
ibm_watsonx:
project_id: "your_project_id"
model_id: "ibm/granite-13b-chat-v2"
api_endpoint: "https://us-south.ml.cloud.ibm.com"
interface:
theme: "soft"
title: "BioViT3R-Beta: Plant Analysis Platform"
port: 7860Create a .env file:
IBM_WATSON_APIKEY=your_api_key_here
IBM_PROJECT_ID=your_project_id_here
IBM_WATSON_URL=https://us-south.ml.cloud.ibm.com
WANDB_API_KEY=your_wandb_key # Optional: for experiment tracking- Source: Australian Centre for Field Robotics
- Content: Apple detection in orchard environments
- Images: 1,000+ labeled images
- Usage: Fruit detection model training
- Source: University of Minnesota
- Content: 41,000+ apple annotations
- Images: 670+ high-resolution images
- Usage: Enhanced fruit detection accuracy
Download and prepare datasets:
python scripts/setup_datasets.py --dataset acfr --path data/acfr_orchard/
python scripts/setup_datasets.py --dataset minneapple --path data/minneapple/Train on your own dataset:
python scripts/train_fruit_detector.py \
--dataset_path /path/to/custom/dataset \
--config configs/training_config.yaml \
--output_dir models/custom_fruit_detection/python scripts/train_health_classifier.py \
--dataset_path /path/to/health/dataset \
--epochs 100 \
--batch_size 32| Model Component | Accuracy | Speed (GPU) | Speed (CPU) |
|---|---|---|---|
| Fruit Detection | 94.2% mAP | 45 FPS | 8 FPS |
| Health Classification | 91.7% | 120 FPS | 15 FPS |
| 3D Reconstruction | - | 12 FPS | 2 FPS |
| Growth Stage | 88.5% | 150 FPS | 20 FPS |
CUDA Out of Memory
# Reduce batch size in config
# Or use CPU mode
export CUDA_VISIBLE_DEVICES=""Model Download Fails
# Manual download
python scripts/download_models.py --model vggt --path models/vggt/IBM Watsonx Connection Error
- Verify API credentials in
.envfile - Check network connectivity
- Ensure project ID is correct
Check logs for detailed error information:
- Application logs:
logs/biovitr_app.log - CLI logs:
logs/biovitr_cli.log - Training logs:
logs/training/
We welcome contributions to BioViT3R-Beta! Please see our contributing guidelines for details.
# Install development dependencies
pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit install
# Run tests
pytest tests/
# Check code style
black src/ tests/
flake8 src/ tests/- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- ACFR for the Orchard Fruit Dataset
- University of Minnesota for the MinneApple Dataset
- IBM for Watsonx.ai and Granite models
- PyTorch and Open3D communities
- All contributors and researchers in agricultural AI
- Project Homepage: https://github.com/amasuba/BioViT3R-Beta
- Issues: https://github.com/amasuba/BioViT3R-Beta/issues
- Email: amasuba@acm.org
⭐ If you find BioViT3R-Beta useful, please star the repository and share it with the community!