105 lines
4.8 KiB
Python
105 lines
4.8 KiB
Python
import json
|
|
import os
|
|
from config import Config
|
|
from data_loader import DatasetLoader
|
|
from image_preprocessor import DataPreprocessor
|
|
from meta_data.meta_data_extractor import MetaExtractor
|
|
from meta_data.post_extraction import PostExtractor
|
|
from obfuscation.obfuscation_engine import ObfuscationEngine
|
|
|
|
|
|
##Steps:
|
|
#Configure Pipeline (e.g. region, datasets, amount of images per dataset, analysis scopes)
|
|
|
|
#For each obfuscation method
|
|
##For each dataset
|
|
###Load raw data (image-wise)
|
|
###Preprocess data and save (according to given criteria)
|
|
###Analyze data (values before obfuscation)
|
|
###Obfuscate data (with current method)
|
|
###Analyze data (values after obfuscation)
|
|
###Evaluate (analyze e.g. delta/error for before vs after, and aggregate results)
|
|
###Visualize Statistics
|
|
|
|
|
|
##Motivation
|
|
#Bilder und Videos sind daten, welche viele semantische informationen in sich tragen können
|
|
#Entsprechend ist CV so beliebt, weil sich damit mannigfaltig viele aufgaben erledigen lassen wie A, B, C
|
|
#Neben den Informationen die für die aufgabe relevant sind, auch andere Informationen abgebildet sind.
|
|
#Die ist besonders dann problematisch, wenn beispielsweise person erkennbar abgebildet sind und bilder möglicherweise veröffentlich werden sollen.
|
|
#Entsprechend gibt es die möglichkeit, bilder nachträglich zu bearbeiten um die person zu anonymisieren.
|
|
#Typischerweise wird dabei eine Verschleierung des Gesichts vorgenommen.
|
|
#VERSCHLEIERUNG NICHT GUT - MACHT NATÜRLICHKEIT des Bildes kaputt
|
|
#NATÜRLICHKEIT IST SCHWER MESSBAR
|
|
#IMPACT AUF TECHNISCHE NUTZBARKEIT NACH VERSCHLEIERUNG
|
|
#EINERSEITS STARKE LOKALE ABWEICHUNGEN
|
|
#GESICHT KÖNNTE NICHT IDENTIFIZIERBAR SEIN
|
|
#HOWEVER DURCH TECHNIK WIE SCHWARZEN BALKEN KÖNNTE ÜBERHAUPT KEIN GESICHT ZU SEHEN SEIN
|
|
#ANDERERSEITS ES KÖNNTE GESICHT DA SEIN, ABER XXX INFORMATIONEN WIE EMOTION ODER
|
|
#ODER AUCH AUF REESTLICHEN KÖRPER KÖRPER
|
|
|
|
#IN DIESEM PAPER WOLLEN WIR QUANTIFIZIEREN WIE NATÜRLICH BILD NACH VERSCHLEIERUNG
|
|
#DAMIT MEINEN WIR INTEGRITÄT IN BEZUG AUF TECHNISCHE NUTZBARKEIT
|
|
#IMPACT AUF gesicht, körper, global
|
|
#hier gehts weiter usw.
|
|
|
|
|
|
|
|
#TODO ODER EINFACH Alles nehmen einfach: Hat Mensch, Face und andere Objekte
|
|
|
|
|
|
#Detektion Gesichter + Body + Min. 1 anderes Objekt haben
|
|
#Alle 3 Modelle müssen gut funktionieren
|
|
|
|
|
|
#TODO: Zusätzliche analysen für Journal: Konfidenz, Mehrere Modelle für Gesichtserkennung, Andere Datensets (in the wild, zb. MSCOCO)
|
|
def main():
|
|
#TODO: die analysen vorher/nachher
|
|
#TODO: gute techniken hinzufügen
|
|
|
|
print("Starting obfuscation platform")
|
|
#1: Preprocess images and extract metadata
|
|
if Config.tasks["preprocessing"]:
|
|
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():
|
|
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)
|
|
|
|
#2: Obfuscate filtered datasets
|
|
if Config.tasks["obfuscation"]:
|
|
obfuscation_engine = ObfuscationEngine(Config.obfuscation_techniques)
|
|
obfuscation_engine.obfuscate_datasets(Config.filtered_output_directory, Config.obfuscated_output_directory, verbose=Config.verbose)
|
|
|
|
#3: Extract metadata from obfuscated datasets
|
|
if Config.tasks["post_extract"]:
|
|
post_extractor = PostExtractor(Config.obfuscated_output_directory)
|
|
post_extractor.extract()
|
|
|
|
#4: Analyze impact of obfuscation
|
|
#TODO: Compare before and after metadata for each dataset, for each technique;
|
|
#TODO: ES FEHLT NOCH EIN MODEL FÜR GESICHTER MATCHING; WIe gut ist verschleierung eigentlich?
|
|
#TODO: Generate some "evaluation_output" for dataset and technique
|
|
|
|
#Für jedes Datenset, für jede Technik messen, welchen einfluss die anonymisierung hat
|
|
#Person
|
|
#Person Accuracy: Wird Person gefunden? Bbox IoU > 0.5
|
|
#Person Segment Similarity: Wie ähnlich sind die Segmentierungen? Polygon Similarity
|
|
|
|
#Face Accuracy: Wird Gesicht gefunden? Bbox IoU > 0.5
|
|
#Obfuscation Success: Wurde Person nicht wiedererkannt? Face Matching
|
|
#Face Mesh Similarity: Wie ähnlich sind die Meshpunkte? Facial Keypoints Similarity
|
|
#Face Emotion Accuracy: Wird Emotion erkannt? Top1 Emotion Matching
|
|
#Face Emotion Vector Similarity: Wie ähnlich sind die Emotionen? Vector Similarity
|
|
|
|
#Global (Für jedes weitere Objekt im Ursprungsbild)
|
|
#Object Accuracy: Wird das Objekt erkannt? Bbox IoU > 0.5
|
|
#Object Segment Similarity: Wie ähnlich sind die Segmentierungen? Polygon Similarity
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|
|
|
|
|