0
0
Computer Visionml~12 mins

Cropping images in Computer Vision - Model Pipeline Trace

Choose your learning style9 modes available
Model Pipeline - Cropping images

This pipeline shows how images are cropped to focus on important parts before being used in a machine learning model. Cropping helps the model learn better by removing unnecessary background.

Data Flow - 4 Stages
1Input images
1000 images x 256 height x 256 width x 3 channelsLoad raw images of size 256x256 pixels with 3 color channels (RGB)1000 images x 256 height x 256 width x 3 channels
An image of a cat with full background
2Cropping
1000 images x 256 height x 256 width x 3 channelsCrop center 128x128 pixels from each image to focus on main object1000 images x 128 height x 128 width x 3 channels
Cropped image showing only the cat's face
3Normalization
1000 images x 128 height x 128 width x 3 channelsScale pixel values from 0-255 to 0-1 range1000 images x 128 height x 128 width x 3 channels
Pixel value 128 becomes 0.502
4Model input
1000 images x 128 height x 128 width x 3 channelsFeed cropped and normalized images into the model1000 predictions x number_of_classes
Model predicts class probabilities for each image
Training Trace - Epoch by Epoch
Loss
1.2 |****
1.0 |*** 
0.8 |**  
0.6 |*   
0.4 |*   
    +-----
     1 5 Epochs
EpochLoss ↓Accuracy ↑Observation
11.20.45Model starts learning with moderate loss and low accuracy
20.90.60Loss decreases and accuracy improves as model learns features
30.70.72Model continues to improve with better focus on cropped images
40.50.80Loss drops further and accuracy reaches a good level
50.40.85Training converges with low loss and high accuracy
Prediction Trace - 4 Layers
Layer 1: Input image
Layer 2: Cropping
Layer 3: Normalization
Layer 4: Model prediction
Model Quiz - 3 Questions
Test your understanding
Why do we crop images before training the model?
ATo add noise for data augmentation
BTo increase image size for better detail
CTo focus on important parts and remove background
DTo convert images to grayscale
Key Insight
Cropping images helps the model focus on the main object by removing unnecessary background. This leads to better learning and higher accuracy as seen by the decreasing loss and increasing accuracy during training.