diff --git a/paper/figures/System Overview/ChatGPT Image 23. Juli 2025, 14_36_44.png b/paper/figures/System Overview/ChatGPT Image 23. Juli 2025, 14_36_44.png new file mode 100644 index 0000000..e1afc8a Binary files /dev/null and b/paper/figures/System Overview/ChatGPT Image 23. Juli 2025, 14_36_44.png differ diff --git a/paper/figures/System Overview/Overview.pptx b/paper/figures/System Overview/Overview.pptx new file mode 100644 index 0000000..b1eb495 Binary files /dev/null and b/paper/figures/System Overview/Overview.pptx differ diff --git a/paper/figures/System Overview/overview.pdf b/paper/figures/System Overview/overview.pdf new file mode 100644 index 0000000..ff66d64 Binary files /dev/null and b/paper/figures/System Overview/overview.pdf differ diff --git a/paper/figures/System Overview/overview.png b/paper/figures/System Overview/overview.png new file mode 100644 index 0000000..663c210 Binary files /dev/null and b/paper/figures/System Overview/overview.png differ diff --git a/paper/figures/System Overview/person_A.png b/paper/figures/System Overview/person_A.png new file mode 100644 index 0000000..7f2cc34 Binary files /dev/null and b/paper/figures/System Overview/person_A.png differ diff --git a/paper/figures/System Overview/person_B.png b/paper/figures/System Overview/person_B.png new file mode 100644 index 0000000..e3a6cf7 Binary files /dev/null and b/paper/figures/System Overview/person_B.png differ diff --git a/paper/figures/System Overview/person_C.png b/paper/figures/System Overview/person_C.png new file mode 100644 index 0000000..9068315 Binary files /dev/null and b/paper/figures/System Overview/person_C.png differ diff --git a/paper/figures/System Overview/person_D.png b/paper/figures/System Overview/person_D.png new file mode 100644 index 0000000..83434d7 Binary files /dev/null and b/paper/figures/System Overview/person_D.png differ diff --git a/paper/figures/System Overview/persons.png b/paper/figures/System Overview/persons.png new file mode 100644 index 0000000..e1afc8a Binary files /dev/null and b/paper/figures/System Overview/persons.png differ diff --git a/project/__pycache__/config.cpython-310.pyc b/project/__pycache__/config.cpython-310.pyc index a236a91..e325b7a 100644 Binary files a/project/__pycache__/config.cpython-310.pyc and b/project/__pycache__/config.cpython-310.pyc differ diff --git a/project/__pycache__/image_preprocessor.cpython-310.pyc b/project/__pycache__/image_preprocessor.cpython-310.pyc index ea60cb7..7fc1f97 100644 Binary files a/project/__pycache__/image_preprocessor.cpython-310.pyc and b/project/__pycache__/image_preprocessor.cpython-310.pyc differ diff --git a/project/config.py b/project/config.py index b06d6fd..0566f7f 100644 --- a/project/config.py +++ b/project/config.py @@ -28,10 +28,10 @@ class Config: verbose=True - tasks = {"preprocessing": False, # optional if already done - "obfuscation": False, # optional if already done - "post_extract": False, # optional if already done - "analysis": False, # optional if already done + tasks = {"preprocessing": True, # optional if already done + "obfuscation": True, # optional if already done + "post_extract": True, # optional if already done + "analysis": True, # optional if already done "visualize": True #Should be always true, since it is the last step for reasoning } @@ -40,9 +40,9 @@ class Config: debug_show_preprocessing=False obfuscation_techniques=[ - Synthetic(), - Style(), - Swap(), + #Synthetic(), + #Style(), + #Swap(), Blackening(), Randoming(), Blurring(), diff --git a/project/image_preprocessor.py b/project/image_preprocessor.py index b10e79f..c644f05 100644 --- a/project/image_preprocessor.py +++ b/project/image_preprocessor.py @@ -1,5 +1,6 @@ import os import json +import shutil from config import Config from meta_data.meta_data_extractor import MetaExtractor, ImageMeta @@ -15,16 +16,19 @@ class DataPreprocessor: #This method filters the images by specific criteria and extracts and saves the metadata for each filtered image def _is_accepted(self, meta: ImageMeta) -> bool: + #Image has at least 1 person (BBox) + #Each person needs to have detected face + #At least 1 object has_person = len(meta.persons) > 0 #Check whether all fields in each person is valid for person in meta.persons: if person.label is None or person.label != "person": return False - if person.bbox is None or len(person.bbox) < 4: + if person.bbox is None or len(person.bbox) != 4: return False if person.segment is None or len(person.segment) < 3: return False - if person.face_bbox is None or len(person.face_bbox) < 4: + if person.face_bbox is None or len(person.face_bbox) != 4: return False if person.body_keypoints is None or len(person.body_keypoints) == 0: return False @@ -38,7 +42,7 @@ class DataPreprocessor: for obj in meta.objects: if obj.label is None or obj.label == "" or obj.label == "person": return False - if obj.bbox is None or len(obj.bbox) < 4: + if obj.bbox is None or len(obj.bbox) != 4: return False if obj.segment is None or len(obj.segment) < 3: return False @@ -77,8 +81,7 @@ class DataPreprocessor: continue with open(meta_data_file_path, "w") as f: json.dump(image_meta.to_dict(), f, indent=2) - img = cv2.imread(img_file_path) - cv2.imwrite(output_image_file_path, img) + shutil.copy2(img_file_path, output_image_file_path) img_counter += 1 def _debug_show(self, image_meta, img_file_path): @@ -87,8 +90,12 @@ class DataPreprocessor: cv2.imshow("Before", img) cv2.waitKey() img_vis = visualize_metadata(img, image_meta) - cv2.imshow("After", img_vis) + winname = "Test" + cv2.namedWindow(winname) # Create a named window + cv2.moveWindow(winname, 40,30) # Move it to (40,30) + cv2.imshow(winname, img_vis) cv2.waitKey() + cv2.destroyAllWindows() print("image_meta") print(image_meta.to_dict()) exit() diff --git a/project/main.py b/project/main.py index 831a75e..50fcbd0 100644 --- a/project/main.py +++ b/project/main.py @@ -10,11 +10,11 @@ from meta_data.post_extraction import PostExtractor from obfuscation.obfuscation_engine import ObfuscationEngine from visualization.visualizer import Visualizer -# import random -# import torch -# -# random.seed(Config.seed) -# torch.manual_seed(Config.seed) +import random +import torch + +random.seed(Config.seed) +torch.manual_seed(Config.seed) def main(): print("Starting obfuscation platform") @@ -24,9 +24,10 @@ def main(): data_loader = DatasetLoader(Config.raw_dataset_path) raw_datasets_dict = data_loader.load_data(verbose=Config.verbose) #This variable contains a dict with the filenames for each dataset for dataset_name, image_paths in raw_datasets_dict.items(): + random.shuffle(image_paths) data_preprocessor = DataPreprocessor(image_paths, Config.max_images_per_dataset) output_directory = os.path.join(Config.filtered_output_directory, dataset_name) - data_preprocessor.preprocess_images(output_directory, Config.verbose) #TODO HIER DAS PRÜFEN + data_preprocessor.preprocess_images(output_directory, Config.verbose) #2: Obfuscate filtered datasets if Config.tasks["obfuscation"]: @@ -38,7 +39,7 @@ def main(): if Config.tasks["post_extract"]: print("3. Running post extraction") post_extractor = PostExtractor(Config.obfuscated_output_directory) - post_extractor.extract() #TODO HIER DAS PRÜFEN + post_extractor.extract() #4: Analyze impact of obfuscation #For each before folder, compare with after folder (after each technique) @@ -66,7 +67,7 @@ def main(): if Config.tasks["visualize"]: print("5. Running visualization") - out_dir = Path(Config.visual_results_directory); + out_dir = Path(Config.visual_results_directory) out_dir.mkdir(exist_ok=True) viz = Visualizer(Config.evaluation_results_directory) for ds in viz.datasets(): @@ -81,8 +82,6 @@ def main(): print(f"📊 {save_path} gespeichert") -#TODO: im comparator die Namen anpassen - #TODO: Die Berechnung jeder einzelnen Metrik überprüfen, metriken prüfen? #TODO: Die Validitätsprüfung der Daten überprüfen #TODO: WIE WERDEN DIE METRIKEN BERECHNET? diff --git a/project/meta_data/__pycache__/meta_data_extractor.cpython-310.pyc b/project/meta_data/__pycache__/meta_data_extractor.cpython-310.pyc index d53574d..ca72fed 100644 Binary files a/project/meta_data/__pycache__/meta_data_extractor.cpython-310.pyc and b/project/meta_data/__pycache__/meta_data_extractor.cpython-310.pyc differ diff --git a/project/meta_data/meta_data_extractor.py b/project/meta_data/meta_data_extractor.py index c038f3b..0f6e6c7 100644 --- a/project/meta_data/meta_data_extractor.py +++ b/project/meta_data/meta_data_extractor.py @@ -102,7 +102,6 @@ class MetaExtractor: person_ids = np.where(classes == 0)[0] # COCO class 0 == person other_ids = np.where(classes != 0)[0] - # ----------- PER-PERSON METADATA ----------------------------------- persons: list[PersonMeta] = [] for idx in person_ids: diff --git a/project/visualization/__pycache__/visualizer.cpython-310.pyc b/project/visualization/__pycache__/visualizer.cpython-310.pyc index 8793234..992ce1d 100644 Binary files a/project/visualization/__pycache__/visualizer.cpython-310.pyc and b/project/visualization/__pycache__/visualizer.cpython-310.pyc differ diff --git a/project/visualization/visualizer.py b/project/visualization/visualizer.py index 8063843..a3c6eb8 100644 --- a/project/visualization/visualizer.py +++ b/project/visualization/visualizer.py @@ -43,11 +43,11 @@ class Visualizer: # ---- Styling options ------------------------------------------ font_sizes: dict | None = None, # {'axes':12,'ticks':10,'legend':10,'barlabel':8,'title':13} hatch_cycle: tuple[str, ...] = ("///", "..", "**", "++", "..", "oo", "**"), - bar_alpha: float = 0.9, + bar_alpha: float = 1, annotate: bool = True, annotate_fmt: str = "{v:.1f}", # no % sign as requested barlabel_padding: int = 2, - top_padding: float = 0.06, # 6% headroom + top_padding: float = 0.01, # 6% headroom legend_ncols: int | None = None, percent_axis: bool = True, # keep % on the y-axis ticks ): @@ -73,7 +73,7 @@ class Visualizer: pivot.plot(kind="bar", ax=ax, edgecolor="black", linewidth=0.6) # ---------------- Font sizes ------------------------------------ - fs = dict(title=13, axes=12, ticks=12, legend=12, barlabel=6) + fs = dict(title=13, axes=13, ticks=13, legend=11, barlabel=6.3) if font_sizes: fs.update(font_sizes) diff --git a/project/yolo11m-seg.pt b/project/yolo11m-seg.pt deleted file mode 100644 index d342cdb..0000000 Binary files a/project/yolo11m-seg.pt and /dev/null differ