我有 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,conv 用于 Smoother。不确定 TensorRT 中的 tf.equal。
如何将这些层添加到 TensorRT?可以使用graphsurgeon 或UFF 模型吗?