Hi,
Does UFF support to create/parse “RPROI_TRT” plugin?
If so, could you help to revise the code snippets below?
Also, it would be appreciated if you could help to elaborate what inputs/outputs of “RPROI_TRT” plugins are.
#!/usr/bin/env python3
from graphsurgeon import DynamicGraph, create_plugin_node
import tensorflow as tf
import tensorrt as trt
import uff
TRT_LOGGER = trt.Logger(trt.Logger.Severity.VERBOSE)
graph = tf.Graph()
with graph.as_default():
rpn_cls_prob_tensor = tf.placeholder(tf.float32, [1, 6000, 2, 1], name='rpn_cls_prob')
rpn_bbox_pred_tensor = tf.placeholder(tf.float32, [1, 6000, 4, 1], name='rpn_bbox_pred')
feature_map_tensor = tf.placeholder(tf.float32, [1, 512, 24, 32], name='feature_map')
im_info_tensor = tf.placeholder(tf.float32, [1, 1, 1, 3], name='im_info')
dynamic_graph = DynamicGraph(graph.as_graph_def())
output_node_def = create_plugin_node(
name='output',
op='RPROI_TRT',
inputs=['rpn_cls_prob', 'rpn_bbox_pred', 'feature_map', 'im_info'],
featureStride=16,
preNmsTop=6000,
nmsMaxOut=300,
iouThreshold=0.7,
minBoxSize=16.0,
spatialScale=0.0625,
pooling=[7, 7],
anchorsRatios=[0.5, 1.0, 2.0],
anchorsScales=[8.0, 16.0, 32.0],
)
dynamic_graph.append(output_node_def)
UFF_PATH = '/tmp/test_RPROI_TRT_plugin.uff'
_ = uff.from_tensorflow(output_filename=UFF_PATH,
output_nodes=['output'],
quiet=False,
text=True,
graphdef=dynamic_graph.as_graph_def())
trt.init_libnvinfer_plugins(TRT_LOGGER, '')
with trt.Builder(TRT_LOGGER) as builder:
with builder.create_network() as network:
uff_parser = trt.UffParser()
uff_parser.register_input('rpn_cls_prob', [6000, 2, 1])
uff_parser.register_input('rpn_bbox_pred', [6000, 4, 1])
uff_parser.register_input('feature_map', [512, 24, 32])
uff_parser.register_input('im_info', [1, 1, 3])
uff_parser.register_output('output')
uff_parser.parse(UFF_PATH, network)
for i in range(network.num_outputs):
output_tensor = network.get_output(i)
print('Output: name {}, shape {}'.format(output_tensor.name, output_tensor.shape))
The above code snippet fails with the following messages on 5.1.2.2-rc
.
[TensorRT] INFO: UFFParser: Did not find plugin field entry pooling in the Registered Creator for layer output
python: NvPluginFasterRCNN.cu:29: nvinfer1::plugin::RPROIPlugin::RPROIPlugin(nvinfer1::plugin::RPROIParams, const float*, const float*): Assertion `params.anchorsRatioCount > 0 && params.anchorsScaleCount > 0' failed.