diff --git a/dinov2/data/adapters.py b/dinov2/data/adapters.py index fe9ce78b0cdf6c07a8fac927589a3cf666546c7e..7dcbc68e046f03460d5867f1388d5380d9c6f603 100644 --- a/dinov2/data/adapters.py +++ b/dinov2/data/adapters.py @@ -20,9 +20,6 @@ class DatasetWithEnumeratedTargets(Dataset): target = self._dataset.get_target(index) return (index, target) - def get_sample_decoder(self, index: int) -> Any: - return self._dataset.get_sample_decoder(index) - def __getitem__(self, index: int) -> Tuple[Any, Tuple[Any, int]]: image, target = self._dataset[index] target = index if target is None else target diff --git a/dinov2/data/datasets/decoders.py b/dinov2/data/datasets/decoders.py index ec6daee223726ae655a20f6e0e94d71a1848be00..548720b3b9959b4949f71fb2dd5cf6af3d184066 100644 --- a/dinov2/data/datasets/decoders.py +++ b/dinov2/data/datasets/decoders.py @@ -5,7 +5,7 @@ # LICENSE file in the root directory of this source tree. from io import BytesIO -from typing import Any, Tuple +from typing import Any from PIL import Image @@ -30,11 +30,3 @@ class TargetDecoder(Decoder): def decode(self) -> Any: return self._target - - -class TupleDecoder(Decoder): - def __init__(self, *decoders: Decoder): - self._decoders: Tuple[Decoder, ...] = decoders - - def decode(self) -> Any: - return (decoder.decode() for decoder in self._decoders) diff --git a/dinov2/data/datasets/extended.py b/dinov2/data/datasets/extended.py index 41894632340574b8a4f363d51bdea47594554ff9..4da831e6ad275025ed55eaa490f780ecf6083f2c 100644 --- a/dinov2/data/datasets/extended.py +++ b/dinov2/data/datasets/extended.py @@ -8,7 +8,7 @@ from typing import Any, Tuple from torchvision.datasets import VisionDataset -from .decoders import Decoder, TargetDecoder, ImageDataDecoder, TupleDecoder +from .decoders import TargetDecoder, ImageDataDecoder class ExtendedVisionDataset(VisionDataset): @@ -35,13 +35,5 @@ class ExtendedVisionDataset(VisionDataset): return image, target - def get_sample_decoder(self, index: int) -> Decoder: - image_data = self.get_image_data(index) - target = self.get_target(index) - return TupleDecoder( - ImageDataDecoder(image_data), - TargetDecoder(target), - ) - def __len__(self) -> int: raise NotImplementedError diff --git a/dinov2/data/datasets/image_net_22k.py b/dinov2/data/datasets/image_net_22k.py index 323ee6ff3ab3c31d42bcaac2558f97a55317ad73..2c0bfd335a68b67e02c241f39b1ae06f9fbe1dd0 100644 --- a/dinov2/data/datasets/image_net_22k.py +++ b/dinov2/data/datasets/image_net_22k.py @@ -22,7 +22,6 @@ from .extended import ExtendedVisionDataset _Labels = int _DEFAULT_MMAP_CACHE_SIZE = 16 # Warning: This can exhaust file descriptors -_IMAGES_SUBDIR_IMAGENET_21KP = "062717" @dataclass