valeriulacatusu commited on
Commit
ab4ab85
·
1 Parent(s): b2f750c

Update dataset configurations and descriptions for COCO 2014 and SA-1B; refactor file pattern generation in examples.py

Browse files
Files changed (3) hide show
  1. backend/config.py +49 -4
  2. backend/descriptions.py +8 -1
  3. backend/examples.py +11 -16
backend/config.py CHANGED
@@ -79,7 +79,47 @@ DATASET_CONFIGS = {
79
  "shush",
80
  ],
81
  },
82
- "val2014_1k/image": {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  "type": "image",
84
  "path": ABS_DATASET_PATH,
85
  "first_cols": ["psnr", "ssim", "lpips", "decoder_time"],
@@ -164,14 +204,19 @@ DATASET_CONFIGS = {
164
  EXAMPLE_CONFIGS = {
165
  "audio": {
166
  "type": "audio",
167
- "dataset_name": "voxpopuli",
168
  "path": ABS_DATASET_PATH,
169
  "db_key": "voxpopuli",
170
  },
 
 
 
 
 
171
  "image": {
172
- "dataset_name": "coco_val2014",
173
  "path": ABS_DATASET_PATH,
174
- "db_key": "coco_val2014",
175
  },
176
  "video": {
177
  "dataset_name": "sav_val_full_v2",
 
79
  "shush",
80
  ],
81
  },
82
+ "val2014_1k_v2/image": {
83
+ "type": "image",
84
+ "path": ABS_DATASET_PATH,
85
+ "first_cols": ["psnr", "ssim", "lpips", "decoder_time"],
86
+ "attack_scores": ["bit_acc", "log10_p_value", "TPR", "FPR"],
87
+ "categories": {
88
+ "proportion": "Geometric",
89
+ "collage": "Inpainting",
90
+ "center_crop": "Geometric",
91
+ "rotate": "Geometric",
92
+ "jpeg": "Compression",
93
+ "brightness": "Visual",
94
+ "contrast": "Visual",
95
+ "saturation": "Visual",
96
+ "sharpness": "Visual",
97
+ "resize": "Geometric",
98
+ "overlay_text": "Inpainting",
99
+ "hflip": "Geometric",
100
+ "perspective": "Geometric",
101
+ "median_filter": "Visual",
102
+ "hue": "Visual",
103
+ "gaussian_blur": "Visual",
104
+ "comb": "Mixed",
105
+ "avg": "Averages",
106
+ "none": "Baseline",
107
+ },
108
+ "attacks_with_variations": [
109
+ "center_crop",
110
+ "jpeg",
111
+ "brightness",
112
+ "contrast",
113
+ "saturation",
114
+ "sharpness",
115
+ "resize",
116
+ "perspective",
117
+ "median_filter",
118
+ "hue",
119
+ "gaussian_blur",
120
+ ],
121
+ },
122
+ "sa_1b_val_1k/image": {
123
  "type": "image",
124
  "path": ABS_DATASET_PATH,
125
  "first_cols": ["psnr", "ssim", "lpips", "decoder_time"],
 
204
  EXAMPLE_CONFIGS = {
205
  "audio": {
206
  "type": "audio",
207
+ "dataset_name": "voxpopuli_1k",
208
  "path": ABS_DATASET_PATH,
209
  "db_key": "voxpopuli",
210
  },
211
+ # "image": {
212
+ # "dataset_name": "val2014_1k_v2",
213
+ # "path": ABS_DATASET_PATH,
214
+ # "db_key": "local_val2014",
215
+ # },
216
  "image": {
217
+ "dataset_name": "sa_1b_val_1k",
218
  "path": ABS_DATASET_PATH,
219
+ "db_key": "local_valid",
220
  },
221
  "video": {
222
  "dataset_name": "sav_val_full_v2",
backend/descriptions.py CHANGED
@@ -226,13 +226,20 @@ DATASET_DESCRIPTIONS = {
226
  "github_link": "",
227
  },
228
 
229
- "val2014_1k/image": {
230
  "full_name": "COCO 2014 Validation Set",
231
  "description": "The COCO 2014 validation set is a widely used dataset for image watermarking tasks. It contains a diverse set of images with various objects and scenes.",
232
  "paper_link": "https://arxiv.org/abs/1405.0312",
233
  "github_link": "",
234
  },
235
 
 
 
 
 
 
 
 
236
  "sav_val_full_v2/video": {
237
  "full_name": "SA-Video Dataset",
238
  "description": "The SA-Video dataset is a collection of videos designed for video watermarking tasks. It includes a variety of video content suitable for testing watermarking techniques.",
 
226
  "github_link": "",
227
  },
228
 
229
+ "val2014_1k_v2/image": {
230
  "full_name": "COCO 2014 Validation Set",
231
  "description": "The COCO 2014 validation set is a widely used dataset for image watermarking tasks. It contains a diverse set of images with various objects and scenes.",
232
  "paper_link": "https://arxiv.org/abs/1405.0312",
233
  "github_link": "",
234
  },
235
 
236
+ "sa_1b_val_1k/image": {
237
+ "full_name": "Segment Anything 1 Billion",
238
+ "description": "Segment Anything 1 Billion (SA-1B) is a dataset designed for training general-purpose object segmentation models from open world images.",
239
+ "paper_link": "https://arxiv.org/abs/2304.02643",
240
+ "github_link": "",
241
+ },
242
+
243
  "sav_val_full_v2/video": {
244
  "full_name": "SA-Video Dataset",
245
  "description": "The SA-Video dataset is a collection of videos designed for video watermarking tasks. It includes a variety of video content suitable for testing watermarking techniques.",
backend/examples.py CHANGED
@@ -95,8 +95,7 @@ def build_description(
95
 
96
  def build_infos(abs_path: Path, datatype: str, dataset_name: str, db_key: str):
97
 
98
- def generate_file_patterns(prefixes, extensions):
99
- indices = [0, 1, 3, 4, 5]
100
  return [
101
  f"{prefix}_{index:05d}.{ext}"
102
  for prefix in prefixes
@@ -108,17 +107,19 @@ def build_infos(abs_path: Path, datatype: str, dataset_name: str, db_key: str):
108
  quality_metrics = ["snr", "sisnr", "stoi", "pesq"]
109
  extensions = ["wav"]
110
  datatype_abbr = "audio"
111
- eval_results_path = abs_path + f"{dataset_name}_1k/examples_eval_results.json"
112
  elif datatype == "image":
113
  quality_metrics = ["psnr", "ssim", "lpips"]
114
  extensions = ["png"]
115
  datatype_abbr = "img"
116
- eval_results_path = abs_path + f"{dataset_name}_1k/examples_eval_results.json"
117
  elif datatype == "video":
118
  quality_metrics = ["psnr", "ssim", "lpips", "msssim", "vmaf"]
119
  extensions = ["mp4"]
120
  datatype_abbr = "video"
121
- eval_results_path = abs_path + f"{dataset_name}/examples_eval_results.json"
 
 
122
 
123
  # Determine if eval_results_path is a URL or local file
124
  if eval_results_path.startswith("http://") or eval_results_path.startswith(
@@ -146,7 +147,7 @@ def build_infos(abs_path: Path, datatype: str, dataset_name: str, db_key: str):
146
  f"wmd_{datatype_abbr}",
147
  ]
148
 
149
- file_patterns = generate_file_patterns(prefixes, extensions)
150
  infos = {}
151
  for model_name in dataset.keys():
152
  model_infos = {}
@@ -170,16 +171,10 @@ def build_infos(abs_path: Path, datatype: str, dataset_name: str, db_key: str):
170
  model_infos[attack] = []
171
  continue
172
 
173
- if datatype == "video":
174
- file_paths = [
175
- f"{abs_path}{dataset_name}/examples/{datatype}/{model_name}/{attack}/{pattern}"
176
- for pattern in file_patterns
177
- ]
178
- else:
179
- file_paths = [
180
- f"{abs_path}{dataset_name}_1k/examples/{datatype}/{model_name}/{attack}/{pattern}"
181
- for pattern in file_patterns
182
- ]
183
 
184
  all_files = []
185
 
 
95
 
96
  def build_infos(abs_path: Path, datatype: str, dataset_name: str, db_key: str):
97
 
98
+ def generate_file_patterns(prefixes, extensions, indices):
 
99
  return [
100
  f"{prefix}_{index:05d}.{ext}"
101
  for prefix in prefixes
 
107
  quality_metrics = ["snr", "sisnr", "stoi", "pesq"]
108
  extensions = ["wav"]
109
  datatype_abbr = "audio"
110
+ indices = [0, 1, 3, 4, 5]
111
  elif datatype == "image":
112
  quality_metrics = ["psnr", "ssim", "lpips"]
113
  extensions = ["png"]
114
  datatype_abbr = "img"
115
+ indices = list(range(20))
116
  elif datatype == "video":
117
  quality_metrics = ["psnr", "ssim", "lpips", "msssim", "vmaf"]
118
  extensions = ["mp4"]
119
  datatype_abbr = "video"
120
+ indices = [0, 1, 3, 4, 5]
121
+
122
+ eval_results_path = abs_path + f"{dataset_name}/examples_eval_results.json"
123
 
124
  # Determine if eval_results_path is a URL or local file
125
  if eval_results_path.startswith("http://") or eval_results_path.startswith(
 
147
  f"wmd_{datatype_abbr}",
148
  ]
149
 
150
+ file_patterns = generate_file_patterns(prefixes, extensions, indices)
151
  infos = {}
152
  for model_name in dataset.keys():
153
  model_infos = {}
 
171
  model_infos[attack] = []
172
  continue
173
 
174
+ file_paths = [
175
+ f"{abs_path}{dataset_name}/examples/{datatype}/{model_name}/{attack}/{pattern}"
176
+ for pattern in file_patterns
177
+ ]
 
 
 
 
 
 
178
 
179
  all_files = []
180