Try reading your image like this:

  
    
    
    Libtorch C++ convert a Tensor to cv:Mat (single channel C++
  
  
    From cv2 to TORCH: 
 cv::cvtColor(frame, frame, CV_BGR2RGB);
 frame.convertTo(frame, CV_32FC3, 1.0f / 255.0f);
 auto input_tensor = torch::from_blob(frame.data, {1, frame_h, frame_w, kCHANNELS});
 input_tensor = input_tensor.permute({0, 3, 1, 2});

From TORCh to cv2: 
input_tensor = input_tensor.to(at::kCUDA);
                torch::Tensor out_tensor = module->forward({input_tensor}).toTensor();

                out_tensor = out_tensor.squeeze().detach().permute({1, 2, 0});
                out_t…
  


For the sake of testing, DO NOT use normalisation either in Python nor C++ and see if you get teh same results.