Spaces:
Runtime error
Runtime error
Update visualization.py
Browse files- visualization.py +3 -3
visualization.py
CHANGED
|
@@ -230,7 +230,7 @@ def create_heatmap(t, mse_embeddings, mse_posture, mse_voice, video_fps, total_f
|
|
| 230 |
combined_mse[1] = mse_posture_norm
|
| 231 |
combined_mse[2] = mse_voice_norm
|
| 232 |
|
| 233 |
-
fig, ax = plt.subplots(figsize=(video_width / 240, 0.
|
| 234 |
ax.imshow(combined_mse, aspect='auto', cmap='Reds', vmin=0, vmax=1, extent=[0, total_frames, 0, 3])
|
| 235 |
ax.set_yticks([0.5, 1.5, 2.5])
|
| 236 |
ax.set_yticklabels(['Voice', 'Posture', 'Face'], fontsize=7)
|
|
@@ -264,10 +264,10 @@ def create_video_with_heatmap(video_path, df, mse_embeddings, mse_posture, mse_v
|
|
| 264 |
width, height = video.w, video.h
|
| 265 |
total_frames = int(video.duration * video.fps)
|
| 266 |
|
| 267 |
-
# Fill missing MSE values with 0
|
| 268 |
def pad_with_zeros(mse_array, total_frames):
|
| 269 |
if len(mse_array) < total_frames:
|
| 270 |
-
return np.pad(mse_array, (0, total_frames - len(mse_array)), 'constant', constant_values=0)
|
| 271 |
else:
|
| 272 |
return mse_array[:total_frames]
|
| 273 |
|
|
|
|
| 230 |
combined_mse[1] = mse_posture_norm
|
| 231 |
combined_mse[2] = mse_voice_norm
|
| 232 |
|
| 233 |
+
fig, ax = plt.subplots(figsize=(video_width / 240, 0.5))
|
| 234 |
ax.imshow(combined_mse, aspect='auto', cmap='Reds', vmin=0, vmax=1, extent=[0, total_frames, 0, 3])
|
| 235 |
ax.set_yticks([0.5, 1.5, 2.5])
|
| 236 |
ax.set_yticklabels(['Voice', 'Posture', 'Face'], fontsize=7)
|
|
|
|
| 264 |
width, height = video.w, video.h
|
| 265 |
total_frames = int(video.duration * video.fps)
|
| 266 |
|
| 267 |
+
# Fill missing MSE values with 0.001
|
| 268 |
def pad_with_zeros(mse_array, total_frames):
|
| 269 |
if len(mse_array) < total_frames:
|
| 270 |
+
return np.pad(mse_array, (0, total_frames - len(mse_array)), 'constant', constant_values=0.001)
|
| 271 |
else:
|
| 272 |
return mse_array[:total_frames]
|
| 273 |
|