Can't load ONNX model

Description

I am getting an error in loading my custom face mask detection model ONNX using the SSD Detector code when I run the main code. I can’t figure out why. Can someone help me? I have included the onnx file and the detector code below in relevant files. Thank you!

This is the error that I am getting.

Loading SSD weights from file...
Traceback (most recent call last):
  File "main.py", line 220, in <module>
    rgb_thread = RGBThread(model=FACE_DET_MODEL)
  File "/home/g1-facemask/FMTemp/rgb/rgb_thread.py", line 18, in __init__
    self._detector = SsdDetector()
  File "/home/g1-facemask/FMTemp/rgb/ssd/detector.py", line 18, in __init__
    self._net = cv2.dnn.readNetFromONNX(onnx_model_pth)
cv2.error: OpenCV(4.4.0) /tmp/build_opencv/opencv/modules/dnn/src/dnn.cpp:604: error: (-2:Unspecified error) Can't create layer "433" of type "Exp" in function 'getLayerInstance'

Environment

TensorRT Version: 8
GPU Type:
Nvidia Driver Version: Jetpack 4.6 Jetson Nano
CUDA Version:
CUDNN Version:
Operating System + Version: Ubuntu 18.04
Python Version (if applicable):
TensorFlow Version (if applicable):
PyTorch Version (if applicable):
Baremetal or Container (if container which image + tag):

Relevant Files

detector.py (1.3 KB)
ssd-mobilenet.onnx (26.5 MB)

Please attach or include links to any models, data, files, or scripts necessary to reproduce your issue. (Github repo, Google Drive, Dropbox, etc.)

Hi,

(-2:Unspecified error) Can't create layer "433" of type "Exp" in function 'getLayerInstance'

Based on the error, it seems that OpenCV meet some issue when deploying the Exp layer.
Since OpenCV is a third-party library, would you mind checking this issue with the library owner directly?

Thanks.

Is there any other way to load my onnx model rather than opencv in which I can get the same output as in the code detector.py?

Hi,

Could you try if the model can be deployed with TensorRT first?

/usr/src/tensorrt/bin/trtexec --onnx=[model]

If yes, you can refer to the below sample to run it with OpenCV data:

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.