Spaces:
Sleeping
Sleeping
Update utils/visualization.py
Browse files- utils/visualization.py +6 -3
utils/visualization.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import matplotlib.pyplot as plt
|
| 2 |
import numpy as np
|
| 3 |
from mpl_toolkits.mplot3d import Axes3D
|
|
@@ -48,12 +49,13 @@ class FactoryVisualizer:
|
|
| 48 |
@staticmethod
|
| 49 |
def plot_class_distribution(detections, save_path):
|
| 50 |
"""๊ฐ์ฒด ๋ถํฌ ์๊ฐํ"""
|
|
|
|
| 51 |
classes = list(detections.keys())
|
| 52 |
-
counts =
|
| 53 |
|
| 54 |
plt.figure(figsize=(10, 6))
|
| 55 |
-
|
| 56 |
-
|
| 57 |
|
| 58 |
plt.ylabel('Detection Count')
|
| 59 |
plt.title('Object Distribution')
|
|
@@ -65,5 +67,6 @@ class FactoryVisualizer:
|
|
| 65 |
f'{height}',
|
| 66 |
ha='center', va='bottom')
|
| 67 |
|
|
|
|
| 68 |
plt.savefig(save_path, bbox_inches='tight')
|
| 69 |
plt.close()
|
|
|
|
| 1 |
+
# utils/visualization.py
|
| 2 |
import matplotlib.pyplot as plt
|
| 3 |
import numpy as np
|
| 4 |
from mpl_toolkits.mplot3d import Axes3D
|
|
|
|
| 49 |
@staticmethod
|
| 50 |
def plot_class_distribution(detections, save_path):
|
| 51 |
"""๊ฐ์ฒด ๋ถํฌ ์๊ฐํ"""
|
| 52 |
+
# ์์ : ์๋ณธ์ list of detections๋ฅผ ๊ธฐ๋ํ์ง๋ง, ์ค์ ์
๋ ฅ์ class: count ๋์
๋๋ฆฌ
|
| 53 |
classes = list(detections.keys())
|
| 54 |
+
counts = list(detections.values())
|
| 55 |
|
| 56 |
plt.figure(figsize=(10, 6))
|
| 57 |
+
colors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFA726']
|
| 58 |
+
bars = plt.bar(classes, counts, color=colors[:len(classes)])
|
| 59 |
|
| 60 |
plt.ylabel('Detection Count')
|
| 61 |
plt.title('Object Distribution')
|
|
|
|
| 67 |
f'{height}',
|
| 68 |
ha='center', va='bottom')
|
| 69 |
|
| 70 |
+
plt.tight_layout()
|
| 71 |
plt.savefig(save_path, bbox_inches='tight')
|
| 72 |
plt.close()
|