davanstrien HF Staff commited on
Commit
6ba36e4
·
1 Parent(s): a9a3a95

Convert boxes and scores to float32 before numpy conversion in process_batch for compatibility

Browse files
Files changed (1) hide show
  1. detect-objects.py +5 -1
detect-objects.py CHANGED
@@ -277,7 +277,11 @@ def process_batch(
277
  image_categories = []
278
  image_scores = []
279
 
280
- for box, score in zip(boxes.cpu().numpy(), scores.cpu().numpy()):
 
 
 
 
281
  x1, y1, x2, y2 = box
282
  width = x2 - x1
283
  height = y2 - y1
 
277
  image_categories = []
278
  image_scores = []
279
 
280
+ # Convert to float32 before numpy (bfloat16 not supported by numpy)
281
+ boxes_np = boxes.cpu().float().numpy()
282
+ scores_np = scores.cpu().float().numpy()
283
+
284
+ for box, score in zip(boxes_np, scores_np):
285
  x1, y1, x2, y2 = box
286
  width = x2 - x1
287
  height = y2 - y1