Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions train.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import config
import trainer_step


def main():
cfg = config.Config(filenamequeue="../data/dataset/layout_1205.tfrecords")
t = trainer_step.Trainer(cfg)
Expand Down
19 changes: 10 additions & 9 deletions trainer_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
tf.compat.v1.disable_eager_execution()
# slim = tf.contrib.slim

DATA_DIR = os.path.join('..','data')
DATA_DIR = os.path.join('..')
class Trainer(object):
def __init__(self, config):
filenamequeue = tf.compat.v1.train.string_input_producer([config.filenamequeue])
Expand Down Expand Up @@ -58,7 +58,8 @@ def _build_model(self, filenamequeue, config):
randomz = tf.random.normal([config.batch_size, config.z_dim])
# testing case
testLayout, testImgfea, testSemvec, testTexfea = self.inputs(config)
randomz_val = np.load(os.path.join(DATA_DIR,'sample','noiseVector_128.npy'))
# randomz_val = np.load(os.path.join(DATA_DIR,'/drive/MyDrive/LayoutNetme/sample','noiseVector_128.npy'))
randomz_val = np.load('../drive/MyDrive/LayoutNetme/sample/noiseVector_128.npy')
testSemvec, _ = model.embeddingSemvec(testSemvec, training_, reuse=True)
testImgfea, _ = model.embeddingImg(testImgfea, training_, reuse=True)
testTexfea, _ = model.embeddingTex(testTexfea, training_, reuse=True)
Expand Down Expand Up @@ -223,21 +224,21 @@ def sample(self):
return (inputdata + 1) / 2.0, (gen + 1) / 2.0, fea

def testing(self):
new_saver = tf.compat.v1.train.import_meta_graph('./log/layoutNet-100.meta')
new_saver.restore(self.sess, './log/layoutNet-100')
new_saver = tf.compat.v1.train.import_meta_graph('/layoutNet-100.meta')
new_saver.restore(self.sess, '/layoutNet-100')
gen, fea = self.sess.run([self.model["Gtest"],
self.model["Etest"]],
feed_dict={self.model["is_training"]: False})

return (gen + 1) / 2.0, fea

def inputs(self, config):
layoutpath = DATA_DIR + '/sample/layout/'
imgfeapath = DATA_DIR + '/sample/visfea/'
texfeapath = DATA_DIR + '/sample/texfea/'
semvecpath = DATA_DIR + '/sample/semvec/'
layoutpath = DATA_DIR + '/drive/MyDrive/LayoutNetme/validation/layout/'
imgfeapath = DATA_DIR + '/drive/MyDrive/LayoutNetme/validation/visfea/'
texfeapath = DATA_DIR + '/drive/MyDrive/LayoutNetme/validation/texfea/'
semvecpath = DATA_DIR + '/drive/MyDrive/LayoutNetme/validation/semvec/'

f = open((DATA_DIR + '/sample/imgSel_128.txt'), 'r')
f = open((DATA_DIR + '/drive/MyDrive/LayoutNetme/validation/imgSel_60.txt'), 'r')
name = f.read()
namelist = name.split()
n_samples = len(namelist)
Expand Down