def __init__(self, args, transform=None, mode='test'): np.random.seed(args.seed) super(Hotel_DB, self).__init__() self.transform = transform total = True if 'seen' in mode: # mode == *_seen or *_unseen mode_tmp = mode total = False else: mode_tmp = mode + '_seen' total = True self.datas, self.num_classes, _, self.labels, self.datas_bg = loadDataToMem(args.dataset_path, args.dataset_name, args.dataset_split_type, mode=mode_tmp, split_file_name=args.splits_file_name, portion=args.portion) # if total: self.all_shuffled_data = get_shuffled_data(self.datas_bg, seed=args.seed, one_hot=False, both_seen_unseen=True, shuffle=False) # else: # todo # self.all_shuffled_data = get_shuffled_data(self.datas, seed=args.seed, one_hot=False) print(f'hotel {mode} classes: ', self.num_classes) print(f'hotel {mode} length: ', self.__len__())
def __init__(self, args, transform=None, mode='train'): # train or val super(CUBClassification, self).__init__() np.random.seed(args.seed) self.transform = transform self.datas, self.num_classes, self.length, self.labels, _ = loadDataToMem( args.dataset_path, args.dataset_name, args.dataset_split_type, mode=mode) self.shuffled_data = get_shuffled_data(self.datas, seed=args.seed)
def __init__(self, args, transform=None, mode='test'): np.random.seed(args.seed) super(CUBTest_Fewshot, self).__init__() self.transform = transform self.times = args.times self.way = args.way self.img1 = None self.c1 = None self.datas, self.num_classes, _, self.labels, _ = loadDataToMem( args.dataset_path, args.dataset_name, args.dataset_split_type, mode=mode) # todo not updated
def __init__(self, args, transform=None, mode='train'): super(CUBTrain_Top, self).__init__() np.random.seed(args.seed) # self.dataset = dataset self.transform = transform self.datas, self.num_classes, self.length, self.labels, _ = loadDataToMem( args.dataset_path, args.dataset_name, args.dataset_split_type, mode=mode) self.shuffled_data = get_shuffled_data(datas=self.datas, seed=args.seed)
def __init__(self, args, transform=None, mode='test_seen', save_pictures=False): np.random.seed(args.seed) super(HotelTest, self).__init__() self.transform = transform self.save_pictures = save_pictures self.times = args.times self.way = args.way self.img1 = None self.c1 = None self.datas, self.num_classes, _, self.labels, self.datas_bg = loadDataToMem(args.dataset_path, args.dataset_name, args.dataset_split_type, mode=mode, split_file_name=args.splits_file_name, portion=args.portion) print(f'hotel {mode} classes: ', self.num_classes) print(f'hotel {mode} length: ', self.__len__())
def __init__(self, args, transform=None, mode='train', save_pictures=False): super(HotelTrain, self).__init__() np.random.seed(args.seed) self.transform = transform self.save_pictures = save_pictures self.class1 = 0 self.image1 = None self.no_negative = args.no_negative self.datas, self.num_classes, self.length, self.labels, _ = loadDataToMem(args.dataset_path, args.dataset_name, args.dataset_split_type, mode=mode, split_file_name=args.splits_file_name, portion=args.portion) self.shuffled_data = get_shuffled_data(datas=self.datas, seed=args.seed) print('hotel train classes: ', self.num_classes) print('hotel train length: ', self.length)