06 learning and inference bobedits - penn state college …€¦ · · 2013-02-19if you want to...
TRANSCRIPT
![Page 1: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/1.jpg)
Computervision:models,learningandinference
Chapter6LearningandInferenceinVision
![Page 2: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/2.jpg)
Outline
22Computervision:models,learningandinference.©2011SimonJ.D.Prince
• Computervisionmodels– Discriminativevsgenerative
• Workedexample1:Regression
• Workedexample2:Classification
• Whichtypeshouldwechoose?
• Applications
![Page 3: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/3.jpg)
ComputerVisionInference
• Observemeasureddata,x• Drawinferencesfromitaboutstateof“world”,w
Examples:
– Observeadjacentframesinvideosequence– Infercameramotion
– Observeimageofface– Inferidentity
– Observeimagesfromtwodisplacedcameras– Infer3dstructureofscene
3Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 4: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/4.jpg)
Regressionvs.Classification
• Observemeasureddata,x
• Drawinferencesfromitaboutworld,w
Whentheworldstatewiscontinuouswe’llcallthisregression
4Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 5: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/5.jpg)
RegressionExamplePosefromImageSilhouette
5Computervision:models,learningandinference.©2011SimonJ.D.Prince
inferjointangles(continuousquantities)
givenmeasuredsilhouetteandageometricbodymodel
![Page 6: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/6.jpg)
RegressionExamplePosefromImage+Depth
6
infer3Djointpositions
givencolorimageandregistereddepthimage(andageometricbodymodel)
MicrosoftKinectSensor
![Page 7: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/7.jpg)
RegressionExampleHeadposeestimation
7Computervision:models,learningandinference.©2011SimonJ.D.Prince
inferrelativeorientationangleofthehead
givenmeasuredimagefeatures
![Page 8: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/8.jpg)
Regressionvs.Classification
• Observemeasureddata,x
• Drawinferencesfromitaboutworld,w
Whentheworldstatewiscontinuouswe’llcallthisregression
Whentheworldstatewisdiscretewecallthisclassification
8Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 9: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/9.jpg)
ClassificationExampleFaceDetection
9Computervision:models,learningandinference.©2011SimonJ.D.Prince
yesornoresult:isthereafaceintheimage?
ifyouwanttoknowwherethefaceis,orcountmultiplefaces,runtheclassifieroveraslidingwindowofimagepatches
![Page 10: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/10.jpg)
ClassificationExample:PedestrianDetection
10Computervision:models,learningandinference.©2011SimonJ.D.Prince
sameideaasfacedetection.HoGfeaturedetectorbyDalaalandTriggsismostcommonimplementation.
![Page 11: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/11.jpg)
ClassificationExampleFaceRecognition
11Computervision:models,learningandinference.©2011SimonJ.D.Prince
amulti‐classdecision,butcanbeturnedintoasetofbinary“1‐vs‐All”classificationdecisions:
personAvseveryoneelsepersonBvseveryoneelsepersonCvseveryoneelse...
![Page 12: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/12.jpg)
ClassificationExampleSemanticSegmentation
12Computervision:models,learningandinference.©2011SimonJ.D.Prince
assignsemanticlabeltoeachpixelbycombiningseveral1‐vs‐Allbinaryclassifiers
![Page 13: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/13.jpg)
Ambiguityofvisualworld
• Unfortunatelyvisualmeasurementsmaybecompatiblewithmorethanoneworldstatew– Measurementprocessisnoisy– Inherentambiguityinvisualdata
• Conclusion:thebestwecandoiscomputeaprobabilitydistributionPr(w|x)overpossiblestatesofworld
13Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 14: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/14.jpg)
Refinedgoalofcomputervision
• Takeobservationsx• ReturnprobabilitydistributionPr(w|x)overpossibleworldscompatiblewithdata
(notalwaystractable–mighthavetosettleforanapproximationtothisdistribution,samplesfromit,orthebest(MAP)solutionforw)
14Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 15: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/15.jpg)
Componentsofsolution
Weneed
• Amodelthatmathematicallyrelatesthevisualdataxtotheworldstatew.Modelspecifiesfamilyofrelationships,particularrelationshipdependsonparametersθ
• Alearningalgorithm:fitsparametersθfrompairedtrainingexamplesxi,wi
• Aninferencealgorithm:usesmodeltoreturnPr(w|x)givennewobserveddatax.
15Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 16: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/16.jpg)
TypesofModel
Themodelmathematicallyrelatesthevisualdataxtotheworldstatew.Twomaincategoriesofmodel
1. ModelcontingencyoftheworldonthedataPr(w|x) 2. ModelcontingencyofdataonworldPr(x|w)
16Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 17: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/17.jpg)
Generativevs.Discriminative
1. ModelcontingencyoftheworldondataPr(w|x)(DISCRIMINATIVEMODEL)
2.ModelcontingencyofdataonworldPr(x|w)(GENERATIVEMODELS)
17Computervision:models,learningandinference.©2011SimonJ.D.Prince
called“Generative”becausewhenwedrawsamplesfromthemodel,weGENERATEnewdata
![Page 18: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/18.jpg)
Type1:ModelPr(w|x)‐Discriminative
HowtomodelPr(w|x)?
1. ChooseanappropriateformforPr(w)2. Makeparametersafunctionofx
3. Functiontakesparametersθthatdefineitsshape
Learningalgorithm:learnparametersθfromtrainingdatax,w
Inferencealgorithm:justevaluatePr(w|x)
18Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 19: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/19.jpg)
Type2:Pr(x|w)‐Generative
HowtomodelPr(x|w)?
1. ChooseanappropriateformforPr(x)2. Makeparametersafunctionofw
3. Functiontakesparametersθthatdefineitsshape
Learningalgorithm:learnparametersθfromtrainingdatax,w
Inferencealgorithm:DefinepriorPr(w)andthencomputePr(w|x)usingBayes’rule
19Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 20: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/20.jpg)
Summary
Twodifferenttypesofmodeldependonthequantityofinterest:1. Pr(w|x)Discriminative2. Pr(w|x)Generative
InferenceindiscriminativemodelseasyaswedirectlymodelposteriorPr(w|x).GenerativemodelsrequiremorecomplexinferenceprocessusingBayes’rule
20Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 21: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/21.jpg)
Outline
2121Computervision:models,learningandinference.©2011SimonJ.D.Prince
• Computervisionmodels– Discriminativevsgenerative
• Workedexample1:Regression
• Workedexample2:Classification
• Whichtypeshouldwechoose?
• Applications
![Page 22: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/22.jpg)
Workedexample1:Regression
Considersimplecasewhere
• wemakeaunivariatecontinuousmeasurementx• usethistopredictaunivariatecontinuousstatew
(recall,whenworldstateiscontinuouswecallourinferencingprocedure“regression”)
22Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 23: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/23.jpg)
SampleRegressionApplication
rownumber
halfhe
ightofp
ersoninpixels
Example:learningboundingboxheightdistributionasafunctionofimagerow
mean
stddev
GeandCollins,CVPR2009“MarkedPointProcessesforCrowdCounting”
X(data)
W(“world”)
![Page 24: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/24.jpg)
Type1:ModelPr(w|x)‐Discriminative
HowtomodelPr(w|x)?
1. ChooseanappropriateformforPr(w)2. Makeparametersafunctionofx
3. Functiontakesparametersθthatdefineitsshape
Learningalgorithm:learnparametersθfromtrainingdatax,w
Inferencealgorithm:justevaluatePr(w|x)
24Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 25: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/25.jpg)
Type1:ModelPr(w|x)‐Discriminative
HowtomodelPr(w|x)?
1. ChooseanappropriateformforPr(w)2. Makeparametersafunctionofx
3. Functiontakesparametersθthatdefineitsshape
25Computervision:models,learningandinference.©2011SimonJ.D.Prince
1. Choosenormaldistributionoverw2. Makemeanµalinearfunctionofx
Letvariancebeaconstant
3. Modelparametersareφ0,φ1,σ2.
note:Thisisalinearregressionmodel.
![Page 26: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/26.jpg)
Parameters arey‐offset,slopeandvariance
26Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 27: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/27.jpg)
Learningalgorithm:learnθfromtrainingpairs(xi,wi).E.g.MAP
27Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 28: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/28.jpg)
Inferencealgorithm:justevaluatePr(w|x)fornewdatax
28Computervision:models,learningandinference.©2011SimonJ.D.Prince
note:thisgivesusawholenormaldistributionoverw,butwecouldthenusethemeantomakeaprediction..
![Page 29: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/29.jpg)
Type2:Pr(x|w)‐Generative
HowtomodelPr(x|w)?
1. ChooseanappropriateformforPr(x)
2. Makeparametersafunctionofw3. Functiontakesparametersθthatdefineitsshape
Learningalgorithm:learnparametersθfromtrainingdatax,w
Inferencealgorithm:DefinepriorPr(w)andcomputePr(w|x)usingBayes’rule
29Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 30: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/30.jpg)
Type2:Pr(x|w)‐Generative
HowtomodelPr(x|w)?
1. ChooseanappropriateformforPr(x)
2. Makeparametersafunctionofw3. Functiontakesparametersθthatdefineitsshape
1. Choosenormaldistributionoverx2. Makemeanµlinearfunctionofw
(varianceconstant)
3. Parameterareφ0,φ1,σ2.
30Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 31: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/31.jpg)
Learningalgorithm:learnθfromtrainingpairs(xi,wi).
31Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 32: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/32.jpg)
Pr(x|w)xPr(w)=Pr(x,w)jointprobability
32Computervision:models,learningandinference.©2011SimonJ.D.Prince
canalsolearnpriordistributionfromthewicomponentsofthetrainingdatapairs,orspecifyinsomeotherway
![Page 33: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/33.jpg)
Inferencealgorithm:computePr(w|x)usingBayesrule
33Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 34: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/34.jpg)
InterestingObservation
34Computervision:models,learningandinference.©2011SimonJ.D.Prince
Inthisexample,bothgenerativeanddiscriminativemodelsleadtothesameposteriornormaldistributionp(w|x)ifMLEisusedtoestimatemodelparameters.
Thisisdueto:*bothxandwbeingcontinuous*theyarerelatedbyalinearmodel*normaldistributionsweretorepresentalluncertainties.
MAPestimationwouldhaveledtodifferencesinthegenerativeanddiscriminativeresultsbecausewewouldplacepriorsontheparameters(e.g.φ0,φ1,σ2)andtheparametershavedifferentmeaningsinthetwomodels.
![Page 35: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/35.jpg)
Outline
3535Computervision:models,learningandinference.©2011SimonJ.D.Prince
• Computervisionmodels– Discriminativevsgenerative
• Workedexample1:Regression
• Workedexample2:Classification
• Whichtypeshouldwechoose?
• Applications
![Page 36: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/36.jpg)
Workedexample2:Classification
Considersimplecasewhere
• wemakeaunivariatecontinuousmeasurementx• usethistopredictadiscretebinaryworldw
(recall:wearecallinginference“classification”whentheworldstateisdiscrete)
36Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 37: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/37.jpg)
ClassificationExample:SkinDetection
3737Computervision:models,learningandinference.©2011SimonJ.D.Prince
redchannelhistogram
skinnonskininputRGBimage
classifyeachpixelasskinvsnotskinofflinelearningfromlabeled
trainingdata
+
![Page 38: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/38.jpg)
Type1:ModelPr(w|x)‐Discriminative
HowtomodelPr(w|x)?
– ChooseanappropriateformforPr(w)
– Makeparametersafunctionofx– Functiontakesparametersθthatdefineitsshape
Learningalgorithm:learnparametersθfromtrainingdatax,w
Inferencealgorithm:justevaluatePr(w|x)
38Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 39: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/39.jpg)
Type1:ModelPr(w|x)‐DiscriminativeHowtomodelPr(w|x)?
1. ChooseanappropriateformforPr(w)
2. Makeparametersafunctionofx3. Functiontakesparametersθthatdefineitsshape
39
Computervision:models,learningandinference.©2011SimonJ.D.Prince
1. ChooseBernoullidist.forPr(w)2. Makeparameterλafunctionofx
3. Functiontakesparametersφ0andφ1
note:Thismodeliscalledlogisticregression(eventhoughwearedoingclassificationherenotregression)
![Page 40: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/40.jpg)
Background:Logisticor“sig”Function
40
t
P(t)
Mapsrealnumberlineintorange[0,1]
![Page 41: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/41.jpg)
Learnthetwomodelparametersfromtrainingpairs(xi,wi)bystandardmethods(ML,MAP,Bayesian)
Inference:JustevaluatePr(w|x)
41
Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 42: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/42.jpg)
Type2:Pr(x|w)‐Generative
HowtomodelPr(x|w)?
1. ChooseanappropriateformforPr(x)
2. Makeparametersafunctionofw3. Functiontakesparametersθthatdefineitsshape
Learningalgorithm:learnparametersθfromtrainingdatax,w
Inferencealgorithm:DefinepriorPr(w)andthencomputePr(w|x)usingBayes’rule
42Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 43: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/43.jpg)
Type2:Pr(x|w)‐Generative
HowtomodelPr(x|w)?
1. ChooseanappropriateformforPr(x)
2. Makeparametersafunctionofw3. Functiontakesparametersθthatdefineitsshape
1. ChooseaGaussiandistributionforPr(x)
2. Makeparametersafunctionofdiscretebinaryw
3. Functiontakesparametersµ0, µ1, σ2
0, σ21thatdefineitsshape
43Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 44: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/44.jpg)
44Computervision:models,learningandinference.©2011SimonJ.D.Prince
Learnmodelparametersµ0, µ1, σ20, σ2
1fromtrainingdata
thisisreallytwodifferentnormaldistributions,oneforP(x|w=0)andoneforP(x|w=1).
![Page 45: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/45.jpg)
45Computervision:models,learningandinference.©2011SimonJ.D.Prince
Inferencealgorithm:DefinepriorPr(w)andthencomputePr(w|x)usingBayes’rule
likelihood
*
prior
posterior
![Page 46: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/46.jpg)
46Computervision:models,learningandinference.©2011SimonJ.D.Prince
ComparingPosteriorsdiscriminative generative
Thistimetheposteriorsarenotequivalent.Thisispartlyduetothe“asymmetry”betweenworldstate(discretedata)andmeasurements(continuousdata).Also,theshapesofdiscriminativeposteriorstendbydefinitiontobesimplerthangenerativeones.
![Page 47: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/47.jpg)
Outline
4747Computervision:models,learningandinference.©2011SimonJ.D.Prince
• Computervisionmodels– Discriminativevsgenerative
• Workedexample1:Regression
• Workedexample2:Classification
• Whichtypeofmodelshouldwechoose?
• Applications
![Page 48: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/48.jpg)
Whichtypeofmodeltouse?1. Generativemethodsmodeldata–costlyand
manyaspectsofdatamayhavenoinfluenceonworldstate
48Computervision:models,learningandinference.©2011SimonJ.D.Prince
BayesRule
mightbesimplertodirectlymodeltheposterior
needlotsofdatatoaccuratelymodelcomplicatedmultimodallikelihoodfunctions
![Page 49: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/49.jpg)
Whichtypeofmodeltouse?
2. Inferencetendstobesimplerandfasterwhenusingdiscriminativemodels
3. Datareallyisgeneratedfromtheworld–generativemodelingmatchesthis
4. Ifmissingdata,thengenerativepreferred
5. Generativeallowsimpositionofpriorknowledgespecifiedbyuser
49Computervision:models,learningandinference.©2011SimonJ.D.Prince
![Page 50: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/50.jpg)
Conclusion
50Computervision:models,learningandinference.©2011SimonJ.D.Prince
• Todocomputervisionwebuildamodelrelatingtheimagedataxtotheworldstatethatwewishtoestimatew
• Twotypesofmodel• ModelPr(w|x)‐‐discriminative• ModelPr(w|x)–generative
![Page 51: 06 Learning And Inference BobEdits - Penn State College …€¦ · · 2013-02-19if you want to know where the face is, or count multiple faces, run the classifier ... Background:](https://reader031.vdocuments.site/reader031/viewer/2022022508/5ace91cb7f8b9ae2138b842d/html5/thumbnails/51.jpg)
FuturePlan
• Seentwotypesofmodel
– Probabilitydensityfunction– Linearregression– Logisticregression
• Nextthreechaptersconcernthesemodels
5151Computervision:models,learningandinference.©2011SimonJ.D.Prince