You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
Hi, I just found that I can not catch some IO exceptions if the program failed to load an image when using mxnet's image decoding API. The problem can be produced like below:
import mxnet as mx
print('MXNet version: %s' % mx.__version__)
with open('test.jpg', 'wb') as fd:
fd.close()
try:
with open('test.jpg', 'rb') as fd:
buf = fd.read()
im = mx.image.imdecode(buf, flag=1, to_rgb=True)
except:
print('mxnet imdecode failed to load image.')
➜ ~ python3 test_imdecode_error.py
MXNet version: 1.3.0
OpenCV Error: Assertion failed (!buf.empty() &&buf.isContinuous()) in imdecode_, file /home/lhy/Documents/Lib/opencv-3.4.0/modules/imgcodecs/src/loadsave.cpp, line 711
terminate called after throwing an instance of 'cv::Exception'what(): /home/lhy/Documents/Lib/opencv-3.4.0/modules/imgcodecs/src/loadsave.cpp:711: error: (-215) !buf.empty() &&buf.isContinuous() infunctionimdecode_
[1] 28041 abort (core dumped) python3 test_imdecode_error.py
However, I would like the program to skip the corrupted images and just continue processing others. Is it a bug?