Spaces:
Sleeping
Sleeping
Update tasks/image.py
Browse files- tasks/image.py +3 -2
tasks/image.py
CHANGED
@@ -5,6 +5,7 @@ import numpy as np
|
|
5 |
from sklearn.metrics import accuracy_score
|
6 |
import random
|
7 |
import os
|
|
|
8 |
|
9 |
from ultralytics import YOLO # Import YOLO
|
10 |
from .utils.evaluation import ImageEvaluationRequest
|
@@ -108,7 +109,7 @@ async def evaluate_image(request: ImageEvaluationRequest):
|
|
108 |
true_boxes_list = [] # Flattened list of ground truth boxes
|
109 |
|
110 |
|
111 |
-
for example in test_dataset
|
112 |
# Extract image and annotations
|
113 |
image = example["image"]
|
114 |
annotation = example.get("annotations", "").strip()
|
@@ -128,7 +129,7 @@ async def evaluate_image(request: ImageEvaluationRequest):
|
|
128 |
true_boxes_list.append([]) # Add empty list for no ground truth smoke
|
129 |
|
130 |
# Perform YOLO inference
|
131 |
-
results = yolo_model .predict(image)
|
132 |
|
133 |
# Extract predicted box if predictions exist
|
134 |
if len(results[0].boxes):
|
|
|
5 |
from sklearn.metrics import accuracy_score
|
6 |
import random
|
7 |
import os
|
8 |
+
from tqdm import tqdm
|
9 |
|
10 |
from ultralytics import YOLO # Import YOLO
|
11 |
from .utils.evaluation import ImageEvaluationRequest
|
|
|
109 |
true_boxes_list = [] # Flattened list of ground truth boxes
|
110 |
|
111 |
|
112 |
+
for example in tqdm(test_dataset, desc="Processing test dataset")
|
113 |
# Extract image and annotations
|
114 |
image = example["image"]
|
115 |
annotation = example.get("annotations", "").strip()
|
|
|
129 |
true_boxes_list.append([]) # Add empty list for no ground truth smoke
|
130 |
|
131 |
# Perform YOLO inference
|
132 |
+
results = yolo_model .predict(image, verbose=False)
|
133 |
|
134 |
# Extract predicted box if predictions exist
|
135 |
if len(results[0].boxes):
|