CSE445Computer Vision
ModulesDetection & TrackingClassical Recognition

Classical Object Recognition

Bag-of-features with k-means codebooks, pooling and normalization, an SVM, and leakage-safe evaluation.

Key Terms

Bag of Featuresk-Means CodebookPoolingNormalizationSVMData Leakage

Python Tools

OpenCVscikit-learnNumPyMatplotlib

Textbook Reference

Szeliski Ch.6

Topics Covered

  1. 1Local features to a visual vocabulary by k-means clustering
  2. 2Hard and soft assignment, histogram pooling, and spatial pyramids
  3. 3L1, L2, and power normalization of the encoded vectors
  4. 4Linear and kernel SVM classification of image encodings
  5. 5Leakage-safe protocols: train/val/test splits, fold-independent codebooks, and cross-validation

Learning Outcomes

  • Build a bag-of-features representation with a k-means codebook
  • Explain how pooling and normalization affect the encoding
  • Design an evaluation that avoids data leakage in the codebook and splits

Pipeline walkthrough

From local features to a Bag-of-Features classifier

Seven stages, 23 steps: global versus local descriptors, keypoint description, a k-means visual vocabulary, nearest-word quantisation, tf-idf histogram pooling, and a one-vs-rest linear SVM. Every number on screen — the clustering, the histogram, the scores and the confusion matrix — is computed live from the synthetic dataset, not hard-coded.

1 / 23

QUERY IMAGEPIPELINEPREPROCESSgreyscale · resizeDESCRIBEdetect + SIFTENCODEbag of featuresCLASSIFYlinear SVMOUTPUTy = ?one of 3: bicycle · motorbike · carPIPELINE STATE72training images1687pooled descriptors128descriptor dim18query keypointsnot built yetvocabularyTHE ENCODER IS THE ONLY BLOCK THAT CAN TURN A VARIABLE-SIZE SET INTO A FIXED-SIZE VECTOR

Stage 1 · Step 1 of 3

Image in, label out

The classical recognition pipeline

A classical recogniser takes a raw image and has to emit one class label. Everything in between is fixed, hand-designed processing.

I∈RH×W×3  ⟼  y∈{1,…,C}\mathcal{I} \in \mathbb{R}^{H \times W \times 3} \;\longmapsto\; y \in \{1, \dots, C\}

Key idea

Every block up to the classifier is designed by hand. Only the last one is learned from data — that is what separates the classical era from the deep era.

Playing. Selecting any stage or step pauses playback so you can inspect it.

Lecture PDFs

Classical Object Recognition

The embedded PDF preview is disabled to reduce Vercel bandwidth usage. Open the lecture file directly in Google Drive for viewing, downloading, or presenting.