diff --git a/project/__pycache__/data_loader.cpython-38.pyc b/project/__pycache__/data_loader.cpython-38.pyc new file mode 100644 index 0000000..e72eb2d Binary files /dev/null and b/project/__pycache__/data_loader.cpython-38.pyc differ diff --git a/project/data_loader.py b/project/data_loader.py index e69de29..4a54ae6 100644 --- a/project/data_loader.py +++ b/project/data_loader.py @@ -0,0 +1,17 @@ +from typing import Dict, List, Sequence, Union +import os + +class DatasetLoader: + def __init__(self, path: str): + self.path=path + + #This function loads the data from the given path and returns a dict with entries for each subfolder in the given path the folder name and strings + def load_data(self) -> Dict[str, List[str]]: + subdirs = [sub for sub in os.listdir(self.path) if os.path.isdir(os.path.join(self.path, sub))] + data_dict = {} + for subdir in subdirs: + data_dict[subdir] = [] + for file in os.listdir(os.path.join(self.path, subdir)): + if file.endswith((".jpg", ".jpeg", ".png")): + data_dict[subdir].append(os.path.join(self.path, subdir, file)) + return data_dict \ No newline at end of file diff --git a/project/datasets/raw/datasetA/A.png b/project/datasets/raw/datasetA/A.png new file mode 100644 index 0000000..b2f471d Binary files /dev/null and b/project/datasets/raw/datasetA/A.png differ diff --git a/project/datasets/raw/datasetB/B.png b/project/datasets/raw/datasetB/B.png new file mode 100644 index 0000000..16d1284 Binary files /dev/null and b/project/datasets/raw/datasetB/B.png differ diff --git a/project/platform.py b/project/platform.py index b98f446..5a3e843 100644 --- a/project/platform.py +++ b/project/platform.py @@ -1,3 +1,4 @@ +from data_loader import DatasetLoader ##Steps: #Configure Pipeline (e.g. region, datasets, amount of images per dataset, analysis scopes) @@ -10,7 +11,7 @@ ###Obfuscate data (with current method) ###Analyze data (values after obfuscation) ###Evaluate (analyze e.g. delta/error for before vs after, and aggregate results) -###Visualize +###Visualize Statistics ##Motivation @@ -35,7 +36,22 @@ #hier gehts weiter usw. -##Metrics## +#TODO: Datenset filtern und Bilder mit Metadaten speichern. Für jedes Bild gilt: + #1. Hat Bild Bobx mit min. 1 anderes Objekt als Mensch? + #1.1 Gibt es zu Bbox Segment? + #2. Hat Bild Bbox mit Mensch? + #2.1 Hat Mensch Segment? + #2.2 Extrahiere Keypoints + #3. Hat Mensch Bbox Gesicht Bbox? + #3.3 Hat + # 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 + +##Metrics for analysis## #Impact on facial attributes: #Detection #TODO: Face detection model #Bounding box (Any/best overlapping box?) FaceDetectionAccuracy = 0.0 - 1.0 @@ -77,6 +93,23 @@ def main(): print("Starting obfuscation platform") + data_path = "datasets/" + data_loader = DatasetLoader(data_path) + data_paths = data_loader.load_data() #This variable contains a dict with the filenames for each dataset + print(data_paths) + #TODO: filter data by criteria; Like N-Images + + #configure pipeline + #load data + #pre-process data //create dataset based on specific criteria + #Run analysis + #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 if __name__ == '__main__': - main() \ No newline at end of file + main() + +