mmsegmentation/mmseg/datasets/coco_stuff.py

97 lines
6.3 KiB
Python
Raw Normal View History

# Copyright (c) OpenMMLab. All rights reserved.
2022-05-10 20:15:20 +08:00
from mmseg.registry import DATASETS
support coco stuff-10k/164k (#625) * support coco stuff-10k/164k * update docs * fix docs * update docs * fix import lints * Update docs/dataset_prepare.md * Update docs/dataset_prepare.md * Update tools/convert_datasets/coco_stuff164k.py * Update tools/convert_datasets/coco_stuff10k.py * Update tools/convert_datasets/coco_stuff10k.py * Update tools/convert_datasets/coco_stuff10k.py * Update tools/convert_datasets/coco_stuff10k.py * Update coco_stuff.py fix the description of the dataset * Update dataset_prepare.md fix the doc tree of coco stuff 10k * Update coco_stuff10k.py fix img_dir * Update coco_stuff.py fix descriptions * Update coco_stuff164k.py fix out_dir * Update coco_stuff10k.py fix save file name * Update coco_stuff.py fix seg_map_suffix * Update dataset_prepare.md fix -p * Update dataset_prepare.md fix doc tree * modify coco stuff convertor * Remove redundant code * fix 164k convert bug * remove redundant comment * add deeplabv3 configs and more iterations * replace shutil.move with shtil.copyfile * Update deeplabv3_r50-d8_512x512_4x4_80k_coco_stuff10k.py fix wrong config * Update deeplabv3_r101-d8_512x512_4x4_80k_coco_stuff164k.py fix wrong config * fix wrong configs * fix wrong configs * fix wrong path for coco stuff 10k * fix convert bugs * fix seg_filename bug * when nproc=0, use track progress * rename configs: coco_stuff --> coco-stuff * add coco-stuff 10k and 164k to README.md * update configs * add deeplabv3 benchmark * add pspnet benchmark * remove redundant comma Co-authored-by: Junjun2016 <hejunjun@sjtu.edu.cn>
2021-09-22 20:48:08 +08:00
from .custom import CustomDataset
@DATASETS.register_module()
class COCOStuffDataset(CustomDataset):
"""COCO-Stuff dataset.
In segmentation map annotation for COCO-Stuff, Train-IDs of the 10k version
are from 1 to 171, where 0 is the ignore index, and Train-ID of COCO Stuff
164k is from 0 to 170, where 255 is the ignore index. So, they are all 171
semantic categories. ``reduce_zero_label`` is set to True and False for the
10k and 164k versions, respectively. The ``img_suffix`` is fixed to '.jpg',
and ``seg_map_suffix`` is fixed to '.png'.
"""
2022-05-26 17:13:40 +08:00
METAINFO = dict(
classes=(
'person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus',
'train', 'truck', 'boat', 'traffic light', 'fire hydrant',
'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog',
'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe',
'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee',
'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat',
'baseball glove', 'skateboard', 'surfboard', 'tennis racket',
'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl',
'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot',
'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch',
'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop',
'mouse', 'remote', 'keyboard', 'cell phone', 'microwave', 'oven',
'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase',
'scissors', 'teddy bear', 'hair drier', 'toothbrush', 'banner',
'blanket', 'branch', 'bridge', 'building-other', 'bush', 'cabinet',
'cage', 'cardboard', 'carpet', 'ceiling-other', 'ceiling-tile',
'cloth', 'clothes', 'clouds', 'counter', 'cupboard', 'curtain',
'desk-stuff', 'dirt', 'door-stuff', 'fence', 'floor-marble',
'floor-other', 'floor-stone', 'floor-tile', 'floor-wood', 'flower',
'fog', 'food-other', 'fruit', 'furniture-other', 'grass', 'gravel',
'ground-other', 'hill', 'house', 'leaves', 'light', 'mat', 'metal',
'mirror-stuff', 'moss', 'mountain', 'mud', 'napkin', 'net',
'paper', 'pavement', 'pillow', 'plant-other', 'plastic',
'platform', 'playingfield', 'railing', 'railroad', 'river', 'road',
'rock', 'roof', 'rug', 'salad', 'sand', 'sea', 'shelf',
'sky-other', 'skyscraper', 'snow', 'solid-other', 'stairs',
'stone', 'straw', 'structural-other', 'table', 'tent',
'textile-other', 'towel', 'tree', 'vegetable', 'wall-brick',
'wall-concrete', 'wall-other', 'wall-panel', 'wall-stone',
'wall-tile', 'wall-wood', 'water-other', 'waterdrops',
'window-blind', 'window-other', 'wood'),
palette=[[0, 192, 64], [0, 192, 64], [0, 64, 96], [128, 192, 192],
[0, 64, 64], [0, 192, 224], [0, 192, 192], [128, 192, 64],
[0, 192, 96], [128, 192, 64], [128, 32, 192], [0, 0, 224],
[0, 0, 64], [0, 160, 192], [128, 0, 96], [128, 0, 192],
[0, 32, 192], [128, 128, 224], [0, 0, 192], [128, 160, 192],
[128, 128, 0], [128, 0, 32], [128, 32, 0], [128, 0, 128],
[64, 128, 32], [0, 160, 0], [0, 0, 0], [192, 128, 160],
[0, 32, 0], [0, 128, 128], [64, 128, 160], [128, 160, 0],
[0, 128, 0], [192, 128, 32], [128, 96, 128], [0, 0, 128],
[64, 0, 32], [0, 224, 128], [128, 0, 0], [192, 0, 160],
[0, 96, 128], [128, 128, 128], [64, 0, 160], [128, 224, 128],
[128, 128, 64], [192, 0, 32], [128, 96, 0], [128, 0, 192],
[0, 128, 32], [64, 224, 0], [0, 0, 64], [128, 128, 160],
[64, 96, 0], [0, 128, 192], [0, 128, 160], [192, 224, 0],
[0, 128, 64], [128, 128, 32], [192, 32, 128], [0, 64, 192],
[0, 0, 32], [64, 160, 128], [128, 64, 64], [128, 0, 160],
[64, 32, 128], [128, 192, 192], [0, 0, 160], [192, 160, 128],
[128, 192, 0], [128, 0, 96], [192, 32, 0], [128, 64, 128],
[64, 128, 96], [64, 160, 0], [0, 64, 0], [192, 128, 224],
[64, 32, 0], [0, 192, 128], [64, 128, 224], [192, 160, 0],
[0, 192, 0], [192, 128, 96], [192, 96, 128], [0, 64, 128],
[64, 0, 96], [64, 224, 128], [128, 64, 0], [192, 0, 224],
[64, 96, 128], [128, 192, 128], [64, 0, 224], [192, 224, 128],
[128, 192, 64], [192, 0, 96], [192, 96, 0], [128, 64, 192],
[0, 128, 96], [0, 224, 0], [64, 64, 64], [128, 128, 224],
[0, 96, 0], [64, 192, 192], [0, 128, 224], [128, 224, 0],
[64, 192, 64], [128, 128, 96], [128, 32, 128], [64, 0, 192],
[0, 64, 96], [0, 160, 128], [192, 0, 64], [128, 64, 224],
[0, 32, 128], [192, 128, 192], [0, 64, 224], [128, 160, 128],
[192, 128, 0], [128, 64, 32], [128, 32, 64], [192, 0, 128],
[64, 192, 32], [0, 160, 64], [64, 0, 0], [192, 192, 160],
[0, 32, 64], [64, 128, 128], [64, 192, 160], [128, 160, 64],
[64, 128, 0], [192, 192, 32], [128, 96, 192], [64, 0, 128],
[64, 64, 32], [0, 224, 192], [192, 0, 0], [192, 64, 160],
[0, 96, 192], [192, 128, 128], [64, 64, 160], [128, 224, 192],
[192, 128, 64], [192, 64, 32], [128, 96, 64], [192, 0, 192],
[0, 192, 32], [64, 224, 64], [64, 0, 64], [128, 192, 160],
[64, 96, 64], [64, 128, 192], [0, 192, 160], [192, 224, 64],
[64, 128, 64], [128, 192, 32], [192, 32, 192], [64, 64, 192],
[0, 64, 32], [64, 160, 192], [192, 64, 64], [128, 64, 160],
[64, 32, 192], [192, 192, 192], [0, 64, 160], [192, 160, 192],
[192, 192, 0], [128, 64, 96], [192, 32, 64], [192, 64, 128],
[64, 192, 96], [64, 160, 64], [64, 64, 0]])
support coco stuff-10k/164k (#625) * support coco stuff-10k/164k * update docs * fix docs * update docs * fix import lints * Update docs/dataset_prepare.md * Update docs/dataset_prepare.md * Update tools/convert_datasets/coco_stuff164k.py * Update tools/convert_datasets/coco_stuff10k.py * Update tools/convert_datasets/coco_stuff10k.py * Update tools/convert_datasets/coco_stuff10k.py * Update tools/convert_datasets/coco_stuff10k.py * Update coco_stuff.py fix the description of the dataset * Update dataset_prepare.md fix the doc tree of coco stuff 10k * Update coco_stuff10k.py fix img_dir * Update coco_stuff.py fix descriptions * Update coco_stuff164k.py fix out_dir * Update coco_stuff10k.py fix save file name * Update coco_stuff.py fix seg_map_suffix * Update dataset_prepare.md fix -p * Update dataset_prepare.md fix doc tree * modify coco stuff convertor * Remove redundant code * fix 164k convert bug * remove redundant comment * add deeplabv3 configs and more iterations * replace shutil.move with shtil.copyfile * Update deeplabv3_r50-d8_512x512_4x4_80k_coco_stuff10k.py fix wrong config * Update deeplabv3_r101-d8_512x512_4x4_80k_coco_stuff164k.py fix wrong config * fix wrong configs * fix wrong configs * fix wrong path for coco stuff 10k * fix convert bugs * fix seg_filename bug * when nproc=0, use track progress * rename configs: coco_stuff --> coco-stuff * add coco-stuff 10k and 164k to README.md * update configs * add deeplabv3 benchmark * add pspnet benchmark * remove redundant comma Co-authored-by: Junjun2016 <hejunjun@sjtu.edu.cn>
2021-09-22 20:48:08 +08:00
2022-05-26 17:13:40 +08:00
def __init__(self, **kwargs) -> None:
super().__init__(
support coco stuff-10k/164k (#625) * support coco stuff-10k/164k * update docs * fix docs * update docs * fix import lints * Update docs/dataset_prepare.md * Update docs/dataset_prepare.md * Update tools/convert_datasets/coco_stuff164k.py * Update tools/convert_datasets/coco_stuff10k.py * Update tools/convert_datasets/coco_stuff10k.py * Update tools/convert_datasets/coco_stuff10k.py * Update tools/convert_datasets/coco_stuff10k.py * Update coco_stuff.py fix the description of the dataset * Update dataset_prepare.md fix the doc tree of coco stuff 10k * Update coco_stuff10k.py fix img_dir * Update coco_stuff.py fix descriptions * Update coco_stuff164k.py fix out_dir * Update coco_stuff10k.py fix save file name * Update coco_stuff.py fix seg_map_suffix * Update dataset_prepare.md fix -p * Update dataset_prepare.md fix doc tree * modify coco stuff convertor * Remove redundant code * fix 164k convert bug * remove redundant comment * add deeplabv3 configs and more iterations * replace shutil.move with shtil.copyfile * Update deeplabv3_r50-d8_512x512_4x4_80k_coco_stuff10k.py fix wrong config * Update deeplabv3_r101-d8_512x512_4x4_80k_coco_stuff164k.py fix wrong config * fix wrong configs * fix wrong configs * fix wrong path for coco stuff 10k * fix convert bugs * fix seg_filename bug * when nproc=0, use track progress * rename configs: coco_stuff --> coco-stuff * add coco-stuff 10k and 164k to README.md * update configs * add deeplabv3 benchmark * add pspnet benchmark * remove redundant comma Co-authored-by: Junjun2016 <hejunjun@sjtu.edu.cn>
2021-09-22 20:48:08 +08:00
img_suffix='.jpg', seg_map_suffix='_labelTrainIds.png', **kwargs)