# Converting Openpose's CMU Tensorflow graph to Tensorrt

**URL:** <https://forums.developer.nvidia.com/t/converting-openposes-cmu-tensorflow-graph-to-tensorrt/75859>\
**Category:** TensorRT\
**Created:** [June 4, 2019, 8:11am UTC](https://forums.developer.nvidia.com/t/converting-openposes-cmu-tensorflow-graph-to-tensorrt/75859 "2019-06-04T08:11:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![edit\_or](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@edit\_or](https://forums.developer.nvidia.com/u/edit_or)\
**Post date:** [June 4, 2019, 8:11am UTC](https://forums.developer.nvidia.com/t/converting-openposes-cmu-tensorflow-graph-to-tensorrt/75859/1 "2019-06-04T08:11:18Z")

</div>

I use this **Openpose’s Tensorflow version library** [https://github.com/ildoonet/tf-pose-estimation](https://github.com/ildoonet/tf-pose-estimation) for Human pose detection. I like to run the model in Tensort for faster processing speed. CMU netowrk [https://github.com/ildoonet/tf-pose-estimation/blob/master/tf\_pose/network\_cmu.py](https://github.com/ildoonet/tf-pose-estimation/blob/master/tf_pose/network_cmu.py) is quite straightforward and composed of **conv, max\_pool,and concat**. All layers are supported in Tensorrt. The network has image is **image** input and output is **concat\_stage7**.  
When I run **convert-to-uff** , the output is

```auto
NOTE: UFF has been tested with TensorFlow 1.12.0. Other versions are not guaranteed to work
UFF Version 0.6.3
=== Automatically deduced input nodes ===
[name: "image"
op: "Placeholder"
attr {
  key: "dtype"
  value {
    type: DT_FLOAT
  }
}
attr {
  key: "shape"
  value {
    shape {
      dim {
        size: -1
      }
      dim {
        size: -1
      }
      dim {
        size: -1
      }
      dim {
        size: 3
      }
    }
  }
}
]
=========================================

=== Automatically deduced output nodes ===
[name: "Openpose/concat_stage7"
op: "ConcatV2"
input: "Mconv7_stage6_L2/BiasAdd"
input: "Mconv7_stage6_L1/BiasAdd"
input: "Openpose/concat_stage7/axis"
attr {
  key: "N"
  value {
    i: 2
  }
}
attr {
  key: "T"
  value {
    type: DT_FLOAT
  }
}
attr {
  key: "Tidx"
  value {
    type: DT_INT32
  }
}
]
==========================================

Using output node Openpose/concat_stage7
Converting to UFF graph
No. nodes: 463
UFF Output written to cmu/cmu_openpose.uff

```

Is that ok in conversion?

But when I do inference the speed is same as running Tensorflow model.

Then Tensorrt output is (276000,) dimension.

But Tensorflow model has 4D tensor.  
self.tensor\_output = self.graph.get\_tensor\_by\_name(‘TfPoseEstimator/Openpose/concat\_stage7:0’)  
(?, ?, ?, 57)

What could be wrong?

---

<div class="post-metadata">

**Author:** ![edit\_or](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@edit\_or](https://forums.developer.nvidia.com/u/edit_or)\
**Post date:** [June 4, 2019, 9:03am UTC](https://forums.developer.nvidia.com/t/converting-openposes-cmu-tensorflow-graph-to-tensorrt/75859/2 "2019-06-04T09:03:43Z")

</div>

The CMU Tensorflow graph file for conversion is here. [url][Dropbox - File Deleted](https://www.dropbox.com/s/he172yau97rcrop/graph_opt.pb?dl=0%5B/url%5D)

Can somebody help as I am rushing for my project deadline.  
I used Tensorrt 5.1.5 GA. What is the difference between GA and RC?  
Thanks

---

<div class="post-metadata">

**Author:** ![caffeinedev](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@caffeinedev](https://forums.developer.nvidia.com/u/caffeinedev)\
**Post date:** [February 10, 2021, 10:43am UTC](https://forums.developer.nvidia.com/t/converting-openposes-cmu-tensorflow-graph-to-tensorrt/75859/3 "2021-02-10T10:43:06Z")

</div>

Hey, @edit_or were you able to convert the model?

---

<div class="post-metadata">

**Author:** ![NVES](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/nves/32/14043_2.png) [@NVES](https://forums.developer.nvidia.com/u/NVES)\
**Post date:** [February 10, 2021, 11:07am UTC](https://forums.developer.nvidia.com/t/converting-openposes-cmu-tensorflow-graph-to-tensorrt/75859/4 "2021-02-10T11:07:37Z")

</div>

Hi, Request you to share the ONNX model and the script so that we can assist you better.

Alongside you can try validating your model with the below snippet

check\_model.py

> import sys  
> import onnx  
> filename = yourONNXmodel  
> model = onnx.load(filename)  
> onnx.checker.check\_model(model).

Alternatively, you can try running your model with trtexec command.  
[https://github.com/NVIDIA/TensorRT/tree/master/samples/opensource/trtexec](https://github.com/NVIDIA/TensorRT/tree/master/samples/opensource/trtexec)

Thanks!
