Spaces:
Running
Running
Martin Tomov
commited on
Commit
β’
d6ab23b
1
Parent(s):
96805b8
Update yolo_utils.py
Browse files- yolo_utils.py +2 -4
yolo_utils.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
import spaces
|
2 |
from ultralytics import YOLO
|
3 |
import torch
|
4 |
import numpy as np
|
@@ -8,12 +7,11 @@ from huggingface_hub import hf_hub_download
|
|
8 |
REPO_ID = "idml/Yolov8_InsectDetect"
|
9 |
FILENAME = "insectYolo.pt"
|
10 |
|
|
|
11 |
# Ensure you have the model file
|
12 |
model = YOLO(hf_hub_download(repo_id=REPO_ID, filename=FILENAME))
|
13 |
-
|
14 |
-
@spaces.GPU
|
15 |
def yolo_processimage(image):
|
16 |
results = model(source=image,
|
17 |
-
|
18 |
rgb_image = cv2.cvtColor(results[0].plot(), cv2.COLOR_BGR2RGB)
|
19 |
return rgb_image
|
|
|
|
|
1 |
from ultralytics import YOLO
|
2 |
import torch
|
3 |
import numpy as np
|
|
|
7 |
REPO_ID = "idml/Yolov8_InsectDetect"
|
8 |
FILENAME = "insectYolo.pt"
|
9 |
|
10 |
+
|
11 |
# Ensure you have the model file
|
12 |
model = YOLO(hf_hub_download(repo_id=REPO_ID, filename=FILENAME))
|
|
|
|
|
13 |
def yolo_processimage(image):
|
14 |
results = model(source=image,
|
15 |
+
conf=0.2, device='cpu')
|
16 |
rgb_image = cv2.cvtColor(results[0].plot(), cv2.COLOR_BGR2RGB)
|
17 |
return rgb_image
|