rsortino commited on
Commit
73dbea8
·
verified ·
1 Parent(s): 3bd3e75

Update tasks/image.py

Browse files
Files changed (1) hide show
  1. 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
- pred_boxes.append(pred.boxes.xywhn.tolist()[0])
 
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