Spaces:
Runtime error
Runtime error
Update visualization.py
Browse files- visualization.py +22 -1
visualization.py
CHANGED
|
@@ -5,6 +5,7 @@ import pandas as pd
|
|
| 5 |
from matplotlib.patches import Rectangle
|
| 6 |
from utils import seconds_to_timecode
|
| 7 |
from anomaly_detection import determine_anomalies
|
|
|
|
| 8 |
|
| 9 |
def plot_mse(df, mse_values, title, color='navy', time_threshold=3, anomaly_threshold=4):
|
| 10 |
plt.figure(figsize=(16, 8), dpi=400)
|
|
@@ -198,4 +199,24 @@ def plot_posture(df, posture_scores, color='blue', anomaly_threshold=3):
|
|
| 198 |
|
| 199 |
plt.tight_layout()
|
| 200 |
plt.close()
|
| 201 |
-
return fig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
from matplotlib.patches import Rectangle
|
| 6 |
from utils import seconds_to_timecode
|
| 7 |
from anomaly_detection import determine_anomalies
|
| 8 |
+
plt.style.use('seaborn')
|
| 9 |
|
| 10 |
def plot_mse(df, mse_values, title, color='navy', time_threshold=3, anomaly_threshold=4):
|
| 11 |
plt.figure(figsize=(16, 8), dpi=400)
|
|
|
|
| 199 |
|
| 200 |
plt.tight_layout()
|
| 201 |
plt.close()
|
| 202 |
+
return fig
|
| 203 |
+
|
| 204 |
+
def create_kdeplot(df, mse_embeddings, mse_posture):
|
| 205 |
+
plt.figure(figsize=(10, 6), dpi=300)
|
| 206 |
+
df['MSE_Embeddings'] = mse_embeddings
|
| 207 |
+
df['MSE_Posture'] = mse_posture
|
| 208 |
+
sns.kdeplot(data=df, x='MSE_Embeddings', y='MSE_Posture', cmap="YlOrRd", shade=True, cbar=True)
|
| 209 |
+
plt.xlabel('Facial Features MSE')
|
| 210 |
+
plt.ylabel('Body Posture MSE')
|
| 211 |
+
plt.title('KDE Plot of Facial Features vs Body Posture MSE')
|
| 212 |
+
plt.close()
|
| 213 |
+
return plt.gcf()
|
| 214 |
+
|
| 215 |
+
def create_jointplot(df, mse_embeddings, mse_posture):
|
| 216 |
+
plt.figure(figsize=(10, 6), dpi=300)
|
| 217 |
+
df['MSE_Embeddings'] = mse_embeddings
|
| 218 |
+
df['MSE_Posture'] = mse_posture
|
| 219 |
+
joint_plot = sns.jointplot(data=df, x='MSE_Embeddings', y='MSE_Posture', kind='hex', cmap="YlOrRd")
|
| 220 |
+
joint_plot.fig.suptitle('Joint Plot of Facial Features vs Body Posture MSE', y=1.02)
|
| 221 |
+
plt.close()
|
| 222 |
+
return joint_plot.fig
|