2021-08-17 14:16:55 +08:00
|
|
|
# Copyright (c) OpenMMLab. All rights reserved.
|
2020-07-07 20:52:19 +08:00
|
|
|
import os.path as osp
|
|
|
|
|
2022-05-10 20:15:20 +08:00
|
|
|
from mmseg.registry import DATASETS
|
2020-07-07 20:52:19 +08:00
|
|
|
from .custom import CustomDataset
|
|
|
|
|
|
|
|
|
|
|
|
@DATASETS.register_module()
|
|
|
|
class PascalVOCDataset(CustomDataset):
|
|
|
|
"""Pascal VOC dataset.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
split (str): Split txt file for Pascal VOC.
|
|
|
|
"""
|
2022-05-26 17:13:40 +08:00
|
|
|
METAINFO = dict(
|
|
|
|
classes=('background', 'aeroplane', 'bicycle', 'bird', 'boat',
|
|
|
|
'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable',
|
|
|
|
'dog', 'horse', 'motorbike', 'person', 'pottedplant', 'sheep',
|
|
|
|
'sofa', 'train', 'tvmonitor'),
|
|
|
|
palette=[[0, 0, 0], [128, 0, 0], [0, 128, 0], [128, 128, 0],
|
|
|
|
[0, 0, 128], [128, 0, 128], [0, 128, 128], [128, 128, 128],
|
|
|
|
[64, 0, 0], [192, 0, 0], [64, 128, 0], [192, 128, 0],
|
|
|
|
[64, 0, 128], [192, 0, 128], [64, 128, 128], [192, 128, 128],
|
|
|
|
[0, 64, 0], [128, 64, 0], [0, 192, 0], [128, 192, 0],
|
|
|
|
[0, 64, 128]])
|
2020-07-07 20:52:19 +08:00
|
|
|
|
2022-05-26 17:13:40 +08:00
|
|
|
def __init__(self, ann_file, **kwargs) -> None:
|
|
|
|
super().__init__(
|
|
|
|
img_suffix='.jpg',
|
|
|
|
seg_map_suffix='.png',
|
|
|
|
ann_file=ann_file,
|
|
|
|
**kwargs)
|
|
|
|
assert self.file_client.exists(
|
|
|
|
self.data_prefix['img_path']) and osp.isfile(self.ann_file)
|