tom-b974 commited on
Commit
41e94b4
·
verified ·
1 Parent(s): 758b73a

Update tasks/image.py

Browse files
Files changed (1) hide show
  1. tasks/image.py +7 -3
tasks/image.py CHANGED
@@ -106,8 +106,10 @@ async def evaluate_image(request: ImageEvaluationRequest):
106
  true_labels = []
107
  pred_boxes = [] # Flattened list of predicted boxes
108
  true_boxes_list = [] # Flattened list of ground truth boxes
109
-
 
110
  for example in test_dataset:
 
111
  # Extract image and annotations
112
  image = example["image"]
113
  annotation = example.get("annotations", "").strip()
@@ -127,7 +129,7 @@ async def evaluate_image(request: ImageEvaluationRequest):
127
  true_boxes_list.append([]) # Add empty list for no ground truth smoke
128
 
129
  # Perform YOLO inference
130
- results = yolo_model .predict(image, verbose=False)
131
 
132
  # Extract predicted box if predictions exist
133
  if len(results[0].boxes):
@@ -137,7 +139,9 @@ async def evaluate_image(request: ImageEvaluationRequest):
137
  else:
138
  predictions.append(0) # No smoke predicted
139
  pred_boxes.append([]) # Add empty list if no prediction
140
-
 
 
141
 
142
  # Filter out entries with empty boxes
143
  filtered_true_boxes_list = []
 
106
  true_labels = []
107
  pred_boxes = [] # Flattened list of predicted boxes
108
  true_boxes_list = [] # Flattened list of ground truth boxes
109
+
110
+ i=0
111
  for example in test_dataset:
112
+ i += 1
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)
133
 
134
  # Extract predicted box if predictions exist
135
  if len(results[0].boxes):
 
139
  else:
140
  predictions.append(0) # No smoke predicted
141
  pred_boxes.append([]) # Add empty list if no prediction
142
+ if i >=10:
143
+ print("fini")
144
+ break
145
 
146
  # Filter out entries with empty boxes
147
  filtered_true_boxes_list = []