This commit is contained in:
Glenn Jocher 2019-04-22 16:53:42 +02:00
parent 5f69861958
commit eb4acecbb5
1 changed files with 1 additions and 1 deletions

View File

@ -93,7 +93,7 @@ def test(
# [{"image_id": 42, "category_id": 18, "bbox": [258.15, 41.29, 348.26, 243.78], "score": 0.236}, ... # [{"image_id": 42, "category_id": 18, "bbox": [258.15, 41.29, 348.26, 243.78], "score": 0.236}, ...
image_id = int(Path(paths[si]).stem.split('_')[-1]) image_id = int(Path(paths[si]).stem.split('_')[-1])
box = pred[:, :4].clone() # xyxy box = pred[:, :4].clone() # xyxy
scale_coords(imgs[si].shape, box, shapes[si]) # to original shape scale_coords(imgs[si].shape[1:], box, shapes[si]) # to original shape
box = xyxy2xywh(box) # xywh box = xyxy2xywh(box) # xywh
box[:, :2] -= box[:, 2:] / 2 # xy center to top-left corner box[:, :2] -= box[:, 2:] / 2 # xy center to top-left corner
for di, d in enumerate(pred): for di, d in enumerate(pred):