def prepare_imagenette_data(self, image_size: tuple[int, int] | torch.Size) -> None:
        """Prepare ImageNette dataset transformations.

        Sets up data transforms and downloads ImageNette dataset if not present.

        Args:
            image_size (tuple[int, int] | torch.Size): Target image size for
                transforms.
        """
        self.data_transforms_imagenet = Compose(
            [
                Resize((image_size[0] * 2, image_size[1] * 2)),
                RandomGrayscale(p=0.3),
                CenterCrop((image_size[0], image_size[1])),
                ToTensor(),
            ],
        )

        if not self.imagenet_dir.is_dir():
            download_and_extract(self.imagenet_dir, IMAGENETTE_DOWNLOAD_INFO)
        imagenet_dataset = ImageFolder(self.imagenet_dir, transform=self.data_transforms_imagenet)
        self.imagenet_loader = DataLoader(imagenet_dataset, batch_size=self.batch_size, shuffle=True, pin_memory=True)
        self.imagenet_iterator = iter(self.imagenet_loader)
Prepare ImageNette dataset transformations.

        Sets up data transforms and downloads ImageNette dataset if not present.

        Args:
            image_size (tuple[int, int] | torch.Size): Target image size for
                transforms.
        
src/anomalib/models/image/efficient_ad/lightning_model.py