Datasets:
Tasks:
Image Classification
Sub-tasks:
multi-class-image-classification
Languages:
English
Size:
100K - 1M
Tags:
adversarial-robustness
common-corruptions
robustness
benchmark
transfer-attacks
vision-language-models
License:
v2.1: common split from the original processed archives
Browse filesReplaces the `common` split of all six datasets with the common-corruption images of the original processed archives (`test_common/`), which were used to evaluate the vision models in the paper. Clean, random, and adversarial splits are unchanged (byte-identical). v2.0 is tagged `v2.0`.
- README.md +3 -2
- data/caltech101/common-00000-of-00001.parquet +2 -2
- data/fgvc-aircraft-2013b/common-00000-of-00001.parquet +2 -2
- data/flowers-102/common-00000-of-00001.parquet +2 -2
- data/oxford-iiit-pet/common-00000-of-00001.parquet +2 -2
- data/stanford_cars/common-00000-of-00001.parquet +2 -2
- data/uc-merced-land-use-dataset/common-00000-of-00001.parquet +2 -2
- scripts/build_parquet.py +15 -8
- scripts/make_card.py +3 -2
README.md
CHANGED
|
@@ -535,7 +535,7 @@ The Parquet files themselves live under `data/<dataset>/`.
|
|
| 535 |
|
| 536 |
### Common corruptions
|
| 537 |
|
| 538 |
-
Shot noise, impulse noise, defocus blur, motion blur, zoom blur, snow, brightness, contrast, elastic transform, pixelate, JPEG compression, all at severity 3 of the ImageNet-C scale.
|
| 539 |
|
| 540 |
### Adversarial perturbations
|
| 541 |
|
|
@@ -660,5 +660,6 @@ Please also cite the six source datasets.
|
|
| 660 |
|
| 661 |
## Versions
|
| 662 |
|
| 663 |
-
- **v2.
|
|
|
|
| 664 |
- **v1.0**: original `.tar.zst` archives, kept for reproducibility under the git tag [`v1.0-archives`](https://huggingface.co/datasets/legolasflagstaff/RobustGenBench/tree/v1.0-archives).
|
|
|
|
| 535 |
|
| 536 |
### Common corruptions
|
| 537 |
|
| 538 |
+
Shot noise, impulse noise, defocus blur, motion blur, zoom blur, snow, brightness, contrast, elastic transform, pixelate, JPEG compression, all at severity 3 of the ImageNet-C scale. The test set is split into 11 contiguous blocks of ⌊n/11⌋ images, one per corruption in the order above, and the remaining images wrap around to the first corruption (column `corruption`). The images are fixed, so every model is evaluated on identical (image, corruption) pairs.
|
| 539 |
|
| 540 |
### Adversarial perturbations
|
| 541 |
|
|
|
|
| 660 |
|
| 661 |
## Versions
|
| 662 |
|
| 663 |
+
- **v2.1** (current): the `common` split contains the common-corruption images of the original processed archives, used throughout the paper.
|
| 664 |
+
- **v2.0**: Parquet layout with Dataset Viewer support; restricted to the surrogates reported in the paper.
|
| 665 |
- **v1.0**: original `.tar.zst` archives, kept for reproducibility under the git tag [`v1.0-archives`](https://huggingface.co/datasets/legolasflagstaff/RobustGenBench/tree/v1.0-archives).
|
data/caltech101/common-00000-of-00001.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:12bb5d88399bc7ad9a9c99771ba03602dd8faffd18f00f980b9d2986e4f66e68
|
| 3 |
+
size 67310473
|
data/fgvc-aircraft-2013b/common-00000-of-00001.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:13a1d4a3381c02dd4578123c35d5b63f8a84c7585205ae723b885bce3f5906a8
|
| 3 |
+
size 66692591
|
data/flowers-102/common-00000-of-00001.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1b92f77be84eab0c527fe78b0d307761b2e7a73bb4d32c78a83f8de0d38a3e36
|
| 3 |
+
size 79720433
|
data/oxford-iiit-pet/common-00000-of-00001.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5cfb31438d1c947dff9c6a721c22e0b16079d045d3e59d054c6e08f1badad402
|
| 3 |
+
size 78349129
|
data/stanford_cars/common-00000-of-00001.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5d51fa1477441c09b62b2d3586625c3bb91bb4a0520f82d10ceb6b0ba0d20bf0
|
| 3 |
+
size 73166263
|
data/uc-merced-land-use-dataset/common-00000-of-00001.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4e7c0ad4de5202b76c62d001825d8237c3980f9c0132ec573d9a9a4396a30078
|
| 3 |
+
size 33152732
|
scripts/build_parquet.py
CHANGED
|
@@ -32,8 +32,10 @@ ROWS_PER_GROUP = 100 # small row groups keep the Dataset Viewer responsive
|
|
| 32 |
DATASETS = ["caltech101", "fgvc-aircraft-2013b", "flowers-102",
|
| 33 |
"oxford-iiit-pet", "stanford_cars", "uc-merced-land-use-dataset"]
|
| 34 |
|
| 35 |
-
#
|
| 36 |
-
#
|
|
|
|
|
|
|
| 37 |
COMMON_CORRUPTIONS = ["shot_noise", "impulse_noise", "defocus_blur", "motion_blur",
|
| 38 |
"zoom_blur", "snow", "brightness", "contrast",
|
| 39 |
"elastic_transform", "pixelate", "jpeg_compression"]
|
|
@@ -61,6 +63,9 @@ THREATS = {
|
|
| 61 |
KEEP_ONLY = {"siglip2_base": {"linf_eps30_autoattack_standard"}}
|
| 62 |
|
| 63 |
|
|
|
|
|
|
|
|
|
|
| 64 |
def read_archive(path, split):
|
| 65 |
with open(path, "rb") as f:
|
| 66 |
buf = io.BytesIO(zstd.ZstdDecompressor().stream_reader(f).read())
|
|
@@ -101,7 +106,7 @@ def pixels(b):
|
|
| 101 |
return np.asarray(PILImage.open(io.BytesIO(b)).convert("RGB"))
|
| 102 |
|
| 103 |
|
| 104 |
-
def build(dataset):
|
| 105 |
class_names_map = json.loads((SRC / "class_names" / f"{dataset}.json").read_text())
|
| 106 |
class_names = [class_names_map[str(i)] for i in range(len(class_names_map))]
|
| 107 |
feats = features(class_names)
|
|
@@ -119,8 +124,9 @@ def build(dataset):
|
|
| 119 |
corruption=None, is_modified=False) for i, lab, b in items]
|
| 120 |
summary[name] = write_split(recs, feats, out_dir, name)
|
| 121 |
|
| 122 |
-
def perturbed(path, split_name, perturbation, surrogate, norm, eps, corr_fn=None
|
| 123 |
-
|
|
|
|
| 124 |
assert len(items) == len(clean_test), (path, len(items))
|
| 125 |
recs = []
|
| 126 |
for i, lab, b in items:
|
|
@@ -133,9 +139,10 @@ def build(dataset):
|
|
| 133 |
summary[split_name] = write_split(recs, feats, out_dir, split_name)
|
| 134 |
|
| 135 |
adv = SRC / "adversarial"
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
|
|
|
| 139 |
perturbed(adv / f"random/linf_eps30_random_uniform/{dataset}__random__linf_eps30_random_uniform_processed.tar.zst",
|
| 140 |
"random_linf_30", "random_uniform", None, "linf", 30 / 255)
|
| 141 |
|
|
|
|
| 32 |
DATASETS = ["caltech101", "fgvc-aircraft-2013b", "flowers-102",
|
| 33 |
"oxford-iiit-pet", "stanford_cars", "uc-merced-land-use-dataset"]
|
| 34 |
|
| 35 |
+
# Common corruptions: the test_common/ split of the original processed archives
|
| 36 |
+
# (paper_code/save_final_dataset.py), i.e. the images used to evaluate the vision
|
| 37 |
+
# models. Image i receives COMMON_CORRUPTIONS[(i // s) % 11] with s = n // 11
|
| 38 |
+
# (paper_code/corruptions/common.py; verified on the pixel data).
|
| 39 |
COMMON_CORRUPTIONS = ["shot_noise", "impulse_noise", "defocus_blur", "motion_blur",
|
| 40 |
"zoom_blur", "snow", "brightness", "contrast",
|
| 41 |
"elastic_transform", "pixelate", "jpeg_compression"]
|
|
|
|
| 63 |
KEEP_ONLY = {"siglip2_base": {"linf_eps30_autoattack_standard"}}
|
| 64 |
|
| 65 |
|
| 66 |
+
ORIG = Path(__file__).parent / "orig" # archives at revision 0790625f (with test_common/)
|
| 67 |
+
|
| 68 |
+
|
| 69 |
def read_archive(path, split):
|
| 70 |
with open(path, "rb") as f:
|
| 71 |
buf = io.BytesIO(zstd.ZstdDecompressor().stream_reader(f).read())
|
|
|
|
| 106 |
return np.asarray(PILImage.open(io.BytesIO(b)).convert("RGB"))
|
| 107 |
|
| 108 |
|
| 109 |
+
def build(dataset, only=None):
|
| 110 |
class_names_map = json.loads((SRC / "class_names" / f"{dataset}.json").read_text())
|
| 111 |
class_names = [class_names_map[str(i)] for i in range(len(class_names_map))]
|
| 112 |
feats = features(class_names)
|
|
|
|
| 124 |
corruption=None, is_modified=False) for i, lab, b in items]
|
| 125 |
summary[name] = write_split(recs, feats, out_dir, name)
|
| 126 |
|
| 127 |
+
def perturbed(path, split_name, perturbation, surrogate, norm, eps, corr_fn=None,
|
| 128 |
+
split="test"):
|
| 129 |
+
items = read_archive(path, split)
|
| 130 |
assert len(items) == len(clean_test), (path, len(items))
|
| 131 |
recs = []
|
| 132 |
for i, lab, b in items:
|
|
|
|
| 139 |
summary[split_name] = write_split(recs, feats, out_dir, split_name)
|
| 140 |
|
| 141 |
adv = SRC / "adversarial"
|
| 142 |
+
step = max(1, len(clean_test) // len(COMMON_CORRUPTIONS))
|
| 143 |
+
perturbed(ORIG / f"{dataset}_processed.tar.zst", "common", "common_corruption_severity3",
|
| 144 |
+
None, None, None, split="test_common",
|
| 145 |
+
corr_fn=lambda i: COMMON_CORRUPTIONS[(i // step) % len(COMMON_CORRUPTIONS)])
|
| 146 |
perturbed(adv / f"random/linf_eps30_random_uniform/{dataset}__random__linf_eps30_random_uniform_processed.tar.zst",
|
| 147 |
"random_linf_30", "random_uniform", None, "linf", 30 / 255)
|
| 148 |
|
scripts/make_card.py
CHANGED
|
@@ -156,7 +156,7 @@ The Parquet files themselves live under `data/<dataset>/`.
|
|
| 156 |
|
| 157 |
### Common corruptions
|
| 158 |
|
| 159 |
-
Shot noise, impulse noise, defocus blur, motion blur, zoom blur, snow, brightness, contrast, elastic transform, pixelate, JPEG compression, all at severity 3 of the ImageNet-C scale.
|
| 160 |
|
| 161 |
### Adversarial perturbations
|
| 162 |
|
|
@@ -242,7 +242,8 @@ Please also cite the six source datasets.
|
|
| 242 |
|
| 243 |
## Versions
|
| 244 |
|
| 245 |
-
- **v2.
|
|
|
|
| 246 |
- **v1.0**: original `.tar.zst` archives, kept for reproducibility under the git tag [`v1.0-archives`](https://huggingface.co/datasets/legolasflagstaff/RobustGenBench/tree/v1.0-archives).
|
| 247 |
"""
|
| 248 |
(ROOT / "README.md").write_text("\n".join(y) + "\n" + body)
|
|
|
|
| 156 |
|
| 157 |
### Common corruptions
|
| 158 |
|
| 159 |
+
Shot noise, impulse noise, defocus blur, motion blur, zoom blur, snow, brightness, contrast, elastic transform, pixelate, JPEG compression, all at severity 3 of the ImageNet-C scale. The test set is split into 11 contiguous blocks of ⌊n/11⌋ images, one per corruption in the order above, and the remaining images wrap around to the first corruption (column `corruption`). The images are fixed, so every model is evaluated on identical (image, corruption) pairs.
|
| 160 |
|
| 161 |
### Adversarial perturbations
|
| 162 |
|
|
|
|
| 242 |
|
| 243 |
## Versions
|
| 244 |
|
| 245 |
+
- **v2.1** (current): the `common` split contains the common-corruption images of the original processed archives, used throughout the paper.
|
| 246 |
+
- **v2.0**: Parquet layout with Dataset Viewer support; restricted to the surrogates reported in the paper.
|
| 247 |
- **v1.0**: original `.tar.zst` archives, kept for reproducibility under the git tag [`v1.0-archives`](https://huggingface.co/datasets/legolasflagstaff/RobustGenBench/tree/v1.0-archives).
|
| 248 |
"""
|
| 249 |
(ROOT / "README.md").write_text("\n".join(y) + "\n" + body)
|