(config)
| 99 | |
| 100 | |
| 101 | def prepare_testing_data(config): |
| 102 | def get_test_data_loader(config, test_name): |
| 103 | # update the config dictionary with the specific testing dataset |
| 104 | config = config.copy() # create a copy of config to avoid altering the original one |
| 105 | config['test_dataset'] = test_name # specify the current test dataset |
| 106 | test_set = DeepfakeAbstractBaseDataset( |
| 107 | config=config, |
| 108 | mode='test', |
| 109 | ) |
| 110 | |
| 111 | test_data_loader = \ |
| 112 | torch.utils.data.DataLoader( |
| 113 | dataset=test_set, |
| 114 | batch_size=config['test_batchSize'], |
| 115 | shuffle=False, |
| 116 | num_workers=int(config['workers']), |
| 117 | collate_fn=test_set.collate_fn, |
| 118 | drop_last = (test_name=='DeepFakeDetection'), |
| 119 | ) |
| 120 | |
| 121 | return test_data_loader |
| 122 | |
| 123 | test_data_loaders = {} |
| 124 | for one_test_name in config['test_dataset']: |
| 125 | test_data_loaders[one_test_name] = get_test_data_loader(config, one_test_name) |
| 126 | return test_data_loaders |
| 127 | |
| 128 | |
| 129 | def choose_optimizer(model, config): |
no test coverage detected