Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dataset alias for PaddleX #3427

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions paddleseg/cvlibs/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ def model(self) -> paddle.nn.Layer:
assert model_cfg != {}, \
'No model specified in the configuration file.'

if self.config.train_dataset_cfg['type'] != 'Dataset':
if self.config.train_dataset_cfg[
'type'] not in ['Dataset', 'SegDataset']:
# check and synchronize the num_classes in model config and dataset class
assert hasattr(self.train_dataset_class, 'NUM_CLASSES'), \
'If train_dataset class is not `Dataset`, it must have `NUM_CLASSES` attr.'
Expand Down Expand Up @@ -236,7 +237,8 @@ def _check_helper(loss_cfg, ignore_index):
'train_dataset ignore_index = {}'.format(loss_cfg['ignore_index'], ignore_index)

# check and synchronize the ignore_index in model config and dataset class
if self.config.train_dataset_cfg['type'] != 'Dataset':
if self.config.train_dataset_cfg[
'type'] not in ['Dataset', 'SegDataset']:
assert hasattr(self.train_dataset_class, 'IGNORE_INDEX'), \
'If train_dataset class is not `Dataset`, it must have `IGNORE_INDEX` attr.'
ignore_index = getattr(self.train_dataset_class, 'IGNORE_INDEX')
Expand Down
6 changes: 6 additions & 0 deletions paddleseg/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@
from .chase_db1 import CHASEDB1
from .pp_humanseg14k import PPHumanSeg14K
from .pssl import PSSLDataset

from paddleseg.cvlibs import manager

# for PaddleX
SegDataset = Dataset
manager.DATASETS._components_dict['SegDataset'] = SegDataset