protobuf works, but uff model producing different & wrong results


my model involves 6 blocks of convolution2D layer + relu layer + maxpool, followed by 3 dense layers, with the last dense layer having 2 outputs (classfication problem). My model was written in keras and trained using channels first.

I froze my model to a protobuf. When i imported a graph def from the protobuf and fed in an image, i get the correct results ([0.99, 0.01]). However, when i try to do the same with the UFF model generated from the protobuf, I get very strange and wrong results ([0.22, 0.78]). I followed the exact flow from the tensorRT guide, can someone advice as to why the results are vastly different?

Is it due to some bug in the tensorRT optimisation? Thanks!

Probably due to mismatch dimensions of the input, the input needs to be in NCHW format for TRT