Spaces:
Sleeping
Sleeping
Initial commit
Browse files
main.py
CHANGED
@@ -9,7 +9,7 @@ import supervision as sv
|
|
9 |
from ultralytics import YOLO
|
10 |
|
11 |
app = FastAPI()
|
12 |
-
model = YOLO("models/
|
13 |
|
14 |
|
15 |
def parse_detection(detections):
|
@@ -56,7 +56,7 @@ def infer(image):
|
|
56 |
image_arr = np.frombuffer(image, np.uint8)
|
57 |
image = cv2.imdecode(image_arr, cv2.IMREAD_COLOR)
|
58 |
image = cv2.resize(image, (640, 640))
|
59 |
-
results = model(image)[0]
|
60 |
width, height = results.orig_shape[1], results.orig_shape[0]
|
61 |
print(results.speed)
|
62 |
detections = sv.Detections.from_ultralytics(results)
|
|
|
9 |
from ultralytics import YOLO
|
10 |
|
11 |
app = FastAPI()
|
12 |
+
model = YOLO("models/best_v2.pt", task="detect")
|
13 |
|
14 |
|
15 |
def parse_detection(detections):
|
|
|
56 |
image_arr = np.frombuffer(image, np.uint8)
|
57 |
image = cv2.imdecode(image_arr, cv2.IMREAD_COLOR)
|
58 |
image = cv2.resize(image, (640, 640))
|
59 |
+
results = model(image, conf=0.6, iou=0.25, imgsz=640)[0]
|
60 |
width, height = results.orig_shape[1], results.orig_shape[0]
|
61 |
print(results.speed)
|
62 |
detections = sv.Detections.from_ultralytics(results)
|