CnnDepth / tx2_fcnn_node

ROS node for real-time FCNN depth reconstruction
MIT License
110 stars 31 forks source link

How to convert UFF model into TensorRT engines #12

Closed surajmahangade closed 4 years ago

surajmahangade commented 4 years ago

I checked the https://github.com/CnnDepth/tensorrt_samples/tree/master/sampleUffFCRN But i am not able to understand how do i run it. How to build that project and run it exactly? Thank you

avbokovoy commented 4 years ago

You can build the engine using tx2_fcnn_node. Check "Compile the engine" in the Compile section. Building the engine with sampleUffFCRN is outdated.

surajmahangade commented 4 years ago

Thank you for a prompt reply. I ran it and when i rosrun the command I get segmentation fault. But everything else works.Hope that won't make a problem . The depth map i am getting is not that great. Is there anything to be changed for better depth map. My image is calibrated.

avbokovoy commented 4 years ago

Yes, segmentation fault sometimes occurs, but the engine should compile anyway. It's hard to estimate what do you actually mean by "not that great". The overall quality depends on several parameters: 1) Camera quality. 2) The environment you are operating in. The deep learning approaches in depth reconstruction are not an universal solution. The environment should look similar to the training data, e.g. NYU Dataset v2. So the neural network's quality is better indoor, then outdoor, camera should be on ~1m height and etc. 3) The data formats. Make sure you pass the image in right color scheme.

surajmahangade commented 4 years ago

Okay I will check all those things. Is there any benchmark of all the pre-trained models given by you.

Edit: How to use resnet_interleaving_2shortcuts_640x480 model ? I tried but am getting an error UffParser: Output error: Output tf/Reshape not found ERROR: sample_uff_fcrn: Fail to parse fcrn_engine_builder: src/tx2_fcnn_node/Thirdparty/fcrn-inference/fcrnEngineBuilder.cpp:290: int main(int, char**): Assertion tmpEngine != nullptr' failed. Aborted (core dumped)

Thank you.

KirillMouraviev commented 4 years ago

The output name for resnet_interleaving_2shortcuts_640x480 model is tf/reshape_1/Reshape. To build engine from this model, use following command: rosrun tx2_fcnn_node fcrn_engine_builder --uff=./resnet_interleaving_2shortcuts_640x480.uff --uffInput=tf/Placeholder --output=tf/reshape_1/Reshape --height=480 --width=640 --engine=./test_engine.trt --fp16

surajmahangade commented 4 years ago

Yeah that worked. Thank you