I’ll give you a sample of the image before and after the transformation with the original code:
The transform function:
transforms = T.Compose([
** T.Resize(size=(288, 144)),**
** T.ToTensor(),**
** T.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])**
])
image before transform (before resize or normalize) :
[[[111 99 91]
[112 100 92]
[111 99 91]
…
[104 92 78]
[105 90 81]
[105 90 83]]
[[111 98 92]
[111 99 92]
[110 98 91]
…
[104 92 78]
[104 91 82]
[104 90 83]]
[[109 97 93]
[110 97 93]
[109 97 92]
…
[104 90 82]
[103 89 84]
[102 89 85]]
…
[[174 153 139]
[ 41 21 3]
[168 149 130]
…
[ 70 48 36]
[ 72 50 38]
[ 74 52 40]]
[[135 117 101]
[ 50 30 15]
[165 146 127]
…
[ 69 47 35]
[ 71 49 37]
[ 73 52 39]]
[[108 89 73]
[ 61 41 23]
[163 144 125]
…
[ 70 48 36]
[ 72 50 38]
[ 73 51 39]]]
image After transform (with resize and normalize):
tensor([[[-0.5596, -0.5596, -0.5424, …, -0.7137, -0.6965, -0.6965],
[-0.5424, -0.5424, -0.5424, …, -0.7137, -0.6965, -0.6965],
[-0.5253, -0.5253, -0.5253, …, -0.6965, -0.6794, -0.6794],
…,
[ 0.0056, -0.2856, -1.1760, …, -1.4500, -1.4329, -1.4329],
[-0.4911, -0.6965, -1.2959, …, -1.4672, -1.4500, -1.4500],
[-0.8678, -1.0048, -1.3815, …, -1.4672, -1.4500, -1.4500]],
[[-0.3025, -0.3025, -0.2850, ..., -0.4601, -0.4601, -0.4601],
[-0.3200, -0.3200, -0.3025, ..., -0.4426, -0.4601, -0.4601],
[-0.3375, -0.3375, -0.3200, ..., -0.4601, -0.4776, -0.4776],
...,
[ 0.3978, 0.0826, -0.7927, ..., -1.1429, -1.1253, -1.1253],
[-0.0924, -0.3200, -0.9153, ..., -1.1604, -1.1253, -1.1253],
[-0.4776, -0.6001, -0.9678, ..., -1.1604, -1.1429, -1.1429]],
[[ 0.1302, 0.1302, 0.1476, ..., 0.0256, 0.0256, 0.0256],
[ 0.1302, 0.1302, 0.1302, ..., 0.0082, 0.0082, 0.0082],
[ 0.1128, 0.1128, 0.1128, ..., -0.0092, -0.0092, -0.0092],
...,
[ 0.9668, 0.6531, -0.2184, ..., -0.5321, -0.5147, -0.5147],
[ 0.4439, 0.2348, -0.3404, ..., -0.5495, -0.5321, -0.5321],
[ 0.0779, -0.0441, -0.4101, ..., -0.5495, -0.5321, -0.5321]]])