Download presentation

Presentation is loading. Please wait.

Published byAbigayle Daughtery Modified over 2 years ago

1
Tamara Berg Object Recognition – BoF models 790-133 Recognizing People, Objects, & Actions 1

2
Topic Presentations Hopefully you have met your topic presentations group members? Group 1 – see me to run through slides this week or Monday at the latest (I’m traveling Thurs/Friday). Send me links to 2-3 papers for the class to read. Sign up for class google group (790-133). To find the group go to groups.google.com and search for 790-133 (sorted by date). Use this to post/answer questions related to the class. 2

3
Object Bag of ‘features’ Bag-of-features models source: Svetlana Lazebnik 3

4
Exchangeability De Finetti Theorem of exchangeability (bag of words theorem): the joint probability distribution underlying the data is invariant to permutation. 4

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

6
Bag of words for text Represent documents as a “bags of words” 6

7
Example Doc1 = “the quick brown fox jumped” Doc2 = “brown quick jumped fox the” Would a bag of words model represent these two documents differently? 7

8
Bag of words for images Represent images as a “bag of features” 8

9
Bag of features: outline 1.Extract features source: Svetlana Lazebnik 9

10
Bag of features: outline 1.Extract features 2.Learn “visual vocabulary” source: Svetlana Lazebnik 10

11
Bag of features: outline 1.Extract features 2.Learn “visual vocabulary” 3.Represent images by frequencies of “visual words” source: Svetlana Lazebnik 11

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

13
2. Learning the visual vocabulary Clustering … Slide credit: Josef Sivic Visual vocabulary 13

14
K-means clustering (reminder) Want to minimize sum of squared Euclidean distances between points x i and their nearest cluster centers m k Algorithm: Randomly initialize K cluster centers Iterate until convergence: Assign each data point to the nearest center Recompute each cluster center as the mean of all points assigned to it source: Svetlana Lazebnik 14

15
Example visual vocabulary Fei-Fei et al. 2005 15

16
Image Representation For a query image Extract features Associate each feature with the nearest cluster center (visual word) Accumulate visual word frequencies over the image Visual vocabulary x x x x x x x x x x

17
3. Image representation ….. frequency codewords source: Svetlana Lazebnik 17

18
4. Image classification ….. frequency codewords source: Svetlana Lazebnik 18 Given the bag-of-features representations of images from different classes, how do we learn a model for distinguishing them? CAR

19
Image Categorization Choose from many categories What is this? helicopter

20
Image Categorization Choose from many categories What is this? SVM/NB Csurka et al (Caltech 4/7) Nearest Neighbor Berg et al (Caltech 101) Kernel + SVM Grauman et al (Caltech 101) Multiple Kernel Learning + SVMs Varma et al (Caltech 101) …

21
Visual Categorization with Bags of Keypoints Gabriella Csurka, Christopher R. Dance, Lixin Fan, Jutta Willamowski, Cédric Bray 21

22
Data Images in 7 classes: faces, buildings, trees, cars, phones, bikes, books Caltech 4 dataset: faces, airplanes, cars (rear and side), motorbikes, background 22

23
Method Steps: – Detect and describe image patches. – Assign patch descriptors to a set of predetermined clusters (a visual vocabulary). – Construct a bag of keypoints, which counts the number of patches assigned to each cluster. – Apply a classifier (SVM or Naïve Bayes), treating the bag of keypoints as the feature vector – Determine which category or categories to assign to the image. 23

24
Bag-of-Keypoints Approach Interesting Point Detection Key Patch Extraction Feature Descriptors Bag of Keypoints Multi-class Classifier 24 Slide credit: Yun-hsueh Liu

25
25 SIFT Descriptors Interesting Point Detection Key Patch Extraction Feature Descriptors Bag of Keypoints Multi-class Classifier Slide credit: Yun-hsueh Liu

26
26 Bag of Keypoints (1) Construction of a vocabulary – Kmeans clustering find “ centroids ” (on all the descriptors we find from all the training images) – Define a “ vocabulary ” as a set of “ centroids ”, where every centroid represents a “ word ”. Interesting Point Detection Key Patch Extraction Feature Descriptors Bag of Keypoints Multi-class Classifier Slide credit: Yun-hsueh Liu

27
27 Bag of Keypoints (2) Histogram – Counts the number of occurrences of different visual words in each image Interesting Point Detection Key Patch Extraction Feature Descriptors Bag of Keypoints Multi-class Classifier Slide credit: Yun-hsueh Liu

28
28 Multi-class Classifier In this paper, classification is based on conventional machine learning approaches – Support Vector Machine (SVM) – Naïve Bayes Interesting Point Detection Key Patch Extraction Feature Descriptors Bag of Keypoints Multi-class Classifier Slide credit: Yun-hsueh Liu

29
SVM 29

30
Reminder: Linear SVM x1x1 x2x2 Margin w T x + b = 0 w T x + b = -1 w T x + b = 1 x+x+ x+x+ x-x- Support Vectors Slide credit: Jinwei Gu Slide 30 of 113 s.t.

31
Nonlinear SVMs: The Kernel Trick With this mapping, our discriminant function becomes: No need to know this mapping explicitly, because we only use the dot product of feature vectors in both the training and test. A kernel function is defined as a function that corresponds to a dot product of two feature vectors in some expanded feature space: Slide credit: Jinwei Gu 31

32
Nonlinear SVMs: The Kernel Trick Linear kernel: Examples of commonly-used kernel functions: Polynomial kernel: Gaussian (Radial-Basis Function (RBF) ) kernel: Sigmoid: Slide credit: Jinwei Gu 32

33
Reminder: Support Vector Machine 1. Choose a kernel function 2. Choose a value for C and any other parameters (e.g. σ) 3. Solve the quadratic programming problem (many software packages available) 4. Classify held out validation instances using the learned model 5. Select the best learned model based on validation accuracy 6. Classify test instances using the final selected model Slide 33 of 113

34
SVM for image classification Train k binary 1-vs-all SVMs (one per class) For a test instance, evaluate with each classifier Assign the instance to the class with the largest SVM output 34

35
Naïve Bayes 35

36
Naïve Bayes Model C – Class F - Features We only specify (parameters): prior over class labels how each feature depends on the class 36

37
Slide from Dan Klein 37 Example:

38
Slide from Dan Klein 38

39
Slide from Dan Klein 39

40
Percentage of documents in training set labeled as spam/ham Slide from Dan Klein 40

41
In the documents labeled as spam, occurrence percentage of each word (e.g. # times “the” occurred/# total words). Slide from Dan Klein 41

42
In the documents labeled as ham, occurrence percentage of each word (e.g. # times “the” occurred/# total words). Slide from Dan Klein 42

43
Classification The class that maximizes: 43

44
Classification In practice 44

45
Classification In practice – Multiplying lots of small probabilities can result in floating point underflow 45

46
Classification In practice – Multiplying lots of small probabilities can result in floating point underflow – Since log(xy) = log(x) + log(y), we can sum log probabilities instead of multiplying probabilities. 46

47
Classification In practice – Multiplying lots of small probabilities can result in floating point underflow – Since log(xy) = log(x) + log(y), we can sum log probabilities instead of multiplying probabilities. – Since log is a monotonic function, the class with the highest score does not change. 47

48
Classification In practice – Multiplying lots of small probabilities can result in floating point underflow – Since log(xy) = log(x) + log(y), we can sum log probabilities instead of multiplying probabilities. – Since log is a monotonic function, the class with the highest score does not change. – So, what we usually compute in practice is: 48

49
Naïve Bayes on images 49

50
Naïve Bayes C – Class F - Features We only specify (parameters): prior over class labels how each feature depends on the class 50

51
Naive Bayes Parameters Problem: Categorize images as one of k object classes using Naïve Bayes classifier: – Classes: object categories (face, car, bicycle, etc) – Features – Images represented as a histogram of visual words. are visual words. treated as uniform. learned from training data – images labeled with category. Probability of a visual word given an image category. 51

52
52 Multi-class classifier – Naïve Bayes (1) Let V = {v i }, i = 1,…,N, be a visual vocabulary, in which each v i represents a visual word (cluster centers) from the feature space. A set of labeled images I = {I i }. Denote C j to represent our Classes, where j = 1,..,M N(t,i) = number of times v i occurs in image I i Compute P(C j |I i ): Slide credit: Yun-hsueh Liu

53
53 Multi-class Classifier – Naïve Bayes (2) Goal - Find maximum probability class C j : In order to avoid zero probability, use Laplace smoothing: Slide credit: Yun-hsueh Liu

54
Results

55
55

56
Results 56

57
Results 57 Results on Dataset 2

58
Results 58

59
Results 59

60
Results 60

61
Thoughts? Pros? Cons?

62
Related BoF models pLSA, LDA, … 62

63
pLSA 63 word topicdocument

64
pLSA 64

65
Marginalizing over topics determines the conditional probability: Joint Probability: 65

66
Fitting the model Need to: Determine the topic vectors common to all documents. Determine the mixture components specific to each document. Goal: a model that gives high probability to the words that appear in the corpus. Maximum likelihood estimation of the parameters is obtained by maximizing the objective function: 66

67
pLSA on images 67

68
Discovering objects and their location in images Josef Sivic, Bryan C. Russell, Alexei A. Efros, Andrew Zisserman, William T. Freeman Documents – Images Words – visual words (vector quantized SIFT descriptors) Topics – object categories Images are modeled as a mixture of topics (objects). 68

69
Goals They investigate three areas: – (i) topic discovery, where categories are discovered by pLSA clustering on all available images. – (ii) classification of unseen images, where topics corresponding to object categories are learnt on one set of images, and then used to determine the object categories present in another set. – (iii) object detection, where you want to determine the location and approximate segmentation of object(s) in each image. 69

70
(i) Topic Discovery Most likely words for 4 learnt topics (face, motorbike, airplane, car) 70

71
(ii) Image Classification Confusion table for unseen test images against pLSA trained on images containing four object categories, but no background images. 71

72
(ii) Image Classification Confusion table for unseen test images against pLSA trained on images containing four object categories, and background images. Performance is not quite as good. 72

73
(iii) Topic Segmentation 73

74
(iii) Topic Segmentation 74

75
(iii) Topic Segmentation 75

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google