Comments (16)
@fengyuentau Ok good point. Is the fix for 3d input also not backwards compatible or can it be included in 4.x?
The 3d issue is not handle yet in either branch.
@cdeln 3d input issue has been solved in #25810.
from opencv.
@fengyuentau I will try out asap :)
from opencv.
@Abdurrahheem could you take a look?
from opencv.
Error cases are:
0 ERROR OpenCV () -> (1, 1)
1 ERROR OpenCV (2,) -> (2, 1)
3 ERROR OpenCV (2, 3, 5) -> (2, 3)
Let me explain one by one.
0 ERROR OpenCV () -> (1, 1)
: OpenCVMat
does not support 0d, 1d cases; that is to say, when a 0d/1d tensor is loaded into aMat
, it is converted to aMat
of shape(1, 1)
.1 ERROR OpenCV (2,) -> (2, 1)
: Similar above. In case of 1d tensor of shape (n,), it isMat
of shape(n, 1)
(so it breaks the rule of broadcasting) when converted.3 ERROR OpenCV (2, 3, 5) -> (2, 3)
: In the OpenCV Python interface, a three dimensional (a, b, c) tensor is loaded into aMat
of shape(a, b)
with channel equals toc
. More details see #23242. This is a legacy problem which should be solved in 5.x I think.
from opencv.
Do you mean that the errors for 0 and 1 dimensions are expected? I feels like a very bad bug to me, and it will leave ONNX integration in a broken state until fixed. So I hope this is not considered expected by OpenCV devs.
OpenCV 4.10 is latest released version, so I am not sure how to test your hypothesis for 5.x without more help. Can you please confirm that this is fixed in 5.x? If that is the case I think it should be back-ported to 4.11 as well.
from opencv.
Do you mean that the errors for 0 and 1 dimensions are expected? I feels like a very bad bug to me, and it will leave ONNX integration in a broken state until fixed. So I hope this is not considered expected by OpenCV devs.
0d/1d mat support is introduced since 5.x. It was a big patch and breaks some existing things. So maybe not a good idea to do a backport.
from opencv.
@fengyuentau Ok good point. Is the fix for 3d input also not backwards compatible or can it be included in 4.x?
from opencv.
@fengyuentau Ok good point. Is the fix for 3d input also not backwards compatible or can it be included in 4.x?
The 3d issue is not handle yet in either branch.
from opencv.
@fengyuentau Can you point me to some instructions on how to build and test the pybindings please?
from opencv.
@cdeln Check below for instructions.
# Get opencv
git clone https://github.com/opencv/opencv
# Configure opencv
cmake -B build \
-S opencv \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=build/install \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-D -DPYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3
# If you use conda, add the following two options as well
# -D PYTHON3_EXECUTABLE=/absolute/path/to/python \
# -D PYTHON3_INCLUDE=/absolute/path/to/Python.h/location \
# -D PYTHON3_LIBRARIES=/absolute/path/to/libpython/location
# Example:
# -D PYTHON3_EXECUTABLE=/Workspace/miniconda3/bin/python \
# -D PYTHON3_INCLUDE=/Workspace/miniconda3/include/python3.10 \
# -D PYTHON3_LIBRARIES=/Workspace/miniconda3/lib \
# Build opencv
cmake --build build --target install -j8
# Install python package. Make sure you uninstall opencv packages beforehand.
python3 -m pip install ./build/python_loader
from opencv.
@fengyuentau Thanks. Sorry to bother you about installation matters, please redirect me if there is a better place to get help, I really want to be able to test things!
Getting this error when I import cv2
, what am I missing?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/cdeln/src/opencv/lib/python3.10/site-packages/cv2/__init__.py", line 181, in <module>
bootstrap()
File "/home/cdeln/src/opencv/lib/python3.10/site-packages/cv2/__init__.py", line 112, in bootstrap
load_first_config([
File "/home/cdeln/src/opencv/lib/python3.10/site-packages/cv2/__init__.py", line 109, in load_first_config
raise ImportError('OpenCV loader: missing configuration file: {}. Check OpenCV installation.'.format(fnames))
ImportError: OpenCV loader: missing configuration file: ['config-3.10.py', 'config-3.py']. Check OpenCV installation.
Standing in /home/cdeln/src
, I configured it like this
cmake -B build \
-S opencv \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=build/install \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-DPYTHON_DEFAULT_EXECUTABLE=$(which python3)
-D PYTHON3_EXECUTABLE=$(which python3)
I use pyenv for python3, and I install the OpenCV python lib into a fresh virtual env.
from opencv.
@cdeln Could you post the log when you run cmake -B ..
command?
from opencv.
If you mean cmake -B build -S opencv
(assuming I stand in /home/cdeln/src
, cloned OpenCV into opencv
and configuring into sibling directory build
), then output is
-- Detected processor: x86_64
-- Looking for ccache - found (/usr/bin/ccache)
Cleaning INTERNAL cached variable: WEBP_LIBRARY
Cleaning INTERNAL cached variable: WEBP_INCLUDE_DIR
-- Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1). OpenJPEG will be built from sources
-- OpenJPEG: VERSION = 2.5.0, BUILD = opencv-4.10.0-dev-openjp2-2.5.0
-- OpenJPEG libraries will be built from sources: libopenjp2 (version "2.5.0")
-- Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf-2_5.so
-- libva: missing va.h header (VA_INCLUDE_DIR)
-- found Intel IPP (ICV version): 2021.11.0 [2021.11.0]
-- at: /home/cdeln/src/build/3rdparty/ippicv/ippicv_lnx/icv
-- found Intel IPP Integration Wrappers sources: 2021.11.0
-- at: /home/cdeln/src/build/3rdparty/ippicv/ippicv_lnx/iw
-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR)
-- Could NOT find JNI (missing: AWT)
-- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
-- Checking for module 'gtk+-3.0'
-- No package 'gtk+-3.0' found
-- Checking for module 'libavresample'
-- No package 'libavresample' found
-- Checking for module 'gstreamer-base-1.0'
-- No package 'gstreamer-base-1.0' found
-- Checking for module 'gstreamer-app-1.0'
-- No package 'gstreamer-app-1.0' found
-- Checking for module 'gstreamer-riff-1.0'
-- No package 'gstreamer-riff-1.0' found
-- Checking for module 'gstreamer-pbutils-1.0'
-- No package 'gstreamer-pbutils-1.0' found
-- Checking for module 'gstreamer-video-1.0'
-- No package 'gstreamer-video-1.0' found
-- Checking for module 'gstreamer-audio-1.0'
-- No package 'gstreamer-audio-1.0' found
-- Allocator metrics storage type: 'long long'
-- Excluding from source files list: <BUILD>/modules/core/test/test_intrin256.lasx.cpp
-- Excluding from source files list: modules/imgproc/src/imgwarp.lasx.cpp
-- Excluding from source files list: modules/imgproc/src/resize.lasx.cpp
-- Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': /home/cdeln/src/opencv/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
-- opencv_dnn: filter out cuda4dnn source code
-- Excluding from source files list: modules/dnn/src/layers/cpu_kernels/conv_winograd_f63.neon.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.rvv.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/layers_common.lasx.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/int8layers/layers_common.rvv.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/int8layers/layers_common.lasx.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/cpu_kernels/conv_block.neon.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/cpu_kernels/conv_block.neon_fp16.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/cpu_kernels/conv_depthwise.rvv.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/cpu_kernels/conv_depthwise.lasx.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/cpu_kernels/conv_winograd_f63.neon_fp16.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/cpu_kernels/fast_gemm_kernels.neon.cpp
-- Excluding from source files list: <BUILD>/modules/dnn/layers/cpu_kernels/fast_gemm_kernels.lasx.cpp
-- highgui: using builtin backend: GTK2
-- Found 'misc' Python modules from /home/cdeln/src/opencv/modules/python/package/extra_modules
-- Found 'mat_wrapper;utils' Python modules from /home/cdeln/src/opencv/modules/core/misc/python/package
-- Found 'gapi' Python modules from /home/cdeln/src/opencv/modules/gapi/misc/python/package
--
-- General configuration for OpenCV 4.10.0-dev =====================================
-- Version control: 4.10.0-117-gc6ace77e21
--
-- Platform:
-- Timestamp: 2024-07-12T12:07:11Z
-- Host: Linux 6.5.0-41-generic x86_64
-- CMake: 3.26.3
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/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 (18 files): + SSSE3 SSE4_1
-- SSE4_2 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2
-- FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
-- AVX (9 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
-- AVX2 (38 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
-- AVX512_SKX (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ standard: 11
-- C++ Compiler: /usr/bin/c++ (ver 11.4.0)
-- C++ flags (Release): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-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): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-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/bin/cc
-- C flags (Release): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -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 -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -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 -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
-- Linker flags (Debug): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
-- ccache: YES
-- Precompiled headers: NO
-- Extra dependencies: dl m pthread rt
-- 3rdparty dependencies:
--
-- OpenCV modules:
-- To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo stitching ts video videoio
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: java python2 python3
-- Applications: tests perf_tests apps
-- Documentation: NO
-- Non-free algorithms: NO
--
-- GUI: GTK2
-- GTK+: YES (ver 2.24.33)
-- GThread : YES (ver 2.72.4)
-- GtkGlExt: NO
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
-- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
-- WEBP: build (ver encoder: 0x020f)
-- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.37)
-- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.3.0)
-- JPEG 2000: build (ver 2.5.0)
-- OpenEXR: /usr/lib/x86_64-linux-gnu/libImath-2_5.so /usr/lib/x86_64-linux-gnu/libIlmImf-2_5.so /usr/lib/x86_64-linux-gnu/libIex-2_5.so /usr/lib/x86_64-linux-gnu/libHalf-2_5.so /usr/lib/x86_64-linux-gnu/libIlmThread-2_5.so (ver 2_5)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
-- PFM: YES
--
-- Video I/O:
-- DC1394: YES (2.2.6)
-- 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: 2021.11.0 [2021.11.0]
-- at: /home/cdeln/src/build/3rdparty/ippicv/ippicv_lnx/icv
-- Intel IPP IW: sources (2021.11.0)
-- at: /home/cdeln/src/build/3rdparty/ippicv/ippicv_lnx/iw
-- VA: NO
-- Lapack: NO
-- Eigen: YES (ver 3.4.0)
-- Custom HAL: NO
-- Protobuf: build (3.19.1)
-- Flatbuffers: builtin/3rdparty (23.5.9)
--
-- OpenCL: YES (no extra features)
-- Include path: /home/cdeln/src/opencv/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python 3:
-- Interpreter: /home/cdeln/.pyenv/versions/default/bin/python3 (ver 3.10.6)
-- Libraries: NO
-- Limited API: NO
-- numpy: /home/cdeln/.pyenv/versions/default/lib/python3.10/site-packages/numpy/core/include (ver 1.24.3)
-- install path: -
--
-- Python (for build): /home/cdeln/src/opencv/bin/python3
--
-- Java:
-- ant: NO
-- Java: YES (ver 17.0.11)
-- JNI: NO
-- Java wrappers: NO
-- Java tests: NO
--
-- Install to: /home/cdeln/src/build/install
-- -----------------------------------------------------------------
--
-- Configuring done (0.8s)
-- Generating done (0.2s)
-- Build files have been written to: /home/cdeln/src/build
from opencv.
-- Python 3:
-- Interpreter: /home/cdeln/.pyenv/versions/default/bin/python3 (ver 3.10.6)
-- Libraries: NO
-- Limited API: NO
-- numpy: /home/cdeln/.pyenv/versions/default/lib/python3.10/site-packages/numpy/core/include (ver 1.24.3)
-- install path: -
Looks like you either did not install numpy
or need using the following options:
# Example:
# -D PYTHON3_EXECUTABLE=/Workspace/miniconda3/bin/python \
# -D PYTHON3_INCLUDE=/Workspace/miniconda3/include/python3.10 \
# -D PYTHON3_LIBRARIES=/Workspace/miniconda3/lib \
You will have to run a clean configure either way by removing the build
.
from opencv.
Hmm, some questions
- Do I have to use miniconda? (I use pyenv currently)
- Doesn't this line mean that numpy is found?
/home/cdeln/.pyenv/versions/default/lib/python3.10/site-packages/numpy/core/include (ver 1.24.3)
from opencv.
from opencv.
Related Issues (20)
- fegetround and fesetround not in std namespace. HOT 1
- Missing Fields in OpenCV-Python Tutorials HOT 1
- findCirclesGrid fails to detect calibration board
- QNX building Error HOT 1
- Add roadmap from dmabuffer to UMat HOT 1
- Layer_Einsum_Test.Accuracy_01D test crashes on 32-bit Linux systems
- Disable strict mode when reading avif files HOT 1
- opencv2 build error on linux HOT 2
- Exceptions when not named parameters HOT 8
- cv2.error: in function 'cv::cornerSubPix' HOT 1
- doc: ToC has duplicated "OpenCV Theory" at Basic Drawing
- Add a family of routines for evaluating confidence limits on parameters of the models optimized with SolvePnP and calibrateCamera HOT 1
- Matmul layer craches with CUDA backend HOT 6
- Python Bindings donot allow Boolean Tensors
- Android 15: UnsatisfiedLinkError: dlopen failed: empty/missing DT_HASH/DT_GNU_HASH
- DirectShow get device name problem
- basic operation python tutorial still mentions itemset HOT 5
- is:issue is:open I have a Java Service running in Windows, the program used the dependency of "opencv_java455.dll",but now I want to deployee the service on ubantu, How do I do?
- onnx dnn performance decreases in multithreading HOT 2
- "How to contribute to OpenCV" is out of date.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencv.