ifnspaml / SGDepth

[ECCV 2020] Self-Supervised Monocular Depth Estimation: Solving the Dynamic Object Problem by Semantic Guidance
MIT License
200 stars 26 forks source link

Creating the necessary .json files for Mapillary dataset #13

Closed Ale0311 closed 3 years ago

Ale0311 commented 3 years ago

Hello!

I want to start by thanking you for all the help you already provided for me! 😊

So, I want to train the model on Mapillary dataset. These are the steps I made:

  1. Downloaded the Mapillary dataset and put in the Dataset folder. This is how it looks:

Screenshot 2021-02-26 at 19 49 51

  1. I tried to create the .json file using the filelist_creator.py script. However, I get this:

Screenshot 2021-02-26 at 19 51 26

Could you possibly provide the required files? And also, could you please tell me why the script is not working? Maybe it's the structure of the Mapillary folder.. Thanks again!

klingner commented 3 years ago

Hi again,

so I think the Script I provided is only compatible to an older version (v1.1) of the Mapillary dataset. I think when they provided a new version (presumably 2.0) they also changed the folder structure accordingly. So I think the easiest way would be, if you could download v1.1 or v1.2 of the dataset with the old folder structure.

If that is not an option, you should try to update the function create_mapillarylists() in the filelist_creator.py. There is a configuration given as:

        json_list = {
            'names': ['color', 'segmentation'],
            'types': ['.jpg', '.png'],
            'filters': ['ColorImage', 'Segmentation']
        }

The filters correspond to the folders in which the files are provided. You could try to change it to something such as

        json_list = {
            'names': ['color', 'segmentation'],
            'types': ['.jpg', '.png'],
            'filters': ['images', ['v1.2', 'labels']]
        }

to adapt to the new folder structure. I can't guarantee, however, that it works out of the box and I would double check that the correct image/label pairs are loaded, when setting this up.

For the v1.1 I could provide the precomputed files. They, however, rely on the old folder structure. I am not sure, is it still possible to download older versions of the Mapillary dataset?

Also, maybe the small advice to precompute the IDs to TrainIDs. Otherwise training takes a reaaaaalllllyyyy long time because of the additional classes present in the Mapillary dataset :)

Ale0311 commented 3 years ago

Hello,

Thank you for your response.

I am afraid that the old version of the dataset is no longer available. So I will try the second solution.

About precomputing the ID's to train IDs, what do you exactly mean by that? To eliminate redundancies from Mapillary IDs?

Thanks again.

klingner commented 3 years ago

As I am aware, the Mapillary dataset provides about 65 (IDs 0 to 65) classes, compared to the 30 classes (IDs from 0 to 30) from Cityscapes, which have to be mapped to the official subset of classes used Cityscapes training (train IDs 0 to 18). I am not 100% sure, if there is already an official mapping, but one possibility is defined here: https://github.com/ifnspaml/IFN_Dataloader/blob/master/dataloader/definitions/labels_file.py.

The more classes a dataset has, the longer does the conversion of IDs to trainIDs of the segmentation maps need during training, if it is not precomputed. As mapillary has more classes than Cityscapes, here this loading takes quite a while longer, which is why I usually precompute IDs (0 to 65) to trainIDs (0 to 18) on Mapillary.