def _data_loader(self): train_trans = dlib.get_train_augmentations() test_trans = dlib.get_test_augmentations() df_train = pd.read_csv(self.args.train_file) df_test = pd.read_csv(self.args.test_file) if self.args.is_debug: df_train = df_train.sample(frac=1.0).iloc[:2 * self.args.batch_size, :] df_test = df_test.sample(frac=1.0).iloc[:2 * self.args.batch_size, :] print('### Debug mode was going ###') labels = list(df_train.target.values) sampler = BalanceClassSampler(labels, mode="upsampling") self.data['train_loader'] = DataLoader(dlib.DataBase( df_train, self.args.data_path, train_trans), batch_size=self.args.batch_size, sampler=sampler) self.data['test_loader'] = DataLoader( dlib.DataBase(df_test, self.args.data_path, test_trans), batch_size=self.args.batch_size, \ shuffle=False, drop_last=False) print('Data loading was finished ...')
def _data_loader(self): self.data['train'] = DataLoader( dlib.DataBase(self.args), batch_size=self.args.batch_size, \ shuffle=True, num_workers=self.args.workers) self.data['lfw'] = DataLoader( dlib.VerifyBase(self.args, benchmark = 'lfw'), batch_size=self.args.batch_size // 2, \ num_workers=self.args.workers, drop_last=False, collate_fn=self.collate_fn_1v1) print('Data loading was finished ...')