In node 1 (importModel): INVALID_GRAPH: Assertion failed: tensors.count(input_name)

Description

I am trying to convert the keras model to tensorrt engine. The steps I followed are as follows

  1. Convert keras model to onnx model using keras2onnx library
    (keras2onnx version = 1.7.0)
  2. Parse the onnx model using trt.OnnxParser but getting parser output as False and with error as In node 1 (importModel): INVALID_GRAPH: Assertion failed: tensors.count(input_name).

Environment

TensorRT Version: 6.0.1.10
CUDA Version: 10.0.326
Python Version (if applicable): 3.6
TensorFlow Version (if applicable): 1.15.2

How can I deal with this error? Thanks

Hi @asmitadrukaretc,
I think this error comes from the ONNX parser having an issue parsing your graph, specifically that it found a node with no input I believe.
Can you try few things:
Check ONNX model using checker function and see if it passes?

import onnx
model = onnx.load(“model.onnx”)onnx.checker.check_model(model)

You can visually inspect your graph using something like https://lutzroeder.github.io/netron/ 13 to see if anything looks wrong with the graph.
If issue persist, could you please share your model file so we can help better.
Thanks!

Sorry for the late reply and thank you for the solution.
The output of the
import onnx
model = onnx.load(“model.onnx”)onnx.checker.check_model(model)
is None and I am assuming that is what expected.


The visual of the graph is attached, could you please help me to inspect it?

Hi @asmitadrukaretc, Can you pls share your model file so that we can assist on the same.
I am afraid, i cant see anything in the image you have shared for the graph .
Thanks!

Hi, can I get your mail id so that I can share it?

You can share your model via IM.
Thanks!

Hi @asmitadrukaretc,
I was not able to reproduce this issue on TRT-7.0.
Some sugestions you can try doing are -
Upgrade your TRT version to the latest.
We recommend you to use TRT NGC container to avoid any system dependency and do the conversion using trtexec

trtexec --onnx=detector.onnx --shapes=input:1x3x1x1 --verbose

Thanks!

Ok, I will try this.
Thanks!