RobustBench / robustbench

RobustBench: a standardized adversarial robustness benchmark [NeurIPS 2021 Benchmarks and Datasets Track]
https://robustbench.github.io
Other
671 stars 99 forks source link

remove unnecessary file when loading custom ImageNet #75

Closed CNOCycle closed 2 years ago

CNOCycle commented 2 years ago

As shown in the following snippet, class_to_idx has been obtained by function self._find_classes(self.root). Therefore, class_to_idx can be reused by function make_custom_dataset. Probably, file imagenet_class_to_id_map.json can be removed permanently.

    def __init__(self, root, loader, extensions=None, transform=None, target_transform=None, is_valid_file=None):
        super(CustomDatasetFolder, self).__init__(root)
        self.transform = transform
        self.target_transform = target_transform
        classes, class_to_idx = self._find_classes(self.root)
        samples = make_custom_dataset(self.root, 'imagenet_test_image_ids.txt',
                                      class_to_idx)
CNOCycle commented 2 years ago

Any progress on this MR? If MR from external user is not allowable, I will close this MR and apply the patch on my forked repo.

fra31 commented 2 years ago

Hi,

sorry for the late reply. Thanks for the contribution, it looks good to us!