Added new stuff for figure

This commit is contained in:
2025-07-29 10:29:43 +02:00
parent 179f06213b
commit 7432d0de06
40 changed files with 4873 additions and 15 deletions
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

+25
View File
@@ -0,0 +1,25 @@
import sys
from PIL import Image
def crop_image(x1, y1, x2, y2, input_path, output_path):
try:
with Image.open(input_path) as img:
cropped_img = img.crop((x1, y1, x2, y2))
cropped_img.save(output_path)
print(f"Bild erfolgreich gespeichert als {output_path}")
except Exception as e:
print(f"Fehler: {e}")
if __name__ == "__main__":
if len(sys.argv) != 7:
print("Verwendung: python crop_image.py x1 y1 x2 y2 input_path output_path")
sys.exit(1)
x1 = int(sys.argv[1])
y1 = int(sys.argv[2])
x2 = int(sys.argv[3])
y2 = int(sys.argv[4])
input_path = sys.argv[5]
output_path = sys.argv[6]
crop_image(x1, y1, x2, y2, input_path, output_path)
Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.
+7 -7
View File
@@ -28,11 +28,11 @@ class Config:
verbose=True
tasks = {"preprocessing": True, # optional if already done
tasks = {"preprocessing": False, # 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
"post_extract": False, # optional if already done
"analysis": False, # optional if already done
"visualize": False #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(),
+6 -4
View File
@@ -59,7 +59,7 @@ def main():
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) #TODO HIER DAS PRÜFEN
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:
@@ -83,10 +83,9 @@ def main():
#TODO Die andren techniken auch
#TODO In paper beispiele zeigen mit den modellen, anhand eines mit StyleGAN2 generierten gesichts
#TODO In paper beispiele zeigen mit den modellen
#TODO: Experimente für kleine modelle wiederholen? Also statt yolov11l zb yolov11n verwenden?
#Möglicherweise gibt es weniger probleme mit besserem modell
@@ -103,7 +102,10 @@ def main():
#TODO: GGF. Ringmasken verwenden?
#TODO: Verteilung von Gesichtern und Objekten Visualisieren mit Heatmap, pro datenset?
#TODO: !!Idee iterativer generic issue solver? Ein kernel der Bildbasiert-die nutzbarkeit optimiert!!@BA?
#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?
if __name__ == '__main__':
main()
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 16 KiB

+4 -4
View File
@@ -12,10 +12,10 @@ class Swap(ObfuscationTechnique):
Replace face with generated face
"""
def __init__(self):
#print("epic not active")
self.image_processing_path = "C:/Users/bijan/Desktop/obfuscation_platform/project/models/epic/image_cache/"
resp = requests.get(f"http://127.0.0.1:8000/init", timeout=60)
resp.raise_for_status()
print("epic not active")
# self.image_processing_path = "C:/Users/bijan/Desktop/obfuscation_platform/project/models/epic/image_cache/"
# resp = requests.get(f"http://127.0.0.1:8000/init", timeout=60)
# resp.raise_for_status()
def obfuscate(self, face_roi_img_bgr: np.ndarray) -> np.ndarray: