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:
- Redefine the model architecture and retrain it
- Change the order before you predict using
img.transpose(2,0,1)
orimg.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)
Chances are, you can! Please take a look at Nobuco.