Skip to content

'CIFAR10Anom' object has no attribute 'class_to_idx' #1

Description

@MlLearnerAkash

To,
The concerned ones ,
I was running the repository for cifar10 dataset , in the data.py file it is popping up an error in the line 30.
The issue says ,the very class "CIFAR10Anom" class does not have any 'class_to_idx' attribute .

How to get rid of this ???

I quote the whole error below :

wandb: Run data is saved locally in /home/genie/AMA/AMA/wandb/run-20220314_143815-2ey9xmj1
wandb: Run wandb offline to turn off syncing.

Chosen Seed: 5
Namespace(abnormal_classes=None, ae_recon_loss_type='wasserstein', anom_metric_type='f_anomloss', anom_pc=0.1, anom_recon_lambda=5.0, atyp_ratio=0.5, atyp_selec_style='inward', augment=False, batchsize=256, ch=128, corrup=False, corruption=0, cuda=0, dataroot='./data/CIFAR10/', dataset='cifar10', expt_name='cifar_experiments', gp_lambda=10, image_size=32, interpolation_in_recon=False, ip_lambda=0.2, learning_setting='ss', lr=0.0003, manualSeed=5, model_load_path='', ngpu=1, normal_class="['ship']", num_channels=3, num_epochs=100, nz=128, ood_model=False, recon_loss_type='wasserstein', regularizer_lambda=1.0, sampling=True, save_logs_epochs=1, save_model_epochs=30, save_model_root='logs', spectral_norm=1, start=0, update_ratio=5, use_penalty=True, val_split=0.05, workers=4)
Files already downloaded and verified
Traceback (most recent call last):
File "train.py", line 175, in
dataset_train, dataset_valid, dataset_test = data.load_data(dataset = opt.dataset, ood = opt.ood_model, anom_classes = anom_classes,anom_ratio=opt.anom_pc,corruption= opt.corruption, seed = opt.manualSeed, augmentation = opt.augment, learning_setting= opt.learning_setting, valid_split = opt.val_split)
File "/home/genie/AMA/AMA/data.py", line 237, in load_data
dataset_train = CIFAR10Anom(root=root,stage='train',
File "/home/genie/AMA/AMA/data.py", line 30, in init
if len(set(anom_classes) & set(self.class_to_idx.keys()))==0:
AttributeError: 'CIFAR10Anom' object has no attribute 'class_to_idx'
Traceback (most recent call last):
File "train.py", line 175, in
dataset_train, dataset_valid, dataset_test = data.load_data(dataset = opt.dataset, ood = opt.ood_model, anom_classes = anom_classes,anom_ratio=opt.anom_pc,corruption= opt.corruption, seed = opt.manualSeed, augmentation = opt.augment, learning_setting= opt.learning_setting, valid_split = opt.val_split)
File "/home/genie/AMA/AMA/data.py", line 237, in load_data
dataset_train = CIFAR10Anom(root=root,stage='train',
File "/home/genie/AMA/AMA/data.py", line 30, in init
if len(set(anom_classes) & set(self.class_to_idx.keys()))==0:
AttributeError: 'CIFAR10Anom' object has no attribute 'class_to_idx'

Thanks in advance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions