Update app.py
Browse files
app.py
CHANGED
@@ -17,6 +17,18 @@ LABEL_MAPS = {
|
|
17 |
'UCF' : UCF_label_map
|
18 |
}
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
def tube_mask_generator(mask_ratio):
|
21 |
window_size = (
|
22 |
num_frames // 2,
|
@@ -58,10 +70,6 @@ def get_model(model_type):
|
|
58 |
|
59 |
|
60 |
def inference(video_file, model_type, mask_ratio):
|
61 |
-
print(video_file)
|
62 |
-
print(model_type)
|
63 |
-
print(mask_ratio)
|
64 |
-
print('---------------')
|
65 |
# get sample data
|
66 |
container = read_video(video_file)
|
67 |
frames = frame_sampling(container, num_frames=num_frames)
|
@@ -101,20 +109,6 @@ def inference(video_file, model_type, mask_ratio):
|
|
101 |
|
102 |
|
103 |
def main():
|
104 |
-
datasets = ['K400', 'SSv2', 'UCF']
|
105 |
-
|
106 |
-
ALL_MODELS = [
|
107 |
-
'TFVideoMAE_L_K400_16x224',
|
108 |
-
'TFVideoMAE_B_SSv2_16x224',
|
109 |
-
'TFVideoMAE_B_UCF_16x224',
|
110 |
-
]
|
111 |
-
|
112 |
-
sample_example = [
|
113 |
-
["examples/k400.mp4", ALL_MODELS[0], 0.9],
|
114 |
-
["examples/ssv2.webm", ALL_MODELS[1], 0.8],
|
115 |
-
["examples/ucf.mp4", ALL_MODELS[2], 0.7],
|
116 |
-
]
|
117 |
-
|
118 |
iface = gr.Interface(
|
119 |
fn=inference,
|
120 |
inputs=[
|
@@ -124,12 +118,6 @@ def main():
|
|
124 |
value="TFVideoMAE_S_K400_16x224",
|
125 |
label="Model"
|
126 |
),
|
127 |
-
# gr.Radio(
|
128 |
-
# datasets,
|
129 |
-
# type='value',
|
130 |
-
# default=datasets[0],
|
131 |
-
# label='Dataset',
|
132 |
-
# ),
|
133 |
gr.Slider(
|
134 |
0.5,
|
135 |
1.0,
|
|
|
17 |
'UCF' : UCF_label_map
|
18 |
}
|
19 |
|
20 |
+
ALL_MODELS = [
|
21 |
+
'TFVideoMAE_L_K400_16x224',
|
22 |
+
'TFVideoMAE_B_SSv2_16x224',
|
23 |
+
'TFVideoMAE_B_UCF_16x224',
|
24 |
+
]
|
25 |
+
|
26 |
+
sample_example = [
|
27 |
+
["examples/k400.mp4", ALL_MODELS[0], 0.9],
|
28 |
+
["examples/ssv2.avi", ALL_MODELS[1], 0.8],
|
29 |
+
["examples/ucf.mp4", ALL_MODELS[2], 0.7],
|
30 |
+
]
|
31 |
+
|
32 |
def tube_mask_generator(mask_ratio):
|
33 |
window_size = (
|
34 |
num_frames // 2,
|
|
|
70 |
|
71 |
|
72 |
def inference(video_file, model_type, mask_ratio):
|
|
|
|
|
|
|
|
|
73 |
# get sample data
|
74 |
container = read_video(video_file)
|
75 |
frames = frame_sampling(container, num_frames=num_frames)
|
|
|
109 |
|
110 |
|
111 |
def main():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
iface = gr.Interface(
|
113 |
fn=inference,
|
114 |
inputs=[
|
|
|
118 |
value="TFVideoMAE_S_K400_16x224",
|
119 |
label="Model"
|
120 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
gr.Slider(
|
122 |
0.5,
|
123 |
1.0,
|