A custom video analytics plugin
AnsweredHello
I created a plugin for object detection with custom model. The plugin was built successfully. The model I use is PaddleDetection model.
Nx winess is used to test plugin. The log file outputs:
ERROR PluginManager(0x179491882c0): Failed loading Server Plugin [C:/Program Files/Network Optix/Nx Witness/MediaServer/plugins/opencv_object_detection_analytics_plugin.dll] (): [cannotLoadLibrary]: Cannot load library C:\Program Files\Network Optix\Nx Witness\MediaServer\plugins\opencv_object_detection_analytics_plugin.dll: The specified module could not be found.
How can I check what the problem is or share codebase privately
-
Hello,
Please provide the following information:
OS version, VMS build number, Metadata SDK version.
The output of the command
dir "C:\Program Files\Network Optix\Nx Witness\MediaServer\plugins"
What step of the guide are you in?
C:\Program Files\Network Optix\Nx Witness\MediaServer\plugins\opencv_object_detection_analytics_plugin.dll
Judging by that, I'd suppose you have one of two situations.
1) If you're using a model file, that means you have at least two files in your plugin solution and you should place those files in a separate folder. The model file has not been places to the folder.
2) You have created a separate folder and have placed there all the necessary files, but you have forgotten to delete the opencv_object_detection_analytics_plugin.dll file for the "plugins" directory.
0 -
Hi,
Windows 11 pro 10.0.22621
metadata Sdk 5.0.0 R6
Nx Witness VMS 5.0.0.35745
I didn't rename the plugin. I created my own version based on a tutorial, with the difference being that I used the PaddleDetection (https://github.com/PaddlePaddle/PaddleDetection/tree/release/2.6/deploy/cpp) model instead of the original model used in the tutorial.
The problem is most likely related to errors in the code, and I'm wondering how I can verify if that's the case and where the error is occurring, especially since the log manager is only indicating that the plugin failed to load.0 -
Hello,
Thanks for the information.
Would you mind doing this?
Could you please share the output of the command
dir "C:\Program Files\Network Optix\Nx Witness\MediaServer\plugins"
What step of the guide are you in?
The code of which "step" folder have you taken as the basis for your plugin?
I'm going to create a support ticket for sharing the code.
0 -
Hello,
Here is what I found out.
The paddle_inference library has a bunch of dependencies which, judging by your CMakeLists.txt, are supposed to be linked statically.
Obviously, some of them has not been linked, because the log message, you've shared on the forumcannotLoadLibrary]: Cannot load library C:\Program Files\Network Optix\Nx Witness\MediaServer\plugins\opencv_object_detection_analytics_plugin.dll: The specified module could not be found.
always means that one or several dependencies has not been found or loaded.
I walked through the thrid_party folder, found several dll files and copied those to the corresdpoding directory.
In case, a plugin has dll it depends on, the files should be copied to a dedicated directory.
For detail, read the "Organizing third-party library files" section in our guide https://meta.nxvms.com/docs/developers/knowledgebase/235-step-4-adding-object-detection
See the screenshot for directory content in my lab
I have not investigated further which of the dll copied was missing. With the dll set presented, the plugin was loaded successfully. See the screenshot.
0 -
Hello, thank you.
It seems that there is another issue as the plugin is not appearing in the camera settings.
Any ideas on how to check what might be wrong? Thank you.0 -
Hi,
the plugin is not appearing in the camera settings.
Could you elaborate, what do you mean by that?
Here is how it's my lab.
0 -
Hello,
I apologize for the inconvenience. The previous message is no longer relevant.
What I currently have is that the server freezes when I enable the plugin.
I thought it may be due to limits of hardware. I experimented with different frame rate and optimized slightly model initialization but it seems it's not a case.
The error in plugin is still possible.0 -
Hi,
The message you've shared most probably is the evidence that the Server has crashed.
Have no idea what's wrong. Can't reproduce that, with the code edition I have.
0 -
Hello,
I tried to reproduce the issue as precisely as possible.
Here is what I've found out.
I downloaded prebuilt OpenCV of your version from here
https://sourceforge.net/projects/opencvlibrary/files/3.4.6/opencv-3.4.6-vc14_vc15.exe/download
During cmake configuration stage I got a message.OpenCV STATIC: OFF
To me that means, this OpenCV configuration is supposed to be linked dynamically, thus requires a .dll file to be copied with the project.

I copied C:\develop\OpenCV 3.4.6\opencv\build\x64\vc15\bin\opencv_world346.dll to the plugin's directory.
Here is the content$ ls -l "C:\Program Files\Network Optix\Nx Witness\MediaServer\plugins\opencv_object_detection_analytics_plugin"
total 252404
-rwxr-xr-x 1 Andrey 197121 1726848 Aug 17 2022 libiomp5md.dll*
-rwxr-xr-x 1 Andrey 197121 21456384 Aug 17 2022 mkldnn.dll*
-rwxr-xr-x 1 Andrey 197121 92649344 Aug 17 2022 mklml.dll*
-rwxr-xr-x 1 Andrey 197121 7900064 Aug 17 2022 onnxruntime.dll*
-rwxr-xr-x 1 Andrey 197121 715776 May 23 21:50 opencv_object_detection_analytics_plugin.dll*
-rwxr-xr-x 1 Andrey 197121 79301632 Apr 7 2019 opencv_world346.dll*
-rwxr-xr-x 1 Andrey 197121 50800640 Aug 17 2022 paddle_inference.dll*
-rwxr-xr-x 1 Andrey 197121 3899392 Aug 17 2022 paddle2onnx.dll*After Server restart, the plugin was loaded successfully.
When I try to enable the plugin on a camera, the Server crashes.
That's obviously because the ObjectDetector class crashes, because model files are missing in my lab.explicit ObjectDetector(const std::string &model_dir = "C:/Users/Development/develop_steps/compressed_obj_model",
const std::string &device = "CPU",
bool use_mkldnn = false, int cpu_threads = 1,
const std::string &run_mode = "paddle",
const int batch_size = 1, const int gpu_id = 0,
const int trt_min_shape = 1,
const int trt_max_shape = 1280,
const int trt_opt_shape = 640,
bool trt_calib_mode = false)The further hurdles of this kind are related to the ObjectDetector class implementation and are not related to the Metadata SDK interfaces.
0
Please sign in to leave a comment.
Comments
9 comments