summaryrefslogtreecommitdiff
path: root/cli/app
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-01-06 15:58:45 +0100
committerJules Laplace <julescarbon@gmail.com>2020-01-06 15:58:45 +0100
commit79a24083c7db61ce056bf08cc5e2b8f872fd51b7 (patch)
tree9e5a067f7ec06f6f4963e416c22f5ae65536f788 /cli/app
parent6f90d4b5e0ac8b168e3ff35c4a3a79bb44f81235 (diff)
getting it running..?
Diffstat (limited to 'cli/app')
-rw-r--r--cli/app/commands/biggan/search_class.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/cli/app/commands/biggan/search_class.py b/cli/app/commands/biggan/search_class.py
index 14c3c39..9b9d466 100644
--- a/cli/app/commands/biggan/search_class.py
+++ b/cli/app/commands/biggan/search_class.py
@@ -31,7 +31,7 @@ from app.search.vector import truncated_z_sample, truncated_z_single, create_lab
help='Path to input image')
@click.option('-d', '--dims', 'opt_dims', default=512, type=int,
help='Dimensions of BigGAN network (128, 256, 512)')
-@click.option('-s', '--steps', 'opt_steps', default=500, type=int,
+@click.option('-s', '--steps', 'opt_steps', default=5000, type=int,
help='Number of optimization iterations')
@click.option('-l', '--limit', 'opt_limit', default=1000, type=int,
help='Limit the number of images to process')
@@ -92,7 +92,7 @@ def find_nearest_vector(sess, opt_fp_in, opt_dims, out_images, out_labels, out_l
y_initial = create_labels(batch_size, vocab_size, 10)
z_lr = 0.001
- y_lr = 0.00001
+ y_lr = 0.001
input_z = tf.compat.v1.Variable(z_initial, dtype=np.float32, constraint=lambda t: tf.clip_by_value(t, -2, 2))
input_y = tf.compat.v1.Variable(y_initial, dtype=np.float32, constraint=lambda t: tf.clip_by_value(t, 0, 1))
@@ -133,7 +133,7 @@ def find_nearest_vector(sess, opt_fp_in, opt_dims, out_images, out_labels, out_l
}
# feed_dict = {input_z: z, input_y: y, input_trunc: truncation}
- phi_start = sess.run(output, feed_dict=feed_dict)
+ phi_start = sess.run(output)
start_im = imgrid(imconvert_uint8(phi_start), cols=1)
imwrite(join(app_cfg.DIR_OUTPUTS, fp_frames, 'frame_0000_start.png'), start_im)
@@ -142,10 +142,10 @@ def find_nearest_vector(sess, opt_fp_in, opt_dims, out_images, out_labels, out_l
for i in range(opt_steps):
curr_loss, _, _ = sess.run([loss, train_step_z, train_step_y], feed_dict=feed_dict)
- phi_guess = sess.run(output)
- guess_im = imgrid(imconvert_uint8(phi_guess), cols=1)
- imwrite(join(app_cfg.DIR_OUTPUTS, fp_frames, 'frame_{:04d}.png'.format(i)), guess_im)
if i % 20 == 0:
+ phi_guess = sess.run(output)
+ guess_im = imgrid(imconvert_uint8(phi_guess), cols=1)
+ imwrite(join(app_cfg.DIR_OUTPUTS, fp_frames, 'frame_{:04d}.png'.format(i)), guess_im)
print('iter: {}, loss: {}'.format(i, curr_loss))
except KeyboardInterrupt:
pass