From 0ed1c674f4cde86aa536b62f50109e9dc71028a9 Mon Sep 17 00:00:00 2001 From: TimefliesG Date: Thu, 7 Apr 2022 10:47:37 +0800 Subject: [PATCH 1/3] Running on cifar10 These modifications are to make the code run successfully on cifar10 --- src/data/loaders.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/data/loaders.py b/src/data/loaders.py index ca175a9..b90f44c 100644 --- a/src/data/loaders.py +++ b/src/data/loaders.py @@ -31,6 +31,8 @@ def setup_data_pipeline(self): config = { "transforms": trainTransform, "train": False, + "val": False, + "challenge": True, "path": self.config["dataset_path"], "prediction_attribute": "data", "protected_attribute": self.config["protected_attribute"], @@ -42,11 +44,15 @@ def setup_data_pipeline(self): else: train_config = {"transforms": trainTransform, "train": True, + "val": False, + "challenge": False, "path": self.config["dataset_path"], "prediction_attribute": self.config["prediction_attribute"], "protected_attribute": self.config["protected_attribute"]} test_config = {"transforms": trainTransform, "train": False, + "val": True, + "challenge": False, "path": self.config["dataset_path"], "prediction_attribute": self.config["prediction_attribute"], "protected_attribute": self.config["protected_attribute"]} From c642daad471391e4821b957b584855d07bf7d6ea Mon Sep 17 00:00:00 2001 From: TimefliesG Date: Thu, 7 Apr 2022 10:49:32 +0800 Subject: [PATCH 2/3] Update dataset_utils.py --- src/data/dataset_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/data/dataset_utils.py b/src/data/dataset_utils.py index 3d27f02..c7d3f56 100644 --- a/src/data/dataset_utils.py +++ b/src/data/dataset_utils.py @@ -114,7 +114,8 @@ def __getitem__(self, index): sample = {'img': img, 'prediction_label': pred_label, 'private_label': privacy_label, 'filepath': filepath, 'filename': filename} - + return sample + def __len__(self): return len(self.indicies) From 1d0edf0dbf8b7ead07a5f872f1cf0ebb6aab69c4 Mon Sep 17 00:00:00 2001 From: TimefliesG Date: Thu, 7 Apr 2022 11:16:06 +0800 Subject: [PATCH 3/3] run on windows This may be a problem with win and Ubuntu addresses. If you want to run on win, you can make this modification. --- src/data/dataset_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/data/dataset_utils.py b/src/data/dataset_utils.py index c7d3f56..b7986c0 100644 --- a/src/data/dataset_utils.py +++ b/src/data/dataset_utils.py @@ -96,9 +96,9 @@ def __getitem__(self, index): if self.config["train"] is True: filename = "train/"+str(filepath)+".jpg" elif self.config["challenge"] is True: # check if this is actually present in the config file. If not, lets add it - (Rohan) - filename = "challenge/"+str(filepath)+".jpg" + filename = str(filepath) elif self.config["val"] is True: - filename = "val/"+str(filepath)+".jpg" + filename = str(filepath) else: filename = filepath.split('/')[-1].split('.')[0]