I am trying to add a non-max suppression layer referencing the ‘config.py’ file in sampleUffSSD.
Following is the log.
Using output node NMS
Converting to UFF graph
Warning: No conversion function registered for layer: NMS_TRT yet.
Converting NMS as custom op: NMS_TRT
No. nodes: 2
UFF Output written to tmp.graph.uff
('register input: ', True)
parsing uff model into engine model
[TensorRT] ERROR: UFFParser: Validator error: NMS: Unsupported operation _NMS_TRT
[TensorRT] ERROR: Network must have at least one output
Tensorrt Version: 5.0.2.6
Ubuntu 16.04
Do I need something additional to install the plugins ?
Function to preprocess the loaded graph
def get_graph_with_nms(dg, input_shape):
channels, height, width = input_shape
Input = gs.create_plugin_node(name="Input",
op="Placeholder",
dtype=tf.float32,
shape=[1, channels, height, width])
PriorBox = gs.create_plugin_node(name="GridAnchor",
op="GridAnchor_TRT",
minSize=0.2,
maxSize=0.95,
aspectRatios=[1.0, 2.0, 0.5, 3.0,
0.33],
variance=[0.1, 0.1, 0.2, 0.2],
featureMapShapes=[19, 10, 5, 3, 2, 1],
numLayers=6
)
NMS = gs.create_plugin_node(
name="NMS",
op="NMS_TRT",
shareLocation=1,
varianceEncodedInTarget=0,
backgroundLabelId=0,
confidenceThreshold=0.5,
nmsThreshold=0.3,
topK=100,
keepTopK=100,
numClasses=91,
inputOrder=[0, 1, 2],
confSigmoid=1,
isNormalized=1
)
concat_priorbox = gs.create_node(
"concat_priorbox",
op="ConcatV2",
dtype=tf.float32,
axis=2
)
concat_box_loc = gs.create_plugin_node(
"concat_box_loc",
op="FlattenConcat_TRT",
dtype=tf.float32,
axis=1,
ignoreBatch=0
)
concat_box_conf = gs.create_plugin_node(
"concat_box_conf",
op="FlattenConcat_TRT",
dtype=tf.float32,
axis=1,
ignoreBatch=0
)
# Create a mapping of namespace names -> plugin nodes.
namespace_plugin_map = {
"MultipleGridAnchorGenerator": PriorBox,
"Postprocessor": NMS,
"Preprocessor/map": Input,
"ToFloat": Input,
# "image_tensor": Input,
"Concatenate": concat_priorbox,
"concat": concat_box_loc,
"concat_1": concat_box_conf
}
for node in dg.graph_inputs:
namespace_plugin_map[node.name] = Input
dg.collapse_namespaces(namespace_plugin_map)
# dg.find_nodes_by_op("NMS_TRT")[0].input.remove("Input")
dg.remove(dg.graph_outputs,
remove_exclusive_dependencies=False)
return dg