Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Cityscapes to COCO inefficiency #466

Open
botcs opened this issue Feb 19, 2019 · 3 comments
Open

Cityscapes to COCO inefficiency #466

botcs opened this issue Feb 19, 2019 · 3 comments
Labels

Comments

@botcs
Copy link
Contributor

botcs commented Feb 19, 2019

I was looking into tools/cityscapes/convert_cityscapes_to_coco.py implementation, and found out that in L167 it is loading a json of already computed polygons to read the metadata and find the binary mask of the corresponding entry to convert them to polygons AGAIN, in tools/cityscapes/instances2dict_with_polygons.py.

Why is it necessary to recompute the polygons?

@fmassa
Copy link
Contributor

fmassa commented Feb 20, 2019

To be frank, I don't know.

That file was taken as is from Detectron in #232 by @henrywang1 , and I didn't actually reviewed that part of the PR, given that it was taken from Detectron.

If you see optimization opportunities there, feel free to send a PR!

@fmassa fmassa added enhancement New feature or request contributions welcome labels Feb 20, 2019
@akshitac8
Copy link

Hello @botcs as I understood from the code it is used to read the height and width of the image. You can replace that step by cv2.imread or lycon.load to get the height and width of the desired image.
Hope this helps 🙂

@botcs
Copy link
Contributor Author

botcs commented Feb 20, 2019

I am currently refactoring the structures/segmentation_mask.py and once it is done, it should be a choice whether the user wants to use the binary masks or the polygons from CityScapes.

If you see optimization opportunities there, feel free to send a PR!

Let me clarify: we download the masks and polygons both with the original dataset - and then we take the masks to generate polygons again. One possibility for this could be that this was some legacy code, maybe the polygon annotation feature was just added later. But that would contradict that the author of this piece of code already knew about the polygon annotation since it reads in the whole file just to check the width and height of the image. Thankfully this stuff goes offline but still its existence is intimidating

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants