Computer Vision & Multimodal Learning Systems (Overview)

Primary references:

  • Computer Vision Hierarchy & Classical Processing YouTube Lecture

  • Scale-Invariant Feature Transform (SIFT) Implementation Notebook

  • Affine SIFT (ASIFT) Technical Paper

  • Speeded-Up Robust Features (SURF) Overview

  • Oriented FAST and Rotated BRIEF (ORB) Introduction

  • Harris Corner Detector Guide

  • Canny Edge Detection Step-by-Step Tutorial

  • [Shape Matching Using Hu Momentscite: 1
  • Structural Similarity Index (SSIM) Image Comparison

  • Feature-Based Image Alignment Using OpenCV

  • Viola-Jones Object Detection Algorithm

  • Focal Loss for Dense Object Detection (RetinaNet)

  • DeepLab V3 Semantic Segmentation Tutorial

  • [MaX-DeepLab: Dual-Path Transformers for Panoptic Segmentationcite: 1
  • Vision Transformers (ViT) Paper & Paperspace Guide

  • DETR: End-to-End Object Detection with Transformers

  • DeNoising DETR (DINO) Technical Paper

  • MLP-Mixer: An all-MLP Architecture for Vision

  • Fourier Transform Applications in Deep Learning

  • Neural Style Transfer Intuitive Guide

  • Human Pose Estimation Guide

  • Segment Anything Model (SAM) Breakdown

  • SAM + XMem for Video Object Segmentation

  • Generative Adversarial Networks (GANs) Original Paper

  • Google ML Crash Course: GAN Problems

  • V7 Labs Autoencoders Guide

  • Variational Autoencoders (VAEs) Lecture & Notes

  • Diffusion Models for Machine Learning Introduction

  • MaskGIT: Masked Generative Image Transformer

  • Attention Modules in CNNs (BAM and CBAM)

  • Grad-CAM: Explanations from Deep Networks

  • Saliency Maps and Interpretation Methods in Deep Learning

  • OpenAI Contrastive Language-Image Pre-training (CLIP)

Overview

Computer vision encompasses algorithms, architectures, and pipelines designed to extract high-level semantic understanding, geometric structure, and generative control from digital images and videos. This document establishes an end-to-end technical reference spanning classical feature engineering, dense spatial segmentation, state-of-the-art transformer backbones, attention visualization, and multimodal generative architectures.


Part 1: Classical Computer Vision & Feature Engineering

Computer Vision Hierarchy

Processing pipelines in computer vision are traditionally categorized into three hierarchical levels:

  • Low-Level Vision (Image-to-Image): Operations such as filtering, blurring, sharpening, and edge or optical flow extraction that handle primitive pixel transformations.

  • Intermediate-Level Vision (Image-to-Features): Extraction of symbolic features, contours, regions, and local descriptors from pre-processed image patches to support object recognition and 3D interpretation.

  • High-Level Vision (Features-to-Analysis): Semantic clustering, classification, activity recognition, and intent interpretation.

Local Feature Detectors and Descriptors

Local features provide robust representations invariant to scale, rotation, and illumination changes.

  • Scale-Invariant Feature Transform (SIFT): Detects scale-space extrema using Difference of Gaussians (DoG) pyramids. Keypoints are filtered to eliminate low-contrast responses and edge artifacts. Descriptors are constructed from 8-bin gradient histograms across $4 \times 4$ sub-regions, yielding a 128-dimensional vector.

  • ASIFT (Affine SIFT): Simulates a comprehensive set of camera axis orientation parameters (latitude and longitude) before applying standard SIFT, providing full affine invariance.

  • SURF (Speeded-Up Robust Features): Approximates Hessian matrix determinants using box filters evaluated rapidly via integral images (summed area tables), producing 64-dimensional descriptors.

  • ORB (Oriented FAST and Rotated BRIEF): Combines the FAST keypoint detector (modified with multi-scale pyramids and an orientation assignment mechanism) with the BRIEF binary descriptor to deliver rotation-invariant features without commercial licensing restrictions.

Edge Detection & Image Enhancement

  • Canny Edge Detection: Applies Gaussian smoothing to suppress noise, computes image gradients via Sobel operators, performs non-maximum suppression along gradient directions, and applies hysteresis thresholding with dual thresholds ($\text{thresh}{\text{high}}$ and $\text{thresh}{\text{low}}$) to connect edge segments.

  • Structural Similarity Index (SSIM): Evaluates perceived structural degradation between two images by comparing luminance, contrast, and structural terms. SSIM values fall within $[-1, 1]$, where $1$ denotes identical structure.

  • Homography: Relates the transformations between two images observing the same planar 3D surface, computed using four or more point correspondences combined with robust estimators like RANSAC.


Part 2: Dense Prediction, Object Detection, and Segmentation

Focal Loss in Object Detection (RetinaNet)

Single-stage detectors evaluate dense grids of candidate anchor boxes but suffer from extreme class imbalance during training, where background regions dominate foreground objects. Focal Loss dynamically scales the cross-entropy loss based on prediction confidence to down-weight easy background examples.

Given the model’s estimated probability $p_t$ for the ground-truth class, the Focal Loss is defined as:

\[\text{FL}(p_t) = -\alpha_t (1 - p_t)^\gamma \log(p_t)\]

where $\alpha_t$ balances class frequencies and the focusing parameter $\gamma$ smoothly reduces the weight given to easily classified examples ($p_t > 0.5$). RetinaNet utilizes $\alpha = 0.25$ and $\gamma = 2$.

Semantic and Panoptic Segmentation

  • DeepLab V3: Employs Atrous (Dilated) Convolutions to expand receptive fields without losing spatial resolution, alongside Atrous Spatial Pyramid Pooling (ASPP) with dilation rates $[6, 12, 18]$ to capture multi-scale contextual features.

  • MaX-DeepLab: Integrates a convolutional pixel path with transformer memory paths via dual-path transformer blocks, eliminating surrogate sub-tasks like Non-Maximum Suppression (NMS) for end-to-end panoptic segmentation.


Part 3: Vision Transformers (ViT) & Modern Architectures

Vision Transformer (ViT)

Vision Transformers adapt the standard NLP transformer encoder for image recognition by processing non-overlapping flattened image patches.

Input Image 
  │
  ├─ Split into patches ──► [Patch 1, Patch 2, ..., Patch N]
  │
  ├─ Linear Projection ──► Linear Patch Embeddings + Learnable [class] Token
  │
  ├─ Position Encoding ──► Added to retain spatial awareness
  │
  ├─ Transformer Encoder ──► Multi-Head Self-Attention + LayerNorm + MLP Blocks
  │
  └─ MLP Classification Head (Reads [class] token output)

Detection Transformer (DETR)

DETR casts object detection directly as a set-prediction problem, eliminating hand-crafted components like anchor generation and NMS. It utilizes a convolutional backbone combined with a transformer encoder-decoder architecture and learns a fixed set of $N$ object queries resolved against ground-truth targets via bipartite matching using the Hungarian algorithm.


Part 4: Generative Computer Vision Models

Variational Autoencoders (VAEs)

Variational Autoencoders parameterize an approximate latent distribution $q_\phi(z \mid x)$ by predicting mean $\mu$ and variance $\sigma^2$ vectors. To enable backpropagation through stochastic nodes, the reparameterization trick is applied:

\[z = \mu + \sigma \odot \epsilon, \quad \epsilon \in \mathcal{N}(0, I)\]

The objective function optimizes the Evidence Lower Bound (ELBO), balancing reconstruction loss against the KL divergence regularization term:

\[\mathcal{L}_{\text{VAE}} = \mathbb{E}_{q_\phi(z \mid x)}[-\log p_\theta(x \mid z)] + D_{\text{KL}}(q_\phi(z \mid x) \parallel p(z))\]

Diffusion Models

Diffusion models generate data by learning to reverse a fixed Markov chain of forward Gaussian noising steps. Starting from data distribution $x_0$, noise is progressively added across $T$ timesteps to yield latent states $x_1, \dots, x_T$. The parameterized reverse process $p_\theta(x_{t-1} \mid x_t)$ is trained to denoise states, producing state-of-the-art sample quality without adversarial instability.


Part 5: Attention Mechanisms & Explainability

Channel and Spatial Attention Modules

  • BAM (Bottleneck Attention Module): Computes attention maps at network bottlenecks using parallel branch channel and spatial sub-modules to suppress irrelevant low-level background features.

  • CBAM (Convolutional Block Attention Module): Applies sequential channel attention (using both Max-Pooling and Average-Pooling summaries) followed by spatial attention (using kernel convolutions over aggregated feature maps).

Grad-CAM

Gradient-weighted Class Activation Mapping (Grad-CAM) produces coarse localization heatmaps by computing the gradients of target class score $y^c$ with respect to feature maps $A^k$ of the final convolutional layer. Global Average Pooling weights $\alpha_k^c$ are computed as:

\[\alpha_k^c = \frac{1}{Z} \sum_{i} \sum_{j} \frac{\partial y^c}{\partial A_{i,j}^k}\]

The final heatmap applies a Rectified Linear Unit (ReLU) to the weighted combination to retain only features with a positive influence on the target class:

\[\text{L}_{\text{Grad-CAM}}^c = \text{ReLU}\left(\sum_{k} \alpha_k^c A^k\right)\]

Part 6: Multimodal Learning (Vision and Language)

Contrastive Language-Image Pre-training (CLIP)

CLIP jointly trains an image encoder and a text encoder on web-scale image-caption pairs using a symmetric contrastive loss. By maximizing cosine similarity between correct matching pairs while minimizing similarity across incorrect pairings in the batch, CLIP learns a joint multimodal embedding space capable of zero-shot classification.

BLIP (Bootstrapping Language-Image Pre-training)

Unlike CLIP’s alignment-only dual-encoder structure, BLIP introduces a unified encoder-decoder mixture architecture capable of both multimodal understanding tasks (retrieval, classification) and generative tasks (captioning, visual question answering). BLIP incorporates a synthetic caption bootstrapping module to filter noisy web text and enhance dataset quality.


Limitations and Open Questions

  • Computational Complexity: Attention-based mechanisms (such as standard ViTs and dense self-attention decoders) incur quadratic complexity relative to spatial resolution or token count.

  • Small Object Detection: Global reasoning models can struggle with minute objects occupying few pixels unless multi-scale feature pyramids (FPN) or high-resolution refinement heads are employed.

  • Mode Coverage and Artifacts: Generative architectures like GANs remain vulnerable to mode collapse and training convergence failures, while diffusion models require iterative multi-step sampling passes that increase inference latency.


Final Technical Takeaways

  • Hierarchical Progression: Low-level feature operators (SIFT, Canny, Harris) provide geometric foundations, while deep convolutional and transformer backbones deliver high-level semantic abstraction.

  • End-to-End Set Prediction: Architectures like DETR eliminate heuristic anchors and NMS via bipartite matching.

  • Multimodal Alignment: Contrastive and encoder-decoder foundation models (CLIP, BLIP, SAM) unify vision and language representations for robust zero-shot generalization.


This site uses Just the Docs, a documentation theme for Jekyll.