summaryrefslogtreecommitdiff
path: root/cli/app/search/search_class.py
diff options
context:
space:
mode:
Diffstat (limited to 'cli/app/search/search_class.py')
-rw-r--r--cli/app/search/search_class.py17
1 files changed, 2 insertions, 15 deletions
diff --git a/cli/app/search/search_class.py b/cli/app/search/search_class.py
index 875bc75..0afa762 100644
--- a/cli/app/search/search_class.py
+++ b/cli/app/search/search_class.py
@@ -23,6 +23,7 @@ from app.search.image import image_to_uint8, imconvert_uint8, imconvert_float32,
imread, imwrite, imgrid, resize_and_crop_image
from app.search.vector import truncated_z_sample, truncated_z_single, \
create_labels, create_labels_uniform
+from app.search.video import export_video
feature_layer_names = {
'1a': "InceptionV3/Conv2d_1a_3x3",
@@ -192,7 +193,7 @@ def find_nearest_vector(sess, generator, opt_fp_in, opt_dims, out_images, out_la
if i > 0:
if opt_stochastic_clipping and (i % opt_clip_interval) == 0 and i < opt_steps * 0.45:
sess.run(clip_latent, { clipped_alpha: (i / opt_steps) ** 2 })
- if opt_label_clipping and (i % opt_clip_interval) == 0:
+ if opt_label_clipping and (i % opt_clip_interval) == 0 and i < opt_steps * 0.75:
sess.run(clip_labels, { normalized_alpha: (i / opt_steps) ** 2 })
if opt_video and opt_snapshot_interval != 0 and (i % opt_snapshot_interval) == 0:
phi_guess = sess.run(output)
@@ -211,20 +212,6 @@ def find_nearest_vector(sess, generator, opt_fp_in, opt_dims, out_images, out_la
out_latent[index] = z_guess
return fp_frames
-def export_video(fp_frames):
- print("Exporting video...")
- cmd = [
- '/home/lens/bin/ffmpeg',
- '-y', # '-v', 'quiet',
- '-r', '30',
- '-i', join(app_cfg.DIR_OUTPUTS, fp_frames, 'frame_%04d.png'),
- '-pix_fmt', 'yuv420p',
- join(app_cfg.DIR_OUTPUTS, fp_frames + '.mp4')
- ]
- # print(' '.join(cmd))
- call(cmd)
- shutil.rmtree(join(app_cfg.DIR_OUTPUTS, fp_frames))
-
def load_target_image(opt_fp_in):
print("Loading {}".format(opt_fp_in))
fn = os.path.basename(opt_fp_in)