资源简介
稀疏表示人脸识别SRC matlab代码实现。附带l1范数优化代码。可以顺利跑通。测试数据集为YaleB。
代码片段和文件信息
% l1qc_logbarrier.m
%
% Solve quadratically constrained l1 minimization:
% min ||x||_1 s.t. ||Ax - b||_2 <= \epsilon
%
% Reformulate as the second-order cone program
% min_{xu} sum(u) s.t. x - u <= 0
% -x - u <= 0
% 1/2(||Ax-b||^2 - \epsilon^2) <= 0
% and use a log barrier algorithm.
%
% Usage: xp = l1qc_logbarrier(x0 A At b epsilon lbtol mu cgtol cgmaxiter)
%
% x0 - Nx1 vector initial point.
%
% A - Either a handle to a function that takes a N vector and returns a K
% vector or a KxN matrix. If A is a function handle the algorithm
% operates in “largescale“ mode solving the Newton systems via the
% Conjugate Gradients algorithm.
%
% At - Handle to a function that takes a K vector and returns an N vector.
% If A is a KxN matrix At is ignored.
%
% b - Kx1 vector of observations.
%
% epsilon - scalar constraint relaxation parameter
%
% lbtol - The log barrier algorithm terminates when the duality gap <= lbtol.
% Also the number of log barrier iterations is completely
% determined by lbtol.
% Default = 1e-3.
%
% mu - Factor by which to increase the barrier constant at each iteration.
% Default = 10.
%
% cgtol - Tolerance for Conjugate Gradients; ignored if A is a matrix.
% Default = 1e-8.
%
% cgmaxiter - Maximum number of iterations for Conjugate Gradients; ignored
% if A is a matrix.
% Default = 200.
%
% Written by: Justin Romberg Caltech
% Email: jrom@acm.caltech.edu
% Created: October 2005
%
function xp = l1qc_logbarrier(x0 A At b epsilon lbtol mu cgtol cgmaxiter)
largescale = isa(A‘function_handle‘);
if (nargin < 6) lbtol = 1e-3; end
if (nargin < 7) mu = 10; end
if (nargin < 8) cgtol = 1e-8; end
if (nargin < 9) cgmaxiter = 200; end
newtontol = lbtol;
newtonmaxiter = 50;
N = length(x0);
% starting point --- make sure that it is feasible
if (largescale)
if (norm(A(x0)-b) > epsilon)
disp(‘Starting point infeasible; using x0 = At*inv(AAt)*y.‘);
AAt = @(z) A(At(z));
[w cgres] = cgsolve(AAt b cgtol cgmaxiter 0);
if (cgres > 1/2)
disp(‘A*At is ill-conditioned: cannot find starting point‘);
xp = x0;
return;
end
x0 = At(w);
end
else
if (norm(A*x0-b) > epsilon)
disp(‘Starting point infeasible; using x0 = At*inv(AAt)*y.‘);
opts.POSDEF = true; opts.SYM = true;
[w hcond] = linsolve(A*A‘ b opts);
if (hcond < 1e-14)
disp(‘A*At is ill-conditioned: cannot find starting point‘);
xp = x0;
return;
end
x0 = A‘*w;
end
end
x = x0;
u = (0.95)*abs(x0) + (0.10)*max(abs(x0));
disp(sprintf(‘Original l1 norm = %.3f original functional = %.3f‘ sum(abs(x0)) sum(u)));
% choose initial value of tau so that the duality gap after the first
% step will be about the origial norm
tau = max((2*N+1)/sum(abs(x0)) 1);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2020-01-17 14:30 src\
文件 3633 2020-01-17 14:18 src\l1qc_logbarrier.m
文件 4565 2020-01-17 14:16 src\l1qc_newton.m
文件 1453 2020-01-17 14:11 src\Main.m
相关资源
- 基于MATLAB的人脸识别源代码
- PCA人脸识别定位matlab代码
- 基于matlab,gui的人脸识别(PCA)
- 人脸识别系统 现成的matlab代码
- 基于PCA及SVM的人脸识别
- omp算法matlab稀疏表示中用来求最优解
- matlab实现基于PCA的人脸识别算法
- GUI人脸识别MATLAB代码
- 基于Gabor小波变换和人工神经网络的人
- adaboost人脸识别 matlab程序
- ICA的人脸识别MATLAB源码
- matlab使用gabor变换和神经网络实现人脸
- 图像处理 人脸识别皮肤提取 经典ma
- 图像稀疏表示matlab193095
- 国外资源 基于PCA的人脸识别matlab代码
- Matlab 人脸识别 SVM
- 局部二值模式(Local Binary Patterns)图
- 非常经典的MATLAB人脸识别程序可显示
- MATLAB基于肤色模型和模板匹配的人脸
- 肤色模型人脸识别matlab代码
- matlab基于笔记本电脑的摄像头的人脸
- 视频中人脸识别
- 二维对称图像矩阵ICA人脸识别MATLAB源
- MATLAB人脸识别PCALDAKPCABP,可视化界面
- MATLAB人脸识别程序加论文
- 人脸识别门禁系统.zip
- PCA和LDA人脸识别matlab代码最紧邻分类
- 基于pca实现人脸识别matlab代码
- 基于MATLAB的LBP图片特征提取算法,人
- Deep Semi-NMF源代码
评论
共有 条评论