Hi,
Comparing the error value between two images using CV2 and pyTorch shows different results. Here is my code. Could you let me know what is problem here?
T = transforms.Compose([transforms.ToTensor()])
P = transforms.Compose([transforms.ToPILImage()])

def ComputFullImgError(in_img,out_img):

    inImg = T(Image.open(in_img))
    outImg = T(Image.open(out_img))

    inImg = inImg.unsqueeze(0)
    print(inImg.size())

    outImg = outImg.unsqueeze(0)
    print(outImg.size())

    l1_error = torch.nn.L1Loss()
    print('L1 Error',l1_error(inImg,outImg))

    mse_loss = torch.nn.MSELoss()
    print('MSE', mse_loss(inImg,outImg) )

def CVError(in_img,out_img):
    imageA = cv2.imread(in_img)
    imageB = cv2.imread(out_img)


    err = np.sum((imageA.astype("float") - imageB.astype("float")) ** 2)
    err /= float(imageA.shape[0] * imageA.shape[1] * imageA.shape[2])

    print('CV',err)

ComputFullImgError('input.png','target.png')
CVError('input.png','target.png')

Result:
torch.Size([1, 3, 1080, 1920])
torch.Size([1, 3, 1080, 1920])
L1 Error tensor(0.0103)
MSE tensor(0.0006)
CV 41.84295669367284