I have tensorflow freezed model from which TensorRT engine is produced.
I can’t retrain model since I don’t have all those required images.
But Tensorflow process has some post processing layers and I like to add into TensorRT engine.
What would be the best approach?
Can I create plugin layer using TensorRT layers?
Those Tensorflow layers are mostly available in TensorRT as follows.
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 has scale for resize_area, conv for Smoother.
Not sure tf.equal in TensorRT.
How to addin those layers to TensorRT?
Possible to use graphsurgeon or UFF model?