ByChelsea / VAND-APRIL-GAN

[CVPR 2023 Workshop] VAND Challenge: 1st Place on Zero-shot AD and 4th Place on Few-shot AD
162 stars 20 forks source link

关于train.py中的的Dataset问题 #30

Open zhibeiyou135 opened 3 months ago

zhibeiyou135 commented 3 months ago

在train.py中: if args.dataset == 'mvtec': train_data = MVTecDataset(root=args.train_data_path, transform=preprocess, target_transform=transform, aug_rate=args.aug_rate) 并未设置mode='train',而 MVTecDataset中mode的默认值为 'test' 。下述代码: if mode == 'train':

如果模式是 'train'

        self.cls_names = [obj_name]  # 将对象名称添加到类别名称列表
        save_dir = os.path.join(save_dir, 'k_shot.txt') # 构建保存目录的路径
    else:
        self.cls_names = list(meta_info.keys()) # 否则,获取所有类别名称

无论是test.py还是train.py都不会执行 mode == 'train'。请问是应该将mode默认值设置为train,还是我理解的幼体,在train.py中mode就应该为test?

ByChelsea commented 3 months ago

Hi, in the zero-shot setting, we use the test set of another dataset for training (this conforms to the principle that zero-shot learning cannot train on data of related objects). More details please refer to our technical report.

The train mode in dataset.py is written for the few-shot setting.