-
Notifications
You must be signed in to change notification settings - Fork 1
/
find_fps.py
103 lines (78 loc) · 2.14 KB
/
find_fps.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#LockHands=['getting a tattoo',
#'making jewelry',
#'bottling',
#'picking fruit',
#'mushroom foraging']
#Touchear=['tying necktie',
#'tying bow tie',
#'massaging neck',
#'playing trombone',
#'playing trumpet',
#'playing ocarina']
#Touchhead=["shaving head",
#"combing hair",
#"blowdrying hair",
#"massaging person's head",
#"washing hair",
#"dyeing hair",
#"curling hair",
#"ironing hair"]
#Touchnose=[
#'eating chips',
#'putting on lipstick',
#'blowing nose',
#'brushing teeth',
#'putting on foundation',
#'smoking pipe']
#Move_the_table=['riding snow blower',
#'sanding floor',
#'mopping floor',
#'pushing car',
#'pushing wheelbarrow']
#Rolly_Polly=['playing hand clapping games',
#'juggling balls',
#'juggling fire',
#'front raises',
#'clapping']
#Arms_Up=['clean and jerk',
#'standing on hands',
#'roller skating',
#'jumping jacks',
#'high jump']
#Tapping=['playing keyboard',
#'tapping guitar',
#'playing lute',
#'playing drums',
#'tapping pen']
Move_the_table=['riding a bike']
Touchear=['playing ice hockey']
LockHands=['playing trombone']
Touchhead=['skydiving']
Touchnose=['putting on eyeliner']
Rolly_Polly=['playing hand clapping games']
Tapping=['playing drums']
Arms_Up=['cartwheeling']
kin_classes =[Move_the_table,Touchear,LockHands,Touchhead,Touchnose,Rolly_Polly,Tapping, Arms_Up]
import pickle
import os
import numpy as np
from random import shuffle
import cv2
#traindata = pickle.load( open( "/DATA/crossval5_8/f_train0.p", "rb" ) )
#labeldata = pickle.load( open( "/DATA/crossval5_8/l_train0.p", "rb" ) )
traindata={}
labeldata=[]
i=0
for folder in kin_classes:
for fld in folder:
for file in os.listdir("/DATA/kin600/kin_600_armax_all_data_200samples/"+fld):
file= file.split('.')[0]+'.mp4'
x = "/DATA/kin600/kin_600_armax_all_data_200samples/"+fld+'/'+file
cap = cv2.VideoCapture(x)
current_framerate = cap.get(5)
nframes = cap.get(7)
x = os.path.basename(x).split('.')[0]
traindata[x]= [current_framerate,nframes]
cap.release()
pickle.dump(traindata, open("/DATA/keras-kinetics-i3d/fps.p", "wb"))
print("data created ")