Pixels & normalisation
Follow one pixel through ToTensor() and Normalize() exactly as PyTorch does, then push a whole image's brightness and contrast until values clip.
Predict first
Commit to a guess before you touch anything. Being wrong here is how it sticks.
A red pixel of 255 after ToTensor + ImageNet Normalize — what value comes out? (2 dp)
Experiment
Move the controls and watch the outputs. Goals tick off automatically when you reach them.
Normalise one pixel
Brightness, contrast & grayscale
Explain it
Put what you saw into words. This is what the exam will ask you to do.
Why normalise with the ImageNet mean and std when fine-tuning a pretrained network?
Code it
Write real code against real data. Python and SQL run right here in your browser and hidden tests check your work; the AI reviews it like an examiner.
ToTensor + Normalize in NumPy
Re-implement what transforms.ToTensor() + transforms.Normalize(MEAN, STD) do:
preprocess(img) takes an H × W × 3 uint8 array and returns a 3 × H × W float32 array:
scale to [0, 1], move channels first (CHW), then normalise each channel with MEAN/STD.
Also write bgr_to_rgb(img) — OpenCV loads images in BGR order.
Challenge
Fixed variations, a new problem every day, and unlimited AI challenges built from your current settings.
Red Channel Max Normalisation
A red-channel pixel has raw value 255 (μ = 0.485, σ = 0.229). What is it after ToTensor() + ImageNet Normalize()? (2 decimals)