opencv: C++ version of OpenCV 4.8.0 returns wrong matrix size for ONNX model

System Information

OpenCV 4.8.0 Operating System: CentOS Compiler: GCC11

opencv-python-rolling-4.8.0.20230624 Windows 10

Detailed description

I am loading the same model with OpenCV Python ok, but get the wrong matrix size for the inference result in the compiled C++ version. Netron confirms the output nodes to be 1170 and 1179 with sizes 1x8400x5 and 1x8400x4. The Python version of OpenCV does return this matrix size, while the C++ version returns [8400 x 1] depth 5 channels() 1 type() 5.

The compile machine is offline and I provided the correct version of ADE by hand.

Other DNN models load and work fine.

Find the model here: https://drive.google.com/file/d/1pvp9WceSrJAREsJ6sEev-cPmHHdr7Cll/view?usp=drive_link

Steps to reproduce

Compile OpenCV 4.8 offline using the following configuartion:

cmake3 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/build/uk/Frameworks/opencv-4.8.0-ov-AVX2-default-debug-install VERBOSE=1 -DOPENCV_EXTRA_MODULES_PATH=~/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/ -DCPU_BASELINE=AVX2 -DENABLE_OMIT_FRAME_POINTER=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_opencv_apps=OFF  ~/local/Frameworks/opencv/4.8.0_trial/source/lib
-- ocv_init_download: OpenCV source tree is not fetched as git repository. 3rdparty resources will be downloaded from github.com by default.
-- Detected processor: x86_64
Python 2.7.5
-- Looking for ccache - not found
Cleaning INTERNAL cached variable: ZLIB_LIBRARY
Cleaning INTERNAL cached variable: ZLIB_INCLUDE_DIR
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) (Required is at least version "1.2.3")
Cleaning INTERNAL cached variable: JPEG_LIBRARY
Cleaning INTERNAL cached variable: JPEG_INCLUDE_DIR
-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
-- libjpeg-turbo: VERSION = 2.1.3, BUILD = opencv-4.8.0-libjpeg-turbo-debug
Cleaning INTERNAL cached variable: TIFF_LIBRARY
Cleaning INTERNAL cached variable: TIFF_INCLUDE_DIR
-- Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR)
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.8.0-openjp2-2.5.0-debug
-- OpenJPEG libraries will be built from sources: libopenjp2 (version "2.5.0")
Cleaning INTERNAL cached variable: PNG_LIBRARY
Cleaning INTERNAL cached variable: PNG_INCLUDE_DIR
-- Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
-- IPPICV: Downloading ippicv_2021.8_lnx_intel64_20230330_general.tgz from https://raw.githubusercontent.com/opencv/opencv_3rdparty/1224f78da6684df04397ac0f40c961ed37f79ccb/ippicv/ippicv_2021.8_lnx_intel64_20230330_general.tgz
-- Try 1 failed
--
=======================================================================
  Couldn't download files from the Internet.
  Please check the Internet access on this host.
=======================================================================

CMake Warning at cmake/OpenCVDownload.cmake:248 (message):
  IPPICV: Download failed: 6;"Couldn't resolve host name"

  For details please refer to the download log file:


  /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug/CMakeDownloadLog.txt


Call Stack (most recent call first):
  3rdparty/ippicv/ippicv.cmake:37 (ocv_download)
  cmake/OpenCVFindIPP.cmake:259 (download_ippicv)
  cmake/OpenCVFindLibsPerf.cmake:12 (include)
  CMakeLists.txt:756 (include)


-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing: Atlas_CBLAS_INCLUDE_DIR Atlas_CLAPACK_INCLUDE_DIR Atlas_CBLAS_LIBRARY Atlas_BLAS_LIBRARY Atlas_LAPACK_LIBRARY)
-- Could NOT find BLAS (missing: BLAS_LIBRARIES)
-- LAPACK requires BLAS
-- A library with LAPACK API not found. Please specify library location.
-- Could NOT find Java (missing: Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE) (found version "1.8.0_372")
-- Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
-- 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 'gtk+-2.0'
--   No package 'gtk+-2.0' found
-- Checking for module 'gthread-2.0>=2.32'
--   No package 'gthread-2.0' found
-- Checking for modules 'libavcodec;libavformat;libavutil;libswscale'
--   No package 'libavcodec' found
--   No package 'libavformat' found
--   No package 'libavutil' found
--   No package 'libswscale' found
-- FFMPEG is disabled. Required libraries: libavcodec;libavformat;libavutil;libswscale. Missing libraries: libavcodec;libavformat;libavutil;libswscale
-- 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
-- Checking for module 'libdc1394-2'
--   No package 'libdc1394-2' found
-- Module opencv_alphamat disabled because the following dependencies are not found: Eigen
-- Checking for module 'freetype2'
--   No package 'freetype2' found
-- Checking for module 'harfbuzz'
--   No package 'harfbuzz' found
-- freetype2:   NO
-- harfbuzz:    NO
-- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS) (found version "")
-- Julia not found. Not compiling Julia Bindings.
-- Module opencv_ovis disabled because OGRE3D was not found
-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-- Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
-- Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
-- Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
-- Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
-- Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
-- Checking for module 'tesseract'
--   No package 'tesseract' found
-- Tesseract:   NO
-- Allocator metrics storage type: 'long long'
-- 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': /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
-- opencv_dnn: filter out cuda4dnn source code
-- 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.lasx.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
-- imgcodecs: OpenEXR codec is disabled in runtime. Details: https://github.com/opencv/opencv/issues/21326
-- highgui: using builtin backend: NONE
-- rgbd: Eigen support is disabled. Eigen is Required for Posegraph optimization
-- wechat_qrcode: Downloading detect.caffemodel from https://raw.githubusercontent.com/WeChatCV/opencv_3rdparty/a8b69ccc738421293254aec5ddb38bd523503252/detect.caffemodel
-- Try 1 failed
--
=======================================================================
  Couldn't download files from the Internet.
  Please check the Internet access on this host.
=======================================================================

CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/cmake/OpenCVDownload.cmake:248 (message):
  wechat_qrcode: Download failed: 6;"Couldn't resolve host name"

  For details please refer to the download log file:


  /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/wechat_qrcode/CMakeLists.txt:26 (ocv_download)


CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/wechat_qrcode/CMakeLists.txt:37 (message):
  WeChatQRCode: Can't get detect caffemodel file for wechat qrcode.


-- wechat_qrcode: Downloading detect.prototxt from https://raw.githubusercontent.com/WeChatCV/opencv_3rdparty/a8b69ccc738421293254aec5ddb38bd523503252/detect.prototxt
-- Try 1 failed
--
=======================================================================
  Couldn't download files from the Internet.
  Please check the Internet access on this host.
=======================================================================

CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/cmake/OpenCVDownload.cmake:248 (message):
  wechat_qrcode: Download failed: 6;"Couldn't resolve host name"

  For details please refer to the download log file:


  /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/wechat_qrcode/CMakeLists.txt:26 (ocv_download)


CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/wechat_qrcode/CMakeLists.txt:37 (message):
  WeChatQRCode: Can't get detect prototxt file for wechat qrcode.


-- wechat_qrcode: Downloading sr.caffemodel from https://raw.githubusercontent.com/WeChatCV/opencv_3rdparty/a8b69ccc738421293254aec5ddb38bd523503252/sr.caffemodel
-- Try 1 failed
--
=======================================================================
  Couldn't download files from the Internet.
  Please check the Internet access on this host.
=======================================================================

CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/cmake/OpenCVDownload.cmake:248 (message):
  wechat_qrcode: Download failed: 6;"Couldn't resolve host name"

  For details please refer to the download log file:


  /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/wechat_qrcode/CMakeLists.txt:26 (ocv_download)


CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/wechat_qrcode/CMakeLists.txt:37 (message):
  WeChatQRCode: Can't get sr caffemodel file for wechat qrcode.


-- wechat_qrcode: Downloading sr.prototxt from https://raw.githubusercontent.com/WeChatCV/opencv_3rdparty/a8b69ccc738421293254aec5ddb38bd523503252/sr.prototxt
-- Try 1 failed
--
=======================================================================
  Couldn't download files from the Internet.
  Please check the Internet access on this host.
=======================================================================

CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/cmake/OpenCVDownload.cmake:248 (message):
  wechat_qrcode: Download failed: 6;"Couldn't resolve host name"

  For details please refer to the download log file:


  /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/wechat_qrcode/CMakeLists.txt:26 (ocv_download)


CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/wechat_qrcode/CMakeLists.txt:37 (message):
  WeChatQRCode: Can't get sr prototxt file for wechat qrcode.


-- xfeatures2d/boostdesc: Downloading boostdesc_bgm.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm.i
-- Try 1 failed
--
=======================================================================
  Couldn't download files from the Internet.
  Please check the Internet access on this host.
=======================================================================

CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/cmake/OpenCVDownload.cmake:248 (message):
  xfeatures2d/boostdesc: Download failed: 6;"Couldn't resolve host name"

  For details please refer to the download log file:


  /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/cmake/download_boostdesc.cmake:22 (ocv_download)
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/CMakeLists.txt:12 (download_boost_descriptors)


-- xfeatures2d/boostdesc: Downloading boostdesc_bgm_bi.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm_bi.i
-- Try 1 failed
--
=======================================================================
  Couldn't download files from the Internet.
  Please check the Internet access on this host.
=======================================================================

CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/cmake/OpenCVDownload.cmake:248 (message):
  xfeatures2d/boostdesc: Download failed: 6;"Couldn't resolve host name"

  For details please refer to the download log file:


  /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/cmake/download_boostdesc.cmake:22 (ocv_download)
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/CMakeLists.txt:12 (download_boost_descriptors)


-- xfeatures2d/boostdesc: Downloading boostdesc_bgm_hd.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm_hd.i
-- Try 1 failed
--
=======================================================================
  Couldn't download files from the Internet.
  Please check the Internet access on this host.
=======================================================================

CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/cmake/OpenCVDownload.cmake:248 (message):
  xfeatures2d/boostdesc: Download failed: 6;"Couldn't resolve host name"

  For details please refer to the download log file:


  /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/cmake/download_boostdesc.cmake:22 (ocv_download)
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/CMakeLists.txt:12 (download_boost_descriptors)


-- xfeatures2d/boostdesc: Downloading boostdesc_binboost_064.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_064.i
-- Try 1 failed
--
=======================================================================
  Couldn't download files from the Internet.
  Please check the Internet access on this host.
=======================================================================

CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/cmake/OpenCVDownload.cmake:248 (message):
  xfeatures2d/boostdesc: Download failed: 6;"Couldn't resolve host name"

  For details please refer to the download log file:


  /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/cmake/download_boostdesc.cmake:22 (ocv_download)
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/CMakeLists.txt:12 (download_boost_descriptors)


-- xfeatures2d/boostdesc: Downloading boostdesc_binboost_128.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_128.i
-- Try 1 failed
--
=======================================================================
  Couldn't download files from the Internet.
  Please check the Internet access on this host.
=======================================================================

CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/cmake/OpenCVDownload.cmake:248 (message):
  xfeatures2d/boostdesc: Download failed: 6;"Couldn't resolve host name"

  For details please refer to the download log file:


  /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/cmake/download_boostdesc.cmake:22 (ocv_download)
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/CMakeLists.txt:12 (download_boost_descriptors)


-- xfeatures2d/boostdesc: Downloading boostdesc_binboost_256.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_256.i
-- Try 1 failed
--
=======================================================================
  Couldn't download files from the Internet.
  Please check the Internet access on this host.
=======================================================================

CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/cmake/OpenCVDownload.cmake:248 (message):
  xfeatures2d/boostdesc: Download failed: 6;"Couldn't resolve host name"

  For details please refer to the download log file:


  /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/cmake/download_boostdesc.cmake:22 (ocv_download)
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/CMakeLists.txt:12 (download_boost_descriptors)


-- xfeatures2d/boostdesc: Downloading boostdesc_lbgm.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_lbgm.i
-- Try 1 failed
--
=======================================================================
  Couldn't download files from the Internet.
  Please check the Internet access on this host.
=======================================================================

CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/cmake/OpenCVDownload.cmake:248 (message):
  xfeatures2d/boostdesc: Download failed: 6;"Couldn't resolve host name"

  For details please refer to the download log file:


  /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/cmake/download_boostdesc.cmake:22 (ocv_download)
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/CMakeLists.txt:12 (download_boost_descriptors)


-- xfeatures2d/vgg: Downloading vgg_generated_48.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_48.i
-- Try 1 failed
--
=======================================================================
  Couldn't download files from the Internet.
  Please check the Internet access on this host.
=======================================================================

CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/cmake/OpenCVDownload.cmake:248 (message):
  xfeatures2d/vgg: Download failed: 6;"Couldn't resolve host name"

  For details please refer to the download log file:


  /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/cmake/download_vgg.cmake:16 (ocv_download)
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/CMakeLists.txt:13 (download_vgg_descriptors)


-- xfeatures2d/vgg: Downloading vgg_generated_64.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_64.i
-- Try 1 failed
--
=======================================================================
  Couldn't download files from the Internet.
  Please check the Internet access on this host.
=======================================================================

CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/cmake/OpenCVDownload.cmake:248 (message):
  xfeatures2d/vgg: Download failed: 6;"Couldn't resolve host name"

  For details please refer to the download log file:


  /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/cmake/download_vgg.cmake:16 (ocv_download)
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/CMakeLists.txt:13 (download_vgg_descriptors)


-- xfeatures2d/vgg: Downloading vgg_generated_80.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_80.i
-- Try 1 failed
--
=======================================================================
  Couldn't download files from the Internet.
  Please check the Internet access on this host.
=======================================================================

CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/cmake/OpenCVDownload.cmake:248 (message):
  xfeatures2d/vgg: Download failed: 6;"Couldn't resolve host name"

  For details please refer to the download log file:


  /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/cmake/download_vgg.cmake:16 (ocv_download)
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/CMakeLists.txt:13 (download_vgg_descriptors)


-- xfeatures2d/vgg: Downloading vgg_generated_120.i from https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_120.i
-- Try 1 failed
--
=======================================================================
  Couldn't download files from the Internet.
  Please check the Internet access on this host.
=======================================================================

CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/cmake/OpenCVDownload.cmake:248 (message):
  xfeatures2d/vgg: Download failed: 6;"Couldn't resolve host name"

  For details please refer to the download log file:


  /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/cmake/download_vgg.cmake:16 (ocv_download)
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/CMakeLists.txt:13 (download_vgg_descriptors)


CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/CMakeLists.txt:17 (message):
  features2d: Boost descriptor implementation is not available due to missing
  data (download failed:
  https://github.com/opencv/opencv_contrib/issues/1301)


CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/xfeatures2d/CMakeLists.txt:22 (message):
  features2d: VGG descriptor implementation is not available due to missing
  data (download failed:
  https://github.com/opencv/opencv_contrib/issues/1301)


-- data: Downloading face_landmark_model.dat from https://raw.githubusercontent.com/opencv/opencv_3rdparty/8afa57abc8229d611c4937165d20e2a2d9fc5a12/face_landmark_model.dat
-- Try 1 failed
--
=======================================================================
  Couldn't download files from the Internet.
  Please check the Internet access on this host.
=======================================================================

CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/cmake/OpenCVDownload.cmake:248 (message):
  data: Download failed: 6;"Couldn't resolve host name"

  For details please refer to the download log file:


  /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug/CMakeDownloadLog.txt


Call Stack (most recent call first):
  /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/face/CMakeLists.txt:13 (ocv_download)


CMake Warning at /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules/face/CMakeLists.txt:26 (message):
  Face: Can't get model file for face alignment.


-- Found 'misc' Python modules from /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/modules/python/package/extra_modules
-- Found 'mat_wrapper;utils' Python modules from /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/modules/core/misc/python/package
-- Found 'gapi' Python modules from /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/modules/gapi/misc/python/package
--
-- General configuration for OpenCV 4.8.0 =====================================
--   Version control:               unknown
--
--   Extra modules:
--     Location (extra):            /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/contrib/modules
--     Version control (extra):     unknown
--
--   Platform:
--     Timestamp:                   2023-07-12T11:50:51Z
--     Host:                        Linux 5.4.248-1.el7.elrepo.x86_64 x86_64
--     CMake:                       3.17.5
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/gmake
--     Configuration:               Debug
--
--   CPU/HW features:
--     Baseline:                    SSE SSE2 SSE3 SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
--       requested:                 AVX2
--     Dispatched code generation:  AVX512_SKX
--       requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
--       AVX512_SKX (5 files):      + AVX_512F AVX512_COMMON AVX512_SKX
--
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ standard:                11
--     C++ Compiler:                /ovde_plugins/gcc11/linux/bin/g++  (ver 11.3.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 -fno-omit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mf16c -mfma -mavx -mavx2 -fvisibility=hidden -fvisibility-inlines-hidden -O2 -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 -fno-omit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mf16c -mfma -mavx -mavx2 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /ovde_plugins/gcc11/linux/bin/gcc
--     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 -fno-omit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mf16c -mfma -mavx -mavx2 -fvisibility=hidden -O2 -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 -fno-omit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mf16c -mfma -mavx -mavx2 -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):      -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
--     Linker flags (Debug):        -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
--     ccache:                      NO
--     Precompiled headers:         NO
--     Extra dependencies:          dl m pthread rt
--     3rdparty dependencies:
--
--   OpenCV modules:
--     To be built:                 aruco bgsegm bioinspired calib3d ccalib core 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 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 cvv freetype hdf java julia matlab ovis python2 python3 sfm ts viz
--     Applications:                -
--     Documentation:               NO
--     Non-free algorithms:         NO
--
--   GUI:                           NONE
--     GTK+:                        NO
--     VTK support:                 NO
--
--   Media I/O:
--     ZLib:                        zlib (ver 1.2.13)
--     JPEG:                        libjpeg-turbo (ver 2.1.3-62)
--     WEBP:                        build (ver encoder: 0x020f)
--     PNG:                         build (ver 1.6.37)
--     TIFF:                        build (ver 42 - 4.2.0)
--     JPEG 2000:                   build (ver 2.5.0)
--     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
--     v4l/v4l2:                    YES (linux/videodev2.h)
--
--   Parallel framework:            pthreads
--
--   Trace:                         YES (with Intel ITT)
--
--   Other third-party libraries:
--     VA:                          YES
--     Lapack:                      NO
--     Eigen:                       NO
--     Custom HAL:                  NO
--     Protobuf:                    build (3.19.1)
--     Flatbuffers:                 builtin/3rdparty (23.5.9)
--
--   OpenCL:                        YES (INTELVA)
--     Include path:                /Net/subnet-homes/Development/User/ukoehler/local/Frameworks/opencv/4.8.0_trial/source/lib/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
--
--   Python (for build):            /usr/bin/python2.7
--
--   Java:
--     ant:                         NO
--     Java:                        NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
--
--   Install to:                    /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-default-debug-install
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /build/uk/Frameworks/opencv-4.8.0-ov-AVX2-PThreads-OpenMP-debug

Compile the test using the following configuration:

cmake3 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/build/uk/Frameworks/opencv-4.8.0-ov-AVX2-default-debug-install VERBOSE=1 ~/local/Frameworks/opencv/4.8.0_trial/source/ovtest

The code to load and execute the model

std::string modelPath = R"(/build/uk/DNNModels/Selftrained/YOLO-NAS/yolo_nas_m_drone-Sim.onnx)";

// Load the network
cv::dnn::Net net = cv::dnn::readNetFromONNX(modelPath);
net.setPreferableBackend(cv::dnn::DNN_BACKEND_OPENCV);
net.setPreferableTarget(cv::dnn::DNN_TARGET_CPU);

std::vector<cv::Mat> outs;
std::vector<std::string> outputNames = DNNHelper::getOutputsNames(net);
for (int i = 0; i < outputNames.size(); i++) {
    std::cout << "DNNHelper::getOutputsNames(net) " << i << "  " << DNNHelper::getOutputsNames(net).at(i) << std::endl;
}
net.forward(outs, DNNHelper::getOutputsNames(net));

std::cout << "outs.size() " << outs.size() << std::endl;
for (size_t i = 0; i < outs.size(); ++i)
{
    std::cout << i << "  " << outs[i].size() << " depth " << outs[i].depth() << " channels() " << outs[i].channels() << " type() " << outs[i].type() << std::endl;
}

The output

[DEBUG:0@10.440] global system.cpp:2881 restoreFPDenormalsState core: restore FP mxcsr flags = 0x00001fb0
[DEBUG:3@10.440] global system.cpp:2881 restoreFPDenormalsState core: restore FP mxcsr flags = 0x00001fb0
...
DNNHelper::getOutputsNames(net) 0  1170
DNNHelper::getOutputsNames(net) 1  1179
[DEBUG:0@10.492] global system.cpp:2842 setFPDenormalsIgnoreHint core: update FP mxcsr flags = 0x00009ff0
[DEBUG:0@10.492] global system.cpp:2881 restoreFPDenormalsState core: restore FP mxcsr flags = 0x00009ff0
...
outs.size() 2
0  [8400 x 1] depth 5 channels() 1 type() 5
1  [8400 x 1] depth 5 channels() 1 type() 5

Issue submission checklist

  • I report the issue, it’s not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

Check the difference:

  • outs[i].size() - works properly for 2D only. For ND arrays result is truncated.
  • outs[i].size

Also check .dims before accessing values.