Custom Model Initialization help (Jetson-inference C++)


I’ve retrained SSD-Mobilenet-V1 using

I have been able to run object detection using I believe the python interface from the command line.

Now I’d like to use the retrained model in C++.
However I am having trouble specifying the output layer blob for the detectnet::create() function call. Below, are the major portions of code for initializing the model. What is giving me trouble is the “const char*output” parameter where I’ve passed in the character array “scores”. I am using scores because this seems to be the output layer labeled. I used the onnx library to get the names of the output layers from the onnx file generated. This check returns the output layer names “scores” and “boxes”. I’ve tried both but no luck.

const Dims3 input_dims;

detectNet * net = detectNet::Create("ssd-mobilenet.onnx", "labels.txt", 0.5, "input_0", input_dims, "scores", "10")

During initialization, I get the following error:

“INVALID_ARGUMENT: Cannot find binding of given name: 10
Failed to find requested output layer 10 in network.”

As mentioned, I’ve been successfully able to run the model using Python. So I think the issue is with the output blob character array that I am passing to the initialization function.

Thank you.


You can find a C++ based detectnet example below:

Please check if Postprocessor and Postprocessor_1 can work for your model.
If not, you can visualize the model with the below page to find the correct output name.


1 Like

This should still work with .onnx files right? My assumption is .prototxt and .uff files are interpreted differently. I’ll be giving this a go soon. And if this doesn’t work with .onnx, I imagine I can convert the files. Thank you!

Hi @cap, use this overload of detectNet::Create() for ONNX:

net = detectNet::Create(NULL, "ssd-mobilenet.onnx", NULL, "labels.txt", 0.5f, "input_0", "scores", "boxes");
1 Like

@dusty_nv ,
Thank you, that worked.

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