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

  
      github.com
  
  
    kerry-Cho/maskrcnn-libtorch/blob/ad2ba81a556671d3e939386c0431dcb48434edd3/maskrcnn-libtorch/maskrcnn-libtorch.cpp#L34 1

		//
		//for (auto param : model->named_parameters())
		//{
		//	std::cout << param.key() << "\n";
		//}




		cv::Mat image = cv::imread("maskrcnn.jpg", cv::IMREAD_COLOR);
		cv::Mat img(480, 640, CV_8UC3);
		cv::resize(image, img, img.size(), 0, 0, cv::INTER_AREA);
		auto input_ = torch::tensor(at::ArrayRef<uint8_t>(img.data, img.rows * img.cols * 3)).view({ 3, img.rows, img.cols });
		
		//cv::Mat rgb[3];
		//cv::split(image, rgb);
		//// Concatenate channels
		//cv::Mat rgbConcat;
		//cv::vconcat(rgb[0], rgb[1], rgbConcat);
		//cv::vconcat(rgbConcat, rgb[2], rgbConcat);
		//
		//// Convert Mat image to tensor C x H x W
		//at::Tensor tensor_image = torch::from_blob(rgbConcat.data, { image.channels(), image.rows, image.cols }, at::kByte);



  
  
    
    
  
  


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.