-
Notifications
You must be signed in to change notification settings - Fork 0
/
transform_video.py
57 lines (43 loc) · 1.94 KB
/
transform_video.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from __future__ import print_function
from argparse import ArgumentParser
import sys
sys.path.insert(0, 'src')
import os, random, subprocess, evaluate, shutil
from utils import exists, list_files
import pdb
TMP_DIR = '.fns_frames_%s/' % random.randint(0,99999)
DEVICE = '/gpu:0'
BATCH_SIZE = 4
def build_parser():
parser = ArgumentParser()
parser.add_argument('--checkpoint', type=str,
dest='checkpoint', help='checkpoint directory or .ckpt file',
metavar='CHECKPOINT', required=True)
parser.add_argument('--in-path', type=str,
dest='in_path', help='in video path',
metavar='IN_PATH', required=True)
parser.add_argument('--out-path', type=str,
dest='out', help='path to save processed video to',
metavar='OUT', required=True)
parser.add_argument('--tmp-dir', type=str, dest='tmp_dir',
help='tmp dir for processing', metavar='TMP_DIR',
default=TMP_DIR)
parser.add_argument('--device', type=str, dest='device',
help='device for eval. CPU discouraged. ex: \'/gpu:0\'',
metavar='DEVICE', default=DEVICE)
parser.add_argument('--batch-size', type=int,
dest='batch_size',help='batch size for eval. default 4.',
metavar='BATCH_SIZE', default=BATCH_SIZE)
parser.add_argument('--no-disk', type=bool, dest='no_disk',
help='Don\'t save intermediate files to disk. Default False',
metavar='NO_DISK', default=False)
return parser
def check_opts(opts):
exists(opts.checkpoint)
exists(opts.out)
def main():
parser = build_parser()
opts = parser.parse_args()
evaluate.ffwd_video(opts.in_path, opts.out, opts.checkpoint, opts.device, opts.batch_size)
if __name__ == '__main__':
main()