voc.py 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. # Copyright (c) OpenMMLab. All rights reserved.
  2. from mmdet.registry import DATASETS
  3. from .xml_style import XMLDataset
  4. @DATASETS.register_module()
  5. class VOCDataset(XMLDataset):
  6. """Dataset for PASCAL VOC."""
  7. METAINFO = {
  8. 'classes':
  9. ('aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat',
  10. 'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', 'person',
  11. 'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor'),
  12. # palette is a list of color tuples, which is used for visualization.
  13. 'palette': [(106, 0, 228), (119, 11, 32), (165, 42, 42), (0, 0, 192),
  14. (197, 226, 255), (0, 60, 100), (0, 0, 142), (255, 77, 255),
  15. (153, 69, 1), (120, 166, 157), (0, 182, 199),
  16. (0, 226, 252), (182, 182, 255), (0, 0, 230), (220, 20, 60),
  17. (163, 255, 0), (0, 82, 0), (3, 95, 161), (0, 80, 100),
  18. (183, 130, 88)]
  19. }
  20. def __init__(self, **kwargs):
  21. super().__init__(**kwargs)
  22. if 'VOC2007' in self.sub_data_root:
  23. self._metainfo['dataset_type'] = 'VOC2007'
  24. elif 'VOC2012' in self.sub_data_root:
  25. self._metainfo['dataset_type'] = 'VOC2012'
  26. else:
  27. self._metainfo['dataset_type'] = None