Adapted code for obfuscation check

This commit is contained in:
2025-08-04 16:47:34 +02:00
parent fa5183b775
commit afb05ecc78
72 changed files with 295 additions and 46 deletions
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 847 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Before

Width:  |  Height:  |  Size: 847 B

After

Width:  |  Height:  |  Size: 847 B

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.
+4 -4
View File
@@ -24,12 +24,12 @@ class Config:
pose_model_type="models/yolo11m-pose.pt" #"models/yolo11x-pose.pt"
face_model_type="yunet" # "retinaface"
evaluation_results_directory = "evaluation_results/"
visual_results_directory = "visual_results/"
evaluation_results_directory = "evaluation_results/evaluation_results_99_with_correct_acc_deid/"
visual_results_directory = "visual_results/visual_results_99_with_correct_acc_deid/"
verbose=True
dataset_names = ["celeba", "wider", "utk"]
dataset_names = ["celeba", "wider"]#, "utk"]
tasks = {"preprocessing": False, # optional if already done
"obfuscation": False, # optional if already done
@@ -38,7 +38,7 @@ class Config:
"visualize": True #Should be always true, since it is the last step for reasoning
}
bbox_matching_iou = 0.5
bbox_matching_iou = 0.99
#DEBUG
+16 -14
View File
@@ -63,17 +63,18 @@ def main():
after_dataset_path = os.path.join(Config.obfuscated_output_directory, after_dataset_name)
#For each technique, compare the datasets
for technique_name in os.listdir(after_dataset_path):
technique_path = os.path.join(after_dataset_path, technique_name)
current_technique_results_directory = os.path.join(Config.evaluation_results_directory, f"results_{before_dataset_name}_{technique_name}.json")
if os.path.exists(current_technique_results_directory):
print(f"Results for {before_dataset_name} with {technique_name} obfuscation already exist, skipping")
continue
print(f"Comparing {before_dataset_name} with {technique_name} obfuscation")
technique_result_dict = comparator.compare_with_before_and_after_folder(before_dataset_path, technique_path)
#Save results in evaluation_results_directory as json
print(f"Saving results in {current_technique_results_directory}")
with open(current_technique_results_directory, "w") as f:
json.dump(technique_result_dict, f, indent=4)
if technique_name != "NO_OP":
technique_path = os.path.join(after_dataset_path, technique_name)
current_technique_results_directory = os.path.join(Config.evaluation_results_directory, f"results_{before_dataset_name}_{technique_name}.json")
if os.path.exists(current_technique_results_directory):
print(f"Results for {before_dataset_name} with {technique_name} obfuscation already exist, skipping")
continue
print(f"Comparing {before_dataset_name} with {technique_name} obfuscation")
technique_result_dict = comparator.compare_with_before_and_after_folder(before_dataset_path, technique_path)
#Save results in evaluation_results_directory as json
print(f"Saving results in {current_technique_results_directory}")
with open(current_technique_results_directory, "w") as f:
json.dump(technique_result_dict, f, indent=4)
if Config.tasks["visualize"]:
print("5. Running visualization")
@@ -105,12 +106,13 @@ def main():
#TODO: Kombinierter Ansatz, vllt besser.
#Erzeuge Gesicht mit passenden Gesichtszügen. Passe es nochmal an.
#TODO: Die ACCde-id anpassen; Problem, es wird identität geprüft, wenn gesichter gematcht werden. Hier ist aber wichtig, dass man das prinzipiell prüft, auf basis der ursprungs Bbox des gesichts.
#SOME IDEAS:
#TODO: Kombinierter Ansatz, vllt besser -->Erzeuge Gesicht mit passenden Gesichtszügen. Passe es nochmal an.
#TODO größenverteilung auch berechnen nicht nur position
#TODO: Global semantic description? Als zusätzliches Ding?
#TODO: "Make unknown faces happy"
# Inputgesicht so optimieren dass emotion besser wird und verschleierung, N-iterationen, Techniken, Parameter anpassen, ...
# !!Idee iterativer generic issue solver? Ein kernel der Bildbasiert-die nutzbarkeit optimiert!!@BA?
+24 -22
View File
@@ -266,19 +266,16 @@ def compute_scores(folder_result_dict):
scores = {
"person": {
"\mathrm{Acc}_\mathrm{det}": (folder_result_dict["found_matching_persons_count"] / folder_result_dict["before_person_count"]) * 100.0,
"\mathrm{mIoU}_\mathrm{seg}": np.mean(folder_result_dict["person_segment_ious"]) if len(folder_result_dict["person_segment_ious"]) > 0 else 0.0,
"\mathrm{Sim}_\mathrm{kp}": np.mean(folder_result_dict["person_keypoint_position_similarities"]) if len(folder_result_dict["person_keypoint_position_similarities"]) > 0 else 0.0,
"\mathrm{mIoU}_\mathrm{seg}": np.mean(folder_result_dict["person_segment_ious"]) if len(folder_result_dict["person_segment_ious"]) > 0 else 0.0
},
"face": {
"\mathrm{Acc}_\mathrm{det}": (folder_result_dict["found_face_count"] / folder_result_dict["before_person_count"]) * 100.0,
"\mathrm{mIoU}_\mathrm{seg}": np.mean(folder_result_dict["face_segment_ious"]) if len(folder_result_dict["face_segment_ious"]) > 0 else 0.0,
"\mathrm{Acc}_\mathrm{emo}": (folder_result_dict["same_emotion_count"] / folder_result_dict["found_face_count"]) * 100.0 if folder_result_dict["found_face_count"] > 0 else 0.0,
"\mathrm{Acc}_\mathrm{deID}": (1.0 - (folder_result_dict["same_person_counter"] / folder_result_dict["found_face_count"])) * 100.0 if folder_result_dict["found_face_count"] > 0 else 100.0,
"\mathrm{Acc}_\mathrm{deID}": (1.0 - (folder_result_dict["same_person_counter"] / folder_result_dict["before_person_count"])) * 100.0 if folder_result_dict["found_face_count"] > 0 else 100.0
},
"object": {
"\mathrm{Acc}_\mathrm{det}": (folder_result_dict["found_matching_objects_count"] / folder_result_dict["before_object_count"]) * 100.0,
"\mathrm{mIoU}_\mathrm{seg}": np.mean(folder_result_dict["object_segment_ious"]) if len(folder_result_dict["object_segment_ious"]) > 0 else 0.0,
"\mathrm{Acc}_\mathrm{cls}": (folder_result_dict["found_matching_classes_count"] / folder_result_dict["before_object_count"]) * 100.0
"\mathrm{mIoU}_\mathrm{seg}": np.mean(folder_result_dict["object_segment_ious"]) if len(folder_result_dict["object_segment_ious"]) > 0 else 0.0
},
"meta": {
"person": {
@@ -287,7 +284,7 @@ def compute_scores(folder_result_dict):
"len_person_bbox_ious": len(folder_result_dict["person_bbox_ious"]),
"len_person_segment_ious": len(folder_result_dict["person_segment_ious"]),
"len_person_keypoint_accuracies": len(folder_result_dict["person_keypoint_accuracies"]),
"len_person_keypoint_position_similarities": len(folder_result_dict["person_keypoint_position_similarities"]),
"len_person_keypoint_position_similarities": len(folder_result_dict["person_keypoint_position_similarities"])
},
"face": {
"face_found_count": folder_result_dict["found_face_count"],
@@ -296,7 +293,7 @@ def compute_scores(folder_result_dict):
"len_emotion_vector_similarities": len(folder_result_dict["emotion_vector_similarities"]),
"same_person_counter": folder_result_dict["same_person_counter"],
"len_identity_distances": len(folder_result_dict["identity_distances"]),
"len_face_keypoint_position_similarities": len(folder_result_dict["face_keypoint_position_similarities"]),
"len_face_keypoint_position_similarities": len(folder_result_dict["face_keypoint_position_similarities"])
},
"object": {
"found_matching_objects_count": folder_result_dict["found_matching_objects_count"],
@@ -307,13 +304,16 @@ def compute_scores(folder_result_dict):
}
},
"other": {
"person_bbox_iou_avg": np.mean(folder_result_dict["person_bbox_ious"]) if len(folder_result_dict["person_bbox_ious"]) > 0 else 0.0,###
"person_keypoint_accuracy_avg": np.mean(folder_result_dict["person_keypoint_accuracies"]) if len(folder_result_dict["person_keypoint_accuracies"]) > 0 else 0.0,###
"face_bbox_iou_avg": np.mean(folder_result_dict["face_bbox_ious"]) if len(folder_result_dict["face_bbox_ious"]) > 0 else 0.0,###
"emotion_vector_similarity_avg": np.mean(folder_result_dict["emotion_vector_similarities"]) if len(folder_result_dict["emotion_vector_similarities"]) > 0 else 0.0,###
"identity_distance_avg": np.mean(folder_result_dict["identity_distances"]) if len(folder_result_dict["identity_distances"]) > 0 else 100.0,###
"\mathrm{Acc}_\mathrm{cls}": (folder_result_dict["found_matching_classes_count"] / folder_result_dict["before_object_count"]) * 100.0,
"\mathrm{Acc}_\mathrm{emo}": (folder_result_dict["same_emotion_count"] / folder_result_dict["found_face_count"]) * 100.0 if folder_result_dict["found_face_count"] > 0 else 0.0,
"\mathrm{Sim}_\mathrm{kp}": np.mean(folder_result_dict["person_keypoint_position_similarities"]) if len(folder_result_dict["person_keypoint_position_similarities"]) > 0 else 0.0,
"person_bbox_iou_avg": np.mean(folder_result_dict["person_bbox_ious"]) if len(folder_result_dict["person_bbox_ious"]) > 0 else 0.0,
"person_keypoint_accuracy_avg": np.mean(folder_result_dict["person_keypoint_accuracies"]) if len(folder_result_dict["person_keypoint_accuracies"]) > 0 else 0.0,
"face_bbox_iou_avg": np.mean(folder_result_dict["face_bbox_ious"]) if len(folder_result_dict["face_bbox_ious"]) > 0 else 0.0,
"emotion_vector_similarity_avg": np.mean(folder_result_dict["emotion_vector_similarities"]) if len(folder_result_dict["emotion_vector_similarities"]) > 0 else 0.0,
"identity_distance_avg": np.mean(folder_result_dict["identity_distances"]) if len(folder_result_dict["identity_distances"]) > 0 else 100.0,
"face_keypoint_position_similarity_avg": np.mean(folder_result_dict["face_keypoint_position_similarities"]) if len(folder_result_dict["face_keypoint_position_similarities"]) > 0 else 0.0,
"object_bbox_iou_avg": np.mean(folder_result_dict["object_bbox_ious"]) if len(folder_result_dict["object_bbox_ious"]) > 0 else 0.0###
"object_bbox_iou_avg": np.mean(folder_result_dict["object_bbox_ious"]) if len(folder_result_dict["object_bbox_ious"]) > 0 else 0.0
}
}
return scores
@@ -559,14 +559,6 @@ class Comparator:
if is_emotion_matching:
same_emotion_count += 1
emotion_vector_similarities.append(_emotion_cosine_similarity(before_person["emotion_vector"], after_person["emotion_vector"]))
before_face_crop = before_img[before_person["face_bbox"][1]:before_person["face_bbox"][3], before_person["face_bbox"][0]:before_person["face_bbox"][2]]
after_face_crop = after_img[after_person["face_bbox"][1]:after_person["face_bbox"][3], after_person["face_bbox"][0]:after_person["face_bbox"][2]]
face_verified, identity_distance = _match_persons(before_face_crop, after_face_crop)
if face_verified:
same_person_counter += 1
identity_distances.append(identity_distance)
_, face_point_position_similarities = _compute_face_keypoint_similarity(before_person["face_keypoints"], after_person["face_keypoints"], before_person["face_bbox"], after_person["face_bbox"])
face_keypoint_position_similarities.extend(face_point_position_similarities)
@@ -582,6 +574,16 @@ class Comparator:
if before_object["label"] == after_object["label"]:
found_matching_classes_count += 1
#For Each Before-Person; Check identifitcation
for before_person in before_meta["persons"]:
before_face_crop = before_img[before_person["face_bbox"][1]:before_person["face_bbox"][3], before_person["face_bbox"][0]:before_person["face_bbox"][2]]
after_face_crop = after_img[before_person["face_bbox"][1]:before_person["face_bbox"][3], before_person["face_bbox"][0]:before_person["face_bbox"][2]]
face_verified, identity_distance = _match_persons(before_face_crop, after_face_crop)
if face_verified:
same_person_counter += 1
identity_distances.append(identity_distance)
image_insights = {
"found_matching_persons_count": found_matching_persons_count,
"before_person_count": before_person_count,
+8 -6
View File
@@ -14,7 +14,7 @@ class Visualizer:
_PTN = re.compile(r"results_(?P<dataset>[^_]+)_(?P<technique>[^.]+)\.json$")
def __init__(self, json_dir: str | Path):
def __init__(self, json_dir):
self.json_dir = Path(json_dir)
if not self.json_dir.exists():
raise FileNotFoundError(self.json_dir)
@@ -59,6 +59,7 @@ class Visualizer:
"""
sub = self.df[(self.df["dataset"] == dataset) &
(self.df["category"] == category)]
if sub.empty:
print(f"[⚠] Kein Eintrag für Dataset={dataset}, Cat={category}")
return
@@ -146,11 +147,12 @@ class Visualizer:
for cat, metrics in data.items():
for metric, val in metrics.items():
recs.append({"dataset": dataset,
"technique": tech,
"category": cat,
"metric": metric,
"value": val})
if cat == "face" and metric == "\mathrm{Acc}_\mathrm{deID}" and tech != "NO_OP": #TODO: This is just for a single bar chart, i can remove this if statement
recs.append({"dataset": dataset,
"technique": tech,
"category": cat,
"metric": metric,
"value": val})
if not recs:
raise RuntimeError("Keine passenden JSON-Dateien gefunden.")
return pd.DataFrame.from_records(recs)
+243
View File
@@ -0,0 +1,243 @@
#!/usr/bin/env python3
import argparse
import json
import math
import os
import re
from collections import defaultdict
from pathlib import Path
import itertools
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
FOLDER_PATTERN = re.compile(r"^evaluation_results_(\d+)$")
# Map LaTeX-like metric keys used in JSON to friendly names
METRIC_KEY_MAP = {
r"\mathrm{Acc}_\mathrm{det}": "Acc_det",
r"\mathrm{mIoU}_\mathrm{seg}": "mIoU_seg",
}
# Labels to show on the Y axis (mathtext/LaTeX style)
METRIC_LABELS_MATH = {
"Acc_det": r"$\mathrm{Acc}_{\mathrm{det}}$",
"mIoU_seg": r"$\mathrm{mIoU}_{\mathrm{seg}}$",
}
ALL_SCOPES = ["person", "face", "object"]
ALL_METRICS = ["Acc_det", "mIoU_seg"]
# Distinct markers to differentiate techniques (in addition to color)
MARKER_STYLES = ['o', 'x', 's', '^', 'D', 'P', '*', 'v', 'X', '+', '<', '>', 'h', 'H', '1', '2', '3', '4', 'p']
def parse_args():
p = argparse.ArgumentParser(description="Visualize metrics across IoU thresholds.")
p.add_argument("--root", type=str, required=True, help="Root directory with evaluation_results_{thr} folders.")
p.add_argument("--out", type=str, default="plots", help="Output directory for figures (PDF).")
p.add_argument("--metric", type=str, choices=["Acc_det", "mIoU_seg", "both"], default="both",
help="Metric to plot. 'both' makes two stacked subplots per figure.")
p.add_argument("--scopes", type=str, nargs="*", default=None,
help="Subset of scopes to include (default: person face object).")
p.add_argument("--dpi", type=int, default=140, help="Figure DPI for rasterized parts in the PDF.")
p.add_argument("--style", type=str, default=None, help="Optional matplotlib style (e.g., 'ggplot').")
return p.parse_args()
def sanitize_filename(s: str) -> str:
# Allow letters, digits, dot, underscore, plus, and hyphen; replace everything else with "_"
# Put "-" at the END of the class so it won't be treated as a range marker.
s = re.sub(r'[^A-Za-z0-9._+\-]+', '_', s)
# Optional cleanup: collapse repeats and trim
s = re.sub(r'_+', '_', s).strip('._ ')
return s
def discover_threshold_folders(root: Path):
thresholds = []
folders = []
for name in os.listdir(root):
m = FOLDER_PATTERN.match(name)
if m:
thr = int(m.group(1))
thresholds.append(thr)
folders.append((thr, root / name))
thresholds = sorted(set(thresholds))
folders.sort(key=lambda x: x[0])
return thresholds, folders
def rsplit_dataset_technique(filename: str):
# Given 'result_{dataset}_{technique}.json' -> (dataset, technique)
if not (filename.startswith("results_") and filename.endswith(".json")):
return None, None
stem = filename[len("results_"):-len(".json")]
if "_" not in stem:
return None, None
dataset, technique = stem.rsplit("_", 1)
return dataset, technique
def load_data(root: Path, scopes_filter=None):
"""
data[dataset][scope][technique][metric][threshold] = value
"""
thresholds, folders = discover_threshold_folders(root)
data = defaultdict( # dataset
lambda: defaultdict( # scope
lambda: defaultdict( # technique
lambda: defaultdict(dict) # metric -> {thr: value}
)
)
)
for thr, folder in folders:
for fname in os.listdir(folder):
dataset, technique = rsplit_dataset_technique(fname)
if not dataset or not technique:
continue
fpath = folder / fname
try:
with open(fpath, "r", encoding="utf-8") as f:
obj = json.load(f)
except Exception as e:
print(f"[WARN] Skipping {fpath}: {e}")
continue
for scope in (scopes_filter or ALL_SCOPES):
if scope not in obj or not isinstance(obj[scope], dict):
continue
for raw_key, val in obj[scope].items():
key = METRIC_KEY_MAP.get(raw_key, raw_key)
if key not in ALL_METRICS:
continue
try:
val_num = float(val)
except Exception:
continue
data[dataset][scope][technique][key][thr] = val_num
return thresholds, data
def plot_dataset_scope(thresholds, dataset, scope, techniques_dict, out_dir: Path, dpi=140, style=None, metric_mode="both"):
"""
techniques_dict: techniques_dict[technique][metric][thr] = value
"""
metrics = ALL_METRICS if metric_mode == "both" else [metric_mode]
# Keep only metrics that actually have any data
metrics_present = []
for m in metrics:
present = any(
any(not math.isnan(v) for v in [techniques_dict[t][m].get(thr, float("nan")) for thr in thresholds])
for t in techniques_dict.keys()
if m in techniques_dict[t]
)
if present:
metrics_present.append(m)
if not metrics_present:
return False
if style:
try:
plt.style.use(style)
except Exception as e:
print(f"[WARN] Could not set style '{style}': {e}")
# Create figure/axes
if len(metrics_present) == 1:
fig, ax = plt.subplots(figsize=(5, 5))
axes = [ax] # list for uniform handling
else:
fig, axes = plt.subplots(
nrows=len(metrics_present),
ncols=1,
figsize=(8, 5 * len(metrics_present)),
sharex=True
)
axes = list(axes)
# Assign a distinct marker per technique (consistent across subplots)
marker_cycle = itertools.cycle(MARKER_STYLES)
markers_by_tech = {tech: next(marker_cycle) for tech in sorted(techniques_dict.keys())}
for ax, metric in zip(axes, metrics_present):
any_line = False
for technique, metric_dicts in sorted(techniques_dict.items()):
metric_values_by_thr = metric_dicts.get(metric, {})
ys = [metric_values_by_thr.get(thr, float("nan")) for thr in thresholds]
if any(not math.isnan(v) for v in ys):
ax.plot(
thresholds,
ys,
marker=markers_by_tech[technique],
linestyle="-",
label=technique,
)
any_line = True
# Axis formatting
#ax.set_title(f"{dataset} – {scope} – {metric}")
ax.set_ylim(0, 105) # 0–100%
# Y ticks as percentages
ax.yaxis.set_major_formatter(FuncFormatter(lambda y, _: f"{y:.0f}%"))
# X ticks as percentages (thresholds like 25 -> "25%")
ax.set_xticks(thresholds)
ax.set_xticklabels([f"{thr}%" for thr in thresholds])
# Labels: x in %, y is the LaTeX metric name
ax.set_xlabel("IoU threshold (%)")
ax.set_ylabel(METRIC_LABELS_MATH.get(metric, metric))
ax.grid(True, linestyle="--", alpha=0.4)
if any_line:
ax.legend(loc="lower left")
#fig.suptitle(f"{dataset} • {scope}", y=0.995, fontsize=12)
fig.tight_layout()
outfile = out_dir / sanitize_filename(f"{dataset}__{scope}__{metric_mode}.pdf")
fig.savefig(outfile, dpi=dpi, bbox_inches="tight")
plt.close(fig)
print(f"[OK] Saved {outfile}")
return True
def main():
args = parse_args()
root = Path(args.root).expanduser().resolve()
out_dir = Path(args.out).expanduser().resolve()
out_dir.mkdir(parents=True, exist_ok=True)
scopes_filter = args.scopes if args.scopes else ALL_SCOPES
thresholds, data = load_data(root, scopes_filter=scopes_filter)
if not thresholds:
print("[ERROR] No evaluation_results_{thr} folders found.")
return
made_any = False
for dataset, scopes in sorted(data.items()):
for scope, techniques in sorted(scopes.items()):
if not techniques:
continue
ok = plot_dataset_scope(
thresholds=thresholds,
dataset=dataset,
scope=scope,
techniques_dict=techniques,
out_dir=out_dir,
dpi=args.dpi,
style=args.style,
metric_mode=args.metric,
)
made_any = made_any or ok
if not made_any:
print("[WARN] No plots generated. Check your JSON naming/contents.")
if __name__ == "__main__":
main()