Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TensorRT not working for custom ssd_mobilenetv2_fn training #6

Open
1208overlord opened this issue Oct 30, 2020 · 1 comment
Open

Comments

@1208overlord
Copy link

I have my own trained model with ssd_mobilenet_v2_fn.
And then, I tried both of tensorflow-onnx-trt and tensorflow-uff-trt, but all not working.
In stage of onnx-trt and uff-trt, it gives error.
I am using it on Jetson Xavier now
Can you give me help?

https://we.tl/t-MOTEiS4V8E

def build_engine():
flag = 1 << int(trt.NetworkDefinitionCreationFlag.EXPLICIT_BATCH)
“”“Takes an ONNX file and creates a TensorRT engine to run inference with”""
with trt.Builder(TRT_LOGGER) as builder, builder.create_network(flag) as network, trt.OnnxParser(network, TRT_LOGGER) as parser:
builder.max_workspace_size = 1 << 28 # 256MiB
builder.max_batch_size = 1

Parse model file

print(‘Loading ONNX file from path {}…’.format(onnx_file_path))
with open(onnx_file_path, ‘rb’) as model:
print(‘Beginning ONNX file parsing’)
parser.parse(model.read())
print(‘Completed parsing of ONNX file’)
print(‘Building an engine from file {}; this may take a while…’.format(onnx_file_path))
engine = builder.build_cuda_engine(network)
print(“Completed creating Engine”)
with open(engine_file_path, “wb”) as f:
f.write(engine.serialize())
return engine
Hello, I am using this script to convert onnx into trt engine for ssd mobilenet model.
And then, I have the following error.

Beginning ONNX file parsing
[TensorRT] ERROR: Parameter check failed at: …/builder/Network.cpp::addInput::671, condition: isValidDims(dims, hasImplicitBatchDimension())
Completed parsing of ONNX file
Building an engine from file ssd_mobilenet_v2_coco_2018_03_29/model_edit.onnx; this may take a while…
[TensorRT] ERROR: Network must have at least one output
Completed creating Engine
Traceback (most recent call last):
File “onnx_runtime_pretrained.py”, line 87, in
engine = get_engine(onnx_file_path, engine_file_path)
File “onnx_runtime_pretrained.py”, line 82, in get_engine
return build_engine()
File “onnx_runtime_pretrained.py”, line 78, in build_engine
f.write(engine.serialize())
AttributeError: ‘NoneType’ object has no attribute ‘serialize’

What is wrong?
I tried with many articles related to that, but not working.
Could you please give me detailed help directly here?
I appreciate for that.

@psyhtest
Copy link

@1208overlord SSD-MobileNet-v2 is not an MLPerf Edge/Datacenter model. Why are you asking here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants