object detec on
play

Object Detec)on Ali Farhadi CSE 576 We have talked - PowerPoint PPT Presentation

Object Detec)on Ali Farhadi CSE 576 We have talked about Nearest Neighbor Nave Bayes Logis)c Regression Boos)ng We saw face


  1. Object ¡Detec)on ¡ Ali ¡Farhadi ¡ CSE ¡576 ¡

  2. We ¡have ¡talked ¡about ¡ • Nearest ¡Neighbor ¡ ¡ • Naïve ¡Bayes ¡ • Logis)c ¡Regression ¡ • Boos)ng ¡ ¡ • We ¡saw ¡face ¡detec)on ¡

  3. Support ¡Vector ¡Machines ¡

  4. Linear ¡classifiers ¡– ¡Which ¡line ¡is ¡beMer? ¡ w . ¡= ¡ ∑ j ¡w (j) ¡x (j) ¡ Data ¡ Example ¡i ¡

  5. Pick ¡the ¡one ¡with ¡the ¡largest ¡margin! ¡ w . x ¡+ ¡b ¡>> ¡0 ¡ ¡ w . x ¡+ ¡b ¡> ¡0 ¡ ¡ w . x ¡+ ¡b ¡= ¡0 ¡ w . x ¡+ ¡b ¡< ¡0 ¡ ¡ w . x ¡+ ¡b ¡<< ¡0 ¡ ¡ Margin: ¡ measures ¡height ¡ of ¡w.x+b ¡plane ¡at ¡each ¡ point, ¡increases ¡with ¡ distance ¡ γ γ j = ( w.x j + b ) y j γ ¡ γ ¡ Max ¡Margin: ¡two ¡equivalent ¡ forms ¡ ¡ γ ¡ max w,b min γ j (1) ¡ j max γ ,w,b γ (2) ¡ w . x ¡= ¡ ∑ j ¡w (j) ¡x (j) ¡ ∀ j ( w.x j + b ) y j > γ

  6. How ¡many ¡possible ¡solu)ons? ¡ max γ ,w,b γ w . x ¡+ ¡b ¡= ¡0 ¡ ∀ j ( w.x j + b ) y j > γ Any ¡other ¡ways ¡of ¡wri)ng ¡the ¡ same ¡dividing ¡line? ¡ • w.x ¡+ ¡b ¡= ¡0 ¡ • 2 w.x ¡+ ¡2b ¡= ¡0 ¡ • 1000 w.x ¡+ ¡1000b ¡= ¡0 ¡ • …. ¡ • Any ¡constant ¡scaling ¡has ¡the ¡ same ¡intersec)on ¡with ¡z=0 ¡ plane, ¡so ¡same ¡dividing ¡line! ¡ Do ¡we ¡really ¡want ¡to ¡max ¡ γ,w,b ? ¡ ¡

  7. Review : ¡Normal ¡to ¡a ¡plane ¡ w . x ¡+ ¡b ¡= ¡0 ¡ Key ¡Terms ¡ -­‑-­‑ ¡projec)on ¡of ¡x j ¡onto ¡w ¡ -­‑-­‑ ¡unit ¡vector ¡normal ¡to ¡w ¡

  8. Idea: ¡ constrained ¡margin ¡ Generally: ¡ w . x ¡+ ¡b ¡= ¡+1 ¡ x + = x − + 2 γ w w . x ¡+ ¡b ¡= ¡0 ¡ w . x ¡+ ¡b ¡= ¡-­‑1 ¡ || w || Assume: ¡ x + ¡on ¡posi)ve ¡line, ¡x -­‑ ¡on ¡ nega)ve ¡ ¡ w.x + + b = 1 γ � ⇥ x − + 2 γ w + b = 1 w. || w || x + ¡ w.x − + b + 2 γ w.w || w || = 1 || || x -­‑ ¡ γ w.w || w || = 1 γ = || w || 1 w.w = √ w.w Final ¡result: ¡can ¡maximize ¡constrained ¡margin ¡by ¡minimizing ¡||w|| 2 !!! ¡

  9. Max ¡margin ¡using ¡canonical ¡hyperplanes ¡ w . x ¡+ ¡b ¡= ¡+1 ¡ w . x ¡+ ¡b ¡= ¡0 ¡ w . x ¡+ ¡b ¡= ¡-­‑1 ¡ γ x + ¡ x -­‑ ¡ The ¡assump)on ¡of ¡canonical ¡hyperplanes ¡ (at ¡+1 ¡and ¡-­‑1) ¡changes ¡the ¡objec)ve ¡and ¡ the ¡constraints! ¡

  10. Support ¡vector ¡machines ¡(SVMs) ¡ w . x ¡+ ¡b ¡= ¡+1 ¡ w . x ¡+ ¡b ¡= ¡0 ¡ w . x ¡+ ¡b ¡= ¡-­‑1 ¡ • Solve ¡efficiently ¡by ¡quadra)c ¡ programming ¡(QP) ¡ – Well-­‑studied ¡solu)on ¡algorithms ¡ – Not ¡simple ¡gradient ¡ascent, ¡but ¡close ¡ • Hyperplane ¡defined ¡by ¡support ¡ vectors ¡ – Could ¡use ¡them ¡as ¡a ¡lower-­‑dimension ¡ basis ¡to ¡write ¡down ¡line, ¡although ¡we ¡ haven’t ¡seen ¡how ¡yet ¡ margin ¡ 2 γ – More ¡on ¡this ¡later ¡ Non-­‑support ¡Vectors: ¡ Support ¡Vectors: ¡ • everything ¡else ¡ • data ¡points ¡on ¡the ¡ • moving ¡them ¡will ¡not ¡ canonical ¡lines ¡ change ¡w ¡

  11. What ¡if ¡the ¡data ¡is ¡not ¡linearly ¡separable? ¡ Add ¡More ¡Features!!! ¡  x (1)  . . .     x ( n )     x (1) x (2)   φ ( x ) =   x (1) x (3)       . . . What ¡about ¡overfimng? ¡   e x (1)     . . .

  12. What ¡if ¡the ¡data ¡is ¡s)ll ¡not ¡linearly ¡separable? ¡ + C #(mistakes) • First ¡Idea: ¡Jointly ¡minimize ¡ w.w ¡ and ¡number ¡of ¡training ¡mistakes ¡ – How ¡to ¡tradeoff ¡two ¡criteria? ¡ – Pick ¡ ¡C ¡on ¡development ¡/ ¡cross ¡valida)on ¡ • Tradeoff ¡#(mistakes) ¡and ¡ w.w ¡ – 0/1 ¡loss ¡ – Not ¡QP ¡anymore ¡ – Also ¡doesn’t ¡dis)nguish ¡near ¡misses ¡and ¡ really ¡bad ¡mistakes ¡ – NP ¡hard ¡to ¡find ¡op)mal ¡solu)on!!! ¡

  13. Slack ¡variables ¡– ¡Hinge ¡loss ¡ w . x ¡+ ¡b ¡= ¡+1 ¡ w . x ¡+ ¡b ¡= ¡0 ¡ + C Σ j ξ j w . x ¡+ ¡b ¡= ¡-­‑1 ¡ - ξ j ξ j ≥ 0 ξ ξ Slack ¡Penalty ¡ C > 0 : ¡ ξ • C = ∞ � ¡have ¡to ¡separate ¡the ¡data! ¡ • C =0 � ¡ignore ¡data ¡en)rely! ¡ ξ • Select ¡on ¡dev. ¡set, ¡etc. ¡ For ¡each ¡data ¡point: ¡ ¡ • If ¡margin ¡≥ ¡1, ¡don’t ¡care ¡ • If ¡margin ¡< ¡1, ¡pay ¡linear ¡penalty ¡

  14. Side ¡Note: ¡Different ¡Losses ¡ Logis)c ¡regression: ¡ Boos)ng ¡: ¡ SVM: ¡ Hinge ¡loss: ¡ 0-­‑1 ¡Loss: ¡ ξ j = (1 − f ( x i ) y i ) + All ¡our ¡new ¡losses ¡approximate ¡0/1 ¡loss! ¡ ¡

  15. What ¡about ¡mul)ple ¡classes? ¡

  16. One ¡against ¡All ¡ w + ¡ Learn ¡3 ¡classifiers: ¡ w -­‑ ¡ • + ¡vs ¡{0,-­‑}, ¡weights ¡w + ¡ • -­‑ ¡vs ¡{0,+}, ¡weights ¡w -­‑ ¡ w 0 ¡ • 0 ¡vs ¡{+,-­‑}, ¡weights ¡w 0 ¡ Output ¡for ¡x: ¡ ¡ ¡ ¡y ¡= ¡argmax i ¡w i .x ¡ Any ¡other ¡way? ¡ Any ¡problems? ¡

  17. Learn ¡1 ¡classifier: ¡Mul)class ¡SVM ¡ w + ¡ Simultaneously ¡learn ¡3 ¡ w -­‑ ¡ sets ¡of ¡weights: ¡ • How ¡do ¡we ¡ guarantee ¡the ¡ w 0 ¡ correct ¡labels? ¡ • Need ¡new ¡ constraints! ¡ For ¡j ¡possible ¡classes: ¡

  18. Learn ¡1 ¡classifier: ¡Mul)class ¡SVM ¡ Also, ¡can ¡introduce ¡slack ¡variables, ¡as ¡before: ¡

  19. What ¡if ¡the ¡data ¡is ¡not ¡linearly ¡separable? ¡ Add ¡More ¡Features!!! ¡  x (1)  . . .     x ( n )     x (1) x (2)   φ ( x ) =   x (1) x (3)       . . .   e x (1)     . . .

  20. Comparison ¡ assuming x in {0 1} Learning Objective Training Inference T T θ x θ ( 1 x ) 0 + − > ( ) 1 0 ( ) x 1 y k r log P x | y ; ∑ ∑ ∑ δ = ∧ = + ⎡ ⎤ ( ) θ P x 1 | y 1 Naïve = = ij i ij i j j where log , θ = maximize ⎢ ⎥ 1 j ( ) i j P x 1 | y 0 = = θ = j Bayes kj ( ) ⎢ ⎥ y k Kr ∑ δ = + ( ) ( ) log P y ; P x 0 | y 1 i + θ = = i ⎣ ⎦ j log i 0 θ = ( ) 0 j i P x 0 | y 0 = = j ( ( ) ) maximize log P y | x , θ θ ∑ + λ Logistic i T θ x t Gradient ascent i > Regression ( ( ) ) ( ) T where P y | x , θ 1 / 1 exp y θ x = + − i i 1 minimize θ ∑ λ ξ + Quadratic programming Linear i 2 T i θ x t > or subgradient opt. SVM T such that y θ x 1 i , 0 ≥ − ξ ∀ ξ ≥ i i i Kernelized Quadratic ( ˆ x ) y K x , 0 complicated to write ∑ α > programming i i i SVM i y Nearest i most similar features � same label Record data Neighbor ( ˆ ) where i argmin K x , x = i i

  21. Image ¡Categoriza)on ¡ Training ¡ Training Labels ¡ Training Images Image ¡ Classifier ¡ Trained ¡ Features ¡ Training ¡ Classifier ¡ Testing Prediction Image ¡ Trained ¡ Features ¡ Classifier ¡ Outdoor Test Image

  22. Example: ¡Dalal-­‑Triggs ¡pedestrian ¡ detector ¡ 1. Extract ¡fixed-­‑sized ¡(64x128 ¡pixel) ¡window ¡at ¡ each ¡posi)on ¡and ¡scale ¡ 2. Compute ¡HOG ¡(histogram ¡of ¡gradient) ¡ features ¡within ¡each ¡window ¡ 3. Score ¡the ¡window ¡with ¡a ¡linear ¡SVM ¡classifier ¡ 4. Perform ¡non-­‑maxima ¡suppression ¡to ¡remove ¡ overlapping ¡detec)ons ¡with ¡lower ¡scores ¡ Navneet ¡Dalal ¡and ¡Bill ¡Triggs, ¡Histograms ¡of ¡Oriented ¡Gradients ¡for ¡Human ¡Detec)on, ¡CVPR05 ¡

  23. Navneet ¡Dalal ¡and ¡Bill ¡Triggs, ¡Histograms ¡of ¡Oriented ¡Gradients ¡for ¡Human ¡Detec)on, ¡CVPR05 ¡ Slides ¡by ¡Pete ¡Barnum ¡

  24. • Tested ¡with ¡ – RGB ¡ Slightly ¡beMer ¡performance ¡vs. ¡grayscale ¡ – LAB ¡ – Grayscale ¡

  25. Outperforms ¡ centered ¡ diagonal ¡ uncentered ¡ cubic-­‑corrected ¡ Sobel ¡ Navneet ¡Dalal ¡and ¡Bill ¡Triggs, ¡Histograms ¡of ¡Oriented ¡Gradients ¡for ¡Human ¡Detec)on, ¡CVPR05 ¡ Slides ¡by ¡Pete ¡Barnum ¡

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