Skip to content

Commit

Permalink
disable filepath retrieval during data loading
Browse files Browse the repository at this point in the history
  • Loading branch information
clemsgrs committed Feb 27, 2024
1 parent 918c302 commit a265bb7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dinov2/data/datasets/pathology.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down

0 comments on commit a265bb7

Please sign in to comment.