1. 修改config.yml
修改前
EPOCH: 40
BATCH_SIZE: 16
NUM_WORKER : 4
TRAIN_DIR : 'anime' # 'anime' or 'afhq_cat' or 'afhq_dog' or afhq_wild
修改后
EPOCH: 400
BATCH_SIZE: 8
NUM_WORKER : 0
TRAIN_DIR : 'nighttime' # 'anime' or 'afhq_cat' or 'afhq_dog' or afhq_wild
添加
USE_TENSORBOARD : 'True'
2. 修改data_loader.py
添加
elif config['TRAINING_CONFIG']['TRAIN_DIR'] == 'nighttime':
self.img_dir = r'F:\RefDataset\KAIST\train\refB'
self.skt_dir = r'F:\RefDataset\KAIST\train\nightA'
self.data_list = glob.glob(os.path.join(self.img_dir, '*.jpg'))
3. 修改model.py
self.gcn3 = Gconv(in_features=channel, out_features=channel)
self.gcn4 = Gconv(in_features=channel, out_features=channel)
修改为
self.gcn3 = Gconv(in_ch=channel, out_ch=channel)
self.gcn4 = Gconv(in_ch=channel, out_ch=channel)
和SGA修改一致
1. 修改config.yml
修改前
EPOCH: 40
BATCH_SIZE: 16
NUM_WORKER : 4
TRAIN_DIR : 'anime' # 'anime' or 'afhq_cat' or 'afhq_dog' or afhq_wild
修改后
EPOCH: 400
BATCH_SIZE: 8
NUM_WORKER : 0
TRAIN_DIR : 'nighttime' # 'anime' or 'afhq_cat' or 'afhq_dog' or afhq_wild
添加
USE_TENSORBOARD : 'True'
2. 修改data_loader.py
添加
elif config['TRAINING_CONFIG']['TRAIN_DIR'] == 'nighttime':
self.img_dir = r'F:\RefDataset\KAIST\train\refB'
self.skt_dir = r'F:\RefDataset\KAIST\train\nightA'
self.data_list = glob.glob(os.path.join(self.img_dir, '*.jpg'))
下载Synchronized-BatchNorm-PyTorch
https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
下载后放到./models/networks/
GitHub提供训练和测试代码
python train.py --name [experiment_name] --dataset_mode custom --label_dir [path_to_labels] -- image_dir [path_to_images] --label_nc [num_labels]
python test.py --name [name_of_experiment] --dataset_mode [dataset_mode] --dataroot [path_to_dataset]
python train.py --name nighttime --dataset_mode custom --label_dir F:\RefDataset\KAIST\train\nightA -- image_dir F:\RefDataset\KAIST\train\refB --label_nc 182
问题1:
IndexError: list index out of range
更改
python train.py --name nighttime --dataset_mode custom --label_dir F:\RefDataset\KAIST\train\nightA --image_dir F:\RefDataset\KAIST\train\refB --label_nc 182 --no_instance
问题2:
RuntimeError: cuDNN error: CUDNN_STATUS_INTERNAL_ERROR
更改
python train.py --name nighttime --dataset_mode custom --dataroot F:\RefDataset\iRay\train --label_dir F:\RefDataset\iRay\train\nightA --image_dir F:\RefDataset\iRay\train\refB --no_instance --contain_dontcare_label --label_nc 512 --no_flip --preprocess_mode none --load_size 256 --crop_size 256 --display_freq 5000 --save_epoch_freq 100 --niter 100--gpu_ids 0
python test.py --name nighttime --dataset_mode custom --dataroot /home/sys120-1/cy/ref_based/iRay/train --label_dir /home/sys120-1/cy/ref_based/iRay/train/nightA --image_dir /home/sys120-1/cy/ref_based/iRay/train/refB --no_instance --contain_dontcare_label --label_nc 512 --no_flip --preprocess_mode none --load_size 256 --crop_size 256 --gpu_ids 0