Skip to content

Commit

Permalink
apply shuffle to batch indices
Browse files Browse the repository at this point in the history
  • Loading branch information
ncullen93 committed Apr 8, 2024
1 parent 8823faf commit cad8c93
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nitrain/loaders/dataset_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ def __iter__(self):
dataset = self.dataset
n_image_batches = math.ceil(len(dataset) / batch_size)

# TODO: shuffle image indices before batch loop
original_indices = np.arange(len(dataset))
if self.shuffle:
np.random.shuffle(original_indices)

image_batch_idx = 0
while image_batch_idx < n_image_batches:
Expand Down

0 comments on commit cad8c93

Please sign in to comment.