-
Notifications
You must be signed in to change notification settings - Fork 7.2k
improve COCO prototype #4650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve COCO prototype #4650
Conversation
The new implementation is working, but is a major perf regression. Cold start now takes ~20 minutes on my system. With minmal fake data warm up is minimal, so I'm guessing one or more things I used in the implementation does not scale to more inputs. |
I've added COCO to the benchmarks. Running python -m torchvision.prototype.datasets.benchmark -n1 --no-start coco with the patch described in #4650 (comment) gives:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
), | ||
areas=torch.tensor([ann["area"] for ann in anns]), | ||
crowds=torch.tensor([ann["iscrowd"] for ann in anns], dtype=torch.bool), | ||
bounding_boxes=BoundingBox( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a future PR, I think it might be preferable to rename the class to BoundingBoxes
as we hold more than one box now.
segmentations=torch.stack( | ||
[ | ||
self._segmentation_to_mask(ann["segmentation"], is_crowd=ann["iscrowd"], image_size=image_size) | ||
for ann in anns | ||
] | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can even have a custom class that holds the raw polygons, and knows how to convert itself if needed. But can be discussed at a separate stage.
ONNX-test error seems suspicious, but probably unrelated. I'm merging this but let's keep an eye on it |
Summary: * improve COCO prototype * test 2017 annotations * add option to include captions * fix categories and add tests * cleanup * add correct image size to bounding boxes * fix annotation collation * appease mypy * add benchmark * always use image as reference * another refactor * add support for segmentations * add support for segmentations * fix CI dependencies Reviewed By: NicolasHug Differential Revision: D32759200 fbshipit-source-id: 9033e959a1014761541ec2959ec5647eaccf5d0a
This adds a few improvements:
Add the ability to select which annotations to load, e.g.
instances
(default) orcaptions
.None
is a special value that will only load the images which is much faster if the annotations are not needed. This is for example useful for unsupervised training.Provide categories for each bounding box.
Add tests.
Add support for segmentation masks. Now you can do something like this:
cc @pmeier @bjuncek