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

Update tasks/image.py

Browse files
Files changed (1) hide show
  1. tasks/image.py +5 -8
tasks/image.py CHANGED
@@ -107,9 +107,8 @@ async def evaluate_image(request: ImageEvaluationRequest):
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()
@@ -139,15 +138,13 @@ async def evaluate_image(request: ImageEvaluationRequest):
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 = []
148
  filtered_pred_boxes = []
149
 
150
-
151
  for true_boxes, pred_boxes_entry in zip(true_boxes_list, pred_boxes):
152
  if true_boxes and pred_boxes_entry: # Keep only if neither is empty
153
  filtered_true_boxes_list.append(true_boxes)
@@ -198,5 +195,5 @@ async def evaluate_image(request: ImageEvaluationRequest):
198
  "test_seed": request.test_seed
199
  }
200
  }
201
-
202
  return results
 
107
  pred_boxes = [] # Flattened list of predicted boxes
108
  true_boxes_list = [] # Flattened list of ground truth boxes
109
 
110
+ print('Start of prediction...')
111
  for example in test_dataset:
 
112
  # Extract image and annotations
113
  image = example["image"]
114
  annotation = example.get("annotations", "").strip()
 
138
  else:
139
  predictions.append(0) # No smoke predicted
140
  pred_boxes.append([]) # Add empty list if no prediction
141
+
142
+ print('Prediction done.')
 
 
143
  # Filter out entries with empty boxes
144
  filtered_true_boxes_list = []
145
  filtered_pred_boxes = []
146
 
147
+ print('Box analysis...')
148
  for true_boxes, pred_boxes_entry in zip(true_boxes_list, pred_boxes):
149
  if true_boxes and pred_boxes_entry: # Keep only if neither is empty
150
  filtered_true_boxes_list.append(true_boxes)
 
195
  "test_seed": request.test_seed
196
  }
197
  }
198
+ print(results)
199
  return results