File size: 5,286 Bytes
8cfab0d
 
14f405d
 
8cfab0d
 
 
 
 
 
 
14f405d
8cfab0d
14f405d
8cfab0d
 
 
 
 
14f405d
 
8cfab0d
14f405d
8cfab0d
 
 
 
 
 
 
 
14f405d
8cfab0d
 
14f405d
8cfab0d
14f405d
8cfab0d
 
 
 
 
 
14f405d
d7a6818
 
14f405d
d7a6818
 
8cfab0d
 
 
 
d7a6818
 
8cfab0d
 
d7a6818
 
 
 
 
 
 
 
8cfab0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d17dfd5
8cfab0d
d17dfd5
8cfab0d
d17dfd5
8cfab0d
 
d17dfd5
8cfab0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d17dfd5
8cfab0d
d17dfd5
8cfab0d
 
 
 
 
 
 
 
 
 
 
 
 
 
d17dfd5
 
8cfab0d
d17dfd5
8cfab0d
 
 
d17dfd5
8cfab0d
d17dfd5
8cfab0d
 
 
 
d17dfd5
8cfab0d
d17dfd5
8cfab0d
 
 
 
d17dfd5
8cfab0d
d17dfd5
8cfab0d
d17dfd5
8cfab0d
 
 
 
 
 
 
 
d17dfd5
8cfab0d
 
 
 
 
 
 
d17dfd5
 
8cfab0d
d17dfd5
8cfab0d
d17dfd5
8cfab0d
d17dfd5
8cfab0d
 
 
d17dfd5
8cfab0d
d17dfd5
22038ab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
---
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.