Please, look at the code and give me some advice

I’m making maskrcnn use libtorch and the result is different from Python.
Can you see the code together? thanks…


@lsrk

Hello !
I didnt see your code deeply, but i found a severe bug.


in this part, code should be

torch::tensor(at::ArrayRef<uint8_t>(img.data, img.rows * img.cols * 3)).view({ img.rows, img.cols, 3 }).permute({2, 0, 1}).contiguous();

img axis order is row col channel. so, reshaping to channel row col is destroying image structure.
Permute and reshape is just what you want.