nicklhy opened a new issue #11912: failed to catch imdecode exception URL: https://github.com/apache/incubator-mxnet/issues/11912 Hi, I just found that I can not catch some IO exceptions when 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.') ``` ```Shell ➜ ~ 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() in function imdecode_ [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?
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
