NVIDIA / NVIDIA/DALI

16 bit gray scale Image read error

Open
#5,401 1 comment 0 reactions 1 assignee View on GitHub

@jantonguirao is already working on this.

Since Mar 28, 2024.

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

Description

Describe the question.

My loader is configured as follows.

However, KeyError: <DALIDataType.UINT16: 1> is occurring.

torch 1.12.1+cu113
nvidia-dali-cuda110 1.36.0
I'm using the above version

class ExternalInputIterator(object):
    ....
  def __next__(self):
      source_batch = []
      target_batch = []
      name_batch = []

      if self.i >= self.n:
          self.__iter__()
          raise StopIteration

      for _ in range(self.batch_size):
          filename = self.source_files[self.i % self.n]
          # print("self.i : ", self.i, ", filename : ", filename)

          source_batch.append(np.fromfile(os.path.join(self.source_root, filename), dtype=np.uint8))  # we can use numpy
          target_batch.append(np.fromfile(os.path.join(self.target_root, filename), dtype=np.uint8))  # we can use numpy
          # name_batch.append(filename)
          name_batch.append(np.fromstring(filename, dtype=np.uint8))
          self.i += 1

      return (source_batch, target_batch, name_batch)

  def __len__(self):
      return self.data_set_len

  next = __next__


def ExternalSourcePipeline(batch_size, num_threads, device_id, external_data, mode):
  pipe = Pipeline(batch_size, num_threads, device_id)
  with pipe:
      source_img, target_img, filename = fn.external_source(source=external_data, num_outputs=3)

      source_images = fn.experimental.decoders.image(
          source_img, device='mixed', output_type=types.GRAY, dtype=types.UINT16)
      target_images = fn.experimental.decoders.image(
          source_img, device='mixed', output_type=types.GRAY, dtype=types.UINT16)

      ...
      ...

      pipe.set_outputs(source_images, target_images, filename)
  return pipe
Check for duplicates
  • I have searched the open bugs/issues and have found no duplicates for this bug report

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.