I want to infer the learning model of efficientnet at high speed using TensorRT.
Since the original onnx_resnet50.py worked,
I wanted to try it with a trained model of efficientnet
First, save the trained model of efficientnet in savedmodel format with the following program
The saved file name is effi_saved_model
import os
import sys
import numpy as np
import tensorflow as tfsave_path = ‘effi_saved_model’
model = tf.keras.applications.EfficientNetB2(weights=‘imagenet’)
model.save(save_path)
Next, execute the following command
The saved file name is effi_saved_model.onnx
python3 -m tf2onnx.convert --saved-model effi_saved_model --output effi_saved_model.onnx
In usr / src / tensorrt / data / resnet50
Include effi_saved_model.onnx
In usr / src / tensorrt / samples / python / introduction_parser_samples / onnx_resnet50.py, with
MODEL_PATH = “effi_saved_model.onnx”
INPUT_SHAPE = (3,260,260)
Changed
I ran
python3 onnx_resnet50.py
but the following error cannot be resolved.
Network has dynamic or shape inputs, but no optimization profile has been defined
Network validation failed