Hello, I’m trying to convert my tensorflow model to tensorrt by using scripts from https://github.com/NVIDIA-AI-IOT/tf_to_trt_image_classification , but facing issue, because my graph contains LeakyRelu operation.
I’ve attempted to modify uff_to_plan.cpp (patch below), but w/o success. In general, i want to understand how i can add LeakyRelu support?
diff --git a/src/uff_to_plan.cpp b/src/uff_to_plan.cpp
index ab2b395..b3db8ea 100644
--- a/src/uff_to_plan.cpp
+++ b/src/uff_to_plan.cpp
@@ -10,6 +10,7 @@
#include <NvInfer.h>
#include <NvUffParser.h>
+#include <NvInferPlugin.h>
using namespace std;
@@ -65,11 +66,17 @@ int main(int argc, char *argv[])
DataType dataType = toDataType(argv[9]);
/* parse uff */
+ bool ok = initLibNvInferPlugins(&gLogger, "");
IBuilder *builder = createInferBuilder(gLogger);
INetworkDefinition *network = builder->createNetwork();
IUffParser *parser = createUffParser();
- parser->registerInput(inputName.c_str(), DimsCHW(3, inputHeight, inputWidth));
+ IPluginV2 *lrelu = createLReLUPlugin(0.1);
+ lrelu->setPluginNamespace("");
+ parser->registerInput(inputName.c_str(), DimsCHW(3, inputHeight, inputWidth), UffInputOrder::kNCHW);
parser->registerOutput(outputName.c_str());
+ parser->registerOutput("orientation/l2_normalize");
+ parser->registerOutput("confidence/Softmax");
+ parser->setPluginNamespace("");
if (!parser->parse(uffFilename.c_str(), *network, dataType))
{
cout << "Failed to parse UFF\n";
@@ -79,6 +86,7 @@ int main(int argc, char *argv[])
return 1;
}
+
https://gist.github.com/r7vme/ee90289a593a856303b3718d42686936 output from command.
configuration:
- Xavier with Jetpack 4.2
- tensorrt 5.0.6
- cuda 10.0.166
- also was able to successfully run tensorRT Yolov3 model with https://github.com/lewes6369/TensorRT-Yolov3