NVIDIA / NVIDIA/DALI

ExternalSource and fn.readers.file

Open
#3,811 9 comments 0 reactions 1 assignee View on GitHub

@JanuszL is already working on this.

Since Apr 12, 2022.

external source help wanted
Dominant language
C++
Stars
5.8k
Forks
678
Avg merge
3d 1h
Merged PRs (30d)
27

Description

  1. CodeBase1: I need to use the weighted random sampler for ImageNet1000, so, i checke this issue. link. Then, I followed this link to get my own codes, including Sampler, ExternalSourcePipeline and DALIGenericIterator.

  2. CodeBase2: Also, I check this ImageNet1000-resnet link.

However, the difference in efficiency of loading data is surprisingly large!!!

I'm not sure. The possible reason may be the difference between fn.readers.file in link and np.fromfile in link

for _ in range(self.batch_size):
    jpeg_filename, label = self.files[self.i % self.n].split(' ')
    batch.append(np.fromfile(self.images_dir + jpeg_filename, dtype = np.uint8))  # we can use numpy
    labels.append(torch.tensor([int(label)], dtype = torch.uint8)) # or PyTorch's native tensors
    self.i += 1

How should I achieve an efficiency similar to CodeBase2 with weighted random sampler.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.