How to convert a tensorflow .pb model (pytorch -> onnx --> pb converted model) from channel first to channel last?

I have converted a channel first model from pytorch → onnx → tensorflow .pb model, but for implementation on edge device I need a model which is channel last. Is there any method I can convert it to channel last at any stage(pytorch, onnx, tensorflow or tflite ) ?

No. You’ll need to do one of the following:

  1. Redefine the model architecture and retrain it
  2. Change the order before you predict using img.transpose(2,0,1) or img.transpose(2,1,0)

See python - What is the correct way to change image channel ordering between channels first and channels last? - Stack Overflow where they have timed the various ways of doing this, and transpose() appears quickest (at least in 2017)