thanks for reply~
the output mask has a shape of [N, C, H, W], here N =1, C=1.
after
out_tensor = out_tensor.squeeze().detach(); 

out_tensor’s shape: [H, W].
As you recommend:
ut_tensor = out_tensor.squeeze(0).detach().permute({ 1,2,0 });

I use this line of code instead.  so the shape become: [H, W, 1]. the mask:

not working…
I find that C = 1, so I changed
cv::Mat resultImg(img.rows, img.cols, CV_8UC3);

to
cv::Mat resultImg(img.rows, img.cols, CV_8UC1);

then the predicted mask:

…