Update tasks/image.py
Browse files- tasks/image.py +3 -2
tasks/image.py
CHANGED
@@ -122,7 +122,7 @@ async def evaluate_image(request: ImageEvaluationRequest):
|
|
122 |
# Make prediction with model
|
123 |
image = example['image']
|
124 |
with torch.inference_mode():
|
125 |
-
pred = model(image)[0]
|
126 |
smoke_detected = pred.boxes.xywhn.shape[0] > 0
|
127 |
predictions.append(int(smoke_detected))
|
128 |
|
@@ -132,7 +132,8 @@ async def evaluate_image(request: ImageEvaluationRequest):
|
|
132 |
# Parse all true boxes from the annotation
|
133 |
image_true_boxes = parse_boxes(annotation)
|
134 |
true_boxes_list.append(image_true_boxes)
|
135 |
-
|
|
|
136 |
|
137 |
#--------------------------------------------------------------------------------------------
|
138 |
# YOUR MODEL INFERENCE STOPS HERE
|
|
|
122 |
# Make prediction with model
|
123 |
image = example['image']
|
124 |
with torch.inference_mode():
|
125 |
+
pred = model(image, conf=0.03)[0]
|
126 |
smoke_detected = pred.boxes.xywhn.shape[0] > 0
|
127 |
predictions.append(int(smoke_detected))
|
128 |
|
|
|
132 |
# Parse all true boxes from the annotation
|
133 |
image_true_boxes = parse_boxes(annotation)
|
134 |
true_boxes_list.append(image_true_boxes)
|
135 |
+
box_idx = pred.boxes.conf.argmax().item()
|
136 |
+
pred_boxes.append(pred.boxes.xywhn.tolist()[box_idx])
|
137 |
|
138 |
#--------------------------------------------------------------------------------------------
|
139 |
# YOUR MODEL INFERENCE STOPS HERE
|