From a265bb7b05dfa651ae18c90a8288fe71b9a1eb59 Mon Sep 17 00:00:00 2001 From: clemsgrs Date: Tue, 27 Feb 2024 11:07:35 +0100 Subject: [PATCH] disable filepath retrieval during data loading --- dinov2/data/datasets/pathology.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dinov2/data/datasets/pathology.py b/dinov2/data/datasets/pathology.py index 5304b9e3f..555a5b44d 100644 --- a/dinov2/data/datasets/pathology.py +++ b/dinov2/data/datasets/pathology.py @@ -37,7 +37,7 @@ def __init__( super().__init__(root, transforms, transform, target_transform) self._subset = subset self._get_entries() - self._filepaths = np.load(Path(root, "pretrain_file_indices.npy"), allow_pickle=True).item() + # self._filepaths = np.load(Path(root, "pretrain_file_indices.npy"), allow_pickle=True).item() self._mmap_tarball = _make_mmap_tarball(Path(root, "pretrain_dataset.tar")) @property @@ -58,7 +58,8 @@ def _load_entries(self, _entries_name: str) -> np.ndarray: def get_image_data(self, index: int) -> bytes: entry = self._entries[index] file_idx, start_offset, end_offset = entry[1], entry[2], entry[3] - filepath = self._filepaths[file_idx] + # filepath = self._filepaths[file_idx] + filepath = f"{file_idx}" mapped_data = self._mmap_tarball[start_offset:end_offset] return mapped_data, Path(filepath)