100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

Computer Vision Basics Cheat Sheet

Computer Vision Basics Cheat Sheet

Core computer vision concepts and workflows, covering image preprocessing, convolutional filters, and building a basic CNN classifier with PyTorch.

2 PagesIntermediateMar 20, 2026

Image Loading & Preprocessing

Load, resize, and augment images.

python
import cv2import torchvision.transforms as T# Load and inspect an image with OpenCV (BGR order by default)img = cv2.imread("photo.jpg")img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)# Resize, blur, edge detectionresized = cv2.resize(img_rgb, (224, 224))blurred = cv2.GaussianBlur(img_rgb, (5, 5), sigmaX=0)edges = cv2.Canny(gray, threshold1=100, threshold2=200)# torchvision transforms for a training pipelinetransform = T.Compose([    T.Resize((224, 224)),    T.RandomHorizontalFlip(p=0.5),    T.ToTensor(),    T.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),])

A Simple CNN

Convolution, pooling, and classification layers.

python
import torch.nn as nnclass SimpleCNN(nn.Module):    def __init__(self, num_classes=10):        super().__init__()        self.conv1 = nn.Conv2d(3, 32, kernel_size=3, padding=1)        self.conv2 = nn.Conv2d(32, 64, kernel_size=3, padding=1)        self.pool = nn.MaxPool2d(2, 2)        self.fc1 = nn.Linear(64 * 56 * 56, 128)        self.fc2 = nn.Linear(128, num_classes)        self.relu = nn.ReLU()    def forward(self, x):        x = self.pool(self.relu(self.conv1(x)))   # 224 -> 112        x = self.pool(self.relu(self.conv2(x)))   # 112 -> 56        x = x.view(x.size(0), -1)        x = self.relu(self.fc1(x))        return self.fc2(x)model = SimpleCNN(num_classes=10)

Computer Vision Concepts

Core building blocks of CNN-based vision models.

  • Convolution- sliding a learnable filter/kernel over an image to detect local patterns like edges
  • Pooling- downsamples feature maps (e.g. max pooling) to reduce spatial size and add translation invariance
  • Stride- step size the filter moves each time; larger stride reduces output size
  • Padding- adds border pixels so output size can match input size ('same' padding)
  • Feature map- the output of applying a convolutional filter to the input
  • Data augmentation- random flips/rotations/crops applied during training to improve generalization
  • Transfer learning- reusing a model pretrained on a large dataset (e.g. ImageNet) and fine-tuning it on your task
  • IoU (Intersection over Union)- overlap metric between predicted and ground-truth bounding boxes, used in object detection

Common CV Tasks

Typical problems solved with computer vision.

  • Image classification- assigning a single label to an entire image
  • Object detection- locating and classifying multiple objects with bounding boxes (e.g. YOLO, Faster R-CNN)
  • Semantic segmentation- classifying every pixel in an image into a category
  • Instance segmentation- segmenting individual object instances, distinguishing overlapping objects of the same class
  • Image generation- synthesizing new images (e.g. GANs, diffusion models)
Pro Tip

Always normalize input images using the same mean/std the pretrained backbone was trained with (e.g. ImageNet's [0.485, 0.456, 0.406] / [0.229, 0.224, 0.225]) when fine-tuning — mismatched normalization silently degrades transfer learning performance.

Was this cheat sheet helpful?

Explore Topics

#ComputerVisionBasics#ComputerVisionBasicsCheatSheet#DataScience#Intermediate#ImageLoadingPreprocessing#ASimpleCNN#ComputerVisionConcepts#CommonCVTasks#MachineLearning#CheatSheet#SkillVeris
Advertisement
Sri Hayavadhana Info-Tech

Professional Web Designing Services

  • Responsive Websites
  • E-commerce Solutions
  • SEO Friendly Design
  • Fast & Secure
  • Support & Maintenance
Get a Free Quote

Share this Cheat Sheet