Skip to content

Commit

Permalink
♻️ refactor: plot, scatter
Browse files Browse the repository at this point in the history
  • Loading branch information
Zerohertz committed Dec 24, 2024
1 parent a052400 commit 5f1aea1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions zerohertzLib/monitoring/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ def cpu(
plot(
time_list,
data,
"Time [Sec]",
"CPU Usages [%]",
xlab="Time [Sec]",
ylab="CPU Usages [%]",
ylim=[0, 100],
ncol=2,
title=path,
Expand Down
4 changes: 2 additions & 2 deletions zerohertzLib/monitoring/gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def gpu_usages(
plot(
time_list,
data,
"Time [Sec]",
"GPU Usages [%]",
xlab="Time [Sec]",
ylab="GPU Usages [%]",
ylim=[0, 100],
ncol=2,
title=path,
Expand Down
50 changes: 25 additions & 25 deletions zerohertzLib/vision/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,27 +293,27 @@ def _prc_curve(
precision_per_cls: Dict[str, List[float]],
classes: Set[str],
) -> None:
data = {}
xdata = {}
ydata = {}
if len(classes) == 1:
cls = list(classes)[0]
data["Recall"] = [confidence_per_cls[cls], recall_per_cls[cls]]
data["Precision"] = [
confidence_per_cls[cls],
precision_per_cls[cls],
]
xdata["Recall"] = confidence_per_cls[cls]
ydata["Recall"] = recall_per_cls[cls]
xdata["Precision"] = confidence_per_cls[cls]
ydata["Precision"] = precision_per_cls[cls]
else:
for cls in classes:
data[f"{cls}: Recall"] = [confidence_per_cls[cls], recall_per_cls[cls]]
data[f"{cls}: Precision"] = [
confidence_per_cls[cls],
precision_per_cls[cls],
]
xdata[f"{cls}: Recall"] = confidence_per_cls[cls]
ydata[f"{cls}: Recall"] = recall_per_cls[cls]
xdata[f"{cls}: Precision"] = confidence_per_cls[cls]
ydata[f"{cls}: Precision"] = precision_per_cls[cls]
scatter(
data,
"Confidence",
"Recall & Precision",
[-0.1, 1.1],
[-0.1, 1.1],
xdata,
ydata,
xlab="Confidence",
ylab="Recall & Precision",
xlim=[-0.1, 1.1],
ylim=[-0.1, 1.1],
ncol=2,
title="PRC Curve",
markersize=6,
Expand All @@ -331,11 +331,11 @@ def _pr_curve(
precision.append(precision_)
plot(
recall,
{"": precision},
"Recall",
"Precision",
[-0.1, 1.1],
[-0.1, 1.1],
precision,
xlab="Recall",
ylab="Precision",
xlim=[-0.1, 1.1],
ylim=[-0.1, 1.1],
stacked=True,
title=f"P-R Curve (mAP: {map_:.2f})",
markersize=1,
Expand All @@ -350,10 +350,10 @@ def _pr_curve(
plot(
recall,
{cls: precision},
"Recall",
"Precision",
[-0.1, 1.1],
[-0.1, 1.1],
xlab="Recall",
ylab="Precision",
xlim=[-0.1, 1.1],
ylim=[-0.1, 1.1],
stacked=True,
title=f"P-R Curve (mAP: {map_:.2f})",
markersize=1,
Expand Down

0 comments on commit 5f1aea1

Please sign in to comment.