nam_nguyenhoai_AI
commited on
Commit
·
7cb8f79
1
Parent(s):
9a26245
fix bug
Browse files
app.py
CHANGED
@@ -86,17 +86,17 @@ def make_video(video_path, outdir='./summarized_video',encoder='Kmeans'):
|
|
86 |
if i % num_frames*50 == 0:
|
87 |
print(f"Loading {i}/{len(final_key_frames)}")
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
|
97 |
number_of_clusters = round(len(features)*0.15)
|
98 |
|
99 |
-
print("Number of frames: ", len(
|
100 |
print("Shape of each frame: ", frames[0].shape)
|
101 |
print("Number of features: ", len(features))
|
102 |
print("Shape of each feature: ", features[0].shape)
|
|
|
86 |
if i % num_frames*50 == 0:
|
87 |
print(f"Loading {i}/{len(final_key_frames)}")
|
88 |
|
89 |
+
# Input clip to the model
|
90 |
+
input_frames = final_key_frames[i:i+num_frames]
|
91 |
+
# Extract features
|
92 |
+
batch_features = extract_features(input_frames, device, model, processor)
|
93 |
+
# Convert to numpy array to decrease the memory usage
|
94 |
+
batch_features = np.array(batch_features.cpu().detach().numpy())
|
95 |
+
features.extend(batch_features)
|
96 |
|
97 |
number_of_clusters = round(len(features)*0.15)
|
98 |
|
99 |
+
print("Number of frames: ", len(final_key_frames))
|
100 |
print("Shape of each frame: ", frames[0].shape)
|
101 |
print("Number of features: ", len(features))
|
102 |
print("Shape of each feature: ", features[0].shape)
|