-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Add cityscapes dataset #1037
Add cityscapes dataset #1037
Conversation
Nice work! Thanks for providing the results on cityscapes. It is okay to adopt multi-scale training since it is almost a convention for this dataset. We can retrain the model with 8 GPUs and compare with your single-gpu results (@yhcao6 please help to verify that). If you figure out the bug in the conversion script, welcome to fix & provide a copy in BTW, there are some linting errors, could you fix them? |
When retraining the model on 8 gpus you can use the learning rate from the config file, it is set for 8 gpus. I downscaled it by a factor of 8 (see the linear scaling rule pull request) for training on 1 gpu. The linting errors should be fixed. |
When I run the code, I met some problems, please have a look to see if there are something wrong.
|
@yhcao6 I think the first issue came up, because you changed the dataset handling in the meantime and I did not check the code again after merging. I added '@DATASETS.register_module' to the 'CityscapesDatasets' definition in the commit above. I think the second error is exactly what I hit too. Either the additional folders have to be added to the filepaths in the annotation or the files have to be extracted from the folders. I decided to do the ladder using 'cp' and some '*'s. However I forgot the exact command and have to try it out again. |
@yhcao6 the right command is: 'mv train/*/* train/'. I will try to look at the conversion scripts soon but am pretty busy the next two weeks. If it works with their scripts and the only thing you have to do is this file moving I can quickly write either a '.sh' function or add this into the conversion code. |
Report 8 gpu results here. I didn't change anything, but fix the dataset registry and move image. |
We can run it for 3 times and take the mid value. Then the model zoo can be updated. |
I ran the code three times, the fluctuation seems really large, |
I guess this is a result of the extremely small data set size (only 5000 images). Any suggestions how to handle this? Finetuning from a Coco checkpoint might reduce the fluctuations (and should result in better performance) but I did not have time yet to implement this. |
I add benchmark for these two models. Please have a look to see if there is any problem. |
configs/cityscapes/README.md
Outdated
|
||
## Environment | ||
|
||
### Hardware |
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.
This may be removed since we tested different hardwares and the performances are comparable.
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.
Agreed
configs/cityscapes/README.md
Outdated
|
||
## Common settings | ||
|
||
- All baselines were trained using 1 GPU with a batch size of 2 (2 images per GPU) using the [linear scaling rule](https://arxiv.org/abs/1706.02677) to scale the learning rate. The learning rate in the configs is set for a batch size of 16 to match the default of the coco models. |
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.
8 GPUs now.
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.
Can you just add in your setup descriptions?
configs/cityscapes/README.md
Outdated
|
||
| Backbone | Style | Lr schd | Scale | Pretraining | Mem (GB) | Train time (s/iter) | Inf time (fps) | box AP | mask AP | Download | | ||
| :-------------: | :-----: | :-----: | :---: | :---------: | :----: | :----: | :----: | :----: | :-----: | :------: | | ||
| R-50-FPN | pytorch | 1x | 800-1024 | Backbone | 4.9 | 0.609 | 2.5 | 37.4 | 32.5 | [model](https://open-mmlab.s3.ap-northeast-2.amazonaws.com/mmdetection/models/cityscapes/mask_rcnn_r50_fpn_1x_city_20190727-9b3c56a5.pth) | |
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.
The inference time seems abnormal.
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.
Just caused by the image resolution.
configs/cityscapes/README.md
Outdated
|
||
| Backbone | Style | Lr schd | Scale | Pretraining | Mem (GB) | Train time (s/iter) | Inf time (fps) | box AP | Download | | ||
| :-------------: | :-----: | :-----: | :---: | :---------: | :----: | :----: | :----: | :----: | :------: | | ||
| R-50-FPN | pytorch | 1x | 800-1024 | Backbone | 4.9 | 0.345 | 8.8 | 36.0 | [model](https://open-mmlab.s3.ap-northeast-2.amazonaws.com/mmdetection/models/cityscapes/faster_rcnn_r50_fpn_1x_city_20190727-7b9c0534.pth) | |
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.
Better to use Y/N for pretraining.
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.
I was trying to specify wether we used coco pretraining. Probably we should just remove this field until we have coco pretrained models and mention somewhere else, that we trained from scratch.
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 just remove this column. In this repo, pretraining usually means using the pretrained model from ImageNet and scratch means no pretrained weights for backbones. If we further add models pretrained from COCO and finetuned on CityScapes, we need to clearly indicate that.
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. Let's think about that once we have the finetuned models.
@michaelisc Let me know if you have any other comments? This PR looks good to me. |
@yhcao6 did you end up moving all images into one folder or change the annotations to go thorough the foilders? I think we should mention this processing step somewhere. Apart from that it looks good to me! |
INSTALL.md
Outdated
│ ├── VOCdevkit | ||
│ │ ├── VOC2007 | ||
│ │ ├── VOC2012 | ||
|
||
``` | ||
The cityscapes annotations have to be converted into the coco format using the [cityscapesScripts](https://github.com/mcordts/cityscapesScripts) toolbox. | ||
We plan to provide an easy to use conversion script. For the moment we recommend following the instructions provided in the | ||
[maskrcnn-benchmark](https://github.com/facebookresearch/maskrcnn-benchmark/tree/master/maskrcnn_benchmark/data) toolbox. |
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.
@yhcao6 I think this is where the description about the file handling would have to go.
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.
I just move all images into one folder. You can add it into readme.
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.
Done!
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.
Looks fine to me
Update information how to arrange cityscapes data.
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.
Everything should be fine now.
Ah, I found something I missed. I don't think I have added cityscapes to |
It will not affect the training and testing, since the class labels are now obtained from the dataset itself. It may be useful for users who want to do something else though. |
That's why I did not bump into this earlier. I only ran into it when trying to visualize the results of a different dataset. |
Yep, so you can add it for potential usage, and I will merge this PR. |
Added the class names. From my side this is ready to be merged. |
* added cityscapes * updated configs * removed wip configs * Add initial dataset instructions * Add cityscapes readme * Add explanation for lr scaling * Ensure pep8 conformity * Add CityscapesDataset to the registry * add benchmark * rename config, modify README.md * fix typo * fix typo in config * modify INSTALL.md Update information how to arrange cityscapes data. * Add cityscapes class names
However, I think your mAP in coco protocol is not in conformity with the protocol of cityscapes evaluation https://github.com/mcordts/cityscapesScripts .Although your mAP is higher than the original MASK RCNN paper, it may be pseudomorph. I have trained cityscapes(only fine) using your code and even get 43.0 mask mAP in val-set in coco protocol, but it is only 30.6 when evaluate the val-set with cityscapesScripts,and only 27.3 on the leaderboard(test-set) of cityscapes. And could you provide your instancesonly_filtered_gtFine_val.json and instancesonly_filtered_gtFine_train.json? Thanks. I follow the maskrcnn-benchmark and get jsons, but when testing your trained model(https://open-mmlab.s3.ap-northeast-2.amazonaws.com/mmdetection/models/cityscapes/mask_rcnn_r50_fpn_1x_city_20190727-9b3c56a5.pth), I onlt get only 23.9 bbox mAP and 19.9 mask mAP in coco protocol. |
Hi! I am trying to train on the Cityscapes dataset as well. I seem to be running into a similar error: FileNotFoundError: img file does not exist: /home/Cityscapes/gtFine_trainvaltest/gtFine/train/bochum_000000_037223_leftImg8bit.png When I checked I found that I did not have a single image with a suffix The error seems to be originating because the image['file_name'] = filename[:-len(
ends_in % data_set.split('_')[0])] + 'leftImg8bit.png' but never writes an image under that name. Please let me know where I'm going wrong. Thanks! |
Never mind. I downloaded the |
* added cityscapes * updated configs * removed wip configs * Add initial dataset instructions * Add cityscapes readme * Add explanation for lr scaling * Ensure pep8 conformity * Add CityscapesDataset to the registry * add benchmark * rename config, modify README.md * fix typo * fix typo in config * modify INSTALL.md Update information how to arrange cityscapes data. * Add cityscapes class names
…AT, XGB (open-mmlab#1037) * Tabular: Added support for specifying early stopping rounds in GBM, CAT, XGB * addressed comment
Dataset class and config files for cityscapes.
Annotation format:
The annotations have to be converted into the coco format following the example of maskrcnn-benchmark. The results are evaluated using the pycocotools.
Current status: working
The configs and dataset class are final and working. The results in config/cityscapes/README.md are reproducible and I am happy to provide the checkpoints.
Open points: