Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
-
Based on your excellent training results, here's a comprehensive README.md file for your Hugging Face model repository:
|
| 2 |
-
|
| 3 |
```markdown
|
| 4 |
---
|
| 5 |
license: mit
|
|
|
|
|
|
|
| 6 |
tags:
|
| 7 |
- object-detection
|
| 8 |
- yolov8
|
|
@@ -10,16 +10,18 @@ tags:
|
|
| 10 |
- agriculture
|
| 11 |
- computer-vision
|
| 12 |
- pytorch
|
|
|
|
| 13 |
library_name: ultralytics
|
|
|
|
| 14 |
datasets:
|
| 15 |
- qwer0213/PDT_dataset
|
| 16 |
metrics:
|
| 17 |
- mAP50
|
| 18 |
- mAP50-95
|
| 19 |
-
-
|
| 20 |
-
-
|
| 21 |
model-index:
|
| 22 |
-
- name:
|
| 23 |
results:
|
| 24 |
- task:
|
| 25 |
type: object-detection
|
|
@@ -28,18 +30,22 @@ model-index:
|
|
| 28 |
name: PDT Dataset
|
| 29 |
type: qwer0213/PDT_dataset
|
| 30 |
metrics:
|
| 31 |
-
- type:
|
| 32 |
value: 0.933
|
| 33 |
name: mAP50
|
| 34 |
-
- type:
|
| 35 |
value: 0.659
|
| 36 |
-
name: mAP50-95
|
| 37 |
- type: precision
|
| 38 |
value: 0.878
|
| 39 |
name: Precision
|
| 40 |
- type: recall
|
| 41 |
value: 0.863
|
| 42 |
name: Recall
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
---
|
| 44 |
|
| 45 |
# YOLOv8s Tree Disease Detection Model
|
|
@@ -197,90 +203,4 @@ This model is released under the MIT License.
|
|
| 197 |
## Contact
|
| 198 |
|
| 199 |
For questions or collaborations, please reach out through the HuggingFace repository discussions.
|
| 200 |
-
```
|
| 201 |
-
|
| 202 |
-
You can also create additional files for your repository:
|
| 203 |
-
|
| 204 |
-
### `config.yaml`:
|
| 205 |
-
```yaml
|
| 206 |
-
# Model Configuration
|
| 207 |
-
|
| 208 |
-
# Model info
|
| 209 |
-
model_type: yolov8s
|
| 210 |
-
task: object-detection
|
| 211 |
-
architecture: YOLOv8s
|
| 212 |
-
|
| 213 |
-
# Classes
|
| 214 |
-
nc: 1 # number of classes
|
| 215 |
-
names: ['unhealthy'] # class names
|
| 216 |
-
|
| 217 |
-
# Input
|
| 218 |
-
imgsz: 640 # inference image size
|
| 219 |
-
|
| 220 |
-
# Inference settings
|
| 221 |
-
conf: 0.25 # confidence threshold
|
| 222 |
-
iou: 0.45 # IoU threshold for NMS
|
| 223 |
-
max_det: 300 # maximum detections per image
|
| 224 |
-
|
| 225 |
-
# Device
|
| 226 |
-
device: 0 # cuda device, i.e. 0 or cpu
|
| 227 |
-
```
|
| 228 |
-
|
| 229 |
-
### `requirements.txt`:
|
| 230 |
-
```
|
| 231 |
-
ultralytics>=8.3.0
|
| 232 |
-
torch>=2.0.0
|
| 233 |
-
opencv-python>=4.8.0
|
| 234 |
-
pillow>=10.0.0
|
| 235 |
-
matplotlib>=3.7.0
|
| 236 |
-
```
|
| 237 |
-
|
| 238 |
-
### `example.py`:
|
| 239 |
-
```python
|
| 240 |
-
# Example usage of the Tree Disease Detection model
|
| 241 |
-
|
| 242 |
-
from ultralytics import YOLO
|
| 243 |
-
import cv2
|
| 244 |
-
import matplotlib.pyplot as plt
|
| 245 |
-
|
| 246 |
-
# Load the model
|
| 247 |
-
model = YOLO('best.pt')
|
| 248 |
-
|
| 249 |
-
# Example inference on a single image
|
| 250 |
-
def detect_tree_disease(image_path):
|
| 251 |
-
# Run inference
|
| 252 |
-
results = model(image_path)
|
| 253 |
-
|
| 254 |
-
# Extract results
|
| 255 |
-
detections = []
|
| 256 |
-
for result in results:
|
| 257 |
-
boxes = result.boxes
|
| 258 |
-
if boxes is not None:
|
| 259 |
-
for box in boxes:
|
| 260 |
-
detection = {
|
| 261 |
-
'confidence': float(box.conf[0]),
|
| 262 |
-
'bbox': box.xyxy[0].tolist(),
|
| 263 |
-
'class': 'unhealthy'
|
| 264 |
-
}
|
| 265 |
-
detections.append(detection)
|
| 266 |
-
|
| 267 |
-
# Visualize
|
| 268 |
-
annotated_img = results[0].plot()
|
| 269 |
-
plt.figure(figsize=(12, 8))
|
| 270 |
-
plt.imshow(cv2.cvtColor(annotated_img, cv2.COLOR_BGR2RGB))
|
| 271 |
-
plt.axis('off')
|
| 272 |
-
plt.title(f'Detected {len(detections)} unhealthy tree(s)')
|
| 273 |
-
plt.show()
|
| 274 |
-
|
| 275 |
-
return detections
|
| 276 |
-
|
| 277 |
-
# Example usage
|
| 278 |
-
if __name__ == "__main__":
|
| 279 |
-
# Replace with your image path
|
| 280 |
-
image_path = 'sample_tree_image.jpg'
|
| 281 |
-
detections = detect_tree_disease(image_path)
|
| 282 |
-
|
| 283 |
-
print(f"Found {len(detections)} unhealthy trees")
|
| 284 |
-
for i, det in enumerate(detections):
|
| 285 |
-
print(f"Detection {i+1}: Confidence={det['confidence']:.2f}")
|
| 286 |
```
|
|
|
|
|
|
|
|
|
|
| 1 |
```markdown
|
| 2 |
---
|
| 3 |
license: mit
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
tags:
|
| 7 |
- object-detection
|
| 8 |
- yolov8
|
|
|
|
| 10 |
- agriculture
|
| 11 |
- computer-vision
|
| 12 |
- pytorch
|
| 13 |
+
- ultralytics
|
| 14 |
library_name: ultralytics
|
| 15 |
+
pipeline_tag: object-detection
|
| 16 |
datasets:
|
| 17 |
- qwer0213/PDT_dataset
|
| 18 |
metrics:
|
| 19 |
- mAP50
|
| 20 |
- mAP50-95
|
| 21 |
+
- precision
|
| 22 |
+
- recall
|
| 23 |
model-index:
|
| 24 |
+
- name: crop_desease_detection
|
| 25 |
results:
|
| 26 |
- task:
|
| 27 |
type: object-detection
|
|
|
|
| 30 |
name: PDT Dataset
|
| 31 |
type: qwer0213/PDT_dataset
|
| 32 |
metrics:
|
| 33 |
+
- type: map
|
| 34 |
value: 0.933
|
| 35 |
name: mAP50
|
| 36 |
+
- type: map
|
| 37 |
value: 0.659
|
| 38 |
+
name: mAP50-95
|
| 39 |
- type: precision
|
| 40 |
value: 0.878
|
| 41 |
name: Precision
|
| 42 |
- type: recall
|
| 43 |
value: 0.863
|
| 44 |
name: Recall
|
| 45 |
+
inference: true
|
| 46 |
+
widget:
|
| 47 |
+
- src: https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/example_image.jpg
|
| 48 |
+
example_title: Example Tree Image
|
| 49 |
---
|
| 50 |
|
| 51 |
# YOLOv8s Tree Disease Detection Model
|
|
|
|
| 203 |
## Contact
|
| 204 |
|
| 205 |
For questions or collaborations, please reach out through the HuggingFace repository discussions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
```
|