NVIDIA-AI-IOT / tf_to_trt_image_classification

Image classification with NVIDIA TensorRT from TensorFlow models.
BSD 3-Clause "New" or "Revised" License
456 stars 155 forks source link

I got a big error #30

Open Airyzf opened 6 years ago

Airyzf commented 6 years ago

nvidia@tegra-ubuntu:~/demo/tf_to_trt_image_classification/build$ cmake .. -- Configuring done -- Generating done -- Build files have been written to: /home/nvidia/demo/tf_to_trt_image_classification/build nvidia@tegra-ubuntu:~/demo/tf_to_trt_image_classification/build$ make [ 33%] Built target classify_image [ 50%] Building CXX object src/CMakeFiles/uff_to_plan.dir/uff_to_plan.cpp.o /home/nvidia/demo/tf_to_trt_image_classification/src/uff_to_plan.cpp: In function ‘int main(int, char)’: /home/nvidia/demo/tf_to_trt_image_classification/src/uff_to_plan.cpp:71:79: error: no matching function for call to ‘nvuffparser::IUffParser::registerInput(const char, nvinfer1::DimsCHW)’ parser->registerInput(inputName.c_str(), DimsCHW(3, inputHeight, inputWidth)); ^ In file included from /home/nvidia/demo/tf_to_trt_image_classification/src/uff_to_plan.cpp:12:0: /usr/include/aarch64-linux-gnu/NvUffParser.h:182:18: note: candidate: virtual bool nvuffparser::IUffParser::registerInput(const char, nvinfer1::Dims, nvuffparser::UffInputOrder) virtual bool registerInput(const char inputName, nvinfer1::Dims inputDims, ^ /usr/include/aarch64-linux-gnu/NvUffParser.h:182:18: note: candidate expects 3 arguments, 2 provided src/CMakeFiles/uff_to_plan.dir/build.make:62: recipe for target 'src/CMakeFiles/uff_to_plan.dir/uff_to_plan.cpp.o' failed make[2]: [src/CMakeFiles/uff_to_plan.dir/uff_to_plan.cpp.o] Error 1 CMakeFiles/Makefile2:160: recipe for target 'src/CMakeFiles/uff_to_plan.dir/all' failed make[1]: [src/CMakeFiles/uff_to_plan.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: [all] Error 2 nvidia@tegra-ubuntu:~/demo/tf_to_trt_image_classification/build$

ghost commented 6 years ago

Hi Airyzf.

This is likely an API discrepancy between TensorRT 3 and TensorRT 4.

Could you try compiling after checking out the branch trt_4plus?

git checkout trt_4plus

Thanks, John

Airyzf commented 6 years ago

thanks, it works.

Airyzf commented 6 years ago

I got an other problem. I collected some data ,trained with yolov3 model and output a "yolov3.pb" file. But the step "Convert frozen graph to TensorRT engine" need a output node name, how can i get the output node name? please help ,thanks.

ghost commented 6 years ago

I don't have experience with YoloV3 specifically, but it may help to visualize the frozen graph using Tensorboard. There should be plenty of documentation on this but I'm happy to provide more details if needed.

John

ghost commented 6 years ago

Also, note that many object detection models have layers that are not natively supported by TensorRT. For these cases it may be easiest to try using TensorRT integration inside TensorFlow.

We have examples for doing this using models from the TensorFlow object detection API here

https://github.com/NVIDIA-Jetson/tf_trt_models

John

Airyzf commented 6 years ago

ok,thanks

Airyzf commented 6 years ago

I don't have experience with YoloV3 specifically, but it may help to visualize the frozen graph using Tensorboard. There should be plenty of documentation on this but I'm happy to provide more details if needed.

John

Hi,John When I run "Convert frozen graph to TensorRT engine" with other tensorflow frozen graph, I always got the other exception "list indices must be integers, not AttrValue".

python scripts/convert_plan.py data/frozen_graphs/test.h5.pb data/plans/test.h5.pb.plan input 416 416 output_node0 1 0 float Using output node output_node0 Converting to UFF graph Warning: No conversion function registered for layer: Identity yet. Converting as custom op Identity output_node0 name: "output_node0" op: "Identity" input: "activation_2/Softmax" attr { key: "T" value { type: DT_FLOAT } }

Traceback (most recent call last): File "scripts/convert_plan.py", line 71, in data_type File "scripts/convert_plan.py", line 22, in frozenToPlan text=False, File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/conversion_helpers.py", line 103, in from_tensorflow_frozen_model return from_tensorflow(graphdef, output_nodes, **kwargs) File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/conversion_helpers.py", line 75, in from_tensorflow name="main") File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/converter.py", line 64, in convert_tf2uff_graph uff_graph, input_replacements) File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/converter.py", line 51, in convert_tf2uff_node op, name, tf_node, inputs, uff_graph, tf_nodes=tf_nodes) File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/converter.py", line 28, in convert_layer fields = cls.parse_tf_attrs(tf_node.attr) File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/converter.py", line 177, in parse_tf_attrs for key, val in attrs.items()} File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/converter.py", line 177, in for key, val in attrs.items()} File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/converter.py", line 172, in parse_tf_attr_value return cls.convert_tf2uff_field(code, val) File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/converter.py", line 146, in convert_tf2uff_field return TensorFlowToUFFConverter.convert_tf2numpy_dtype(val) File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/converter.py", line 74, in convert_tf2numpy_dtype return np.dtype(dt[dtype]) TypeError: list indices must be integers, not AttrValue

mitesh741 commented 5 years ago

I have Tensor RT 5.0.6 included in Jetpack for Xavier. I got the same error. Can you please ?

AHA03926 commented 4 years ago

I also have same problem. I have Tensor RT 5.0.6 included in Jetpack for TX2 please gime a solution for this?

=============================== make ・ ・ ・ -- Configuring done -- Generating done -- Build files have been written to: /home/nvidia/project4/tf_to_trt_image_classification/build [ 16%] Linking CXX executable classify_image [ 33%] Built target classify_image [ 50%] Building CXX object src/CMakeFiles/uff_to_plan.dir/uff_to_plan.cpp.o /home/nvidia/project4/tf_to_trt_image_classification/src/uff_to_plan.cpp: In function ‘int main(int, char)’: /home/nvidia/project4/tf_to_trt_image_classification/src/uff_to_plan.cpp:71:79: error: no matching function for call to ‘nvuffparser::IUffParser::registerInput(const char, nvinfer1::DimsCHW)’    parser->registerInput(inputName.c_str(), DimsCHW(3, inputHeight, inputWidth));                                                                                ^ In file included from /home/nvidia/project4/tf_to_trt_image_classification/src/uff_to_plan.cpp:12:0: /usr/include/aarch64-linux-gnu/NvUffParser.h:182:18: note: candidate: virtual bool nvuffparser::IUffParser::registerInput(const char, nvinfer1::Dims, nvuffparser::UffInputOrder)      virtual bool registerInput(const char inputName, nvinfer1::Dims inputDims, UffInputOrder inputOrder) = 0;                   ^~~~~ /usr/include/aarch64-linux-gnu/NvUffParser.h:182:18: note:   candidate expects 3 arguments, 2 provided src/CMakeFiles/uff_to_plan.dir/build.make:62: recipe for target 'src/CMakeFiles/uff_to_plan.dir/uff_to_plan.cpp.o' failed make[2]: [src/CMakeFiles/uff_to_plan.dir/uff_to_plan.cpp.o] Error 1 CMakeFiles/Makefile2:160: recipe for target 'src/CMakeFiles/uff_to_plan.dir/all' failed make[1]: [src/CMakeFiles/uff_to_plan.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: [all] Error 2 nvidia@jetsontx2:~/project4/tf_to_trt_image_classification/build$