Spaces:
Runtime error
Runtime error
| ''' | |
| * Copyright (c) 2023 Salesforce, Inc. | |
| * All rights reserved. | |
| * SPDX-License-Identifier: Apache License 2.0 | |
| * For full license text, see LICENSE.txt file in the repo root or http://www.apache.org/licenses/ | |
| * By Can Qin | |
| * Modified from ControlNet repo: https://github.com/lllyasviel/ControlNet | |
| * Copyright (c) 2023 Lvmin Zhang and Maneesh Agrawala | |
| * Modified from MMCV repo: From https://github.com/open-mmlab/mmcv | |
| * Copyright (c) OpenMMLab. All rights reserved. | |
| ''' | |
| import os.path as osp | |
| from .builder import DATASETS | |
| from .custom import CustomDataset | |
| class PascalVOCDataset(CustomDataset): | |
| """Pascal VOC dataset. | |
| Args: | |
| split (str): Split txt file for Pascal VOC. | |
| """ | |
| 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]] | |
| def __init__(self, split, **kwargs): | |
| super(PascalVOCDataset, self).__init__( | |
| img_suffix='.jpg', seg_map_suffix='.png', split=split, **kwargs) | |
| assert osp.exists(self.img_dir) and self.split is not None | |