Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions mmseg/datasets/pascal_context.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import mmengine.fileio as fileio

from mmseg.registry import DATASETS
from .basesegdataset import BaseSegDataset
Expand Down Expand Up @@ -46,18 +46,18 @@ class PascalContextDataset(BaseSegDataset):
[255, 71, 0], [0, 235, 255], [0, 173, 255], [31, 0, 255]])

def __init__(self,
ann_file: str,
ann_file='',
img_suffix='.jpg',
seg_map_suffix='.png',
reduce_zero_label=False,
**kwargs) -> None:
super().__init__(
img_suffix=img_suffix,
seg_map_suffix=seg_map_suffix,
ann_file=ann_file,
reduce_zero_label=False,
reduce_zero_label=reduce_zero_label,
**kwargs)
assert self.file_client.exists(
self.data_prefix['img_path']) and osp.isfile(self.ann_file)
assert fileio.exists(self.data_prefix['img_path'], self.backend_args)


@DATASETS.register_module()
Expand All @@ -66,8 +66,10 @@ class PascalContextDataset59(BaseSegDataset):

In segmentation map annotation for PascalContext, 0 stands for background,
which is included in 60 categories. ``reduce_zero_label`` is fixed to
False. The ``img_suffix`` is fixed to '.jpg' and ``seg_map_suffix`` is
True. The ``img_suffix`` is fixed to '.jpg' and ``seg_map_suffix`` is
fixed to '.png'.
Noted: If the background is 255 and the ids of categories are from 0 to 58,
``reduce_zero_label`` needs to be set to False.

Args:
ann_file (str): Annotation file path.
Expand Down Expand Up @@ -100,7 +102,7 @@ class PascalContextDataset59(BaseSegDataset):
[255, 71, 0], [0, 235, 255], [0, 173, 255], [31, 0, 255]])

def __init__(self,
ann_file: str,
ann_file='',
img_suffix='.jpg',
seg_map_suffix='.png',
reduce_zero_label=True,
Expand All @@ -111,5 +113,4 @@ def __init__(self,
ann_file=ann_file,
reduce_zero_label=reduce_zero_label,
**kwargs)
assert self.file_client.exists(
self.data_prefix['img_path']) and osp.isfile(self.ann_file)
assert fileio.exists(self.data_prefix['img_path'], self.backend_args)