Solved by mhubii in post #7 
              
              
                The problem with your images may be resolved by changing the way you convert the cv::Mat to a torch::Tensor, e.g. 
// Replace this
torch::Tensor tensor_image = torch::from_blob(img.data, { img.rows, img.cols,1}, at::kFloat);
// By this
torch::Tensor tensor_image = torch::from_blob(img.data, { img.ro…