https://pytorch.org/docs/stable/data.html#torch.utils.data.ConcatDataset
I’m using ConcatDataset class which is justified in pytorch document.
And when after the ConcatDataset ‘TypeError: object of type ‘ABCMeta’ has no len()’ is keep occuring.
Below is the code which I implemented. I am trying to concat two datasets and train.
def prepare_data(args, ckpt_dir=None, with_input_orig=False, split=None):
train_sets = []
train_preprocessor_kwargs = {}
pdb.set_trace()
if 'cityscapes-with-depth' in args.dataset:
Dataset = Cityscapes
dataset_kwargs = {
'n_classes': 19,
'disparity_instead_of_depth': False
}
valid_set = 'valid'
train_sets.append(Dataset)
if 'sunrgbd' in args.dataset:
Dataset = SUNRGBD
dataset_kwargs = {}
valid_set = 'test'
train_sets.append(Dataset)
if len(train_sets) != len(args.dataset):
raise Exception('Something went wrong. Please check your dataset names are valid')
if len(train_sets) == 0:
raise Exception('Dataset {} is not supported'.format(args.dataset))
if len(args.dataset) != 1:
Datasets = ConcatDataset(train_sets)
What is the problem?