Bag of Words Models. CS4670 / 5670: Computer Vision Noah Snavely. Bag-of-words models 11/26/2013

Similar documents
CS6670: Computer Vision

Patch Descriptors. CSE 455 Linda Shapiro

Supervised learning. y = f(x) function

Local Features and Bag of Words Models

Patch Descriptors. EE/CSE 576 Linda Shapiro

Object Recognition. Computer Vision. Slides from Lana Lazebnik, Fei-Fei Li, Rob Fergus, Antonio Torralba, and Jean Ponce

CV as making bank. Intel buys Mobileye! $15 billion. Mobileye:

By Suren Manvelyan,

Supervised learning. y = f(x) function

Descriptors for CV. Introduc)on:

Image classification Computer Vision Spring 2018, Lecture 18

Machine Learning Crash Course

Announcements. Recognition. Recognition. Recognition. Recognition. Homework 3 is due May 18, 11:59 PM Reading: Computer Vision I CSE 152 Lecture 14

Beyond bags of features: Adding spatial information. Many slides adapted from Fei-Fei Li, Rob Fergus, and Antonio Torralba

Introduction to object recognition. Slides adapted from Fei-Fei Li, Rob Fergus, Antonio Torralba, and others

Previously. Part-based and local feature models for generic object recognition. Bag-of-words model 4/20/2011

Today. Main questions 10/30/2008. Bag of words models. Last time: Local invariant features. Harris corner detector: rotation invariant detection

Part-based and local feature models for generic object recognition

CEE598 - Visual Sensing for Civil Infrastructure Eng. & Mgmt.

Lecture 12 Visual recognition

Bag-of-features. Cordelia Schmid

EECS 442 Computer vision. Object Recognition

Supervised learning. f(x) = y. Image feature

Part based models for recognition. Kristen Grauman

Visual Object Recognition

Simple Example of Recognition Statistical Viewpoint!

Beyond Bags of features Spatial information & Shape models

Recognition with Bag-ofWords. (Borrowing heavily from Tutorial Slides by Li Fei-fei)

Keypoint-based Recognition and Object Search

Colorado School of Mines. Computer Vision. Professor William Hoff Dept of Electrical Engineering &Computer Science.

Lecture 12 Recognition

Deformable Part Models

Distribution Distance Functions

Visual words. Map high-dimensional descriptors to tokens/words by quantizing the feature space.

Indexing local features and instance recognition May 16 th, 2017

TA Section: Problem Set 4

Fuzzy based Multiple Dictionary Bag of Words for Image Classification

Outline. Segmentation & Grouping. Examples of grouping in vision. Grouping in vision. Grouping in vision 2/9/2011. CS 376 Lecture 7 Segmentation 1

Indexing local features and instance recognition May 14 th, 2015

Lecture 12 Recognition. Davide Scaramuzza

Loose Shape Model for Discriminative Learning of Object Categories

Lecture 12 Recognition

Recognition. Topics that we will try to cover:

Beyond Bags of Features

CLASSIFICATION Experiments

Computer Vision. Exercise Session 10 Image Categorization

Integrated Feature Selection and Higher-order Spatial Feature Extraction for Object Categorization

Lecture 6: Texture. Tuesday, Sept 18

Segmentation and Grouping April 19 th, 2018

Grouping and Segmentation

Object Category Detection. Slides mostly from Derek Hoiem

Lecture 14: Indexing with local features. Thursday, Nov 1 Prof. Kristen Grauman. Outline

Segmentation and Grouping

Indexing local features and instance recognition May 15 th, 2018

Large Scale 3D Reconstruction by Structure from Motion

Distances and Kernels. Motivation

Efficient Kernels for Identifying Unbounded-Order Spatial Features

Bias-Variance Trade-off + Other Models and Problems

Object Recognition and Augmented Reality

Artistic ideation based on computer vision methods

Lecture 15: Object recognition: Bag of Words models & Part based generative models

Introduction to Object Recognition & Bag of Words (BoW) Models

Large-scale visual recognition The bag-of-words representation

Object Classification Problem

String distance for automatic image classification

Segmentation and Grouping April 21 st, 2015

Kernels for Visual Words Histograms

Determining Patch Saliency Using Low-Level Context

Pattern recognition (3)

Discriminative Object Class Models of Appearance and Shape by Correlatons

CMPSCI 670: Computer Vision! Grouping

6.819 / 6.869: Advances in Computer Vision

Perception IV: Place Recognition, Line Extraction

Lecture 24: Image Retrieval: Part II. Visual Computing Systems CMU , Fall 2013

Recognizing object instances

Classifying Images with Visual/Textual Cues. By Steven Kappes and Yan Cao

CS 4495 Computer Vision Classification 3: Bag of Words. Aaron Bobick School of Interactive Computing

Feature Matching + Indexing and Retrieval

Improved Spatial Pyramid Matching for Image Classification

Learning Tree-structured Descriptor Quantizers for Image Categorization

Local features, distances and kernels. Plan for today

Large-scale Image Search and location recognition Geometric Min-Hashing. Jonathan Bidwell

Object Detection Using A Shape Codebook

Bag of Words or Bag of Features. Lecture-16 (Slides Credit: Cordelia Schmid LEAR INRIA Grenoble)

CS 4495 Computer Vision. Segmentation. Aaron Bobick (slides by Tucker Hermans) School of Interactive Computing. Segmentation

OBJECT CATEGORIZATION

Large Scale Image Retrieval

Texture. Texture. 2) Synthesis. Objectives: 1) Discrimination/Analysis

Automatic Ranking of Images on the Web

Local features: detection and description. Local invariant features

Local Image Features

Mining Discriminative Adjectives and Prepositions for Natural Scene Recognition

CS 231A CA Session: Problem Set 4 Review. Kevin Chen May 13, 2016

Frequent Inner-Class Approach: A Semi-supervised Learning Technique for One-shot Learning

Spatial Hierarchy of Textons Distributions for Scene Classification

Selection of Scale-Invariant Parts for Object Class Recognition

Three things everyone should know to improve object retrieval. Relja Arandjelović and Andrew Zisserman (CVPR 2012)

ECE 5424: Introduction to Machine Learning

Geometric VLAD for Large Scale Image Search. Zixuan Wang 1, Wei Di 2, Anurag Bhardwaj 2, Vignesh Jagadesh 2, Robinson Piramuthu 2

Instance recognition

Transcription:

CS4670 / 5670: Computer Vision Noah Snavely Bag-of-words models Object Bag of words Bag of Words Models Adapted from slides by Rob Fergus and Svetlana Lazebnik 1

Object Bag of words Origin 1: Texture Recognition Example textures (from Wikipedia) 2

Origin 1: Texture recognition Texture is characterized by the repetition of basic elements or textons For stochastic textures, it is the identity of the textons, not their spatial arrangement, that matters Julesz, 1981; Cula & Dana, 2001; Leung & Malik 2001; Mori, Belongie & Malik, 2001; Schmid 2001; Varma & Zisserman, 2002, 2003; Lazebnik, Schmid & Ponce, 2003 Origin 1: Texture recognition histogram Universal texton dictionary Universal texton dictionary Julesz, 1981; Cula & Dana, 2001; Leung & Malik 2001; Mori, Belongie & Malik, 2001; Schmid 2001; Varma & Zisserman, 2002, 2003; Lazebnik, Schmid & Ponce, 2003 3

Origin 2: Bag-of-words models Orderless document representation: frequencies of words from a dictionary Salton & McGill (1983) Origin 2: Bag-of-words models Orderless document representation: frequencies of words from a dictionary Salton & McGill (1983) US Presidential Speeches Tag Cloud http://chir.ag/phernalia/preztags/ 4

Origin 2: Bag-of-words models Orderless document representation: frequencies of words from a dictionary Salton & McGill (1983) US Presidential Speeches Tag Cloud http://chir.ag/phernalia/preztags/ Origin 2: Bag-of-words models Orderless document representation: frequencies of words from a dictionary Salton & McGill (1983) US Presidential Speeches Tag Cloud http://chir.ag/phernalia/preztags/ 5

Bags of features for object recognition face, flowers, building Works pretty well for image-level classification and for recognizing object instances Csurka et al. (2004), Willamowski et al. (2005), Grauman & Darrell (2005), Sivic et al. (2003, 2005) Bags of features for object recognition Caltech6 dataset bag of features bag of features Parts-and-shape model 6

Bag of features First, take a bunch of images, extract features, and build up a dictionary or visual vocabulary a list of common features Given a new image, extract features and build a histogram for each feature, find the closest visual word in the dictionary Bag of features: outline 1. Extract features 7

Bag of features: outline 1. Extract features 2. Learn visual vocabulary Bag of features: outline 1. Extract features 2. Learn visual vocabulary 3. Quantize features using visual vocabulary 8

Bag of features: outline 1. Extract features 2. Learn visual vocabulary 3. Quantize features using visual vocabulary 4. Represent images by frequencies of visual words 1. Feature extraction Regular grid Vogel & Schiele, 2003 Fei-Fei & Perona, 2005 9

1. Feature extraction Regular grid Vogel & Schiele, 2003 Fei-Fei & Perona, 2005 Interest point detector Csurka et al. 2004 Fei-Fei & Perona, 2005 Sivic et al. 2005 1. Feature extraction Regular grid Vogel & Schiele, 2003 Fei-Fei & Perona, 2005 Interest point detector Csurka et al. 2004 Fei-Fei & Perona, 2005 Sivic et al. 2005 Other methods Random sampling (Vidal-Naquet & Ullman, 2002) Segmentation-based patches (Barnard et al. 2003) 10

2. Learning the visual vocabulary 2. Learning the visual vocabulary Clustering Slide credit: Josef Sivic 11

2. Learning the visual vocabulary Visual vocabulary Clustering Slide credit: Josef Sivic K-means clustering Want to minimize sum of squared Euclidean distances between points x i and their nearest cluster centers m k Algorithm: D( X, M ) Randomly initialize K cluster centers Iterate until convergence: ( cluster k pointi in cluster k x i m k ) Assign each data point to the nearest center Recompute each cluster center as the mean of all points assigned to it 2 12

From clustering to vector quantization Clustering is a common method for learning a visual vocabulary or codebook Unsupervised learning process Each cluster center produced by k-means becomes a codevector Codebook can be learned on separate training set Provided the training set is sufficiently representative, the codebook will be universal The codebook is used for quantizing features A vector quantizer takes a feature vector and maps it to the index of the nearest codevector in a codebook Codebook = visual vocabulary Codevector = visual word Example visual vocabulary Fei-Fei et al. 2005 13

Image patch examples of visual words Sivic et al. 2005 Visual vocabularies: Issues How to choose vocabulary size? Too small: visual words not representative of all patches Too large: quantization artifacts, overfitting Computational efficiency Vocabulary trees (Nister & Stewenius, 2006) 14

frequency 11/26/2013 3. Image representation.. codewords Image classification Given the bag-of-features representations of images from different classes, how do we learn a model for distinguishing them? 15

Uses of BoW representation Treat as feature vector for standard classifier e.g k-nearest neighbors, support vector machine Cluster BoW vectors over image collection Discover visual themes Large-scale image matching Bag-of-words models have been useful in matching an image to a large database of object instances 11,400 images of game covers (Caltech games dataset) how do I find this image in the database? 16

Large-scale image search Build the database: Extract features from the database images Learn a vocabulary using k- means (typical k: 100,000) Compute weights for each word Create an inverted file mapping words images Weighting the words Just as with text, some visual words are more discriminative than others the, and, or vs. cow, AT&T, Cher the bigger fraction of the documents a word appears in, the less useful it is for matching e.g., a word that appears in all documents is not helping us 17

TF-IDF weighting Instead of computing a regular histogram distance, we ll weight each word by it s inverse document frequency inverse document frequency (IDF) of word j = log number of documents number of documents in which j appears TF-IDF weighting To compute the value of bin j in image I: term frequency of j in I x inverse document frequency of j 18

Inverted file Each image has ~1,000 features We have ~100,000 visual words each histogram is extremely sparse (mostly zeros) Inverted file mapping from words to documents Inverted file Can quickly use the inverted file to compute similarity between a new image and all the images in the database Only consider database images whose bins overlap the query image 19

Large-scale image search query image top 6 results Cons: not as accurate as per-image-pair feature matching performance degrades as the database grows Large-scale image search Pros: Works well for CD covers, movie posters Real-time performance possible real-time retrieval from a database of 40,000 CD covers Nister & Stewenius, Scalable Recognition with a Vocabulary Tree 20

Large-scale image matching Turn 1,000,000 images of Rome into 3D models St. Peter s Basilica Colosseum Trevi Fountain 21

Large-scale image matching How can we match 1,000,000 images to each other? Brute force approach: 500,000,000,000 pairs won t scale Better approach: use bag-of-words technique to find likely matches For each image, find the top M scoring other images, do detailed SIFT matching with those Example bag-of-words matches 22

Example bag-of-words matches 23

What about spatial info?? 24