转换后的 Tensorrt 模型具有与 Tensorflow 模型不同的输出形状?
Converted Tensorrt model has different output shape from Tensorflow model?
我有一个 tensorflow 模型并转换为 tensorrt 模型。
Tensorflow模型的uff转换如下图。输入是图像,输出是 Openpose/concat_stage7
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
Tensorflow 模型输出形状为
self.tensor_output = self.graph.get_tensor_by_name('TfPoseEstimator/Openpose/concat_stage7:0')
(?, ?, ?, 57)
当我运行tensorrt时,输出维度是(217500,)?
如何与Tensorflow模型具有相同的维度?
是的,现在一切都解决了,我可以在 TensorRT 中生成与 Tensorflow 模型输出相同的结果。
问题是 TensorRT 以扁平格式生成输出数组。需要根据需要重塑尺寸。
所以我所做的是检查 Tensorflow 输出的维度并相应地重新整形。
我有一个 tensorflow 模型并转换为 tensorrt 模型。 Tensorflow模型的uff转换如下图。输入是图像,输出是 Openpose/concat_stage7
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
Tensorflow 模型输出形状为
self.tensor_output = self.graph.get_tensor_by_name('TfPoseEstimator/Openpose/concat_stage7:0')
(?, ?, ?, 57)
当我运行tensorrt时,输出维度是(217500,)? 如何与Tensorflow模型具有相同的维度?
是的,现在一切都解决了,我可以在 TensorRT 中生成与 Tensorflow 模型输出相同的结果。
问题是 TensorRT 以扁平格式生成输出数组。需要根据需要重塑尺寸。
所以我所做的是检查 Tensorflow 输出的维度并相应地重新整形。