Closed PBrockmann closed 2 years ago
Thanks for the bug report. Platform details (OS, hardware platform, cv.getBuildInformation()
function output) are very useful for debugging. Could you also run the code with GDB on your side and publish stack trace here.
I tried with OpenCV 4.5.5.64 and Python 3.8 on my Ubuntu 18.04 and do not observe issues:
import cv2
img = cv2.imread("lena.jpg")
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
haar_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
faces_rect = haar_cascade.detectMultiScale(gray_img, 1.1, 9)
print(faces_rect)
Output:
python3.8 ./repro.py
[[219 203 169 169]]
The same result with Ubuntu 20.04 and Python 3.9.5 from apt:
$ python3.9 ./repro.py
[[219 203 169 169]]
@PBrockmann friendly reminder.
Still have the problem on my Ubuntu 18.04 with Python 3.9.10 opencv-contrib-python 4.5.5.64 opencv-python 4.5.5.64
On another machine Ubuntu 18.04, it workds with a conda forge install (opencv).
So still looking for a solution. And replacing pip install by a conda install starts but never ends (conda looking for ever to dependancies...) is not possible.
Platform details (OS, hardware platform, cv.getBuildInformation() function output) are very useful for debugging. Could you also run the code with GDB on your side and publish stack trace here.
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.6 LTS"
Here is the ouput from cv.getBuildInformation()
General configuration for OpenCV 4.5.5 =====================================
Version control: 4.5.5-dirty
Extra modules:
Location (extra): /io/opencv_contrib/modules
Version control (extra): 4.5.5
Platform:
Timestamp: 2022-03-04T06:50:33Z
Host: Linux 5.11.0-1028-azure x86_64
CMake: 3.22.2
CMake generator: Unix Makefiles
CMake build tool: /bin/gmake
Configuration: Release
CPU/HW features:
Baseline: SSE SSE2 SSE3
requested: SSE3
Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
SSE4_1 (16 files): + SSSE3 SSE4_1
SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2
FP16 (0 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX (4 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2 (31 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
AVX512_SKX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
C/C++:
Built as dynamic libs?: NO
C++ standard: 11
C++ Compiler: /usr/lib/ccache/compilers/c++ (ver 10.2.1)
C++ flags (Release): -Wl,-strip-all -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -Wl,-strip-all -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: /usr/lib/ccache/compilers/cc
C flags (Release): -Wl,-strip-all -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 -Wuninitialized -Wno-comment -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -Wl,-strip-all -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 -Wuninitialized -Wno-comment -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -L/root/ffmpeg_build/lib -Wl,--gc-sections -Wl,--as-needed
Linker flags (Debug): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -L/root/ffmpeg_build/lib -Wl,--gc-sections -Wl,--as-needed
ccache: YES
Precompiled headers: NO
Extra dependencies: /lib64/libopenblas.so Qt5::Test Qt5::Concurrent /lib64/libz.so Qt5::Core Qt5::Gui Qt5::Widgets dl m pthread rt
3rdparty dependencies: libprotobuf ade ittnotify libjpeg-turbo libwebp libpng libtiff libopenjp2 IlmImf quirc ippiw ippicv
OpenCV modules:
To be built: aruco barcode bgsegm bioinspired calib3d ccalib core cvv datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
Disabled: world
Disabled by dependency: -
Unavailable: alphamat cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev freetype hdf java julia matlab ovis python2 sfm ts viz
Applications: -
Documentation: NO
Non-free algorithms: NO
GUI: QT5
QT: YES (ver 5.15.0 )
QT OpenGL support: NO
GTK+: NO
VTK support: NO
Media I/O:
ZLib: /lib64/libz.so (ver 1.2.7)
JPEG: libjpeg-turbo (ver 2.1.2-62)
WEBP: build (ver encoder: 0x020f)
PNG: build (ver 1.6.37)
TIFF: build (ver 42 - 4.2.0)
JPEG 2000: build (ver 2.4.0)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES
Video I/O:
DC1394: NO
FFMPEG: YES
avcodec: YES (58.134.100)
avformat: YES (58.76.100)
avutil: YES (56.70.100)
swscale: YES (5.9.100)
avresample: NO
GStreamer: NO
v4l/v4l2: YES (linux/videodev2.h)
Parallel framework: pthreads
Trace: YES (with Intel ITT)
Other third-party libraries:
Intel IPP: 2020.0.0 Gold [2020.0.0]
at: /io/_skbuild/linux-x86_64-3.6/cmake-build/3rdparty/ippicv/ippicv_lnx/icv
Intel IPP IW: sources (2020.0.0)
at: /io/_skbuild/linux-x86_64-3.6/cmake-build/3rdparty/ippicv/ippicv_lnx/iw
VA: NO
Lapack: YES (/lib64/libopenblas.so)
Eigen: NO
Custom HAL: NO
Protobuf: build (3.19.1)
OpenCL: YES (no extra features)
Include path: /io/opencv/3rdparty/include/opencl/1.2
Link libraries: Dynamic load
Python 3:
Interpreter: /opt/python/cp36-cp36m/bin/python3.6 (ver 3.6.15)
Libraries: libpython3.6m.a (ver 3.6.15)
numpy: /opt/python/cp36-cp36m/lib/python3.6/site-packages/numpy/core/include (ver 1.13.3)
install path: python/cv2/python-3
Python (for build): /bin/python2.7
Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO
Install to: /io/_skbuild/linux-x86_64-3.6/cmake-install
-----------------------------------------------------------------
and the script run with gdb
gdb python
GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python...done.
(gdb) run a.py
Starting program: /opt/anaconda3/bin/python a.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe5d0c700 (LWP 31919)]
[New Thread 0x7fffe550b700 (LWP 31920)]
[New Thread 0x7fffdcd0a700 (LWP 31921)]
[New Thread 0x7fffcc509700 (LWP 31922)]
[New Thread 0x7fffc3d08700 (LWP 31923)]
[New Thread 0x7fffc3507700 (LWP 31924)]
[New Thread 0x7fffb2d06700 (LWP 31925)]
[New Thread 0x7fffa9867700 (LWP 31926)]
[New Thread 0x7fffa9066700 (LWP 31927)]
[New Thread 0x7fffa8865700 (LWP 31928)]
[New Thread 0x7fff9bfff700 (LWP 31929)]
[New Thread 0x7fff9b7fe700 (LWP 31930)]
[New Thread 0x7fff9affd700 (LWP 31931)]
[New Thread 0x7fff9a7fc700 (LWP 31932)]
[New Thread 0x7fff98d63700 (LWP 31933)]
[New Thread 0x7fff8a98e700 (LWP 31934)]
[New Thread 0x7fff8a18d700 (LWP 31935)]
[New Thread 0x7fff8998c700 (LWP 31936)]
[New Thread 0x7fff8918b700 (LWP 31937)]
[New Thread 0x7fff8898a700 (LWP 31938)]
Thread 1 "python" received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
This issue seems very similar: https://github.com/basler/pypylon/issues/116
Hello,
Any progress ? Because I have exactly the same problem.
I work on Slackware current 15.0.
Here is the output from cv.getBuildInformation()
General configuration for OpenCV 4.5.5 ===================================== Version control: 4.5.5-dirty
Extra modules: Location (extra): /io/opencv_contrib/modules Version control (extra): 4.5.5
Platform: Timestamp: 2021-12-28T06:19:30Z Host: Linux 5.11.0-1022-azure x86_64 CMake: 3.22.1 CMake generator: Unix Makefiles CMake build tool: /bin/gmake Configuration: Release
CPU/HW features: Baseline: SSE SSE2 SSE3 requested: SSE3 Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX SSE4_1 (16 files): + SSSE3 SSE4_1 SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 (0 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX AVX (4 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX AVX2 (31 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX512_SKX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
C/C++: Built as dynamic libs?: NO C++ standard: 11 C++ Compiler: /usr/lib/ccache/compilers/c++ (ver 10.2.1) C++ flags (Release): -Wl,-strip-all -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG C++ flags (Debug): -Wl,-strip-all -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG C Compiler: /usr/lib/ccache/compilers/cc C flags (Release): -Wl,-strip-all -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 -Wuninitialized -Wno-comment -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG C flags (Debug): -Wl,-strip-all -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 -Wuninitialized -Wno-comment -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG Linker flags (Release): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -L/root/ffmpeg_build/lib -Wl,--gc-sections -Wl,--as-needed Linker flags (Debug): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -L/root/ffmpeg_build/lib -Wl,--gc-sections -Wl,--as-needed ccache: YES Precompiled headers: NO Extra dependencies: /lib64/libopenblas.so Qt5::Test Qt5::Concurrent /lib64/libpng.so /lib64/libz.so Qt5::Core Qt5::Gui Qt5::Widgets dl m pthread rt 3rdparty dependencies: libprotobuf ade ittnotify libjpeg-turbo libwebp libtiff libopenjp2 IlmImf quirc ippiw ippicv
OpenCV modules: To be built: aruco barcode bgsegm bioinspired calib3d ccalib core cvv datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto Disabled: world Disabled by dependency: - Unavailable: alphamat cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev freetype hdf java julia matlab ovis python2 sfm ts viz Applications: - Documentation: NO Non-free algorithms: NO
GUI: QT5 QT: YES (ver 5.15.0 ) QT OpenGL support: NO GTK+: NO VTK support: NO
Media I/O: ZLib: /lib64/libz.so (ver 1.2.7) JPEG: libjpeg-turbo (ver 2.1.2-62) WEBP: build (ver encoder: 0x020f) PNG: /lib64/libpng.so (ver 1.5.13) TIFF: build (ver 42 - 4.2.0) JPEG 2000: build (ver 2.4.0) OpenEXR: build (ver 2.3.0) HDR: YES SUNRASTER: YES PXM: YES PFM: YES
Video I/O: DC1394: NO FFMPEG: YES avcodec: YES (58.91.100) avformat: YES (58.45.100) avutil: YES (56.51.100) swscale: YES (5.7.100) avresample: NO GStreamer: NO v4l/v4l2: YES (linux/videodev2.h)
Parallel framework: pthreads
Trace: YES (with Intel ITT)
Other third-party libraries: Intel IPP: 2020.0.0 Gold [2020.0.0] at: /io/_skbuild/linux-x86_64-3.6/cmake-build/3rdparty/ippicv/ippicv_lnx/icv Intel IPP IW: sources (2020.0.0) at: /io/_skbuild/linux-x86_64-3.6/cmake-build/3rdparty/ippicv/ippicv_lnx/iw VA: NO Lapack: YES (/lib64/libopenblas.so) Eigen: NO Custom HAL: NO Protobuf: build (3.19.1)
OpenCL: YES (no extra features) Include path: /io/opencv/3rdparty/include/opencl/1.2 Link libraries: Dynamic load
Python 3: Interpreter: /opt/python/cp36-cp36m/bin/python3.6 (ver 3.6.15) Libraries: libpython3.6m.a (ver 3.6.15) numpy: /opt/python/cp36-cp36m/lib/python3.6/site-packages/numpy/core/include (ver 1.13.3) install path: python/cv2/python-3
Python (for build): /bin/python2.7
Java: ant: NO JNI: NO Java wrappers: NO Java tests: NO
Install to: /io/_skbuild/linux-x86_64-3.6/cmake-install
and my script run with gdb
GNU gdb (GDB) 11.2 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-slackware-linux". Type "show configuration" for configuration details. For bug reporting instructions, please see: https://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.
For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from python3... (No debugging symbols found in python3) (gdb) run detect_face.py -f G001/pic_1.jpg -c haarcascade_frontalface_default.xml Starting program: /usr/bin/python3 detect_face.py -f G001/pic_1.jpg -c haarcascade_frontalface_default.xml [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". [New Thread 0x7fffe8c5f640 (LWP 23609)] [New Thread 0x7fffe645e640 (LWP 23610)] [New Thread 0x7fffe5c5d640 (LWP 23611)] [New Thread 0x7fffe345c640 (LWP 23612)] [New Thread 0x7fffe0c5b640 (LWP 23613)] [New Thread 0x7fffdc45a640 (LWP 23614)] [New Thread 0x7fffdbc59640 (LWP 23615)] [New Thread 0x7fffd7458640 (LWP 23616)] [New Thread 0x7fffd4c57640 (LWP 23617)] [New Thread 0x7fffd2456640 (LWP 23618)] [New Thread 0x7fffcfc55640 (LWP 23619)] [New Thread 0x7fffcd454640 (LWP 23620)] [New Thread 0x7fffcac53640 (LWP 23621)] [New Thread 0x7fffc8452640 (LWP 23622)] [New Thread 0x7fffc5c51640 (LWP 23623)] [New Thread 0x7fffc070a640 (LWP 23624)] [New Thread 0x7fffbff09640 (LWP 23625)] [New Thread 0x7fffbf708640 (LWP 23626)] [New Thread 0x7fffbef07640 (LWP 23627)] [New Thread 0x7fffbe706640 (LWP 23628)] [New Thread 0x7fffbdf05640 (LWP 23629)] [New Thread 0x7fffbd704640 (LWP 23630)] [New Thread 0x7fffbcf03640 (LWP 23631)] [New Thread 0x7fff9ffff640 (LWP 23632)] [New Thread 0x7fff9f7fe640 (LWP 23633)] [New Thread 0x7fff9effd640 (LWP 23634)] [New Thread 0x7fff9e7fc640 (LWP 23635)] [New Thread 0x7fff9dffb640 (LWP 23636)] [New Thread 0x7fff9d7fa640 (LWP 23637)] [New Thread 0x7fff9cff9640 (LWP 23638)]
Thread 1 "python3" received signal SIGSEGV, Segmentation fault. 0x00007fff7385c5b9 in ?? () from /usr/lib64/gallium-pipe/pipe_iris.so
Thanks for your help !!!
@SpartanRK117 It looks like your issue differs from the original one and related to OpenCL. You code tries to run OpenCL path in the code. could you provide couple of things to me to debug the issue:
@asmorkalov Thank for your help.
Maybe I don't look the right things. I'm going to explore more but your advice will be usefully. My script Python is very basic and the error message doesn't inspire me this time...
"I tried clinfo but it returns segmentation fault." - It means that your OpenCL installation is broken. OpenCV detects OpenCL and tries to use it for acceleration, if available. There is nothing related to OpenCV and I can help with.
I get a segmentation fault from a simple call to detectMultiScale. Don't know how to analyze the problem.
I works with 4.5.0 on another machine (python 3.7.8)
atestfile.jpg and haarcascade_frontalface_default.xml are local files.
I use Python 3.9.10 and opencv-contrib-python 4.5.5.64 opencv-python 4.5.5.64
It is a referenced bug ??