The shape of tensor obtained by nvidia.dali reads the image is rotated
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 5.8k
- Forks
- 678
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 27
Description
The shape of tensor obtained by nvidia.dali reads the image is rotated, because the rotated jpeg file has orientation info, dali considers the rotation head information of the jpeg file, but opencv does not consider it。
code:
dali:
class ImageDecoderPipeline(Pipeline):
def __init__(self, image_dir, batch_size, num_threads, device_id):
super(ImageDecoderPipeline, self).__init__(batch_size, num_threads, device_id, seed = seed)
self.input = ops.FileReader(file_root = image_dir)
if torch.cuda.is_available():
self.decode = ops.ImageDecoder(device = 'mixed', output_type = types.RGB) #mixed
# self.rotate = ops.Rotate(device="gpu", angle = 0.0)
else:
self.decode = ops.ImageDecoder(device='cpu', output_type=types.RGB) # mixed
def define_graph(self):
jpegs, labels = self.input()
images = self.decode(jpegs)
return (images, labels)
opencv:
input = cv2.imread(file_path)
the jpeg file:

the head info:
{"size":2534018,"format":"jpeg","width":3000,"height":4000,"colorModel":"ycbcr","orientation":"Right-top"}
obtain by dali and opencv:
dali: 
opencv: 
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided ImageDecoderPipeline and ops.ImageDecoder example, then reproduce the report with the linked JPEG and compare its tensor shape with cv2.imread. Trace how JPEG orientation metadata is handled and verify the resulting behavior against the reported DALI and OpenCV outputs; done means the discrepancy is resolved or covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, opencv, python
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100