From 21bb879e00eea74a5df9e703749b8cfa20ec1732 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 9 Jan 2020 13:16:51 +0100 Subject: video --- cli/app/search/search_class.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'cli/app/search/search_class.py') 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) -- cgit v1.2.3-70-g09d2