資源簡介
RPCA方法的圖像去噪算法。該程序為精確拉格朗日乘子法。去噪的話直接調用程序就好。也可以不用分塊、聚合。
代碼片段和文件信息
function?[A_hat?E_hat?iter]?=?exact_alm_rpca(D?lambda?tol?maxIter)
%?Oct?2009
%?This?matlab?code?implements?the?augmented?Lagrange?multiplier?method?for
%?Robust?PCA.
%
%?D?-?m?x?n?matrix?of?observations/data?(required?input)%這個是觀察到的矩陣D
%
%?lambda?-?weight?on?sparse?error?term?in?the?cost
%?function%這個是應該是代價函數的誤差稀疏度的權重
%
%?tol?-?tolerance?for?stopping?criterion.%這個是停止迭代的誤差容忍度
%?????-?DEFAULT?1e-7?if?omitted?or?-1.
%
%?maxIter?-?maximum?number?of?iterations%這個是最大的迭代次數
%?????????-?DEFAULT?1000?if?omitted?or?-1.
%?
%?Initialize?AEYu
%?while?~converged?
%???minimize
%?????L(AEYu)?=?|A|_*?+?lambda?*?|E|_1?+??+?mu/2?*?|D-A-E|_F^2;
%???Y?=?Y?+?\mu?*?(D?-?A?-?E);
%???\mu?=?\rho?*?\mu;
%?end
%
%?Minming?Chen?October?2009.?Questions??v-minmch@microsoft.com?;?
%?Arvind?Ganesh?(abalasu2@illinois.edu)
%
%?Copyright:?Perception?and?Decision?Laboratory?University?of?Illinois?Urbana-Champaign
%????????????Microsoft?Research?Asia?Beijing
addpath?PROPACK;
[m?n]?=?size(D);
%%設定算法參數default取值
if?nargin?2%說明只輸入了D
????lambda?=?1?/?sqrt(m);
end
if?nargin?3
????tol?=?1e-7;
elseif?tol?==?-1
????tol?=?1e-7;
end
if?nargin?4
????maxIter?=?1000;
elseif?maxIter?==?-1
????maxIter?=?1000;
end
%?initialize
Y?=?sign(D);%這個是符號函數對D矩陣中的每一個元素符號進行判斷,然后Y與D的大小是一樣的
%?norm_two?=?lansvd(Y?1?‘L‘);%求Y的最大的奇異值(矩陣的二范數為矩陣最大的奇異值)
norm_two=norm(Y);
norm_inf?=?norm(?Y(:)?inf)?/?lambda;
dual_norm?=?max(norm_two?norm_inf);%求二范數和無窮范數的最大值
Y?=?Y?/?dual_norm;%對Y進行初始化
A_hat?=?zeros(?m?n);
E_hat?=?zeros(?m?n);
dnorm?=?norm(D?‘fro‘);%D的F范數
tolProj?=?1e-6?*?dnorm;%用于內層循環中的收斂判斷條件
total_svd?=?0;
mu?=?.5/norm_two?%?this?one?can?be?tuned,uk的建議取值
rho?=?6??????????%?this?one?can?be?tuned,uk更新的參數
iter?=?0;
converged?=?false;
stopCriterion?=?1;
sv?=?5;%
評論
共有 條評論