|
|
--- |
|
|
license: mit |
|
|
language: |
|
|
- en |
|
|
tags: |
|
|
- object-detection |
|
|
- yolov8 |
|
|
- tree-disease-detection |
|
|
- agriculture |
|
|
- computer-vision |
|
|
- pytorch |
|
|
- ultralytics |
|
|
library_name: ultralytics |
|
|
pipeline_tag: object-detection |
|
|
datasets: |
|
|
- qwer0213/PDT_dataset |
|
|
metrics: |
|
|
- mAP50 |
|
|
- mAP50-95 |
|
|
- precision |
|
|
- recall |
|
|
model-index: |
|
|
- name: crop_desease_detection |
|
|
results: |
|
|
- task: |
|
|
type: object-detection |
|
|
name: Object Detection |
|
|
dataset: |
|
|
name: PDT Dataset |
|
|
type: qwer0213/PDT_dataset |
|
|
metrics: |
|
|
- type: map |
|
|
value: 0.933 |
|
|
name: mAP50 |
|
|
- type: map |
|
|
value: 0.659 |
|
|
name: mAP50-95 |
|
|
- type: precision |
|
|
value: 0.878 |
|
|
name: Precision |
|
|
- type: recall |
|
|
value: 0.863 |
|
|
name: Recall |
|
|
inference: true |
|
|
spaces: |
|
|
- IsmatS/tree-disease-detector-demo |
|
|
widget: |
|
|
- src: https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/example_image.jpg |
|
|
example_title: Example Tree Image |
|
|
--- |
|
|
|
|
|
# YOLOv8s Tree Disease Detection Model |
|
|
|
|
|
Try the model in action: [🚀 Live Demo](https://huggingface.co/spaces/IsmatS/tree-disease-detector-demo) |
|
|
|
|
|
This model detects unhealthy/diseased trees in aerial UAV imagery using YOLOv8s architecture. It was trained on the PDT (Pests and Diseases Tree) dataset and achieves high accuracy for agricultural monitoring applications. |
|
|
|
|
|
<!-- Embed the Space --> |
|
|
<iframe |
|
|
src="https://IsmatS-tree-disease-detector-demo.hf.space" |
|
|
frameborder="0" |
|
|
width="850" |
|
|
height="450" |
|
|
></iframe> |
|
|
|
|
|
## Model Description |
|
|
|
|
|
This YOLOv8s model has been fine-tuned specifically for detecting unhealthy trees affected by pests and diseases in high-resolution UAV imagery. The model is particularly effective for: |
|
|
|
|
|
- Precision agriculture monitoring |
|
|
- Forest health assessment |
|
|
- Early disease detection in orchards |
|
|
- Large-scale plantation management |
|
|
- Environmental monitoring |
|
|
|
|
|
### Architecture |
|
|
- **Base Model**: YOLOv8s |
|
|
- **Input Size**: 640x640 pixels |
|
|
- **Framework**: Ultralytics YOLOv8 |
|
|
- **Classes**: 1 (unhealthy) |
|
|
|
|
|
## Training Details |
|
|
|
|
|
### Dataset |
|
|
- **Dataset**: [PDT (Pests and Diseases Tree)](https://huggingface.co/datasets/qwer0213/PDT_dataset) |
|
|
- **Training Images**: 4,536 |
|
|
- **Validation Images**: 567 |
|
|
- **Test Images**: 567 |
|
|
- **Resolution**: 640x640 (Low Resolution version) |
|
|
|
|
|
### Training Configuration |
|
|
- **Epochs**: 50 |
|
|
- **Batch Size**: 16 |
|
|
- **Optimizer**: SGD |
|
|
- **Learning Rate**: 0.01 |
|
|
- **Momentum**: 0.9 |
|
|
- **Weight Decay**: 0.001 |
|
|
- **Device**: NVIDIA A100-SXM4-40GB |
|
|
- **Training Time**: 0.408 hours |
|
|
|
|
|
## Performance Metrics |
|
|
|
|
|
| Metric | Value | |
|
|
|--------|-------| |
|
|
| mAP50 | 0.933 | |
|
|
| mAP50-95 | 0.659 | |
|
|
| Precision | 0.878 | |
|
|
| Recall | 0.863 | |
|
|
|
|
|
## Usage |
|
|
|
|
|
### Installation |
|
|
|
|
|
```bash |
|
|
pip install ultralytics |
|
|
|
|
|
### Inference |
|
|
|
|
|
```python |
|
|
from ultralytics import YOLO |
|
|
import cv2 |
|
|
|
|
|
# Load model |
|
|
model = YOLO('best.pt') # or path to downloaded model |
|
|
|
|
|
# Run inference on an image |
|
|
results = model('path/to/your/image.jpg') |
|
|
|
|
|
# Process results |
|
|
for result in results: |
|
|
boxes = result.boxes |
|
|
if boxes is not None: |
|
|
for box in boxes: |
|
|
confidence = box.conf[0] |
|
|
coordinates = box.xyxy[0] |
|
|
print(f"Unhealthy tree detected with {confidence:.2f} confidence") |
|
|
|
|
|
# Visualize results |
|
|
annotated_image = results[0].plot() |
|
|
cv2.imwrite('detection_result.jpg', annotated_image) |
|
|
``` |
|
|
|
|
|
### Advanced Usage |
|
|
|
|
|
```python |
|
|
# Custom inference settings |
|
|
results = model.predict( |
|
|
source='path/to/image.jpg', |
|
|
conf=0.25, # confidence threshold |
|
|
iou=0.45, # IoU threshold for NMS |
|
|
imgsz=640, # inference size |
|
|
save=True # save results |
|
|
) |
|
|
|
|
|
# Batch processing |
|
|
import glob |
|
|
image_paths = glob.glob('path/to/images/*.jpg') |
|
|
results = model(image_paths, batch=8) |
|
|
``` |
|
|
|
|
|
## Model Files |
|
|
|
|
|
- `best.pt`: Best model weights from training |
|
|
- `tree_disease_detector.pt`: Final saved model |
|
|
- `training_results.png`: Training curves and metrics |
|
|
|
|
|
## Limitations and Considerations |
|
|
|
|
|
1. The model is trained on UAV imagery at 640x640 resolution |
|
|
2. Optimized for detecting single class: "unhealthy" trees |
|
|
3. Performance may vary with different tree species or image conditions |
|
|
4. Best results with aerial/drone imagery similar to training data |
|
|
|
|
|
## Applications |
|
|
|
|
|
- **Precision Agriculture**: Early detection of diseased trees in orchards |
|
|
- **Forest Management**: Large-scale monitoring of forest health |
|
|
- **Environmental Monitoring**: Tracking disease spread patterns |
|
|
- **Research**: Studying tree disease progression and patterns |
|
|
|
|
|
## Citation |
|
|
|
|
|
If you use this model in your research, please cite: |
|
|
|
|
|
```bibtex |
|
|
@model{yolov8_tree_disease_2024, |
|
|
title={YOLOv8s Tree Disease Detection Model}, |
|
|
author={IsmatS}, |
|
|
year={2024}, |
|
|
publisher={HuggingFace}, |
|
|
url={https://huggingface.co/IsmatS/crop_desease_detection} |
|
|
} |
|
|
|
|
|
@dataset{pdt_dataset, |
|
|
title={PDT: UAV Pests and Diseases Tree Dataset}, |
|
|
author={Zhou et al.}, |
|
|
year={2024}, |
|
|
publisher={HuggingFace}, |
|
|
conference={ECCV 2024} |
|
|
} |
|
|
``` |
|
|
|
|
|
## License |
|
|
|
|
|
This model is released under the MIT License. |
|
|
|
|
|
## Acknowledgments |
|
|
|
|
|
- Dataset: [PDT Dataset](https://huggingface.co/datasets/qwer0213/PDT_dataset) by Zhou et al. |
|
|
- Framework: [Ultralytics YOLOv8](https://github.com/ultralytics/ultralytics) |
|
|
- Training performed on Google Colab with NVIDIA A100 GPU |
|
|
|
|
|
## Contact |
|
|
|
|
|
For questions or collaborations, please reach out through the HuggingFace repository discussions. |