Fail to run dnn with OpenCV C++

side info if needed
{
I have OpenCV-4x and I am using it with Windows 10 Home, Visual Studio 2019 and Intel D455. I followed the steps in this link librealsense/readme.md at master · IntelRealSense/librealsense · GitHub

but instead of using OpenCV3.4 I am using OpenCV-4x

Reason I did is here OpenCV · Issue #11496 · IntelRealSense/librealsense · GitHub
}

The problem: When I run OpenCV dnn, the following errors show up even though other projects, such as imshow, works fine.

[ INFO:0@1.678] global registry.impl.hpp:114 cv::highgui_backend::UIBackendRegistry::UIBackendRegistry UI: Enabled backends(4, sorted by priority): GTK(1000); GTK3(990); GTK2(980); WIN32(970) + BUILTIN(WIN32UI)
[ INFO:0@1.678] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load C:\git\librealsense\build\Debug\opencv_highgui_gtk470_64.dll => FAILED
[ INFO:0@1.680] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_highgui_gtk470_64.dll => FAILED
[ INFO:0@1.680] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load C:\git\librealsense\build\Debug\opencv_highgui_gtk3470_64.dll => FAILED
[ INFO:0@1.681] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_highgui_gtk3470_64.dll => FAILED
[ INFO:0@1.681] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load C:\git\librealsense\build\Debug\opencv_highgui_gtk2470_64.dll => FAILED
[ INFO:0@1.681] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_highgui_gtk2470_64.dll => FAILED
[ INFO:0@1.682] global backend.cpp:90 cv::highgui_backend::createUIBackend UI: using backend: WIN32 (priority=970)
[ INFO:0@1.682] global window_w32.cpp:3008 cv::impl::Win32BackendUI::createWindow OpenCV/UI: Creating Win32UI window: Display Image (1)
[ INFO:0@2.693] global registry_parallel.impl.hpp:96 cv::parallel::ParallelBackendRegistry::ParallelBackendRegistry core(parallel): Enabled backends(3, sorted by priority): ONETBB(1000); TBB(990); OPENMP(980)
[ INFO:0@2.694] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load C:\git\librealsense\build\Debug\opencv_core_parallel_onetbb470_64d.dll => FAILED
[ INFO:0@2.696] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_core_parallel_onetbb470_64d.dll => FAILED
[ INFO:0@2.696] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load C:\git\librealsense\build\Debug\opencv_core_parallel_tbb470_64d.dll => FAILED
[ INFO:0@2.697] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_core_parallel_tbb470_64d.dll => FAILED
[ INFO:0@2.697] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load C:\git\librealsense\build\Debug\opencv_core_parallel_openmp470_64d.dll => FAILED
[ INFO:0@2.699] global plugin_loader.impl.hpp:67 cv::plugin::impl::DynamicLib::libraryLoad load opencv_core_parallel_openmp470_64d.dll => FAILED
OpenCV(4.7.0-dev) Error: Assertion failed (!blobs.empty() || inputs.size() > 1) in cv::dnn::ConvolutionLayerImpl::getMemoryShapes, file C:\git\opencv-4.x\modules\dnn\src\layers\convolution_layer.cpp, line 392
[ERROR:0@2.797] global net_impl.cpp:1164 cv::dnn::dnn4_v20221220::Net::Impl::getLayerShapesRecursively OPENCV/DNN: [Convolution]:(conv0): getMemoryShapes() throws exception. inputs=1 outputs=0/1 blobs=0
[ERROR:0@2.797] global net_impl.cpp:1167 cv::dnn::dnn4_v20221220::Net::Impl::getLayerShapesRecursively input[0] = [ 1 3 300 300 ]
[ERROR:0@2.798] global net_impl.cpp:1177 cv::dnn::dnn4_v20221220::Net::Impl::getLayerShapesRecursively Exception message: OpenCV(4.7.0-dev) C:\git\opencv-4.x\modules\dnn\src\layers\convolution_layer.cpp:392: error: (-215:Assertion failed) !blobs.empty() || inputs.size() > 1 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'

OpenCV(4.7.0-dev) C:\git\opencv-4.x\modules\dnn\src\layers\convolution_layer.cpp:392: error: (-215:Assertion failed) !blobs.empty() || inputs.size() > 1 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'

C:\git\librealsense\build\Debug\OFFrs-dnn.exe (process 11256) exited with code 1.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .

Can some one help please? thank you in advance.

your original (3.4) issue has a simple solution:

the folder containing the opencv dlls must be appended to the PATH env variable, so your exe can find those dlls at runtime
(same problem with any other opencv version, btw)

we need to see, what kind of model you’re using here, how it got exported, etc
also, code for the network input, please !

is it the sample from here ?

where / how did you dl the model data ?
(cant find any link to the caffemodel there, did you try any of those, too ?)

btw, cannot reproduce your problem (colab/4.7.0-dev) with data from here

cv::dnn::Net q = cv::dnn::readNet("/content/MobileNetSSD_deploy.caffemodel", "/content/MobileNetSSD_deploy.prototxt");
Mat i(300,300,CV_8UC3);
Mat inputBlob = cv::dnn::blobFromImage(i, 1,
                                      Size(300,300), Scalar(), false);
q.setInput(inputBlob, "data");
Mat o = q.forward();
cout << o.size << endl;

// 1 x 1 x 100 x 7