summaryrefslogtreecommitdiff
path: root/cli/app/commands
diff options
context:
space:
mode:
Diffstat (limited to 'cli/app/commands')
-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