generalization globa image features
play

Generalization + Globa Image Features Various slides from previous - PowerPoint PPT Presentation

CS4501: Introduction to Computer Vision Generalization + Globa Image Features Various slides from previous courses by: D.A. Forsyth (Berkeley / UIUC), I. Kokkinos (Ecole Centrale / UCL). S. Lazebnik (UNC / UIUC), S. Seitz (MSR / Facebook), J.


  1. CS4501: Introduction to Computer Vision Generalization + Globa Image Features Various slides from previous courses by: D.A. Forsyth (Berkeley / UIUC), I. Kokkinos (Ecole Centrale / UCL). S. Lazebnik (UNC / UIUC), S. Seitz (MSR / Facebook), J. Hays (Brown / Georgia Tech), A. Berg (Stony Brook / UNC), D. Samaras (Stony Brook) . J. M. Frahm (UNC), V. Ordonez (UVA), Steve Seitz (UW).

  2. Last Class • Softmax Classifier (Linear Classifiers) • Stochastic Gradient Descent

  3. Today’s Class • Generalization / Overfitting / Regularization • Global Image Features

  4. Supervised Learning - Classification Training Data ! ) = [ ] * ) = [ ] cat ! ( = [ ] * ( = [ ] dog * ' = [ ] ! ' = [ ] cat . . . ! " = [ ] * " = [ ] bear 4

  5. Supervised Learning - Classification Training Data targets / We need to find a function that labels / inputs predictions maps x and y for any of them. ground truth ' & = [' && ' &% ' &$ ' &* ] ! & = ! : & = 1 1 ! , - = .(' , ; 1) ! % = ! : % = ' % = [' %& ' %% ' %$ ' %* ] 2 2 ' $ = [' $& ' $% ' $$ ' $* ] ! $ = ! : $ = 1 2 How do we ”learn” the parameters of this function? . We choose ones that makes the . following quantity small: . " 3 4567(! , -, ! , ) ! " = ! : " = ' " = [' "& ' "% ' "$ ' "* ] 3 1 ,9& 5

  6. Supervised Learning –Softmax Classifier Training Data targets / labels / inputs ground truth ' & = [' && ' &% ' &$ ' &* ] ! & = 1 ! % = ' % = [' %& ' %% ' %$ ' %* ] 2 ' $ = [' $& ' $% ' $$ ' $* ] ! $ = 1 . . . ! " = ' " = [' "& ' "% ' "$ ' "* ] 3 6

  7. Supervised Learning –Softmax Classifier Training Data targets / labels / predictions inputs ground truth ! , & = ' & = [' && ' &% ' &$ ' &* ] ! & = [0.85 0.10 0.05] [1 0 0] ! , % = ! % = ' % = [' %& ' %% ' %$ ' %* ] [0.20 0.70 0.10] [0 1 0] ! , $ = ' $ = [' $& ' $% ' $$ ' $* ] ! $ = [0.40 0.45 0.05] [1 0 0] . . . ! , " = ! " = [0.40 0.25 0.35] ' " = [' "& ' "% ' "$ ' "* ] [0 0 1] 7

  8. Supervised Learning –Softmax Classifier $ " = [$ "& $ "( $ ") $ "* ] ! " = ! , " = [- . - / - 0 ] [1 0 0] 1 . = 2 .& $ "& + 2 .( $ "( + 2 .) $ ") + 2 .* $ "* + 4 . 1 / = 2 /& $ "& + 2 /( $ "( + 2 /) $ ") + 2 /* $ "* + 4 / 1 0 = 2 0& $ "& + 2 0( $ "( + 2 0) $ ") + 2 0* $ "* + 4 0 . = 5 6 7 /(5 6 7 +5 6 : + 5 6 ; ) - / = 5 6 : /(5 6 7 +5 6 : + 5 6 ; ) - 0 = 5 6 ; /(5 6 7 +5 6 : + 5 6 ; ) - 8

  9. How do we find a good w and b? $ " = [$ "& $ "( $ ") $ "* ] ! " = ! , " = [- . (0, 2) - 4 (0, 2) - 5 (0, 2)] [1 0 0] We need to find w, and b that minimize the following function L: > ) > > 6 0, 2 = 7 7 −! ",9 log (! , ",9 ) = 7 −log (! , ",?@5A? ) = 7 −log - ",?@5A? (0, 2) "=& 9=& "=& "=& Why? 9

  10. Gradient Descent (GD) Problem: expensive! 7 = 0.01 4 !(#, %) = ( −log . /,01230 (#, %) Initialize w and b randomly /56 for e = 0, num_epochs do Compute: and ;!(#, %)/;% ;!(#, %)/;# Update w: # = # − 7 ;!(#, %)/;# Update b: % = % − 7 ;!(#, %)/;% // Useful to see if this is becoming smaller or not. Print: !(#, %) end 10

  11. Solution: (mini-batch) Stochastic Gradient Descent (SGD) 6 = 0.01 !(#, %) = ( −log . /,01230 (#, %) Initialize w and b randomly /∈5 for e = 0, num_epochs do B is a small for b = 0, num_batches do set of training Compute: and :!(#, %)/:% :!(#, %)/:# examples. Update w: # = # − 6 :!(#, %)/:# Update b: % = % − 6 :!(#, %)/:% // Useful to see if this is becoming smaller or not. Print: !(#, %) end end 11

  12. Source: Andrew Ng

  13. Three more things • How to compute the gradient • Regularization • Momentum updates 13

  14. SGD Gradient for the Softmax Function

  15. SGD Gradient for the Softmax Function

  16. SGD Gradient for the Softmax Function

  17. Supervised Learning –Softmax Classifier ; < " = [2 , 2 0 2 1 ] Extract features ! " = [! "% ! "' ! "( ! ") ] Run features through classifier + , = - ,% ! "% + - ,' ! "' + - ,( ! "( + - ,) ! ") + / , + 0 = - 0% ! "% + - 0' ! "' + - 0( ! "( + - 0) ! ") + / 0 + 1 = - 1% ! "% + - 1' ! "' + - 1( ! "( + - 1) ! ") + / 1 Get predictions , = 3 4 5 /(3 4 5 +3 4 8 + 3 4 9 ) 2 0 = 3 4 8 /(3 4 5 +3 4 8 + 3 4 9 ) 2 1 = 3 4 9 /(3 4 5 +3 4 8 + 3 4 9 ) 2 17

  18. Supervised Machine Learning Steps Training Training Labels Training Images Image Learned Training Features model Learned model Testing Image Prediction Features Test Image Slide credit: D. Hoiem

  19. Generalization Generalization refers to the ability to correctly classify never before • seen examples Can be controlled by turning “knobs” that affect the complexity of • the model Test set (labels unknown) Training set (labels known)

  20. Overfitting % is a polynomial of % is linear % is cubic degree 9 !"## $ is high !"## $ is low !"## $ is zero! Overfitting Underfitting High Bias High Variance

  21. Pytorch: Project Assignment 4 • http://vicenteordonez.com/vision/

  22. Supervised Machine Learning Steps Training Training Labels Training Images Image Learned Training Features model Learned model Testing Image Prediction Features Test Image Slide credit: D. Hoiem

  23. Image Features In your Project 4: Nearest Neighbors + Softmax Classifier features are: • Feature: 3072-dim vector Image: 3x32x32

  24. Image Features: Color Photo by: marielito slide by Tamara L. Berg

  25. Image Features: Color

  26. Image Features: Color However, these are all images of people but the colors in each image are very different.

  27. Image Features: HoG Paper by Navneet Dalal & Bill Triggs presented at CVPR 2005 for detecting people. Scikit-image implementation

  28. Image Features: HoG + Block Normalization Paper by Navneet Dalal & Bill Triggs presented at CVPR 2005 for detecting people. Figure from Zhuolin Jiang, Zhe Lin, Larry S. Davis, ICCV 2009 for human action recognition.

  29. Image Features: GIST The “gist” of a scene: Oliva & Torralba, 2001

  30. Image Features: GIST Oriented edge response at multiple scales (5 spatial scales, 6 Hays and Efros, edge orientations) SIGGRAPH 2007

  31. Image Features: GIST Aggregated edge responses over 4x4 windows Hays and Efros, SIGGRAPH 2007

  32. Image Features: Bag of (Visual) Words Representation slide by Fei-fei Li

  33. slide by Fei-fei Li

  34. Questions? 34

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend