My code runs perfectly fine from the command-line, but it fails with a spurious error when it is run from Jupyter notebook. The error is:
—————————————————————————————————————
error Traceback (most recent call last)
<ipython-input-32-efc5ccb15aed> in <module>
1 im = cv2.imread(DATA_PATH + 'images/street.jpg')
----> 2 objects = detect_objects(net, im)
3 display_objects(im, objects)
<ipython-input-31-a2dc02cd6a3d> in detect_objects(net, im)
14
15 # Peform Prediction
---> 16 objects = net.forward()
17 return objects
error: OpenCV(4.1.2) /Users/brisance/opencv/modules/dnn/src/layers/concat_layer.cpp:95: error: (-201:Incorrect size of input array) Inconsistent shape for ConcatLayer in function 'getMemoryShapes'
The dependencies are numpy (v1.17.3), OpenCV (v4.1.2) and matplotlib (v3.1.1). My set up is as follows:
ProductName: Mac OS X
ProductVersion: 10.15.1
BuildVersion: 19B88
Python version 3.7.5 (default, Nov 1 2019, 02:16:23)
[Clang 11.0.0 (clang-1100.0.33.8)]
General configuration for OpenCV 4.1.2 =====================================
Version control: 4.1.2
Extra modules:
Location (extra): /Users/brisance/opencv_contrib/modules
Version control (extra): 4.1.2
Platform:
Timestamp: 2019-10-29T07:32:45Z
Host: Darwin 19.0.0 x86_64
CMake: 3.15.4
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: RELEASE
CPU/HW features:
Baseline: SSE SSE2 SSE3 SSSE3 SSE4_1
requested: DETECT
Dispatched code generation: SSE4_2 FP16 AVX AVX2 AVX512_SKX
requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
SSE4_2 (2 files): + POPCNT SSE4_2
FP16 (1 files): + POPCNT SSE4_2 FP16 AVX
AVX (5 files): + POPCNT SSE4_2 AVX
AVX2 (29 files): + POPCNT SSE4_2 FP16 FMA3 AVX AVX2
AVX512_SKX (6 files): + POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
C/C++:
Built as dynamic libs?: YES
C++ Compiler: /Library/Developer/CommandLineTools/usr/bin/c++ (ver 11.0.0.11000033)
C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: /Library/Developer/CommandLineTools/usr/bin/cc
C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release): -Wl,-dead_strip
Linker flags (Debug): -Wl,-dead_strip
ccache: NO
Precompiled headers: NO
Extra dependencies: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework
3rdparty dependencies:
OpenCV modules:
To be built: aruco bgsegm bioinspired calib3d ccalib core cvv datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 python3 quality reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
Disabled: world
Disabled by dependency: -
Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev freetype hdf java js matlab ovis sfm viz
Applications: tests perf_tests examples apps
Documentation: NO
Non-free algorithms: NO
GUI:
QT: YES (ver 5.13.1)
QT OpenGL support: YES (Qt5::OpenGL 5.13.1)
Cocoa: YES
OpenGL support: YES (/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework)
VTK support: NO
Media I/O:
ZLib: build (ver 1.2.11)
JPEG: build-libjpeg-turbo (ver 2.0.2-62)
WEBP: build (ver encoder: 0x020e)
PNG: build (ver 1.6.37)
TIFF: build (ver 42 - 4.0.10)
JPEG 2000: build (ver 1.900.1)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES
Video I/O:
DC1394: NO
FFMPEG: NO
avcodec: NO
avformat: NO
avutil: NO
swscale: NO
avresample: NO
GStreamer: NO
AVFoundation: YES
v4l/v4l2: NO
Parallel framework: GCD
Trace: YES (with Intel ITT)
Other third-party libraries:
Intel IPP: 2019.0.0 Gold [2019.0.0]
at: /Users/brisance/opencv/build/3rdparty/ippicv/ippicv_mac/icv
Intel IPP IW: sources (2019.0.0)
at: /Users/brisance/opencv/build/3rdparty/ippicv/ippicv_mac/iw
Lapack: YES (/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Accelerate.framework)
Eigen: NO
Custom HAL: NO
Protobuf: build (3.5.1)
OpenCL: YES (no extra features)
Include path: NO
Link libraries: -framework OpenCL
Python 2:
Interpreter: /usr/bin/python2.7 (ver 2.7.16)
Libraries: /usr/lib/libpython2.7.dylib (ver 2.7.16)
numpy: /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include (ver 1.8.0rc1)
install path: lib/python2.7/site-packages
Python 3:
Interpreter: /usr/local/bin/python3 (ver 3.7.4)
Libraries: /usr/local/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7m.dylib (ver 3.7.4)
numpy: /usr/local/lib/python3.7/site-packages/numpy/core/include (ver 1.17.2)
install path: /Users/brisance/OpenCV-4.1.2-py3/lib/python3.7/site-packages/
Python (for build): /usr/bin/python2.7
Java:
ant: NO
JNI: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/JavaVM.framework/Headers /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/JavaVM.framework/Headers /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/JavaVM.framework/Headers
Java wrappers: NO
Java tests: NO
Install to: /Users/brisance/installation/OpenCV-4.1.2
-----------------------------------------------------------------
How do I go about tracking down the source of this bug?