Object Categorization and Detection: Methods and Frameworks
Overview of Recognition Tasks
Image Classification / Object Categorization: This involves classifying an entire image by assigning it to a correct category label and recognizing any instances of that specific category.
Object Identification: Defined as a $1$-to-$n$ matching system, where $n$ represents all possible identities. It focuses on finding a specific, particular object (e.g., distinguishing "John's car" from any other car).
Object Detection / Localization: This task involves locating objects within an image (such as people or faces) and recognizing the correct category for each located object.
Object Segmentation: This task determines which specific pixels belong to a certain object category (e.g., "Which pixels are part of an aeroplane?").
Identification vs. Categorization
Identification: The goal is to find one particular, unique object (e.g., identifying a specific car owned by an individual).
Categorization: The goal is to recognize ANY instance belonging to a category (e.g., recognizing any object that fits the definition of a "car").
Potential Applications for Object Categorization
Consumer Electronics: Integration into everyday devices for smarter interaction.
Autonomous Robots: Required for navigation and driver safety (e.g., Google's autonomous projects).
Content-Based Retrieval and Analysis: Used for searching images and videos on platforms like Google Images and YouTube.
Medical Image Analysis: Analyzing scans for diagnostic purposes.
Scope and Scale of Categories
According to Biederman (1987), there are approximately to distinct object categories in existence.
Challenges in Robustness
Realistic scenes are often crowded, cluttered, and contain overlapping objects.
Variability Factors: Systems must learn to compensate for:
Illumination: Changes in lighting conditions.
Object Pose: The orientation of the object.
Clutter: Distracting elements in the background.
Occlusions: Objects being partially hidden by other objects.
Intra-class Appearance: Variation within the same category (e.g., different breeds of dogs).
Viewpoint: Changes in the camera's perspective.
Scale: Variation in the size of the object within the frame.
Articulation: Changes in the shape of flexible objects.
The Supervised Classification Framework
Goal: Given a collection of labeled examples, develop a function to predict labels for new, unseen examples.
Mathematical Model:
: Image features.
: Prediction function.
: Output (label).
Training Phase: Given a training set of labeled examples , the function is estimated by minimizing the prediction error on the training set.
Testing Phase: The function is applied to an unseen test example to output the predicted value .
Classification Strategies
Generative Strategy: Training data is used to build a representative probability model. It separately models class-conditional densities and priors.
Example: modeling .
Formula: .
Discriminative Strategy: Directly constructs a decision boundary or models the posterior probability . It avoids modeling the underlying distribution of the class itself, focusing instead on the boundary between classes.
Object Detection via Classification: Sliding Window Approach
Basic Component: A binary classifier (e.g., Car vs. Non-car).
Procedure: If an object exists in a cluttered scene, a window is "slid" across the image to check every location.
Spatial and Scale Scanning: To find objects of different sizes, the image is down-scaled repeatedly, and the scan is performed at each scale. This converts detection into a subwindow classification problem.
Training Phase Steps:
Obtain labeled training data.
Scan locations (if relevant to the specific algorithm).
Extract features.
Define/Train the classifier.
Testing Phase Steps:
Input test data.
Scan all possible locations and scales.
Extract features for each window.
Classify features using the trained model.
Post-processing (e.g., Non-maxima suppression).
Post-Processing: Non-Maxima Suppression (NMS)
Multiple overlapping windows may detect the same object.
Procedure:
Iterate over all detections.
Select the box with the highest confidence score.
Calculate the overlap with all other boxes.
Remove boxes that have an overlap higher than a specific threshold (usually ).
Intersection over Union (IoU): The standard metric for overlap.
Feature Extraction: Global Appearance vs. Gradients
Global Appearance: Simple holistic descriptions like grayscale or color histograms and vectors of pixel intensities.
Weakness: Highly sensitive to small spatial shifts, illumination changes, and intra-class variation (e.g., an "albino koala" would fail a standard color-based pixel test).
Gradient-based Representations: Focuses on edges, contours, and oriented intensity gradients.
Invariance: Summarizing local distributions of gradients (locally orderless) offers invariance to small shifts and rotations.
Localized Histograms: Provide more spatial information than a single global histogram.
Contrast-Normalization: Helps correct for variable illumination.
Histograms of Oriented Gradients (HOG) Descriptor
Developed by Dalal & Triggs (CVPR 2005), the processing chain involves:
Optional Gamma Compression: Goal is to reduce the effect of overly strong gradients. Each pixel intensity is replaced by its square root: .
Gradient Computation: Simple finite difference filters are applied. Gradients are computed on all color channels, and the strongest one is used. No Gaussian smoothing is applied.
Spatial/Orientation Binning: The image is divided into cells (typically pixels). A histogram of orientations is created for each cell, typically using bins ( to degrees).
Gradient Orientation Voting: Each pixel's contribution to the histogram is weighted by its gradient magnitude.
Orientation Formula:
Gradient Magnitude Formula:
Contrast Normalization: Cells are grouped into overlapping blocks (e.g., cells). The histograms within the block are normalized (usually normalization) to account for changes in lighting/contrast.
Feature Vector Construction: Normalized HOG blocks are collected into a single large vector.
SVM Classification: The vector is passed to a Linear Support Vector Machine (SVM) to decide if the window contains the object or not.
Support Vector Machines (SVMs)
SVM is a discriminative classifier based on finding an optimal separating hyperplane (a line in 2D).
Margin: The width the boundary can be increased before hitting a data point. SVM maximizes this margin between positive and negative training examples.
Linear SVM Math:
Separating line:
For positive examples:
For negative examples:
The margin width is calculated as: .
Optimization: Maximizing the margin is equivalent to minimizing subject to for all .
Classification Function: . This relies on the inner product between the test point and the support vectors .
Non-Linear SVMs and the Kernel Trick
If data is not linearly separable in the original space, it can be mapped to a higher-dimensional feature space where it becomes separable.
Kernel Trick: Instead of explicitly computing the high-dimensional mapping, a kernel function is defined.
Common Kernel Functions:
Linear:
Polynomial of power p:
Gaussian (Radial-Basis Function):
Multi-Class SVMs
Since SVM is inherently binary, multi-class classification is achieved by combining multiple classifiers:
One vs. All: Learn an SVM for each class against all other classes combined. The test example is assigned to the class of the SVM that returns the highest decision value.
One vs. One: Learn an SVM for every possible pair of classes. For a -way problem, this results in binary classifiers. Each SVM "votes," and the class with the most votes is chosen.
Summary: Sliding-Windows
Pros:
Simple detection protocol to implement.
Critical success relies on good feature choices (e.g., HOG).
Effective for specific classes with defined shapes (e.g., pedestrians, faces).
Cons/Limitations:
High computational complexity due to the exhaustive search over space and scale.
Rigid structure: not all objects are "box" shaped.