Permalink
Browse files

Fixed a bug in the testing mode

  • Loading branch information...
Ming-Yu Liu
Ming-Yu Liu committed Nov 8, 2017
1 parent d01726a commit 1384533900ffe05075adc2cf0c2e544e39c68c6c
Showing with 55 additions and 2 deletions.
  1. +53 −0 exps/unit/blondhair_test.yaml
  2. BIN results/cat2tiger_cat001.jpg
  3. +2 −2 src/datasets/dataset_image.py
@@ -0,0 +1,53 @@
# Copyright (C) 2017 NVIDIA Corporation. All rights reserved.
# Licensed under the CC BY-NC-ND 4.0 license (https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode).
train:
snapshot_save_iterations: 5000 # How often do you want to save trained models
image_save_iterations: 2500 # How often do you want to save output images during training
image_display_iterations: 100
display: 1 # How often do you want to log the training stats
snapshot_prefix: ../outputs/unit/celeba/blondhair/blondhair # Where do you want to save the outputs
hyperparameters:
trainer: COCOGANTrainer
lr: 0.0001 # learning rate
ll_direct_link_w: 100 # weight on the self L1 reconstruction loss
kl_direct_link_w: 0.1 # weight on VAE encoding loss
ll_cycle_link_w: 100 # weight on the cycle L1 reconstruction loss
kl_cycle_link_w: 0.1 # weight on the cycle L1 reconstruction loss
gan_w: 10 # weight on the adversarial loss
batch_size: 1 # image batch size per domain
max_iterations: 2000000 # maximum number of training epochs
gen:
name: COCOResGen2
ch: 64 # base channel number per layer
input_dim_a: 3
input_dim_b: 3
n_enc_front_blk: 3
n_enc_res_blk: 3
n_enc_shared_blk: 1
n_gen_shared_blk: 1
n_gen_res_blk: 3
n_gen_front_blk: 3
dis:
name: COCOSharedDis
ch: 64
input_dim_a: 3
input_dim_b: 3
n_front_layer: 2
n_shared_layer: 4
datasets:
train_a: # Domain 1 dataset
channels: 3 # image channel number
scale: 1.0 # scaling factor for scaling image before processing
crop_image_size: 128 # crop image size
class_name: dataset_celeba # dataset class name
root: /data/datasets/celeba/ # dataset folder location
folder: img_align_crop_resize_celeba/
list_name: lists/Blond_Hair_ON.txt
train_b: # Domain 2 dataset
channels: 3 # image channel number
scale: 1.0 # scaling factor for scaling image before processing
crop_image_size: 128 # crop image size
class_name: dataset_celeba # dataset class name
root: /data/datasets/celeba/ # dataset folder location
folder: img_align_crop_resize_celeba/
list_name: lists/Blond_Hair_OFF.txt
View
BIN +150 Bytes (100%) results/cat2tiger_cat001.jpg
Binary file not shown.
@@ -96,8 +96,8 @@ def _load_one_image(self, img_name, test=False):
img = np.float32(img)
h, w, c = img.shape
if test == True:
x_offset = np.int((w - self.crop_image_width) / 2)[0]
y_offset = np.int((h - self.crop_image_height) / 2)[0]
x_offset = np.int((w - self.crop_image_width) / 2)
y_offset = np.int((h - self.crop_image_height) / 2)
else:
if np.random.rand(1) > 0.5:
img = cv2.flip(img, 1)

0 comments on commit 1384533

Please sign in to comment.