【计算机图形学】多视几何009:对极几何

【视觉SLAM】4a-特征点法估计相机运动之对极几何2D-2D 对极几何(Epipolar Geometry)描述了同一场景中两幅图像(2D-2D)间的几何关系,在图像匹配、三维重建等领域应用广泛。接下来看如何从已知两幅图像的匹配点对(2D像素点)中恢复相机运动。 阅读详情

对极几何和基本矩阵

对射

在对极几何中,在图像 A 中的点 x ,被映射到图像 B 的对极线 l ′ 上。 在对极几何中,在图像A中的点x,被映射到图像B的对极线l'上。 在对极几何中,在图像A中的点x,被映射到图像B的对极线l′上。
x        F 基本矩阵       → l ′ x\overrightarrow{\ \ \ \ \ \ F基本矩阵\ \ \ \ \ \ } l' x      F基本矩阵       l′
任何与 x 匹配的点 x ’必然在对极线 l ′ 上 , x F x ′ = 0 。 任何与x匹配的点x’必然在对极线l'上,xFx'=0。 任何与x匹配的点x’必然在对极线l′上,xFx′=0。
在这里插入图片描述 F = e × ′ H π , 其中 d e t ( e × ′ ) = 2 , d e t ( H π ) = 3 , d e t ( F ) ≤ 2 F=e'_{\times}H_{\pi},其中det(e'_{\times})=2,det(H_{\pi})=3,det(F)\leq2 F=e×′​Hπ​,其中det(e×′​)=2,det(Hπ​)=3,det(F)≤2

在这里插入图片描述

p ′ = R p + T p ′ , T , p 三线共面约束: ( R p ) T ∗ ( T × p ′ ) = 0 p T R T ∗ ( T × ∗ p ′ ) = 0 p T ( R T ∗ T × ) p ′ = 0 p T ( E ) p ′ = 0 又 p = K − 1 x p ’ = K ′ − 1 x ’ x T ( K − T E K ′ − 1 ) x ’ = 0 p'=Rp+T\\ p',T,p三线共面约束:(Rp)^T*(T×p')=0\\ p^TR^T*(T_×* p')=0\\ p^T(R^T*T_×) p'=0\\ p^T(E) p'=0 \\ 又p = K^{-1}x\\ p’= K'^{-1}x’ \\ x^T(K^{-T}E K'^{-1})x’=0 \\ p′=Rp+Tp′,T,p三线共面约束:(Rp)T∗(T×p′)=0pTRT∗(T×​∗p′)=0pT(RT∗T×​)p′=0pT(E)p′=0又p=K−1xp’=K′−1x’xT(K−TEK′−1)x’=0

基本矩阵计算 基本矩阵计算 基本矩阵计算

归一化8点法:

step1:对于每一对对应点x与x’,有:

[ x y 1 ] [ f 11 f 12 f 13 f 21 f 22 f 23 f 31 f 32 f 33 ] [ x ′ y ′ 1 ] = 0 ⇓ x ′ x f 11 + x ′ y f 12 + x ′ f 13 + y ′ x f 21 + y ′ y f 22 + y ′ f 23 + x f 31 + y f 32 + f 33 = 0 ⇓ [ x ′ x x ′ y x ′ y ′ x y ′ y y ′ x y 1 ] f = 0 对于给定的 n 个对应点对,有                                                                            A n , 9 ∗ f = [ x 1 ′ x 1 x 1 ′ y 1 x 1 ′ y 1 ′ x 1 y 1 ′ y 1 y 1 ′ x 1 y 1 1 ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ x n ′ x n x n ′ y n x n ′ y n ′ x n y n ′ y n y n ′ x n y n 1 ] f = 0 \begin{bmatrix}x&y&1\end{bmatrix}\begin{bmatrix}f_{11}&f_{12}&f_{13}\\f_{21}&f_{22}&f_{23}\\f_{31}&f_{32}&f_{33}\end{bmatrix}\begin{bmatrix}x'\\y'\\1\end{bmatrix}=0 \\ \Downarrow \\ x'xf_{11}+x'yf_{12}+x'f_{13}+y'xf_{21}+y'yf_{22}+y'f_{23}+xf_{31}+yf_{32}+f_{33} = 0 \\ \Downarrow \\ \begin{bmatrix} x'x&x'y&x'&y'x&y'y&y'&x&y&1 \end{bmatrix}f=0 \\ 对于给定的n个对应点对,有 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \\ A_{n,9}*f=\begin{bmatrix}x_1'x_1&x_1'y_1&x_1'&y_1'x_1&y_1'y_1&y_1'&x_1&y_1&1\\\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots\\x_n'x_n&x_n'y_n&x_n'&y_n'x_n&y_n'y_n&y_n'&x_n&y_n&1\end{bmatrix}f = 0 [x​y​1​] ​f11​f21​f31​​f12​f22​f32​​f13​f23​f33​​ ​ ​x′y′1​ ​=0⇓x′xf11​+x′yf12​+x′f13​+y′xf21​+y′yf22​+y′f23​+xf31​+yf32​+f33​=0⇓[x′x​x′y​x′​y′x​y′y​y′​x​y​1​]f=0对于给定的n个对应点对,有                                                                           An,9​∗f= ​x1′​x1​⋮xn′​xn​​x1′​y1​⋮xn′​yn​​x1′​⋮xn′​​y1′​x1​⋮yn′​xn​​y1′​y1​⋮yn′​yn​​y1′​⋮yn′​​x1​⋮xn​​y1​⋮yn​​1⋮1​ ​f=0

如果 A 的秩为 8 ,则在差一个尺度因子的情况下,解是唯一的。若因为噪声等原因, A 的秩为 9 ,则使用最小二乘解法, m i n ‖ A f ‖ 如果A的秩为8,则在差一个尺度因子的情况下,解是唯一的。 若因为噪声等原因,A的秩为9,则使用最小二乘解法,min‖Af‖ 如果A的秩为8,则在差一个尺度因子的情况下,解是唯一的。若因为噪声等原因,A的秩为9,则使用最小二乘解法,min‖Af‖
A = U S V T A=USV^T A=USVT
f 的解就是系数矩阵 A 最小奇异值对应的奇异向量( V 最后一列) f的解就是系数矩阵A最小奇异值对应的奇异向量(V最后一列) f的解就是系数矩阵A最小奇异值对应的奇异向量(V最后一列)

step2:奇异性约束(F的秩为2):
如果基本矩阵是非奇异的,那么所计算的对极线将不重合
m i n ∣ ∣ F − F ′ ∣ ∣ 2   ,    s . t . d e t ( F ′ ) = 0 F = U S V T , F ′ = U ∗ d i a g ( s 1 , s 2 , 0 ) ∗ V T min ||F-F'||_2 \ , \ \ s.t. det(F')=0\\ F=USV^T,F'=U*diag(s_1,s_2,0) * V^T min∣∣F−F′∣∣2​ ,  s.t.det(F′)=0F=USVT,F′=U∗diag(s1​,s2​,0)∗VT

为了提高解的稳定性和精度,往往会对输入点集的坐标先进行归一化处理。

其中归一化变换 T : 1. 将点进行平移使其形心( x , y 的均值)位于原点。 2. 对点进行缩放使特征点到原点的距离为 2 3. 对两幅图进行独立的上述变换 其中归一化变换T:\\ 1.将点进行平移使其形心(x,y的均值)位于原点。\\2.对点进行缩放使特征点到原点的距离为\sqrt 2\\3.对两幅图进行独立的上述变换 其中归一化变换T:1.将点进行平移使其形心(x,y的均值)位于原点。2.对点进行缩放使特征点到原点的距离为2 ​3.对两幅图进行独立的上述变换

重投影误差

l 1 = F ∗ x 2 = [ a 1 b 1 c 1 ] e 1 = x 1 T l 1 a 1 2 + b 1 2 l_1=F*x_2=\begin{bmatrix}a_1\\b_1\\c_1\end{bmatrix}\\ e_1= \frac{x_1^Tl_1}{\sqrt{a_1^2+b_1^2}} l1​=F∗x2​= ​a1​b1​c1​​ ​e1​=a12​+b12​ ​x1T​l1​​
添加链接描述

clear all; 
clc;
bDrawDebug = true;
bShouldNormalizePts = true;
bAssumeTrueMatches = true; % Whether or not to assume all matches are true

% load images 
I1 = imread('house1.jpg');
I2 = imread('house2.jpg');


%Load match files for the first example
% This is a N x 4 file where the first two numbers of each row
% are coordinates of corners in the first image and the last two
% are coordinates of corresponding corners in the second image: 
% matches(i,1:2) is a point in the first image
% matches(i,3:4) is a corresponding point in the second image
matches = load('house_matches.txt'); 
%matches = generate_matches(I1,I2, 100, false);
%matches = load('library_matches.txt');
%matches = generate_matches(I1,I2, 200, bDrawDebug);

numMatches = size(matches,1);

if(bDrawDebug)
    %display an overlay of the features ontop of the image
    figure; imshow([I1 I2]); hold on; title('Overlay detected features (corners)');
    hold on; plot(matches(:,1),matches(:,2),'ys'); plot(matches(:,3) + size(I1,2), matches(:,4), 'ys'); 
    
    % display two images side-by-side with matches
    % this code is to help you visualize the matches, you don't need
    % to use it to produce the results for the assignment
    figure; imshow([I1 I2]); hold on;
    plot(matches(:,1), matches(:,2), '+r');
    plot(matches(:,3)+size(I1,2), matches(:,4), '+r');
    line([matches(:,1) matches(:,3) + size(I1,2)]', matches(:,[2 4])', 'Color', 'r');
end


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fit a Fundamental Matrix using the matches
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if (bAssumeTrueMatches)  
    display('Assuming all matches are true and fitting to all');
    F = fit_fundamental(matches, bShouldNormalizePts); 
    % this is a function that you should write
    % bShouldNormalizePts: 是否进行归一化
else
    display('Estimating the fundamental matrix');
    %If the matches cannot be assumed to be ground truth, then estimate the
    %fundamental matrix using RANSAC
    F = estimate_fundamental(matches, bShouldNormalizePts);
end
residuals = calc_residuals(F,matches);
display(['Mean residual is: ' , num2str(mean(residuals))]);



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% display second image with epipolar lines reprojected 
% from the first image
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% transform points from the 1st img to get epipolar lines in the 2nd image
L = (F * [matches(:,1:2) ones(numMatches,1)]')'; 

% find points on epipolar lines L closest to matches(:,3:4)
L = L ./ repmat(sqrt(L(:,1).^2 + L(:,2).^2), 1, 3); % rescale the line
pt_line_dist = sum(L .* [matches(:,3:4) ones(numMatches,1)],2);
closest_pt = matches(:,3:4) - L(:,1:2) .* repmat(pt_line_dist, 1, 2);

% find endpoints of segment on epipolar line (for display purposes)
pt1 = closest_pt - [L(:,2) -L(:,1)] * 100; % offset from the closest point is 10 pixels
pt2 = closest_pt + [L(:,2) -L(:,1)] * 100;

% display points and segments of corresponding epipolar lines
figure;
imshow(I2); hold on;
plot(matches(:,3), matches(:,4), '+r');
line([matches(:,3) closest_pt(:,1)]', [matches(:,4) closest_pt(:,2)]', 'Color', 'r');
line([pt1(:,1) pt2(:,1)]', [pt1(:,2) pt2(:,2)]', 'Color', 'b');


function [ F ] = fit_fundamental( matches, bShouldNormalize )
%FIT_FUNDAMENTAL Summary of this function goes here
%Output...
%   F: Fundamental Matrix
%Inputs...
%   matches:
%       This is a N x 4 file where the first two numbers of each row
%       are coordinates of corners in the first image and the last two
%       are coordinates of corresponding corners in the second image: 
%       matches(i,1:2) is a point in the first image
%       matches(i,3:4) is a corresponding point in the second image
%   bShouldNormalize:
%       Whether or not the points should be normalized prior to estimating 
%       the fundamental matrix

    %homogenize the points
    x1 = cart_2_homo( matches(:,1:2) );
    x2 = cart_2_homo( matches(:,3:4) );
    
    if bShouldNormalize
        %The linear system to be solved will have terms that involve a
        %product between feature coordinates. If the coordinates are large,
        %then F could end up w/ values that are orders of magnitude
        %different from one another. This could yield poor behavior in
        %practice. So normalize the coordinates, compute F in the
        %normalized coordinates and then adjust it back to the original
        %coordinates later using the normalization transformations
        %display('Normalizing Coordinates');
        [transform_1, x1_norm] = normalize_coordinates(x1);
        [transform_2, x2_norm] = normalize_coordinates(x2);
        x1 = x1_norm;
        x2 = x2_norm;
    end
    
    u1 = x1(:,1);
    v1 = x1(:,2);
    u2 = x2(:,1);
    v2 = x2(:,2);
   
    %group at least 8 known matches together in a useful form
    temp = [ u2.*u1, u2.*v1, u2, v2.*u1, v2.*v1, v2, u1, v1, ones(size(matches,1), 1)];
    %Obtain an estimate for F by solving the homogenous linear system using
    %those matches
    %display('Solving homogenous linear system');
    [~,~,V] = svd(temp);
    f_vec = V(:,9);
    
    F = reshape(f_vec, 3,3); %reshape the 9x1 vec into the 3x3 fund matrix
    F = rank_2_constraint(F); %enforce the rank 2 constraint on F
    
    if bShouldNormalize
        %if F was computed from normalized points, transform it back to
        %the original coordinates
        F = transform_2' * F * transform_1;
    end
end

计算F时的秩约束:

function [ rank2_mat ] = rank_2_constraint( mat )
%RANK_2_CONSTRAINT Enforce a rank 2 constraint on 3x3 input matrix
%   Detailed explanation goes here

    %display('Enforcing Rank 2 Constraint');
    %take the svd of the input matrix
    [U, S, V] = svd(mat);
    %throw out the smallest singular value
    S(end) = 0;
    %recalcualte the matrix to yield the closest rank 2 constraint of the
    %original
    rank2_mat = U*S*V';
end
function residuals = calc_residuals(F, matches)
%CALC_RESIDUALS Summary of this function goes here
%   Detailed explanation goes here
   
    numMatches = size(matches,1);
    L = (F * [matches(:,1:2) ones(numMatches,1)]')'; % transform points from 
    % the first image to get epipolar lines in the second image

    % find points on epipolar lines L closest to matches(:,3:4)
    L = L ./ repmat(sqrt(L(:,1).^2 + L(:,2).^2), 1, 3); % rescale the line
    distances = sum(L .* [matches(:,3:4) ones(numMatches,1)],2); %distances from each pt to its line
    
    residuals = abs(distances);
end

Matab2012b中的函数estimatefundamentalmatrix

代数推导链接,添加链接描述基础矩阵百度百科链接

多视图几何--对极几何--从0-1理解对极几何 如图所示,物体点PPP,图像点p1,p2p_1,p_2p1​,p2​,相机中心o1,o2o_1,o_2o1​,o2​五点共面的关系称为对极几何。o1,o2o_1,o_2o1​,o2​连线称为基线,其与图像的交点称为e1,e2e_1,e_2e1​,e2​极点,图像点p1,p2p_1,p_2p1​,p2​与极点e1,e2e_1,e_2e1​,e2​组成的连线称为极线。 不妨假设图像点在相机坐标系的坐标为p1,p2p_1,p_2p1​,p2​,在三维空间中,由叉乘的几何意义可以得到一个垂直于平面的法向量,又有两个 阅读详情

相关推荐

计算机视觉——多视图几何

多视图几何1.前言1.1 多视图几何概念2. 基本原理2.1 对极几何2.2 基础矩阵2.2.1 基础矩阵推导2.2.2 求解基础矩阵3. 实验过程3.1 实验数据准备3.2 实验代码3.3 实验结果及分析4. 实验中遇到的问题 1.前言 1.1 多视图几何概念 多视图几何是利用在不同视点所拍摄图像间的关系,来研究照相机之间或者特征之间关系的一门科学。 多视图几何(Multiple View ...

RuiMa的博客 7728

对极几何基本概念

对极几何(Epipolar Geometry)描述的是两幅视图之间的内在射影关系,与外部场景无关,只依赖于摄像机内参数和这两幅试图之间的的相对姿态 什么是对极几何粗略概念 对极几何相关的一个重要约束5点共面约束 对极几何的几个相关概念 对应点的约束 1. 什么是对极几何·粗略概念提到对极几何,一定是对二幅图像而言,对极几何实际上是“两幅图像之间的对极几何”,它是图像平面与以基线为轴的平面束

tina的博客 4万+

超融合架构实战:如何用3节点搭建企业级分布式存储系统?

本文详细介绍了如何利用3节点搭建企业级分布式存储系统的超融合架构实战指南。从硬件选型、网络配置到存储策略调优,提供了全面的实操建议和性能优化技巧,帮助企业实现高效、弹性的IT基础设施。特别适合需要简化运维、提升存储性能的中型企业参考。

weixin_29200485的博客 333

计算机视觉-对极几何

本文主要描述计算机视觉中极线约束以及基础矩阵和本质矩阵的求解

nuc_baixu的博客 2778

模拟量传输4-20ma电流

大家可能会非常熟悉RS232,RS485,CAN等工业上常用的总线,他们都是传输数字信号的方式。那么,我们用什么方式来传输模拟信号呢?工业上普遍需要测量各类非电物理量,例如温度、压力、速度、角度等,这些都需要转换成模拟量电信号才能传输到几百米外的控制室或显示设备上。工业上最广泛采用的是用4~20mA电流来传输模拟量。 采用电流信号的原因是不容易受干扰,因为工业现场的噪声电压的幅度可能达到数V,但是噪声的功率很弱,所以噪声电流通常小于nA级别,因此给4-20mA传输带来的误差非常小;电流源内阻趋于无穷.

tangdongming的博客 1万+

银河麒麟V10SP1系统盘瘦身指南:如何制作一个只含必需软件的轻量级安装镜像

本文详细介绍了银河麒麟V10SP1系统盘瘦身的完整流程,从依赖分析到最小化镜像构建,帮助用户创建只含必需软件的轻量级安装镜像。通过智能包筛选、KickStart定制和性能优化,显著减少ISO体积和部署时间,适用于服务器批量部署等场景。

weixin_26765287的博客 408

【计算机图形学】多视几何000 综述

两个相机拍同一个东西或者一个相机用两个角度拍同一个东西 图像有重现的部分,这些重现的部分是一一对应的关系,多视图几何研究的就是这个关系

ResumeProject的博客 321

建行报专版报道建设银行金融科技发展历程

经过十多年的建设,总行前中后台部门都有了自己的业务系统,但系统“部门”特征显著,渠道、客户、产品的横向整合不足,产品系统层次化、结构化、参数化程度不高,渠道支持产品快速部署以及跨渠道服务能力不足,管理分析类系统建设相对滞后,系统较弱的可扩展能力在应对高速增长的交易量时已疲态尽显,同时安全稳定运行的压力和风险日益积聚。站在新的历史起点上,科技条线将聚焦主责主业,完善信息科技管理体系,紧紧围绕安全生产中心任务,持续推动技术能力复用共享和自主可控,为全行做好金融五篇大文章,推动业务高质量发展提供技术支撑。

银行信息系统应用架构详解 396

计算机图学概念,计算机图形学中的基本概念总结

Chapter 01001、Image Processing:图像处理,照片和电视扫描片等现有图片的修改或者解释称为图像处理;002、计算机图形学中,计算机用来生成图形,而图像处理技术用来改善图片质量、分析图像等;Chapter 02003、图形系统一般使用视频显示器作为其基本的输出设备;004、CRT:阴极射线管,cathode-ray tube;005、Resolution:分辨率,CRT无重...

weixin_30999777的博客 525

Python爬虫技术:使用Playwright和Twitter API v2高效获取Twitter/X数据完全教程

遵守规则:始终遵循Twitter的使用条款和速率限制错误处理:实现完善的错误处理和重试机制数据质量:进行数据清洗和验证性能优化:使用异步处理和合理的延迟设置可维护性:模块化代码,便于维护和扩展。

2201_76125261的博客 674

AI在智能制造中的落地:从预测维护到自适应生产调度

从最新的研究与实践来看,“预测维护”和“自适应生产调度”正在成为智能制造中最先跑通闭环的两个核心场景:前者通过对设备健康的前瞻性预测,帮助企业减少非计划停机、优化备件与维护资源;后者通过对复杂生产系统的实时决策优化,使工厂能够更好地应对订单波动、设备故障和多目标约束。更重要的是,越来越多的研究与项目不再将二者视为孤立模块,而是尝试构建“设备健康—生产调度—供应链”三者联动的一体化架构。Nature在技术层面,深度学习、强化学习、多智能体系统、图神经网络和注意力机制等方法,为建模复杂工业系统提供了强大工具;

nmdbbzcl的博客 1295

清华大学计算机学院主页,计算机图形学基础课程主页 | 清华大学计算机系

1.2002级本科生黄其兴同学在完成图形学课作业的过程中就B样条的升阶和顶点插入算法进行了深入的研究,并在胡事民教授和Martin教授的共同指导下在国际著名刊物Computer Aided Geometric Design (CAGD)上发表文章.Fast degree elevation and knot insertion for B-spline curves, Computer Aid...

weixin_39648539的博客 451

【Prometheus】prometheus结合cAdvisor监控docker容器运行状态,并且实现实时告警通知

Docker的监控,可以使用Docker自带的stats命令来获取当前主机上运行中的容器的资源使用情况。 例如:容器的CPU使用率、内存占用、网络IO以及磁盘IO等指标。

景天科技苑 6万+

L3-009 烽火台选址:几何视角下的最少建造策略

本文从几何视角探讨了烽火台选址问题,提出了一种基于斜率比较法和单调栈的高效算法,用于确定最少建造策略。通过分析凸包概念和斜率比较原理,文章详细介绍了算法实现、边界条件处理及实际应用场景,如无线基站布置和监控摄像头优化。

weixin_30843605的博客 375

这5组白月光少女三视图提示词直接用

今天分享5组治愈系白月光少女女主提示词,适合用于AI漫剧角色设计、角色库搭建和人物设定参考,所有提示词均是完整可复刻。

欢迎来到鸾姝淡月博客,专为程序员和编程爱好者打造的技术博客。我们分享编程语言趋势、开发工具、编程哲学、职业发展等,助你掌握新技术,优化技能,激发编程热情。 190

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

图形学基础 | 计算机图形学常用术语整理

计算机图形学常用术语整理 001. Physically Based Rendering 英文缩写】PBR 【中文翻译】基于物理的渲染 【补充说明】大型3D游戏常用的一种渲染流程,有利于保证画面效果的真实感。 【相关资料】《Physically Based Rendering: From Theory to Implementation》 002. Local Illumination 【英...

【黑键】 3214

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

【高级UI】【009】贝塞尔曲线图形原理和公式推导

什么是贝塞尔曲线 贝塞尔曲线,英文名Bezier Curve,是计算机图形学非常重要的一种曲线 它可以将若干的点,用一条平滑自然的曲线来连接起来 比如我们在地图库中绘制用户行走轨迹时,如果用折线来展示,就比较难看 如果通过贝塞尔曲线,转为曲线来显示,就特别舒服自然了 像安卓中的水纹,波形等,很多就是通过贝塞尔曲线实现的 所以在讲绘制之前,先把这个基础知识给讲了 贝塞尔曲线简单示例 如图,P0和P2为贝塞尔曲线要经过的点,P1为控制点 选择不同的控制点,可以得到不同的曲线路径,但都可以结果P0和P2 贝塞尔

天天向上 Up Up Up (*^▽^*) 4773

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

009-3D数学矩阵的由来,矩阵的数学定义,矩阵的维度与表示方法详解及实例

矩阵理论是数学史上的重要篇章,尤其在3D图形学中扮演着核心角色。矩阵的雏形可追溯至中国古代的《九章算术》,但现代矩阵理论主要形成于17-19世纪,由克莱默、凯莱等数学家奠定基础。矩阵在3D图形学中的应用始于计算机图形学早期,用于高效表示几何变换。矩阵不仅是数据的容器,还建立了矩阵代数系统,用于表示线性变换、解线性方程组等。矩阵的维度通常表示为m×n,其中m为行数,n为列数。在3D图形学中,常用矩阵包括2×2、3×3和4×4矩阵,分别用于2D变换、3D旋转和仿射变换。矩阵的存储方式有行主序和列主序两种,分别适

小宝哥Code的专栏 1550

【UE4 009】江河海洋水体材质

使用方法 使用方法较为简单,作者已经将大部分重要参数可视化,直接在Detail面板中修改数值即可。 例如Heightmap栏中的参数:Scale决定海浪的范围大小,Speed决定流速,Displacement决定水量高度。 实现原理及方法 在计算机图形学中,流体仿真的其中一种做法是基于网格绘制,通过物理模拟(波动方程)来计算网格点位置,达到动态效果。此项目将这种思路简化,根据坐标计算每个点的位置及其渲染所需的参数。 此项目通过蓝图实现,较为重...

刀客 3185

经典大学课程:清华大学计算机系网络教学视频

 31门计算机课程,大概10G左右, 要观看视频,请点击“进入课程”后,再点“视频讲解”:C,c 本科课程 微型计算机技术  http://www.nuist.edu.cn/courses/jsj/GD_jsj_001b/index.htm 数据结构 http://www.nuist.edu.cn/courses/jsj/GD_jsj_002b/index.htm 人工智能导论

Mobidogs Blog 8094

清华计算机专业课程列表

<br />转载于:wibnmo<br />http://blog.csdn.net/wibnmo/archive/2009/10/16/4680679.aspx<br /> <br /><br />本科课程 <br /><br />微型计算机技术 <br />http://www.nuist.edu.cn/courses/jsj/GD_jsj_001b/index.htm<br />数据结构 <br />[url]http://www.nuist.edu.cn/courses/jsj/GD_jsj_002

Benjamin 1万+

清华大学计算机系网络教学视频31门计算机课程

本科课程 微型计算机技术 http://www.nuist.edu.cn/courses/jsj/GD_jsj_001b/index.htm 数据结构http://www.nuist.edu.cn/courses/jsj/GD_jsj_002b/index.htm 人工智能导论http://www.nuist.edu.cn/courses/jsj/GD_jsj_003b/index...

a785842114的博客 1507

我的java思想009:控制屏幕重画的方法

控制屏幕重画的方法:        现情况掌握的控制屏幕重画的方法有两种: (1)使用单独的线程实现重画,优点是重画的比较均匀,不许人工控制重画。 (2)通过按下某个键实现重画。缺点需要人工控制,绘画的不均匀。

wu505183872的专栏 528

清华大学计算机全套教程,清华大学计算机全套教程(值得收藏).doc

清华大学计算机全套教程(值得收藏)要观看视频,请点击下列网址后,“进入课程”后,再点”视频讲解”本科课程微型计算机技术 /courses/jsj/GD_jsj_001b/index.htm数据结构 /courses/jsj/GD_jsj_002b/index.htm人工智能导论 /courses/jsj/GD_jsj_003b/index.htm信号处理原理/courses/jsj/GD_jsj_...

weixin_32639437的博客 570

计算机大学学习课程

关键字: 计算机基础 微型计算机技术 http://www.nuist.edu.cn/courses/jsj/GD_jsj_001b/index.htm 数据结构http://www.nuist.edu.cn/courses/jsj/GD_jsj_002b/index.htm 人工智能导论http://www.nuist.edu.cn/courses/jsj/GD_jsj_003b/index.h...

zhaoyongheng的博客 273
上一篇: 随机过程:母函数
下一篇: 【计算机图形学】多视几何 001:齐次矩阵变换,无穷远点经过仿射变换仍为无穷远点
FakeOccupational
博客等级 码龄6年 2万+粉丝 1730原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址