I am using a python layer in Digits to crop each training image with random sizes crops, and then using cv2.resize method to resize to expected top dimensions.
The resizing works as expected when used offline on a saved batch of images, the numpy array gets correctly resized to shape (128x3x227x227).
When using the python layer in digits however i get code -11 Error. Caffe output log shows this:
I1212 12:11:41.999608 14949 solver.cpp:291] Solving
I1212 12:11:41.999610 14949 solver.cpp:292] Learning Rate Policy: fixed
I1212 12:11:42.001058 14949 solver.cpp:349] Iteration 0, Testing net (#0)
I1212 12:11:42.001065 14949 net.cpp:693] Ignoring source layer train-data
*** Aborted at 1481541102 (unix time) try "date -d @1481541102" if you are using GNU date ***
PC: @ 0x7f7c46b63acf cv::resize()
*** SIGSEGV (@0x0) received by PID 14949 (TID 0x7f7c564d0ac0) from PID 0; stack trace: ***
@ 0x7f7c53b734b0 (unknown)
@ 0x7f7c46b63acf cv::resize()
@ 0x7f67e132d736 pyopencv_cv_resize()
@ 0x7f7c547a8c55 PyEval_EvalFrameEx
@ 0x7f7c548d301c PyEval_EvalCodeEx
@ 0x7f7c548292e0 (unknown)
@ 0x7f7c547fc1e3 PyObject_Call
@ 0x7f7c5487031c (unknown)
@ 0x7f7c547fc1e3 PyObject_Call
@ 0x7f7c548d2447 PyEval_CallObjectWithKeywords
@ 0x7f7c54830f17 PyEval_CallFunction
@ 0x7f67f34add85 caffe::PythonLayer<>::Forward_cpu()
@ 0x7f7c55bc6207 caffe::Net<>::ForwardFromTo()
@ 0x7f7c55bc6577 caffe::Net<>::Forward()
@ 0x7f7c55be8dda caffe::Solver<>::Test()
@ 0x7f7c55be992e caffe::Solver<>::TestAll()
@ 0x7f7c55be9a4c caffe::Solver<>::Step()
@ 0x7f7c55bea5e9 caffe::Solver<>::Solve()
@ 0x40cf6f train()
@ 0x4088e8 main
@ 0x7f7c53b5e830 __libc_start_main
@ 0x4091b9 _start
@ 0x0 (unknown)
Additional information:
- the environment in which I test the resize method offline (when it works) is the same environment I use for Digits/caffe
- I can use the scipy misc.imresize method instead and it works as expected, however the scipy method doesn't preserve the original numpy values, converting them back to uint8 in 0-256 range, so I can't use that method. It's also much slower than cv2 (tested on offline batches)
If someone can suggest an alternative interpolation method to resize the numpy nd-array that would be very useful too
Many thanks