Skip to content
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

reimplement cityscapes #2089

Merged
merged 23 commits into from
Mar 1, 2020
Merged

reimplement cityscapes #2089

merged 23 commits into from
Mar 1, 2020

Conversation

xvjiarui
Copy link
Collaborator

@xvjiarui xvjiarui commented Feb 12, 2020

This PR reimplemented Cityscapes dataset support.

  1. Add script to easily convert original cityscapes dataset into coco json format.
  2. Evaluate results with Cityscapes official API.

@hellock hellock requested a review from ZwwWayne February 12, 2020 15:58
Copy link
Collaborator

@ZwwWayne ZwwWayne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
In faster rcnn config, the type should change back to faster rcnn. Otherwise, it will cause error due to the lack of mask_head config.

image
The doc may indicate the users that it uses pre-trained models that need to be download from the remote servers thus the users can decide whether to download it before training or leave it for training. This might cause errors due to network or some other issues if the download is proceded in training.

Copy link
Collaborator

@ZwwWayne ZwwWayne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
Change the type back to FasterRCNN. Otherwise, it will cause bug due to the lack of config of mask_head.

image
The doc may indicate current configs use pre-trained models and need to download from the remote server first. Sometimes the download process might cause errors at the beginning of the training.

Copy link
Collaborator

@ZwwWayne ZwwWayne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
During implementation, I found that [7] yields better performance, maybe we can change it to [7] for higher performance and better practice.

@Liyw979
Copy link

Liyw979 commented Feb 25, 2020

I don't think it a good idea to read Read original Cityscapes dataset annotation since it's very slow compared to using genertated coco format annotation(about 5s).
Fewer launch time is quiet important when implementing new model, during which developers frequently run trainning to see if all the tensor shapes all matched.

@xvjiarui
Copy link
Collaborator Author

I don't think it a good idea to read Read original Cityscapes dataset annotation since it's very slow compared to using genertated coco format annotation(about 5s).
Fewer launch time is quiet important when implementing new model, during which developers frequently run trainning to see if all the tensor shapes all matched.

Thanks for your valuable advice.

Actually, I just updated the comment of this PR. A user-friendly convert script is provided to generate COCO style annotations. You could check it out here. It would be merged into master recently.

Btw, if there is any issue about this PR, you are very welcomed to point it out or make a PR in the future.

@Liyw979
Copy link

Liyw979 commented Feb 25, 2020

Nice! Looking forward to the new implementation:)

"""
The correct CLASSES order in official cityscapes should be
CLASSES = ('person', 'rider', 'car', 'truck', 'bus', 'train', 'motorcycle',
'bicycle')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment can be removed.

gt_dir = osp.join(cityscapes_path, args.gt_dir)

set_name = dict(
train='instance_train_gtFine.json',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may also use instancesonly_filtered_gtFine_xxx.json

results,
metric='bbox',
logger=None,
jsonfile_prefix=None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe renamed to outfile_prefix since the output file may be a json or txt.

"""
eval_results = dict()

metrics = metric if isinstance(metric, list) else [metric]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy it if it is a list, because we remove cityscapes from the list.


def parse_args():
parser = argparse.ArgumentParser(
description='Convert Cityscapes annotations to mmdetection format')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to COCO format



### Faster R-CNN

| Backbone | Style | Lr schd | Scale | Mem (GB) | Train time (s/iter) | Inf time (fps) | box AP | Download |
| :-------------: | :-----: | :-----: | :---: | :------: | :-----------------: | :------------: | :----: | :------: |
| R-50-FPN | pytorch | 1x | 800-1024 | 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) |
| R-50-FPN | pytorch | 1x | 800-1024 | 4.9 | 0.345 | 8.8 | 41.6 | [model](https://open-mmlab.s3.ap-northeast-2.amazonaws.com/mmdetection/models/cityscapes/faster_rcnn_r50_fpn_1x_cityscapes_20200227-362cfbbf.pth) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Train time and Inf time are outdated.

@@ -1,7 +1,7 @@
# model settings
model = dict(
type='FasterRCNN',
pretrained='modelzoo://resnet50',
pretrained='torchvision://resnet50',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have specified load_from, pretrained can be left None.

@hellock hellock merged commit e27046d into open-mmlab:master Mar 1, 2020
@Liyw979
Copy link

Liyw979 commented Mar 3, 2020

The tools/test.py is running on the test set by default.
image

test=dict(
type=dataset_type,
ann_file=data_root +
'annotations/instancesonly_filtered_gtFine_test.json',
img_prefix=data_root + 'leftImg8bit/test/',
pipeline=test_pipeline))

Should it be changed to val?

@xvjiarui
Copy link
Collaborator Author

xvjiarui commented Mar 3, 2020

The tools/test.py is running on the test set by default.
image

test=dict(
type=dataset_type,
ann_file=data_root +
'annotations/instancesonly_filtered_gtFine_test.json',
img_prefix=data_root + 'leftImg8bit/test/',
pipeline=test_pipeline))

Should it be changed to val?

We usually submit test set results of Cityscapes instance segmentation. You could change it to val set in your program if needed.

ioir123ju pushed a commit to ioir123ju/mmdetection that referenced this pull request Mar 30, 2020
* reimplement cityscapes

* fixed gt bbox mode

* convert cityscapes to coco style, add cityscapes eval

* add cityscapes convert script

* add doc

* Update INSTALL.md

* Update INSTALL.md

* update fater rcnn

* fix cityscapes eval

* support format only in cityscapes

* add docs

* remove redundancy

* resolve eval

* update cityscapes md

* more doc and rename

* update doc and cfg

* change to test set
mike112223 pushed a commit to mike112223/mmdetection that referenced this pull request Aug 25, 2020
* reimplement cityscapes

* fixed gt bbox mode

* convert cityscapes to coco style, add cityscapes eval

* add cityscapes convert script

* add doc

* Update INSTALL.md

* Update INSTALL.md

* update fater rcnn

* fix cityscapes eval

* support format only in cityscapes

* add docs

* remove redundancy

* resolve eval

* update cityscapes md

* more doc and rename

* update doc and cfg

* change to test set
jben-hun pushed a commit to jben-hun/mmdetection that referenced this pull request Jan 10, 2025
* reimplement cityscapes

* fixed gt bbox mode

* convert cityscapes to coco style, add cityscapes eval

* add cityscapes convert script

* add doc

* Update INSTALL.md

* Update INSTALL.md

* update fater rcnn

* fix cityscapes eval

* support format only in cityscapes

* add docs

* remove redundancy

* resolve eval

* update cityscapes md

* more doc and rename

* update doc and cfg

* change to test set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants