0Pricing
Deep Learning Academy · Lesson

Normalize and Standardize Inputs

Scale features so training converges.

Normalize and Standardize Inputs is a free Deep Learning Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Deep Learning Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Raw Numbers Slow Learning

Features on wildly different scales, like age and salary, confuse a network. Rescaling them first is why normalization makes training converge faster. ⚖️

Two Common Recipes

You will meet two main scalers: standardization shifts data to mean zero and unit variance, while min-max squeezes it into a fixed range like 0 to 1.

Standardize with Mean and Std

Standardization subtracts the mean and divides by the standard deviation. The result is centered on zero with a spread of one, the deep learning default.

x = (x - x.mean()) / x.std()

Min-Max Scaling

Min-max scaling maps your smallest value to 0 and largest to 1. It is handy when a bounded input range matters, like pixel intensities.

x = (x - x.min()) / (x.max() - x.min())

Fit on Train Only

Compute the mean and std from the training set only. Reusing test data to set these stats leaks information and inflates your scores.

Reuse the Same Stats

Apply the exact training statistics to validation and test data. Both splits must be transformed the same way or your model sees mismatched inputs.

x_val = (x_val - train_mean) / train_std

Per-Channel for Images

For images you normalize each color channel with its own mean and std. PyTorch ships transforms.Normalize to do exactly this in a pipeline.

transforms.Normalize(mean=[0.5], std=[0.5])

Borrow Known ImageNet Stats

When using pretrained vision models, normalize with the ImageNet means and stds they were trained on. Matching those numbers keeps inputs in the expected range.

Do It Inside __getitem__

The cleanest spot to scale is your dataset's __getitem__ or a transform. Then every sample arrives normalized without extra code in your training loop.

Watch for Divide by Zero

If a feature is constant its std is zero and dividing explodes. Add a tiny epsilon to the denominator to keep the math safe and stable.

x = (x - mean) / (std + 1e-8)

Small Step, Big Payoff

Normalizing inputs is a quick preprocessing habit, yet it often unlocks faster, more stable training. Skip it and even a good model may crawl.

Quick Check

From which split should you compute normalization statistics?

Recap

Normalization rescales features so training converges, using stats fit on the training set and reused everywhere, often inside a transform. 🎉

Frequently asked questions

Is the “Normalize and Standardize Inputs” lesson free?

Yes — the full text of “Normalize and Standardize Inputs” is free to read here on the web, and the Deep Learning Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Deep Learning Academy course, upgrade to CoddyKit PRO.

What will I learn in “Normalize and Standardize Inputs”?

Scale features so training converges. You practise Deep Learning Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Deep Learning Academy?

No prior experience is required. Deep Learning Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Normalize and Standardize Inputs” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Deep Learning Academy lesson?

Yes. Every Deep Learning Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Write a Custom Dataset Class
  2. Batching, Shuffling & num_workers
  3. collate_fn for Variable-Length Inputs
  4. Normalize and Standardize Inputs
← Back to Deep Learning Academy