Issue 1:
Hi,

I successfully converted my Keras H5 model that I use in Python into a pb and pbtxt files in order to use the same model in C++ via OpenCV.

You can find below the sample code I used simply to make sure that I can load the model correctly:

#include <opencv2/dnn.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>

#include <fstream>
#include <sstream>
#include <iostream>

using namespace cv;
using namespace dnn;
using namespace std;

int main()
{
String modelConfiguration = "wine_plant_detector.pbtxt";
String modelWeights = "wine_plant_detector.pb";
Mat blob;

Net net = readNetFromTensorflow(modelWeights, modelConfiguration);

return 0;
}

That gives me the following error in Visual Studio 2017:

OpenCV(4.4.0) Error: Assertion failed (const_layers.insert(std::make_pair(name, li)).second) in
cv::dnn::dnn4_v20200609::`anonymous-namespace'::addConstNodes, file C:\build\master_winpack-build-win64-
vc15\opencv\modules\dnn\src\tensorflow\tf_importer.cpp, line 672

I have attached the model files so that you can test your end.

model_files.zip

What I do not understand is that if I only use load the weight file it can load the model so the error seems to occur while trying to read the model configuration file. Is it necessary to use that file that make inference?

Here is my setup:

OpenCV => 4.4

Operating System / Platform => Windows 64 Bit

Compiler => Visual Studio 2017

Thanks in advance.

Regards,

Issue 2:
This crash log is the same version of the previous crash log of #8015

System information (version)

OpenCV => 3.2

Qt 5.7.1

Qt Creator 4.2.0

Operating System / Platform => Ubuntu 16.04

Compiler => GCC 4.9.1

GPU: Geforce GTX 1070

Cuda 8.0

Code was succesfully compiled. I get this error at run time;

OpenCV Error: The function/feature is not implemented (Unknown/unsupported array type) in getUMatVector, file /opt/opencv/modules/core/src/matrix.cpp, line 1470
terminate called after throwing an instance of 'cv::Exception'
what(): /opt/opencv/modules/core/src/matrix.cpp:1470: error: (-213) Unknown/unsupported array type in function getUMatVector

The program has unexpectedly finished.

main code;

#include "mainwindow.h"
#include <QApplication>
#include <QDebug>
#include <QElapsedTimer>

#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/stitching.hpp>

using namespace cv;
using namespace cv::cuda;
using namespace std;

int main(int argc, char *argv[])
{
QApplication a(argc, argv);

QElapsedTimer tTmr;
tTmr.start();

bool try_use_gpu = true; // use GPU
Stitcher stitcher = Stitcher::createDefault(try_use_gpu);

stitcher.setWarper(new CylindricalWarperGpu());
stitcher.setWaveCorrection(false);
stitcher.setSeamEstimationResol(0.001);
stitcher.setPanoConfidenceThresh(0.1);

//stitcher.setSeamFinder(new cv::detail::GraphCutSeamFinder(cv::detail::GraphCutSeamFinderBase::COST_COLOR_GRAD));
stitcher.setSeamFinder(new cv::detail::NoSeamFinder());
stitcher.setBlender(cv::detail::Blender::createDefault(cv::detail::Blender::NO, try_use_gpu));
//stitcher.setExposureCompensator(cv::detail::ExposureCompensator::createDefault(cv::detail::ExposureCompensator::NO));
stitcher.setExposureCompensator(new cv::detail::NoExposureCompensator());

std::vector<cv::Mat> images(3);
std::vector<GpuMat> gpuImages(3);
GpuMat pano_result_gpu;
cv::Mat pano_result;
bool firstTime = true;

QString tImagePath = QApplication::applicationDirPath() + "/../data/stitching_img";

images[0] = imread((tImagePath + "/shanghai01.jpg").toStdString());
images[1] = imread((tImagePath + "/shanghai02.jpg").toStdString());
images[2] = imread((tImagePath + "/shanghai03.jpg").toStdString());

for (int i = 0; i < 3; i++)
gpuImages[i].upload(images[i]);

if (firstTime)
{
Stitcher::Status status = stitcher.estimateTransform(gpuImages);//images);//

qDebug()<<"Esimate Status: "<<status;

firstTime = false;
}

Stitcher::Status status = stitcher.composePanorama(gpuImages, pano_result_gpu);//images, pano_result);//
qint64 tTime = tTmr.elapsed();

qDebug()<<"Panorama status: "<<status;

pano_result_gpu.download(pano_result);

imwrite("D:/stitching_result.jpg", pano_result);

qDebug()<<"File Saved: "<<tTime;

MainWindow w;
w.show();

return a.exec();
}

cmake output

Detected version of GNU GCC: 54 (504)
FP16: Feature disabled
Checking for module 'gtk+-3.0'
No package 'gtk+-3.0' found
Checking for module 'gstreamer-base-1.0'
No package 'gstreamer-base-1.0' found
Checking for module 'gstreamer-video-1.0'
No package 'gstreamer-video-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-base-0.10'
No package 'gstreamer-base-0.10' found
Checking for module 'gstreamer-video-0.10'
No package 'gstreamer-video-0.10' found
Checking for module 'gstreamer-app-0.10'
No package 'gstreamer-app-0.10' found
Checking for module 'gstreamer-riff-0.10'
No package 'gstreamer-riff-0.10' found
Checking for module 'gstreamer-pbutils-0.10'
No package 'gstreamer-pbutils-0.10' found
Looking for linux/videodev.h
Looking for linux/videodev.h - not found
Looking for linux/videodev2.h
Looking for linux/videodev2.h - found
Looking for sys/videoio.h
Looking for sys/videoio.h - not found
Checking for module 'libavresample'
No package 'libavresample' found
Checking for module 'libgphoto2'
No package 'libgphoto2' found
found IPP (ICV version): 9.0.1 [9.0.1]
at: /opt/opencv/release/3rdparty/ippicv/ippicv_lnx
CUDA detected: 8.0
CUDA NVCC target flags: -gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-D_FORCE_INLINES
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 JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN)
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
Caffe: NO
Protobuf: NO
Glog: NO
freetype2: YES
harfbuzz: YES
Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS)
Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
freetype2: YES
harfbuzz: YES
Checking for modules 'tesseract;lept'
No package 'tesseract' found
No package 'lept' found
Tesseract: NO
Check contents of vgg_generated_48.i ...
Check contents of vgg_generated_64.i ...
Check contents of vgg_generated_80.i ...
Check contents of vgg_generated_120.i ...
Check contents of boostdesc_bgm.i ...
Check contents of boostdesc_bgm_bi.i ...
Check contents of boostdesc_bgm_hd.i ...
Check contents of boostdesc_binboost_064.i ...
Check contents of boostdesc_binboost_128.i ...
Check contents of boostdesc_binboost_256.i ...
Check contents of boostdesc_lbgm.i ...

General configuration for OpenCV 3.2.0 =====================================
Version control: 3.2.0

Extra modules:
Location (extra): /opt/opencv_contrib/modules
Version control (extra): 3.2.0

Platform:
Timestamp: 2017-01-20T07:13:04Z
Host: Linux 4.4.0-31-generic x86_64
CMake: 3.5.1
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: Release

C/C++:
Built as dynamic libs?: YES
C++ Compiler: /usr/bin/c++ (ver 5.4.0)
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 -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-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 -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: /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 -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=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 -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release):
Linker flags (Debug):
ccache: NO
Precompiled headers: YES
Extra dependencies: /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libjasper.so gtk-x11-2.0 gdk-x11-2.0 pangocairo-1.0 atk-1.0 cairo gdk_pixbuf-2.0 gio-2.0 pangoft2-1.0 pango-1.0 gobject-2.0 glib-2.0 fontconfig freetype gthread-2.0 dc1394 avcodec-ffmpeg avformat-ffmpeg avutil-ffmpeg swscale-ffmpeg dl m pthread rt cudart nppc nppi npps cufft -L/usr/local/cuda/lib64
3rdparty dependencies: libwebp libpng libtiff libjpeg IlmImf libprotobuf

OpenCV modules:
To be built: cudev core cudaarithm flann imgproc ml reg surface_matching video cudabgsegm cudafilters cudaimgproc cudawarping dnn freetype fuzzy imgcodecs photo shape videoio cudacodec highgui objdetect plot ts xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo datasets rgbd stereo superres tracking videostab xfeatures2d ximgproc aruco optflow phase_unwrapping stitching structured_light python2
Disabled: world contrib_world
Disabled by dependency: -
Unavailable: java python3 viz cnn_3dobj cvv hdf matlab sfm

GUI:
QT: NO
GTK+ 2.x: YES (ver 2.24.30)
GThread : YES (ver 2.48.1)
GtkGlExt: NO
OpenGL support: NO
VTK support: NO

Media I/O:
ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8)
JPEG: libjpeg (ver 90)
WEBP: build (ver 0.3.1)
PNG: build (ver 1.6.24)
TIFF: build (ver 42 - 4.0.2)
JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
OpenEXR: build (ver 1.7.1)
GDAL: NO
GDCM: NO

Video I/O:
DC1394 1.x: NO
DC1394 2.x: YES (ver 2.2.4)
FFMPEG: YES
avcodec: YES (ver 56.60.100)
avformat: YES (ver 56.40.101)
avutil: YES (ver 54.31.100)
swscale: YES (ver 3.1.101)
avresample: NO
GStreamer: NO
OpenNI: NO
OpenNI PrimeSensor Modules: NO
OpenNI2: NO
PvAPI: NO
GigEVisionSDK: NO
Aravis SDK: NO
UniCap: NO
UniCap ucil: NO
V4L/V4L2: NO/YES
XIMEA: NO
Xine: NO
gPhoto2: NO

Parallel framework: pthreads

Other third-party libraries:
Use IPP: 9.0.1 [9.0.1]
at: /opt/opencv/release/3rdparty/ippicv/ippicv_lnx
Use IPP Async: NO
Use VA: NO
Use Intel VA-API/OpenCL: NO
Use Lapack: NO
Use Eigen: NO
Use Cuda: YES (ver 8.0)
Use OpenCL: YES
Use OpenVX: NO
Use custom HAL: NO

NVIDIA CUDA
Use CUFFT: YES
Use CUBLAS: NO
USE NVCUVID: NO
NVIDIA GPU arch: 60 61
NVIDIA PTX archs:
Use fast math: YES

OpenCL: <Dynamic loading of OpenCL library>
Include path: /opt/opencv/3rdparty/include/opencl/1.2
Use AMDFFT: NO
Use AMDBLAS: NO

Python 2:
Interpreter: /usr/bin/python2.7 (ver 2.7.12)
Libraries: /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.12)
numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.11.0)
packages path: lib/python2.7/dist-packages

Python 3:
Interpreter: /usr/bin/python3 (ver 3.5.2)

Python (for build): /usr/bin/python2.7

Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO

Matlab: Matlab not found or implicitly disabled

Tests and samples:
Tests: YES
Performance tests: YES
C/C++ Examples: NO

Install path: /usr/local

cvconfig.h is in: /opt/opencv/release
-----------------------------------------------------------------

Configuring done

what is wrong?