【发布时间】:2019-07-22 02:30:03
【问题描述】:
我有 tensorflow 冻结模型,从中生成 TensorRT 引擎。
我无法重新训练模型,因为我没有所有必需的图像。
但 Tensorflow 流程有一些后处理层,我喜欢添加到 TensorRT 引擎中。
最好的方法是什么?
我可以使用 TensorRT 层创建插件层吗?
这些 Tensorflow 层大多在 TensorRT 中可用,如下所示。
self.tensor_heatMat_up = tf.image.resize_area(self.tensor_output[:, :, :, :19], self.upsample_size,
align_corners=False, name='upsample_heatmat')
self.tensor_pafMat_up = tf.image.resize_area(self.tensor_output[:, :, :, 19:], self.upsample_size,
align_corners=False, name='upsample_pafmat')
if trt_bool is True:
smoother = Smoother({'data': self.tensor_heatMat_up}, 25, 3.0, 19)
else:
smoother = Smoother({'data': self.tensor_heatMat_up}, 25, 3.0)
gaussian_heatMat = smoother.get_output()
max_pooled_in_tensor = tf.nn.pool(gaussian_heatMat, window_shape=(3, 3), pooling_type='MAX', padding='SAME')
self.tensor_peaks = tf.where(tf.equal(gaussian_heatMat, max_pooled_in_tensor), gaussian_heatMat,
tf.zeros_like(gaussian_heatMat))
TensorRT 对 resize_area 有 scale,对 Smoother 有 conv。 不确定 TensorRT 中的 tf.equal。
如何将这些层添加到 TensorRT? 可以使用graphsurgeon或UFF模型吗?
【问题讨论】:
标签: tensorflow tensorrt