Dali: failed: Encoded image has ambiguous format

Created on 1 Aug 2020  路  4Comments  路  Source: NVIDIA/DALI

thanks for your code. it is very cool. but I meet the problem:
it show me that:

Traceback (most recent call last):
  File "main.py", line 428, in <module>
    main()
  File "main.py", line 193, in main
    avg_train_time = train(dataset, model, criterion, optimizer, epoch)
  File "main.py", line 235, in train
    for i, data in enumerate(train_loader):
  File "/data2/zhx/DALI_pytorch_demo/dali.py", line 217, in __next__
    data = next(self._dali_iterator)
  File "/data2/zhx/py36_env/lib/python3.6/site-packages/nvidia/dali/plugin/pytorch.py", line 186, in __next__
    outputs.append(p.share_outputs())
  File "/data2/zhx/py36_env/lib/python3.6/site-packages/nvidia/dali/pipeline.py", line 529, in share_outputs
    return self._pipe.ShareOutputs()
RuntimeError: Critical error in pipeline: [/opt/dali/dali/image/image_factory.cc:87] Assert on "CheckIsPNG(encoded_image, length) + CheckIsBMP(encoded_image, length) + CheckIsGIF(encoded_image, length) + CheckIsJPEG(encoded_image, length) + CheckIsTiff(encoded_image, length) + CheckIsPNM(encoded_image, length) == 1" failed: Encoded image has ambiguous format
Stacktrace (11 entries):
[frame 0]: /data2/zhx/py36_env/lib/python3.6/site-packages/nvidia/dali/libdali.so(+0x83fce) [0x7f5b1ca74fce]
[frame 1]: /data2/zhx/py36_env/lib/python3.6/site-packages/nvidia/dali/libdali.so(dali::ImageFactory::CreateImage(unsigned char const*, unsigned long, dali::DALIImageType)+0x382) [0x7f5b1ca7a3b2]
[frame 2]: /data2/zhx/py36_env/lib/python3.6/site-packages/nvidia/dali/libdali_operators.so(+0x3daeb7) [0x7f5a76bafeb7]
[frame 3]: /data2/zhx/py36_env/lib/python3.6/site-packages/nvidia/dali/libdali_operators.so(+0x3dc09d) [0x7f5a76bb109d]
[frame 4]: /data2/zhx/py36_env/lib/python3.6/site-packages/nvidia/dali/libdali.so(+0xe12b5) [0x7f5b1cad22b5]
[frame 5]: /data2/zhx/py36_env/lib/python3.6/site-packages/nvidia/dali/libdali.so(+0xe1c15) [0x7f5b1cad2c15]
[frame 6]: /data2/zhx/py36_env/lib/python3.6/site-packages/nvidia/dali/libdali.so(+0xb8dc6) [0x7f5b1caa9dc6]
[frame 7]: /data2/zhx/py36_env/lib/python3.6/site-packages/nvidia/dali/libdali.so(+0x131f56) [0x7f5b1cb22f56]
[frame 8]: /data2/zhx/py36_env/lib/python3.6/site-packages/nvidia/dali/libdali.so(+0x8df6d0) [0x7f5b1d2d06d0]
[frame 9]: /lib/x86_64-linux-gnu/libpthread.so.0(+0x76db) [0x7f5b3a4ae6db]
[frame 10]: /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f) [0x7f5b3a7e788f]

I have delete other format image except the jpg. Does it mean I have a broken jpg file ? how can i find its path? but the pytorch backend work . thanks

bug

All 4 comments

Hi,
It seems that we missed providing the name of the faulty image in one place, it should be fixed in https://github.com/NVIDIA/DALI/pull/2174.
In the meantime, you can run CPU ImageDecoder (mixed one missed this information in the error message) and check again. It should fail but the error message should provide the image name that cannot be decoded properly by DALI. Try to open it first in any image viewer. If it works it would be great if you can provide it to us so we can check why it doesn't work with DALI.

One more remark. If you are using the EternalSource to provide the images you won't get its name. You need to bisect the file manually bu adjusting the python code that loads it.

yes. it is a broken jpg file.

0.25 was released. The issue should be fixed.

Was this page helpful?
0 / 5 - 0 ratings