Is it necessary to normalize pixel values if there are only black and white ones (no greys)?
the model is trained expecting values with 0 mean and some measured variance.
Thinking about your case, you would getting something like, eg,
blue channel pixel with 1:
(1-0.485)/0.229 = 2.24
and for pixel with 0:
(0-0.485)/0.229 = -2.11
If you are using pre trained weights i would guess that yes, it is necessary, otherwise, you can measure it in your training accuracy.
Anyway, if you are not sure, test the result with and without it.
Is it necessary to normalize pixel values if there are only black and white ones (nothing in between/no greys), before feeding into ResNet18 for classification?
IOW, is this transform necessary?
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
Note: I'm currently stacking each black and white image 3 times so it aligns with ResNet's RGB expectation.