That is the issue comes out when there is no layer in TensorRT for a Tensorflow layer.
I have 4 plugins created.
RESIZEAREA_PLUGIN_LIBRARY = os.path.join(
WORKING_DIR,
'plugins/ResizeArea/build/libResizeAreaplugin.so'
)
SELECT_PLUGIN_LIBRARY = os.path.join(
WORKING_DIR,
'plugins/Select/build/libSelectplugin.so'
)
FILL_PLUGIN_LIBRARY = os.path.join(
WORKING_DIR,
'plugins/Fill/build/libFillplugin.so'
)
EQUAL_PLUGIN_LIBRARY = os.path.join(
WORKING_DIR,
'plugins/Equal/build/libEqualplugin.so'
)
def main():
if not os.path.isfile(RESIZEAREA_PLUGIN_LIBRARY):
raise IOError("\n{}\n{}\n{}\n".format(
"Failed to load library ({}).".format(RESIZEAREA_PLUGIN_LIBRARY),
"Please build the ResizeArea plugin.",
"For more information, see the included README.md"
))
ctypes.CDLL(RESIZEAREA_PLUGIN_LIBRARY)
if not os.path.isfile(SELECT_PLUGIN_LIBRARY):
raise IOError("\n{}\n{}\n{}\n".format(
"Failed to load library ({}).".format(SELECT_PLUGIN_LIBRARY),
"Please build the Select plugin.",
"For more information, see the included README.md"
))
ctypes.CDLL(SELECT_PLUGIN_LIBRARY)
if not os.path.isfile(FILL_PLUGIN_LIBRARY):
raise IOError("\n{}\n{}\n{}\n".format(
"Failed to load library ({}).".format(FILL_PLUGIN_LIBRARY),
"Please build the Fill plugin.",
"For more information, see the included README.md"
))
ctypes.CDLL(FILL_PLUGIN_LIBRARY)
if not os.path.isfile(EQUAL_PLUGIN_LIBRARY):
raise IOError("\n{}\n{}\n{}\n".format(
"Failed to load library ({}).".format(EQUAL_PLUGIN_LIBRARY),
"Please build the Equal plugin.",
"For more information, see the included README.md"
))
ctypes.CDLL(EQUAL_PLUGIN_LIBRARY)
Then converted to uff as
class ModelData(object):
INPUT_NAME = "image"
RESIZEAREA_NAME = "upsample_heatmat"
FILL_NAME = "zeros_like"
EQUAL_NAME = "Equal"
SELECT_NAME = "Select"
OUTPUT_NAME = "Openpose/output"
def prepare_namespace_plugin_map():
# In this sample, the only operation that is not supported by TensorRT
# is tf.nn.relu6, so we create a new node which will tell UffParser which
# plugin to run and with which arguments in place of tf.nn.relu6.
# The "clipMin" and "clipMax" fields of this TensorFlow node will be parsed by createPlugin,
# and used to create a CustomClipPlugin with the appropriate parameters.
trt_resizearea = gs.create_plugin_node(name="trt_resizearea", op="ResizeAreaPlugin", in_width=80.0, in_height=60.0, in_channel=3.0, upscale=4.0)
trt_fill = gs.create_plugin_node(name="trt_fill", op="FillPlugin", in_width=320.0, in_height=240.0, in_channel=3.0, value=0.0)#fill 0
trt_equal = gs.create_plugin_node(name="trt_equal", op="EqualPlugin", in_width=320.0, in_height=240.0, in_channel=3.0)
trt_select = gs.create_plugin_node(name="trt_select", op="SelectPlugin", in_width=320.0, in_height=240.0, value=0.0)
namespace_plugin_map = {
ModelData.RESIZEAREA_NAME: trt_resizearea,
ModelData.FILL_NAME: trt_fill,
ModelData.EQUAL_NAME: trt_equal,
ModelData.SELECT_NAME: trt_select
}
return namespace_plugin_map
def model_to_uff(model_path):
# Transform graph using graphsurgeon to map unsupported TensorFlow
# operations to appropriate TensorRT custom layer plugins
dynamic_graph = gs.DynamicGraph(model_path)
dynamic_graph.collapse_namespaces(prepare_namespace_plugin_map())
# Save resulting graph to UFF file
output_uff_path = model_path_to_uff_path(model_path)
uff.from_tensorflow(
dynamic_graph.as_graph_def(),
[ModelData.OUTPUT_NAME],
output_filename=output_uff_path,
text=True
)
return output_uff_path
I still have warnings
Warning: No conversion function registered for layer: ResizeAreaPlugin yet.
Converting trt_resizearea as custom op: ResizeAreaPlugin
Warning: No conversion function registered for layer: SelectPlugin yet.
Converting trt_select as custom op: SelectPlugin
Warning: No conversion function registered for layer: FillPlugin yet.
Converting trt_fill as custom op: FillPlugin
Warning: No conversion function registered for layer: EqualPlugin yet.
Converting trt_equal as custom op: EqualPlugin
Why i have warning for own plugin?
Is the conversion correct?
I thought conversion is from Tensorflow operations to plugin.
Tensorflow operations are ResizeArea, Fill, Equal, Select.