-
Notifications
You must be signed in to change notification settings - Fork 155
/
demo_feature.py
executable file
·32 lines (19 loc) · 977 Bytes
/
demo_feature.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
#!/usr/bin/python
#-*- coding: utf-8 -*-
import time, pdb, argparse, subprocess
from SyncNetInstance import *
# ==================== LOAD PARAMS ====================
parser = argparse.ArgumentParser(description = "SyncNet");
parser.add_argument('--initial_model', type=str, default="data/syncnet_v2.model", help='');
parser.add_argument('--batch_size', type=int, default='20', help='');
parser.add_argument('--vshift', type=int, default='15', help='');
parser.add_argument('--videofile', type=str, default="data/example.avi", help='');
parser.add_argument('--tmp_dir', type=str, default="data", help='');
parser.add_argument('--save_as', type=str, default="data/features.pt", help='');
opt = parser.parse_args();
# ==================== RUN EVALUATION ====================
s = SyncNetInstance();
s.loadParameters(opt.initial_model);
print("Model %s loaded."%opt.initial_model);
feats = s.extract_feature(opt, videofile=opt.videofile)
torch.save(feats, opt.save_as)