-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain_demo.m
75 lines (56 loc) · 2.1 KB
/
main_demo.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
clc;close all; clear;
%%
addpath('.\TV'); addpath('.\FCSBL');
% load 'J' (sensitivity matrix), 'V' (measurement matrix),
% and 'mask' (mask matrix of the round sensing area).
% NOTE: 'J' is normalized in rows;
% 'V' is subtracted with background signal and normalized.
% emt1: high SNR (>30dB); emt3: low SNR (<20dB).
load('.\data\emt3.mat');
% load the mask image of the ground truth phantom position.
load('.\data\ref_img.mat');
load('.\data\s11.mat');
%% One-step Inversion with Regularization
% compute difference operators
dr_filt = [1;-1];
dc_filt = [1,-1];
Dr = convmtx2(dr_filt, 64,64) * mask';
Dc = convmtx2(dc_filt, 64,64) * mask';
DtDr = Dr'*Dr;
DtDc = Dc'*Dc;
Lap = (DtDc + DtDr);
% One-step reconstruction
x_onestep_tv = (J'*J + 1e-5* Lap)\J'* V; % TV reg.
% Display Result
DispRecos(mask * ref_img(:), s11, 64,'linear',0);title('Ground Truth Location');
for i = 1:size(x_onestep_tv,2)
DispRecos(x_onestep_tv(:,i), s11, 64,'linear',0);title(['TV Reg. f' num2str(i)]);
end
%% Iterative Total Varaition
% set freq (1,2,3,4)
freq = 4; Vs = V(:,freq);
% 'iso'--> isotropic TV
% 'l1' --> l1-based, anisotropic TV
pars.tv = 'iso';
pars.MAXITER = 200;
X_fista_tv = tv_fista(J,Vs,mask,1e-6,-Inf,Inf,pars);
DispRecos(mask * X_fista_tv(:), s11, 64,'linear',0);title(['Iterative TV f' num2str(freq)]);
%% FCSBL
%%%%%%%%%%%%%%%%% Embed the block structure %%%%%%%%%%%%%%%%%
% generate block structure; run only once
% b_mat = BlkGenerate(Phi, 'type',2,'len',3,'s11',s11);
% save('.\data\blk.mat','b_mat');
load('.\data\blk.mat'); % load block structure;
% block embedding, see Eq. (14) in the paper
J = J * b_mat;
% parameter settings
blkStartLoc = 1:9:size(b_mat,2);
learnlambda = 1;
Result = FCSBL(J, V, blkStartLoc, learnlambda,...
'LEARNTYPE', 1, 'lambda', 1e-3, 'prune_gamma',1e-3,...
'MAX_ITERS', 20,'EPSILON', 1e-8, 'PRINT',0);
X_fcsbl = b_mat*Result.x;
for i = 1:size(X_fcsbl,2)
DispRecos(X_fcsbl(:,i), s11, 64,'linear',0);title(['FCSBL f' num2str(i)]);
end
% save('.\results\FCSBL3.mat', 'X_fcsbl');