Skip to content

Commit

Permalink
Disable shuffle when rect
Browse files Browse the repository at this point in the history
  • Loading branch information
werner-duvaud committed Nov 12, 2021
1 parent d8fd61d commit c363fb7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def create_dataloader(path, imgsz, batch_size, stride, single_cls=False, hyp=Non
prefix=prefix)

batch_size = min(batch_size, len(dataset))
shuffle = shuffle and not rect # disable shuffle in rect mode to keep the dataset sorted by aspect ratio
nw = min([os.cpu_count() // WORLD_SIZE, batch_size if batch_size > 1 else 0, workers]) # number of workers
sampler = torch.utils.data.distributed.DistributedSampler(dataset, shuffle=shuffle) if rank != -1 else None
loader = torch.utils.data.DataLoader if image_weights else InfiniteDataLoader
Expand Down

0 comments on commit c363fb7

Please sign in to comment.