Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions demo/birds_skip_thought_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
sys.path.append('misc')
sys.path.append('stageII')

from misc.config import cfg, cfg_from_file
from misc.utils import mkdir_p
from stageII.model import CondGAN
from config import cfg, cfg_from_file
from utils import mkdir_p
from model import CondGAN
from skimage.transform import resize


Expand Down
2 changes: 1 addition & 1 deletion demo/cfg/birds-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ GPU_ID: 0
Z_DIM: 100

TEST:
PRETRAINED_MODEL: './models/model_330000.ckpt'
PRETRAINED_MODEL: './models/stageII/model_330000.ckpt'
BATCH_SIZE: 64
NUM_COPY: 8

Expand Down
2 changes: 1 addition & 1 deletion demo/cfg/birds-eval.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Z_DIM: 100

TRAIN:
FLAG: False
PRETRAINED_MODEL: './models/birds_model_164000.ckpt'
PRETRAINED_MODEL: './models/stageII/model_330000.ckpt'
BATCH_SIZE: 64
NUM_COPY: 8

Expand Down
2 changes: 1 addition & 1 deletion demo/cfg/birds-skip-thought-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Z_DIM: 100

TEST:
CAPTION_PATH: './Data/birds/example_captions.txt'
PRETRAINED_MODEL: './models/birds_skip_thought_model_164000.ckpt'
PRETRAINED_MODEL: './models/stageII/model_330000.ckpt'
BATCH_SIZE: 64
NUM_COPY: 8

Expand Down
3 changes: 3 additions & 0 deletions demo/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def build_model(sess, embedding_dim, batch_size):
print("Input a valid model path.")
return embeddings, fake_images, hr_fake_images


def drawCaption(img, caption):
caption = caption_convert(caption)
img_txt = Image.fromarray(img)
Expand Down Expand Up @@ -114,6 +115,7 @@ def save_super_images(sample_batchs, hr_sample_batchs, captions_batch, batch_siz
# First row with up to 8 samples
for i in range(np.minimum(8, len(sample_batchs))):
lr_img = sample_batchs[i][j]
lr_img = (lr_img + 1.0) * 127.5
hr_img = hr_sample_batchs[i][j]
hr_img = (hr_img + 1.0) * 127.5
re_sample = resize(lr_img, hr_img.shape[:2])
Expand All @@ -129,6 +131,7 @@ def save_super_images(sample_batchs, hr_sample_batchs, captions_batch, batch_siz
row2 = [padding]
for i in range(8, len(sample_batchs)):
lr_img = sample_batchs[i][j]
lr_img = (lr_img + 1.0) * 127.5
hr_img = hr_sample_batchs[i][j]
hr_img = (hr_img + 1.0) * 127.5
re_sample = resize(lr_img, hr_img.shape[:2])
Expand Down
5 changes: 2 additions & 3 deletions misc/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import division
from __future__ import print_function

import os.path as osp
import numpy as np
from easydict import EasyDict as edict

Expand Down Expand Up @@ -48,7 +47,8 @@
__C.TRAIN.COEFF = edict()
__C.TRAIN.COEFF.KL = 2.0

__C.TRAIN.FINETUNE_LR = True # False
# For Stage II training
__C.TRAIN.FINETUNE_LR = False
__C.TRAIN.FT_LR_RETIO = 0.1

# Modal options
Expand All @@ -69,7 +69,6 @@ def _merge_a_into_b(a, b):
for k, v in a.items():
# a must specify keys that are in b
if k not in b:
#if not b.has_key(k):
raise KeyError('{} is not a valid config key'.format(k))

# the types must match, too
Expand Down
Loading