Skip to content

Commit

Permalink
Expose a few more parameters to video test demo.
Browse files Browse the repository at this point in the history
  • Loading branch information
radekd91 committed Apr 21, 2022
1 parent ae4f1d4 commit 700b30f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
10 changes: 7 additions & 3 deletions gdl/datasets/FaceVideoDataModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,9 +874,13 @@ def _gather_video_metadata(self):
self.video_metas = []
for vi, vid_file in enumerate(tqdm(self.video_list)):
vid = ffmpeg.probe(str( Path(self.root_dir) / vid_file))
codec_idx = [idx for idx in range(len(vid)) if vid['streams'][idx]['codec_type'] == 'video']
if len(codec_idx) > 1:
raise RuntimeError("Video file has two video streams! '%s'" % str(vid_file))
# codec_idx = [idx for idx in range(len(vid)) if vid['streams'][idx]['codec_type'] == 'video']
codec_idx = [idx for idx in range(len(vid)) if vid['streams'][0]['codec_type'] == 'video']
if len(codec_idx) == 0:
raise RuntimeError("Video file has no video streams! '%s'" % str(vid_file))
# if len(codec_idx) > 1:
# raise RuntimeError("Video file has two video streams! '%s'" % str(vid_file))
print("[WARNING] Video file has %d video streams. Only the first one will be processed" % len(codec_idx))
codec_idx = codec_idx[0]
vid_info = vid['streams'][codec_idx]
vid_meta = {}
Expand Down
15 changes: 11 additions & 4 deletions gdl_apps/EMOCA/demos/test_emoca_on_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,21 @@ def main():
parser.add_argument('--processed_subfolder', type=str, default=None,
help="If you want to resume previously interrupted computation over a video, make sure you specify" \
"the subfolder where the got unpacked. It will be in format 'processed_%Y_%b_%d_%H-%M-%S'")
parser.add_argument('--cat_dim', type=int, default=0,
help="The result video will be concatenated vertically if 0 and horizontally if 1")
parser.add_argument('--include_transparent', type=bool, default=False,
help="Apart from the reconstruction video, also a video with the transparent mesh will be added")
args = parser.parse_args()

print("Path to models " + args.path_to_models)
path_to_models = args.path_to_models
input_video = args.input_video
output_folder = args.output_folder
model_name = args.model_name
image_type = args.image_type
# processed_subfolder = args.processed_subfolder
processed_subfolder = "processed_2022_Jan_15_15-03-37"
cat_dim = args.cat_dim
include_transparent = bool(args.include_transparent)
print("Include transparent:", include_transparent)
processed_subfolder = args.processed_subfolder

mode = 'detail'
# mode = 'coarse'
Expand Down Expand Up @@ -96,7 +102,8 @@ def main():
save_codes(Path(outfolder), name, vals, i)

## 5) Create the reconstruction video (reconstructions overlayed on the original video)
dm.create_reconstruction_video(0, rec_method=model_name, image_type=image_type, overwrite=True)
dm.create_reconstruction_video(0, rec_method=model_name, image_type=image_type, overwrite=True,
cat_dim=cat_dim, include_transparent=include_transparent)
print("Done")


Expand Down

0 comments on commit 700b30f

Please sign in to comment.