def __init__(self, name, shuffle=True, dir=None):
        """
        Args:
            name (str): 'train', 'test', 'val'
            shuffle (bool): shuffle the dataset
        """
        if dir is None:
            dir = get_dataset_path(self._DIR_NAME)
        assert name in ['train', 'test', 'val']
        self.name = name
        self.shuffle = shuffle

        def get_images_and_labels(data_file):
            f = maybe_download(self._SOURCE_URL + data_file, dir)
            data = scipy.io.loadmat(f)
            return data

        self.data = get_images_and_labels("caltech101_silhouettes_28_split1.mat")

        if self.name == "train":
            self.images = self.data["train_data"].reshape((4100, 28, 28))
            self.labels = self.data["train_labels"].ravel() - 1
        elif self.name == "test":
            self.images = self.data["test_data"].reshape((2307, 28, 28))
            self.labels = self.data["test_labels"].ravel() - 1
        else:
            self.images = self.data["val_data"].reshape((2264, 28, 28))
            self.labels = self.data["val_labels"].ravel() - 1

        Args:
            name (str): 'train', 'test', 'val'
            shuffle (bool): shuffle the dataset
        
tensorpack/dataflow/dataset/caltech101.py