os.mkdir(opt.dataset) if not os.path.exists(os.path.join("{}/train".format(opt.dataset))): os.mkdir(os.path.join("{}/train".format(opt.dataset))) os.mkdir(os.path.join("{}/train/A".format(opt.dataset))) os.mkdir(os.path.join("{}/train/B".format(opt.dataset))) if not os.path.exists(os.path.join("{}/test".format(opt.dataset))): os.mkdir(os.path.join("{}/test".format(opt.dataset))) os.mkdir(os.path.join("{}/test/A".format(opt.dataset))) os.mkdir(os.path.join("{}/test/B".format(opt.dataset))) train_set = get_training_set(opt.datasetPath) train_data_loader = DataLoader(dataset=train_set, num_workers=0, batch_size=1, shuffle=True) test_set = get_test_set(opt.datasetPath) testing_data_loader = DataLoader(dataset=test_set, num_workers=0, batch_size=1, shuffle=False) criterionMSE = nn.MSELoss() criterionMSE = criterionMSE.cuda() i = 0 ''' for x in range(10): for batch in train_data_loader: input, target, input_masked = Variable(batch[0], volatile=True), Variable(batch[1], volatile=True), Variable( batch[2], volatile=True)
print(opt) if opt.cuda and not torch.cuda.is_available(): raise Exception("No GPU found, please run without --cuda") cudnn.benchmark = True torch.manual_seed(opt.seed) if opt.cuda: torch.cuda.manual_seed(opt.seed) print('===> Loading datasets') train_set = get_training_set(opt.datasetPath, opt.image_size, opt.masked_size, opt.resize_ratio) test_set = get_test_set(opt.datasetPath, opt.image_size, opt.masked_size, opt.resize_ratio) training_data_loader = DataLoader(dataset=train_set, num_workers=opt.threads, batch_size=opt.batchSize, shuffle=True, pin_memory=True) testing_data_loader = DataLoader(dataset=test_set, num_workers=opt.threads, batch_size=opt.testBatchSize, shuffle=False) print('===> Building model') resume_epoch = 0 if opt.resume_epoch < 0: net_g_model_out_path = "checkpoint/{}_{}/netG_model_latest.pth".format(