Closed noreen-walker closed 11 months ago
Thanks for the fix. Can confirm after copy code works perfectly.
Inplace bboxes update was fixed in the method convert_to_coco_api
by https://github.com/pytorch/vision/pull/5289
Now it does:
https://github.com/pytorch/vision/blob/c35d3855ccbfa6a36e6ae6337a1f2c721c1f1e78/references/detection/coco_utils.py#L138-L139
so, technically there is no need to copy boxes in the user code.
Let's close this issue as solved, feel free to open a new issue if any related problem appear.
🐛 Describe the bug
I'm following the object detection tutorial here which uses the coco evaluation metrics.
It uses
convert_to_coco_api
in https://github.com/pytorch/vision/blob/main/references/detection/coco_utils.py to convert a dataset to coco format.But when the bounding boxes are preloaded into memory in a dataset (i.e. not generated on the fly like in the tutorial) this conversion changes them in place. So the dataset gets modified unexpectedly. I think it happens here :
bboxes[:, 2:] -= bboxes[:, :2]
and could be fixed by doing a copy first.Versions
not applicable