Attribution 4.0 (CC BY 4.0)https://creativecommons.org/licenses/by/4.0/
License information was derived automatically
Adversarial patches are optimized contiguous pixel blocks in an input image that cause a machine-learning model to misclassify it. However, their optimization is computationally demanding and requires careful hyperparameter tuning. To overcome these issues, we propose ImageNet-Patch, a dataset to benchmark machine-learning models against adversarial patches. It consists of a set of patches optimized to generalize across different models and applied to ImageNet data after preprocessing them with affine transformations. This process enables an approximate yet faster robustness evaluation, leveraging the transferability of adversarial perturbations.
We release our dataset as a set of folders indicating the patch target label (e.g., banana
), each containing 1000 subfolders as the ImageNet output classes.
An example showing how to use the dataset is shown below.
import os.path
from torchvision import datasets, transforms, models import torch.utils.data
class ImageFolderWithEmptyDirs(datasets.ImageFolder): """ This is required for handling empty folders from the ImageFolder Class. """
def find_classes(self, directory):
classes = sorted(entry.name for entry in os.scandir(directory) if entry.is_dir())
if not classes:
raise FileNotFoundError(f"Couldn't find any class folder in {directory}.")
class_to_idx = {cls_name: i for i, cls_name in enumerate(classes) if
len(os.listdir(os.path.join(directory, cls_name))) > 0}
return classes, class_to_idx
dataset_folder = 'data/ImageNet-Patch'
available_labels = { 487: 'cellular telephone', 513: 'cornet', 546: 'electric guitar', 585: 'hair spray', 804: 'soap dispenser', 806: 'sock', 878: 'typewriter keyboard', 923: 'plate', 954: 'banana', 968: 'cup' }
target_label = 954
dataset_folder = os.path.join(dataset_folder, str(target_label)) normalizer = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) transforms = transforms.Compose([ transforms.ToTensor(), normalizer ])
dataset = ImageFolderWithEmptyDirs(dataset_folder, transform=transforms) model = models.resnet50(pretrained=True) loader = torch.utils.data.DataLoader(dataset, shuffle=True, batch_size=5) model.eval()
batches = 10 correct, attack_success, total = 0, 0, 0 for batch_idx, (images, labels) in enumerate(loader): if batch_idx == batches: break pred = model(images).argmax(dim=1) correct += (pred == labels).sum() attack_success += sum(pred == target_label) total += pred.shape[0]
accuracy = correct / total attack_sr = attack_success / total
print("Robust Accuracy: ", accuracy) print("Attack Success: ", attack_sr)
Content This dataset adds 300 images for each of the 100 classes in the CIFAR-100 dataset. It was scraped using the Flickr API. Each folders name represents the class of it's containing images. All images are in JPEG. Has no known overlap with the CIFAR-100 dataset.
Import Can be imported easily using PyTorchs torchvision.datasets.ImageFolder or Tensorflows tfds.ImageFolder.
Attribution-NonCommercial-ShareAlike 2.0 (CC BY-NC-SA 2.0)https://creativecommons.org/licenses/by-nc-sa/2.0/
License information was derived automatically
This dataset contains images obtained by appropriate transformation of cloud detections from a ceilometer located in San Giovanni La Punta (Catania, Italy), from January 2023 to mid-March 2023. We used a Lufft CHM 15k ceilometer that leverages Light Detection and Ranging (LiDAR) technology. The ceilometer took measurements every 15 seconds quantifying the concentration of particles in the atmosphere. By taking advantage of the reflection, it is possible to determine the cloud layer coverage. Once raw data was collected, the variables of interest were scaled using a normalisation factor of the lidar-based ceilometer. All the variables are used to generate backscatter profiles. Specifically, we plot the time on the x-axis and the height of the measured particles (contained in the backscatter coefficient) on the y-axis. The colour of the plot depends on the intensity of the measured particle: intense blue means absence of particulate; red means intense presence of particulate. Numerically, the scale goes from the value 0 to the value of 5 · 10−6. We generated a backscatter profile for each day of measurements and each of these were further divided for every hour. In this way, we obtained 24 backscatter profiles for each day of observation.
The file uploaded is a file with '. ZIP' extension. Once extracted, there are two folders: train and test. For each folder, there are two classes of images: true and false. We suggest using 'ImageFolder' to use the dataset (see reference: https://pytorch.org/vision/main/generated/torchvision.datasets.ImageFolder.html)
For an example of using the dataset, please visit the following authors' repository: https://github.com/alessiochisari/CeilometerDatasetBenchmark
The repository contains all the Jupyter Notebooks used by the authors to benchmark five state-of-the-art models on this new dataset.
Please cite our work for any use of the dataset or code in this repository using this citation:
@inproceedings{chisari2024, author = {Alessio Barbaro Chisari and others}, title = {On the Cloud Detection from Backscattered Images Generated From a Lidar-Based Ceilometer: Current State and Opportunities}, booktitle = {{IEEE} {ICIP} 2024, Abu Dhabi, UAE, October 27-30, 2024}, year = {2024} }
Not seeing a result you expected?
Learn how you can add new datasets to our index.
Attribution 4.0 (CC BY 4.0)https://creativecommons.org/licenses/by/4.0/
License information was derived automatically
Adversarial patches are optimized contiguous pixel blocks in an input image that cause a machine-learning model to misclassify it. However, their optimization is computationally demanding and requires careful hyperparameter tuning. To overcome these issues, we propose ImageNet-Patch, a dataset to benchmark machine-learning models against adversarial patches. It consists of a set of patches optimized to generalize across different models and applied to ImageNet data after preprocessing them with affine transformations. This process enables an approximate yet faster robustness evaluation, leveraging the transferability of adversarial perturbations.
We release our dataset as a set of folders indicating the patch target label (e.g., banana
), each containing 1000 subfolders as the ImageNet output classes.
An example showing how to use the dataset is shown below.
import os.path
from torchvision import datasets, transforms, models import torch.utils.data
class ImageFolderWithEmptyDirs(datasets.ImageFolder): """ This is required for handling empty folders from the ImageFolder Class. """
def find_classes(self, directory):
classes = sorted(entry.name for entry in os.scandir(directory) if entry.is_dir())
if not classes:
raise FileNotFoundError(f"Couldn't find any class folder in {directory}.")
class_to_idx = {cls_name: i for i, cls_name in enumerate(classes) if
len(os.listdir(os.path.join(directory, cls_name))) > 0}
return classes, class_to_idx
dataset_folder = 'data/ImageNet-Patch'
available_labels = { 487: 'cellular telephone', 513: 'cornet', 546: 'electric guitar', 585: 'hair spray', 804: 'soap dispenser', 806: 'sock', 878: 'typewriter keyboard', 923: 'plate', 954: 'banana', 968: 'cup' }
target_label = 954
dataset_folder = os.path.join(dataset_folder, str(target_label)) normalizer = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) transforms = transforms.Compose([ transforms.ToTensor(), normalizer ])
dataset = ImageFolderWithEmptyDirs(dataset_folder, transform=transforms) model = models.resnet50(pretrained=True) loader = torch.utils.data.DataLoader(dataset, shuffle=True, batch_size=5) model.eval()
batches = 10 correct, attack_success, total = 0, 0, 0 for batch_idx, (images, labels) in enumerate(loader): if batch_idx == batches: break pred = model(images).argmax(dim=1) correct += (pred == labels).sum() attack_success += sum(pred == target_label) total += pred.shape[0]
accuracy = correct / total attack_sr = attack_success / total
print("Robust Accuracy: ", accuracy) print("Attack Success: ", attack_sr)