MeanShiftTheoryandApplicationsYaronUkrainitz&BernardSarelAgenda•MeanShiftTheory•WhatisMeanShift?•DensityEstimationMethods•DerivingtheMeanShift•Meanshiftproperties•Applications•Clustering•DiscontinuityPreservingSmoothing•ObjectContourDetection•Segmentation•ObjectTrackingMeanShiftTheoryIntuitiveDescriptionDistributionofidenticalbilliardballsRegionofinterestCenterofmassMeanShiftvectorObjective:FindthedensestregionIntuitiveDescriptionDistributionofidenticalbilliardballsRegionofinterestCenterofmassMeanShiftvectorObjective:FindthedensestregionIntuitiveDescriptionDistributionofidenticalbilliardballsRegionofinterestCenterofmassMeanShiftvectorObjective:FindthedensestregionIntuitiveDescriptionDistributionofidenticalbilliardballsRegionofinterestCenterofmassMeanShiftvectorObjective:FindthedensestregionIntuitiveDescriptionDistributionofidenticalbilliardballsRegionofinterestCenterofmassMeanShiftvectorObjective:FindthedensestregionIntuitiveDescriptionDistributionofidenticalbilliardballsRegionofinterestCenterofmassMeanShiftvectorObjective:FindthedensestregionIntuitiveDescriptionDistributionofidenticalbilliardballsRegionofinterestCenterofmassObjective:FindthedensestregionWhatisMeanShift?Non-parametricDensityEstimationNon-parametricDensityGRADIENTEstimation(MeanShift)DataDiscretePDFRepresentationPDFAnalysisPDFinfeaturespace•Colorspace•Scalespace•Actuallyanyfeaturespaceyoucanconceive•…Atoolfor:Findingmodesinasetofdatasamples,manifestinganunderlyingprobabilitydensityfunction(PDF)inRNNon-ParametricDensityEstimationAssumption:ThedatapointsaresampledfromanunderlyingPDFAssumedUnderlyingPDFRealDataSamplesDatapointdensityimpliesPDFvalue!AssumedUnderlyingPDFRealDataSamplesNon-ParametricDensityEstimationAssumedUnderlyingPDFRealDataSamples?Non-ParametricDensityEstimationParametricDensityEstimationAssumption:ThedatapointsaresampledfromanunderlyingPDFAssumedUnderlyingPDF22()2iPDF()=iiicex-μxEstimateRealDataSamplesKernelDensityEstimationParzenWindows-FunctionForms11()()niiPKnxx-xAfunctionofsomefinitenumberofdatapointsx1…xnDataInpracticeoneusestheforms:1()()diiKckxxor()KckxxSamefunctiononeachdimensionFunctionofvectorlengthonlyKernelDensityEstimationVariousKernels11()()niiPKnxx-xAfunctionofsomefinitenumberofdatapointsx1…xnExamples:•EpanechnikovKernel•UniformKernel•NormalKernel211()0otherwiseEcKxxx1()0otherwiseUcKxx21()exp2NKcxxDataKernelDensityEstimationGradient11()()niiPKnxx-xGiveupestimatingthePDF!EstimateONLYthegradient2()iiKckhx-xx-xUsingtheKernelform:Weget:1111()niinniiiniiiigccPkgnngxxxSizeofwindowg()()kxxKernelDensityEstimationGradient1111()niinniiiniiiigccPkgnngxxxComputingTheMeanShiftg()()kxx1111()niinniiiniiiigccPkgnngxxxComputingTheMeanShiftYetanotherKerneldensityestimation!SimpleMeanShiftprocedure:•Computemeanshiftvector•TranslatetheKernelwindowbym(x)2121()niiiniighghx-xxmxxx-xg()()kxxMeanShiftModeDetectionUpdatedMeanShiftProcedure:•FindallmodesusingtheSimpleMeanShiftProcedure•Prunemodesbyperturbingthem(findsaddlepointsandplateaus)•Prunenearby–takehighestmodeinthewindowWhathappensifwereachasaddlepoint?PerturbthemodepositionandcheckifwereturnbackAdaptiveGradientAscentMeanShiftProperties•Automaticconvergencespeed–themeanshiftvectorsizedependsonthegradientitself.•Nearmaxima,thestepsaresmallandrefined•Convergenceisguaranteedforinfinitesimalstepsonlyinfinitelyconvergent,(thereforesetalowerbound)•ForUniformKernel(),convergenceisachievedinafinitenumberofsteps•NormalKernel()exhibitsasmoothtrajectory,butisslowerthanUniformKernel().RealModalityAnalysisTessellatethespacewithwindowsRuntheprocedureinparallelRealModalityAnalysisThebluedatapointsweretraversedbythewindowstowardsthemodeRealModalityAnalysisAnexampleWindowtrackssignifythesteepestascentdirectionsMeanShiftStrengths&WeaknessesStrengths:•Applicationindependenttool•Suitableforrealdataanalysis•Doesnotassumeanypriorshape(e.g.elliptical)ondataclusters•Canhandlearbitraryfeaturespaces•OnlyONEparametertochoose•h(windowsize)hasaphysicalmeaning,unlikeK-MeansWeaknesses:•Thewindowsize(bandwidthselection)isnottrivial•Inappropriatewindowsizecancausemodestobemerged,orgenerateadditional“shallow”modesUseadaptivewindowsizeMeanShiftApplicationsClusteringAttractionbasin:theregionforwhichalltrajectoriesleadtothesamemodeCluster:AlldatapointsintheattractionbasinofamodeMeanShift:ArobustApproachTowardFeatureSpaceAnalysis,byComaniciu,MeerClusteringSyntheticExamplesSimpleModalStructuresComplexModalStructuresClusteringRealExampleInitialwindowcentersModesfoundModesafterpruningFinalclustersFeaturespace:L*u*vrepresentationClusteringRealExampleL*u*vspacerepresentationClusteringRealExampleNotalltrajectoriesintheattractionbasinreachthesamemode2D(L*u)spacerepresentationFinalclustersDiscontinuityPreservingSmoothingFeaturespace:Jointdomain=spatialcoordinates+colorspace()srsrsrKCkkhhxxxMeaning:treattheimageasdat