伊利诺伊州立大学计算机视觉PPT第9章-FittingandRegistration-Vision_Spring2012
合集下载
计算机视觉课件课件1210v14
W代表权值的总数,Pi代表第i层的感知器数量: 当网络层数不多的时候,随着感知器单元数量的增加,权值数目是平方增加的趋势
、
4.3 前向传播与反向传播算法
随着神经网络的崛起而名声大噪的方法
前向传播算法
假设上一层结点i, j, k,…与本层的结点w有连接,结点w的计算方法就是通过上一层的i, j, k等结点以及对应的连接权值进行加权和运算, 最终结果再加上一个偏置项(图中为了简单省略了),最后通过一个非线性函数(即激活函数),如ReLU,sigmoid等函数,得到的 结果就是本层结点w的输出。最终通过逐层运算的方式,得到输出层结果。
正向传播后: 反向传播:
链式推导:
最终结果:
更新权值:
、
4.4 卷积神经网络概述
计算机视觉核心网络。
卷积神经网络概述
卷积神经网络是一种前馈神经网络,它的人工神经元可以响应一部分覆盖范围内的周围单元,对于大型图像处理有出色表现。 卷积神经网络由一个或多个卷积层和顶端的全连通层(对应经典的神经网络)组成,同时也包括关联权重和池化层。这一结构使得卷 积神经网络能够利用输入数据的二维结构,其中最早比较有名的卷积神经网络为LeNet-5。与其他深度学习结构相比,卷积神经网络在 图像和语音识别方面能够给出更好的结果。这一模型也可以使用反向传播算法进行训练。相比较其他深度、前馈神经网络,卷积神经 网络需要考量的参数更少,使之成为一种颇具吸引力的深度学习结构。
卷积神经网络架构回顾
输入层 -> [[卷积层 -> 线性整流层]*N -> 池化层?]*M -> [全连接层 -> 线性整流层]*K -> 全连接层 堆叠几个卷积和整流层,再加一个池化层,然后再用全连接层控制输出。 上述表达式中,问号符号代表0次或1次,符号N和M则代表具体的数值。通常情况下,取N >= 0 && N <= 3,M >= 0,K >= 0 && K < 3。
、
4.3 前向传播与反向传播算法
随着神经网络的崛起而名声大噪的方法
前向传播算法
假设上一层结点i, j, k,…与本层的结点w有连接,结点w的计算方法就是通过上一层的i, j, k等结点以及对应的连接权值进行加权和运算, 最终结果再加上一个偏置项(图中为了简单省略了),最后通过一个非线性函数(即激活函数),如ReLU,sigmoid等函数,得到的 结果就是本层结点w的输出。最终通过逐层运算的方式,得到输出层结果。
正向传播后: 反向传播:
链式推导:
最终结果:
更新权值:
、
4.4 卷积神经网络概述
计算机视觉核心网络。
卷积神经网络概述
卷积神经网络是一种前馈神经网络,它的人工神经元可以响应一部分覆盖范围内的周围单元,对于大型图像处理有出色表现。 卷积神经网络由一个或多个卷积层和顶端的全连通层(对应经典的神经网络)组成,同时也包括关联权重和池化层。这一结构使得卷 积神经网络能够利用输入数据的二维结构,其中最早比较有名的卷积神经网络为LeNet-5。与其他深度学习结构相比,卷积神经网络在 图像和语音识别方面能够给出更好的结果。这一模型也可以使用反向传播算法进行训练。相比较其他深度、前馈神经网络,卷积神经 网络需要考量的参数更少,使之成为一种颇具吸引力的深度学习结构。
卷积神经网络架构回顾
输入层 -> [[卷积层 -> 线性整流层]*N -> 池化层?]*M -> [全连接层 -> 线性整流层]*K -> 全连接层 堆叠几个卷积和整流层,再加一个池化层,然后再用全连接层控制输出。 上述表达式中,问号符号代表0次或1次,符号N和M则代表具体的数值。通常情况下,取N >= 0 && N <= 3,M >= 0,K >= 0 && K < 3。
《计算机视觉》PPT课件
fucntion)
精选课件ppt
11
Overview (3)
计算机视觉的图像模型基础
✓ 摄像机模型及其校准
▪ 内参数、外参数
✓ 图像特征
▪ 边缘、角点、轮廓、纹理、形状…
✓ 图像序列特征 (运动)
▪ 对应点、光流
精选课件ppt
12
Overview (4)
计算机视觉的信号处理层次
低层视觉处理
✓ 单图像:滤波/边缘检测/纹理
计算机视觉的基本的分析工具和数学模型 Signal processing approach: FFT, filtering, wavelets, … Subspace approach: PCA, LDA, ICA, … Bayesian inference approach: EM, Condensation/SIS/…, MCMC, …. Machine learning approach: SVM/Kernel machine, Boosting/Adaboost, NN/Regression, … HMM, BN/DBN, … Gibbs, MRF, …
✓ 多图像:几何/立体/从运动恢复仿射或透视结构 affine/perspective structure from motion
中层视觉处理
✓ 聚类分割/拟合线条、曲线、轮廓 clustering for segmentation, fitting line…
✓ 基于概率方法的聚类分割/拟合
✓ 跟踪 tracking
精选课件ppt
6
Tools
Intel OpenCV, IPL
✓ Camera calibration (Zhang Zhengyou’s method) ✓ Face detection (a variation of Viola’s) ✓ Motion analysis and object tracking
精选课件ppt
11
Overview (3)
计算机视觉的图像模型基础
✓ 摄像机模型及其校准
▪ 内参数、外参数
✓ 图像特征
▪ 边缘、角点、轮廓、纹理、形状…
✓ 图像序列特征 (运动)
▪ 对应点、光流
精选课件ppt
12
Overview (4)
计算机视觉的信号处理层次
低层视觉处理
✓ 单图像:滤波/边缘检测/纹理
计算机视觉的基本的分析工具和数学模型 Signal processing approach: FFT, filtering, wavelets, … Subspace approach: PCA, LDA, ICA, … Bayesian inference approach: EM, Condensation/SIS/…, MCMC, …. Machine learning approach: SVM/Kernel machine, Boosting/Adaboost, NN/Regression, … HMM, BN/DBN, … Gibbs, MRF, …
✓ 多图像:几何/立体/从运动恢复仿射或透视结构 affine/perspective structure from motion
中层视觉处理
✓ 聚类分割/拟合线条、曲线、轮廓 clustering for segmentation, fitting line…
✓ 基于概率方法的聚类分割/拟合
✓ 跟踪 tracking
精选课件ppt
6
Tools
Intel OpenCV, IPL
✓ Camera calibration (Zhang Zhengyou’s method) ✓ Face detection (a variation of Viola’s) ✓ Motion analysis and object tracking
ComputerVision计算机视觉英文实用PPT课件
• There are two ultimate goal that computer vision will realize, they can be simply described as follow:
• one is to realize the understanding of the world,in other words, it can realiz e some f un ctions of the human visual system;
第6页/共23页
Advances in computer vision research
• After nearly 50 years, research in computer vision has made considerable achievements. This makes the field to become the most active part of the AI research in the past 40 years.
• 3 T h e third purpose is to c a l c u l a t e t h e p h y s i c a l characteristics from the observation point to the object according to one or more 2D images;
• In the work of Roberts, the relationship between 3D objects and 2D imaging is introduced, and some simple methods of feature extraction are introduced.
• one is to realize the understanding of the world,in other words, it can realiz e some f un ctions of the human visual system;
第6页/共23页
Advances in computer vision research
• After nearly 50 years, research in computer vision has made considerable achievements. This makes the field to become the most active part of the AI research in the past 40 years.
• 3 T h e third purpose is to c a l c u l a t e t h e p h y s i c a l characteristics from the observation point to the object according to one or more 2D images;
• In the work of Roberts, the relationship between 3D objects and 2D imaging is introduced, and some simple methods of feature extraction are introduced.
计算机视觉PPT课件:深度学习基础
C表示 loss function,δl表示第l層的殘差, 我們就得到第l層的殘差:
c
j f net j wk kj
k 1
38/48
池化層的誤差反向傳播
39/48
池化層的的誤差反向傳播
先考慮mean-pooling:得到的卷積層應該是 4×4大小,其值分佈為(等值複製)左圖:
由於需要滿足反向傳播時各層間殘差總和不 變,所以卷積層對應每個值需要平攤:
這種方法很好的解決了Adagrad過早結束的問 題,適合處理非平穩目標,對於RNN效果很 好。
這裏未必是遞增,通過參 數來協調當前和過往。
Adam
Adam 這個名字來源於 adaptive moment estimation,自適應矩估計。
Adam本質上是帶 有動量項的 RMSprop,它利用 梯度的一階矩估計 和二階矩估計動態 調整每個參數的學 習率。
CNN池化層
• 作用:特徵融合,降維 • 無參數需要學習 • 超參數
• 尺寸(size) • 步長(step) • 計算類別
• 最大化池化(Max pooling) • 平均池化(Average pooling)
36/48
卷積神經網路(CNN)
CNN-Softmax層
• 指數歸一化函數
• 將一個實數值向量壓縮到(0, 1) • 所有元素和為1
進 行調參。 3.充分瞭解數據——如果模型是非常稀疏的,那麼優先
考慮自適應學習率的演算法。 4. 根據需求來選擇——在模型設計實驗過程中,要快速
驗證新模型的效果,可以先用Adam;在模型上線或者 結果發佈前,可以用精調的SGD進行模型的極致優化。 5. 先用小數據集進行實驗。有論文研究指出,隨機梯度 下降演算法的收斂速度和數據集的大小的關係不大。因 此 可以先用一個具有代表性的小數據集進行實驗。
c
j f net j wk kj
k 1
38/48
池化層的誤差反向傳播
39/48
池化層的的誤差反向傳播
先考慮mean-pooling:得到的卷積層應該是 4×4大小,其值分佈為(等值複製)左圖:
由於需要滿足反向傳播時各層間殘差總和不 變,所以卷積層對應每個值需要平攤:
這種方法很好的解決了Adagrad過早結束的問 題,適合處理非平穩目標,對於RNN效果很 好。
這裏未必是遞增,通過參 數來協調當前和過往。
Adam
Adam 這個名字來源於 adaptive moment estimation,自適應矩估計。
Adam本質上是帶 有動量項的 RMSprop,它利用 梯度的一階矩估計 和二階矩估計動態 調整每個參數的學 習率。
CNN池化層
• 作用:特徵融合,降維 • 無參數需要學習 • 超參數
• 尺寸(size) • 步長(step) • 計算類別
• 最大化池化(Max pooling) • 平均池化(Average pooling)
36/48
卷積神經網路(CNN)
CNN-Softmax層
• 指數歸一化函數
• 將一個實數值向量壓縮到(0, 1) • 所有元素和為1
進 行調參。 3.充分瞭解數據——如果模型是非常稀疏的,那麼優先
考慮自適應學習率的演算法。 4. 根據需求來選擇——在模型設計實驗過程中,要快速
驗證新模型的效果,可以先用Adam;在模型上線或者 結果發佈前,可以用精調的SGD進行模型的極致優化。 5. 先用小數據集進行實驗。有論文研究指出,隨機梯度 下降演算法的收斂速度和數據集的大小的關係不大。因 此 可以先用一個具有代表性的小數據集進行實驗。
计算机视觉ppt课件
19
(2) 路径
和 路48路路[径i径径0 :,从::像 像互j像0 素素为]素与与邻[,i其其点1,近近j1 邻邻][到i像像 0像,,素 素素j,是是0[]i48n 连连,通通jn 关关]的系系一[[个iikn像,, jj素kn]序] 列:[ik1, jk1]
,
(3)前景
图像中值为1的全部像素的集合,用S表示.
5,5,1,5,4
18
3.5 二值图像算法 3.5.1 定义 (1)近邻:
4邻点(4-neighbors):有公共边关系的两个像素. 8邻点(8-neighbors):两个像素至少共享一个顶角 4连通(4-connected):一个像素与其4邻点的关系 8连通(4-connected):一个像素与其8邻点的关系
第 3章
二值图象分析 Binary Image Analysis
1
3.1 二值图象
二值图像例
2
(2) 二值图象的特点 a. 二值图像只有两个灰度级,其中物体像素值为1,背景像素值为0; b. 图象中许多的特征如边缘、轮廓可以用二值图像表示; c.二值图像处理的算法简单,所需的内存小,计算速度快; d.二值视觉系统技术可用于灰度图像视觉系统 。
3
(3)二值图象的获取 a. 硬件实现
敏感元二值输出或逻辑输出。敏感元模拟值 输出,通过硬件电路二值 化。 b. 软件实现
灰度图象可以通过阈值(threshold)分割进行二值化处理。
4
(4)灰度图象的二值化
图象二值化 设一幅灰度图像中物体的灰度分布在某一区间内,经过阈值运算后的图
像为二值图像。
7
(1) 尺寸和位置 一幅二值图像区域的面积(或零阶矩)由下式给出:
8
物体的中心位置:
(2) 路径
和 路48路路[径i径径0 :,从::像 像互j像0 素素为]素与与邻[,i其其点1,近近j1 邻邻][到i像像 0像,,素 素素j,是是0[]i48n 连连,通通jn 关关]的系系一[[个iikn像,, jj素kn]序] 列:[ik1, jk1]
,
(3)前景
图像中值为1的全部像素的集合,用S表示.
5,5,1,5,4
18
3.5 二值图像算法 3.5.1 定义 (1)近邻:
4邻点(4-neighbors):有公共边关系的两个像素. 8邻点(8-neighbors):两个像素至少共享一个顶角 4连通(4-connected):一个像素与其4邻点的关系 8连通(4-connected):一个像素与其8邻点的关系
第 3章
二值图象分析 Binary Image Analysis
1
3.1 二值图象
二值图像例
2
(2) 二值图象的特点 a. 二值图像只有两个灰度级,其中物体像素值为1,背景像素值为0; b. 图象中许多的特征如边缘、轮廓可以用二值图像表示; c.二值图像处理的算法简单,所需的内存小,计算速度快; d.二值视觉系统技术可用于灰度图像视觉系统 。
3
(3)二值图象的获取 a. 硬件实现
敏感元二值输出或逻辑输出。敏感元模拟值 输出,通过硬件电路二值 化。 b. 软件实现
灰度图象可以通过阈值(threshold)分割进行二值化处理。
4
(4)灰度图象的二值化
图象二值化 设一幅灰度图像中物体的灰度分布在某一区间内,经过阈值运算后的图
像为二值图像。
7
(1) 尺寸和位置 一幅二值图像区域的面积(或零阶矩)由下式给出:
8
物体的中心位置:
伊利诺伊州立大学计算机视觉PPT...
Source: K. Grauman
Median filter
Salt-and-pepper noise
Median filtered
• MATLAB: medfilt2(image, [h w])
Source: M. Hebert
Median vs. Gaussian filtering
3x3
pixels) • Max or min filter (ordfilt2) • Bilateral filtering (weight by spatial distance and intensity
difference)
Bilateral filtering
Image: /?p=1455
• Criteria for a good edge detector:
– Good detection: the optimal detector should find all real edges, ignoring noise or other artifacts
– Good localization • the edges detected must be as close as possible to the true edges • the detector must return one point only for each true edge point
• Canny has shown that the first derivative of the Gaussian closely approximates the operator that optimizes the product of signal-to-noise ratio and localization
Median filter
Salt-and-pepper noise
Median filtered
• MATLAB: medfilt2(image, [h w])
Source: M. Hebert
Median vs. Gaussian filtering
3x3
pixels) • Max or min filter (ordfilt2) • Bilateral filtering (weight by spatial distance and intensity
difference)
Bilateral filtering
Image: /?p=1455
• Criteria for a good edge detector:
– Good detection: the optimal detector should find all real edges, ignoring noise or other artifacts
– Good localization • the edges detected must be as close as possible to the true edges • the detector must return one point only for each true edge point
• Canny has shown that the first derivative of the Gaussian closely approximates the operator that optimizes the product of signal-to-noise ratio and localization
计算机视觉课件
Note: foreground and background must use different connectivities.
Hole or not?
but it does
0 1 0
(1) Boundary: boundary of S is a set of pixels in S
jB[i, j]
x i j
B[i, j]
ij
iB[i, j]
y i j
B[i, j]
ij
(3)Orientation:
(4) The orientation of binary image component is defined
by a straight line that the distance sum from all the pixels to the line is minimized,i.e.,
2 rij2B[i,j]min ij
(5) wherrie, j is the distance from pixel [ i, j ]to the line.
(6) Let the line in polar coordinates be:
xc os ys in
(7)
Thenr : x co y s si n
called maximum axis and minimum axis of the image component.
Maximum axis
Minimum axis
(4) Foreground / Background :
Foreground: the set f all “1” pixels in an image.
Hole or not?
but it does
0 1 0
(1) Boundary: boundary of S is a set of pixels in S
jB[i, j]
x i j
B[i, j]
ij
iB[i, j]
y i j
B[i, j]
ij
(3)Orientation:
(4) The orientation of binary image component is defined
by a straight line that the distance sum from all the pixels to the line is minimized,i.e.,
2 rij2B[i,j]min ij
(5) wherrie, j is the distance from pixel [ i, j ]to the line.
(6) Let the line in polar coordinates be:
xc os ys in
(7)
Thenr : x co y s si n
called maximum axis and minimum axis of the image component.
Maximum axis
Minimum axis
(4) Foreground / Background :
Foreground: the set f all “1” pixels in an image.
计算机视觉课件笔记
3 视网膜:将光信号转变成电脉冲信号 1 光感受体:包括视锥细胞和视杆细胞。作 用是将光信号转换为电脉冲信号。 视锥细胞:亮视觉 视杆细胞:暗视觉 2 中间层: 构成视觉信息传输的直接和间接 通道。 3 神经节细胞层:视觉信息在这里形成纤维 束,离源自人眼。光线 ---------
4 视觉通路概述: 视网膜 视觉传导通路:光线—角膜—瞳孔—晶状体—玻璃体—视 网膜色素上皮细胞层 — 视锥视杆细胞层 — 双极神经原 — 节细胞—视神经—视交叉—视束—外侧膝状体—视辐射— 大脑半球枕叶皮质。 视觉反射通路:光线—角膜—瞳孔—晶状体—玻璃体—视 网膜色素上皮细胞层 — 视锥视杆细胞层 — 双极神经原 — 节细胞—视神经—视交叉—视束—外侧膝状体—上丘臂— 双侧上丘 — 中脑动眼神经副交感核 — 动眼神经 — 睫状神 经节—节后纤维—瞳孔、睫状体—调节瞳孔对光反射和视 觉反射
第三讲:数学基础 1 线性代数知识复习:齐次坐标系、普通二维坐标和二维齐次坐标之间进行转换、行列式、行列式几何意义(二阶 行列式:平面平行四边形的有向面积;三阶行列式:平行六面体的有向体积;n 阶行列式:n 维平行多面体的有向 容积) 、行列式性质、两个三维向量叉积、矩阵、任意一个矩阵其本身蕴含一个变换、矩阵与线性变换之间的关系 (矩阵变换就是线性变换) 、二阶矩阵对应线性变换的平面几何图形小结、矩阵的秩(初等变换不改变矩阵的秩) 、 矩阵的 K 阶子式、满秩矩阵、满秩矩阵的逆矩阵、反对称矩阵、二元/三元线性方程组解的行列式表示、Gramer(克 拉姆)法则、三点共线的判定(三点的齐次坐标行列式的值为 0) 、
det( p1 , p3 ) det( p1 , p4 ) : det( p2 , p3 ) det( p2 , p4 )
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
2
Solution
x AT A AT b
1
least squares solution to Ax b
x A\b
(matlab)
Problem statement
minimize x T AT Ax s.t. x T x 1
Solution
[ v, ] eig( A T A)
– – – Try all possible Each point votes for all consistent parameters Repeatedly sample enough points to solve for parameters
2. Score the given parameters
Bad
• May not be what you want to optimize • Sensitive to outliers
– Bad matches, extra points
• Doesn’t allow you to get multiple good fits
– Detecting multiple objects, lines, etc.
2
2
y T y 2( Ap )T y ( Ap )T ( Ap )
dE 2 A T Ap 2 A T y 0 dp
Matlab: p = A \ y;
1
AT Ap AT y p AT A AT y
Modified from S. Lazebnik
Problem with “vertical” least squares
Find (a, b, c) to minimize the sum of squared perpendicular distances
ax+by+c=0
Unit normal: N=(a, b) E (a x( by d )) x y i, i
n 2 i 1 i i
E i 1 ( a xi b yi c )
proof: /PointLineDistance2-Dimensional.html
ax+by+c=0
Unit normal: N=(a, b) E (a x( by d )) x y i, i
n 2 i 1 i i
Slide modified from S. Lazebnik
Demo – part 1
Other ways to search for parameters (for when no closed form solution exists)
• Line search
1. 2. For each parameter, step through values and choose value that gives best fit Repeat (1) until no parameter changes
• Not rotation-invariant • Fails completely for vertical lines
Slide from S. Lazebnik
Slide modified from S. Lazebnik
Total least squares
If (a2+b2=1) then Distance between point (xi, yi) is |axi + byi + c|
– Number of consistent points, possibly weighted by distance
3. Choose from among the set of parameters
– Global or local maximum of scores
4. Possibly refine parameters using inliers
•
Grid search
1.
2.Propose s来自veral sets of parameters, evenly sampled in the joint set Choose best (or top few) and sample joint parameters around the current best; repeat
• Design challenges
– Design a suitable goodness of fit measure
• Similarity should reflect application goals • Encode robustness to outliers and noise
– Design an optimization method
Hough transform
P.V.C. Hough, Machine Analysis of Bubble Chamber Pictures, Proc. Int. Conf. High Energy Accelerators and Instrumentation, 1959
Given a set of points, find the curve or line that explains the data points best
• Avoid local optima • Find best parameters quickly
Fitting and Alignment: Methods
• Global optimization / Search for parameters
– Least squares fit – Robust least squares – Iterative closest point (ICP)
y=mx+b
E i 1 ( yi m xi b) 2
n
(xi, yi)
2
E i 1 x i
n
x1 1 y1 m m 1 yi Ap y b b xn 1 yn
• Hypothesize and test
– Generalized Hough transform – RANSAC
Simple example: Fitting a line
Least squares line fitting
•Data: (x1, y1), …, (xn, yn) •Line equation: yi = m xi + b •Find (m, b) to minimize
n
n E i 1 2( a xi b yi c ) 0 c
2
a n b n c i 1 xi i 1 yi a x b y n n
x1 x n E i 1 ( a ( xi x ) b( yi y )) 2 xn x
See details on Raleigh Quotient: /wiki/Rayleigh_quotient
Recap: Two Common Optimization Problems
Problem statement
minimize Ax b
Robust least squares (to deal with outliers)
General approach: minimize
u x , ;
i i i
u 2 i 1 ( yi m xi b ) 2
n
ui (xi, θ) – residual of ith point w.r.t. model parameters θ ρ – robust function with scale parameter σ
error( , data i ) 2 2. Choose params to minimize: 2 error( , data ) 2 i i – E.g., numerical optimization
3. Compute new 1.5 median error 4. Repeat (2) and (3) until convergence
x A Ax minimize xT x
non - trivial lsq solution to Ax 0
T
T
1 2..n : x v1
Least squares (global) optimization
Good
• Clearly specified objective • Optimization is easy
ax+by+c=0
Unit normal: N=(a, b) E (a x( by d )) x y i, i
n 2 i 1 i i
E i 1 ( a xi b yi c ) 2
n
Slide modified from S. Lazebnik
Total least squares
Hough Transform: Outline
1. Create a grid of parameter values 2. Each point votes for a set of parameters, incrementing those values in grid 3. Find maximum or local maxima in grid
•
Gradient descent
1. 2. Provide initial position (e.g., random) Locally search for better parameters by following gradient
Solution
x AT A AT b
1
least squares solution to Ax b
x A\b
(matlab)
Problem statement
minimize x T AT Ax s.t. x T x 1
Solution
[ v, ] eig( A T A)
– – – Try all possible Each point votes for all consistent parameters Repeatedly sample enough points to solve for parameters
2. Score the given parameters
Bad
• May not be what you want to optimize • Sensitive to outliers
– Bad matches, extra points
• Doesn’t allow you to get multiple good fits
– Detecting multiple objects, lines, etc.
2
2
y T y 2( Ap )T y ( Ap )T ( Ap )
dE 2 A T Ap 2 A T y 0 dp
Matlab: p = A \ y;
1
AT Ap AT y p AT A AT y
Modified from S. Lazebnik
Problem with “vertical” least squares
Find (a, b, c) to minimize the sum of squared perpendicular distances
ax+by+c=0
Unit normal: N=(a, b) E (a x( by d )) x y i, i
n 2 i 1 i i
E i 1 ( a xi b yi c )
proof: /PointLineDistance2-Dimensional.html
ax+by+c=0
Unit normal: N=(a, b) E (a x( by d )) x y i, i
n 2 i 1 i i
Slide modified from S. Lazebnik
Demo – part 1
Other ways to search for parameters (for when no closed form solution exists)
• Line search
1. 2. For each parameter, step through values and choose value that gives best fit Repeat (1) until no parameter changes
• Not rotation-invariant • Fails completely for vertical lines
Slide from S. Lazebnik
Slide modified from S. Lazebnik
Total least squares
If (a2+b2=1) then Distance between point (xi, yi) is |axi + byi + c|
– Number of consistent points, possibly weighted by distance
3. Choose from among the set of parameters
– Global or local maximum of scores
4. Possibly refine parameters using inliers
•
Grid search
1.
2.Propose s来自veral sets of parameters, evenly sampled in the joint set Choose best (or top few) and sample joint parameters around the current best; repeat
• Design challenges
– Design a suitable goodness of fit measure
• Similarity should reflect application goals • Encode robustness to outliers and noise
– Design an optimization method
Hough transform
P.V.C. Hough, Machine Analysis of Bubble Chamber Pictures, Proc. Int. Conf. High Energy Accelerators and Instrumentation, 1959
Given a set of points, find the curve or line that explains the data points best
• Avoid local optima • Find best parameters quickly
Fitting and Alignment: Methods
• Global optimization / Search for parameters
– Least squares fit – Robust least squares – Iterative closest point (ICP)
y=mx+b
E i 1 ( yi m xi b) 2
n
(xi, yi)
2
E i 1 x i
n
x1 1 y1 m m 1 yi Ap y b b xn 1 yn
• Hypothesize and test
– Generalized Hough transform – RANSAC
Simple example: Fitting a line
Least squares line fitting
•Data: (x1, y1), …, (xn, yn) •Line equation: yi = m xi + b •Find (m, b) to minimize
n
n E i 1 2( a xi b yi c ) 0 c
2
a n b n c i 1 xi i 1 yi a x b y n n
x1 x n E i 1 ( a ( xi x ) b( yi y )) 2 xn x
See details on Raleigh Quotient: /wiki/Rayleigh_quotient
Recap: Two Common Optimization Problems
Problem statement
minimize Ax b
Robust least squares (to deal with outliers)
General approach: minimize
u x , ;
i i i
u 2 i 1 ( yi m xi b ) 2
n
ui (xi, θ) – residual of ith point w.r.t. model parameters θ ρ – robust function with scale parameter σ
error( , data i ) 2 2. Choose params to minimize: 2 error( , data ) 2 i i – E.g., numerical optimization
3. Compute new 1.5 median error 4. Repeat (2) and (3) until convergence
x A Ax minimize xT x
non - trivial lsq solution to Ax 0
T
T
1 2..n : x v1
Least squares (global) optimization
Good
• Clearly specified objective • Optimization is easy
ax+by+c=0
Unit normal: N=(a, b) E (a x( by d )) x y i, i
n 2 i 1 i i
E i 1 ( a xi b yi c ) 2
n
Slide modified from S. Lazebnik
Total least squares
Hough Transform: Outline
1. Create a grid of parameter values 2. Each point votes for a set of parameters, incrementing those values in grid 3. Find maximum or local maxima in grid
•
Gradient descent
1. 2. Provide initial position (e.g., random) Locally search for better parameters by following gradient