Skip to content

Commit

Permalink
fix: register name is class type bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mjq2020 authored and LynnL4 committed Nov 24, 2023
1 parent 587ecee commit f373e3c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions sscma/datasets/dataset_wrappers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from typing import Union

from torch.utils.data.dataset import ConcatDataset as _ConcatDataset
from sscma.registry import DATASETS
from mmdet.datasets import CocoDataset


@DATASETS.register_module(_ConcatDataset)
@DATASETS.register_module()
class SemiDataset(_ConcatDataset):
"""
For merging real labeled and pseudo-labeled datasets in semi-supervised.
Expand All @@ -13,12 +16,12 @@ class SemiDataset(_ConcatDataset):
"""

def __init__(self, sup_dataset: dict, unsup_dataset: dict, **kwargs) -> None:
self._sup_dataset = DATASETS.build(sup_dataset)
self._unsup_dataset = DATASETS.build(unsup_dataset)
self._sup_dataset: CocoDataset = DATASETS.build(sup_dataset)
self._unsup_dataset: CocoDataset = DATASETS.build(unsup_dataset)

super(SemiDataset, self).__init__((self._sup_dataset, self._unsup_dataset))

self.CLASSES = self.sup_dataset.CLASSES
self.CLASSES: Union[list, tuple] = self.sup_dataset.METAINFO['classes']

@property
def sup_dataset(self):
Expand Down

0 comments on commit f373e3c

Please sign in to comment.