SkyAICampus
HomePracticeLearnCode LabFocus

Learn

HomePracticeConcept cardsCode LabSky Tutor

Review

Revise todayMistake notebookProgress

Focus

Campus ForestFocus roomsSquads

Questions or feedback?
support@skyaicampus.com

SkyAICampus
PrivacyTermssupport@skyaicampus.com© 2026 SkyAI Campus
← All modules

Computer vision

One 60-second card per skill, in learning order. 7 of 7 cards ready.

Image basics 2/2CNNs for vision 2/2Vision tasks 2/2Data augmentation 1/1

In this module

1Image basics2 of 2 cards2CNNs for vision2 of 2 cards3Vision tasks2 of 2 cards4Data augmentation1 of 1 cards

Topic 1

Image basics

Pixels and channels · Preparing images

▶Open the lessonPractise this topic

60-second card

Pixels and channels

An image is a grid of pixels. A colour image has 3 channels (red, green, blue), each 0 to 255.

  • Shape is usually (height, width, channels), like (224, 224, 3).
  • Greyscale has 1 channel.
  • One 224×224 colour image is 150,528 numbers.
import numpy as np
img = np.zeros((224, 224, 3), dtype=np.uint8)
print(img.shape, img.size)

Prints

(224, 224, 3) 150528

Remember: Height comes first in the shape, then width.

Common mistake: Mixing up channel order: OpenCV loads BGR, most others use RGB.

60-second card

Preparing images

Before training, images are resized to one size and their pixel values scaled.

  • Resize every image to the input size the model expects.
  • Divide by 255 to get 0–1, or normalise with the dataset's mean and std.
  • Pre-trained models need the same normalisation they were trained with.
import numpy as np
pixels = np.array([0, 51, 255])
print((pixels / 255).round(2).tolist())

Prints

[0.0, 0.2, 1.0]

Remember: Prepare images at prediction time exactly as in training.

Common mistake: Training on 0–1 values and predicting on 0–255 values.

Topic 2

CNNs for vision

CNN architectures · Transfer learning

▶Open the lessonPractise this topic

60-second card

CNN architectures

Vision CNNs stack convolution and pooling blocks: the image shrinks while the number of features grows.

  • ResNet added skip connections, which made 100+ layer networks trainable.
  • The end pools the features and a dense layer predicts the class.
  • Vision Transformers split images into patches and use attention.
size, channels = 224, 64
for block in range(3):
    size, channels = size // 2, channels * 2
print(size, channels)

Prints

28 512

Remember: Deeper isn't always better: pick a model that fits your data and speed needs.

Common mistake: Training a huge network from scratch on a few hundred images.

60-second card

Transfer learning

Transfer learning starts from a model trained on millions of images and adapts it to your task.

  • Early layers already know edges and textures.
  • With little data, freeze most layers and train a new final layer.
  • With more data, fine-tune more layers with a small learning rate.

Example: 500 crop-disease photos: take a ResNet trained on ImageNet, replace its last layer with 4 disease classes, train that layer first.

Remember: It's the default for small image datasets.

Common mistake: Fine-tuning with a big learning rate, which wipes out the pre-trained knowledge.

Topic 3

Vision tasks

Object detection · Segmentation

▶Open the lessonPractise this topic

60-second card

Object detection

Object detection finds what is in an image and where, with a box, a class and a confidence for each object.

  • IoU (intersection over union) measures how well two boxes overlap.
  • Non-maximum suppression removes duplicate boxes on the same object.
  • YOLO detects in one fast pass; good for live video.
overlap = 25
union = 100 + 100 - overlap
print(round(overlap / union, 2))

Prints

0.14

Remember: IoU = overlap area ÷ combined area.

Common mistake: Counting a detection as right just because the class matches, with a badly placed box.

60-second card

Segmentation

Segmentation labels every pixel, giving exact outlines instead of boxes.

  • Semantic: every pixel gets a class (road, car, sky).
  • Instance: separate objects of one class get separate masks.
  • U-Net is popular, especially for medical images.
import numpy as np
pred = np.array([[1, 1], [0, 0]])
true = np.array([[1, 0], [0, 0]])
inter = ((pred == 1) & (true == 1)).sum()
union = ((pred == 1) | (true == 1)).sum()
print(inter / union)

Prints

0.5

Remember: Use segmentation when the exact shape matters.

Common mistake: Judging a mask by pixel accuracy when 90% of the image is background. Use IoU per class.

Topic 4

Data augmentation

Augmentation

▶Open the lessonPractise this topic

60-second card

Augmentation

Augmentation makes new training images by flipping, rotating, cropping or recolouring the ones you have.

  • The model sees slightly different versions each epoch, so it generalises better.
  • Only use changes that keep the label true.
  • Augment training data only, never the test set.
import numpy as np
img = np.array([[1, 2, 3], [4, 5, 6]])
print(np.fliplr(img).tolist())

Prints

[[3, 2, 1], [6, 5, 4]]

Remember: Ask: would a person still give it the same label?

Common mistake: Flipping digits upside down: a 6 becomes a 9.

Log inSign up

Practise a little every day

Five questions a day keep your Sunrise Streak going. Your progress is saved when you sign up.

Sign up free