Assertion failed: scales.is_weights() && "Resize scales must be an initializer!"

Description

I was trying to convert an onnx model to tensor engine file in a docker container of tensorrt (docker pull nvcr.io/nvidia/tensorrt:20.03-py3
)
and got following error:
Assertion failed: scales.is_weights() && "Resize scales must be an initializer!"

Can you please guide what’s the issue here?

Environment

TensorRT Version: 7.1
CUDA Version: 10.2
Operating System + Version: Ubuntu 18.04

Relevant Files

Here’s model: https://drive.google.com/file/d/1SumbATno13RbkcHLEBLg_ezBiSK-4Qx5/view?usp=sharing

Steps To Reproduce

trtexec --onnx=keras-detect-model.onnx --explicitBatch --verbose

Hi @aaryan,
By looking at the error, the issue looks like coming from the opset.
Below post should be able to address it.

However, request you to share your script in case if issue persist.
Thanks!

@AakankshaS
I have used opset-11 already for this model. Below is script attached. Please check the issue.
Script:
Here’s Script:
https://colab.research.google.com/drive/1nAPCOnMK3FnBRCTdr37aV_qRuToJlRsz?usp=sharing

Hi @AakankshaS , just wanted to know if there’s any update on this topic?

Hi @aaryan,
A quick look to your model shows that you are using resize layer with scale factor of output tensor from concat layer


I am afraid, this is not supported by TensorRT yet. We only support scale factor as constant weights, that’s why the error happened

Thanks!

I had the exact same error.
Only using the latest tensorrt docker container (21.11-py3) and opset=12 managed to export my model succesfully.

Hi,
Request you to share the ONNX model and the script if not shared already so that we can assist you better.
Alongside you can try few things:
https://docs.nvidia.com/deeplearning/tensorrt/quick-start-guide/index.html#onnx-export

  1. validating your model with the below snippet

check_model.py

import sys
import onnx
filename = yourONNXmodel
model = onnx.load(filename)
onnx.checker.check_model(model).
2) Try running your model with trtexec command.
https://github.com/NVIDIA/TensorRT/tree/master/samples/opensource/trtexec
In case you are still facing issue, request you to share the trtexec “”–verbose"" log for further debugging
Thanks!