-
Notifications
You must be signed in to change notification settings - Fork 0
/
Map_Assignment.m
70 lines (58 loc) · 1.89 KB
/
Map_Assignment.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
function Out = Map_Assignment(Out,Parm)
% Out = Map_Assignment(Out,Parm)
% function to map assignment
if length(Out.xp)>3000
disp(['Warning! assignment may take longer ' ...
'than usual time for dim > 3000.']);
end
fprintf('\nAssignment started..\n');
zp_tmp = assignment([Out.xp;Out.yp],'pixel',max([Out.A Out.B]));
Out.xp = zp_tmp(:,1)';
Out.yp = zp_tmp(:,2)';
clear zp_tmp
fprintf('Assignment completed\n');
fprintf('\n Pixels: %d x %d\n',Out.A,Out.B);
dset=load('NormalizedData.mat');
dset=dset.dset;
Out.XTrain=[];
Out.XValidation=[];
if Parm.Augment==1
Out.YTrain=Out.orgYTrain;
Out.YValidation=Out.orgYValidation;
end
fprintf('\nMapping of assignment begins\n');
for dsz = 1:size(dset.Xtrain,3)
for j=1:length(Out.YTrain)
Out.XTrain(:,:,dsz,j) = ConvPixel(dset.Xtrain(:,j,dsz),Out.xp,Out.yp,Out.A,Out.B,Out.Base,0);
end
end
dset.Xtrain=[];
for dsz = 1:size(dset.Xtest,3)
for j=1:length(Out.YTest)
Out.XTest(:,:,dsz,j) = ConvPixel(dset.Xtest(:,j,dsz),Out.xp,Out.yp,Out.A,Out.B,Out.Base,0);
end
end
dset.Xtest=[];
for dsz=1:size(dset.XValidation,3)
for j=1:length(Out.YValidation)
Out.XValidation(:,:,dsz,j) = ConvPixel(dset.XValidation(:,j,dsz),Out.xp,Out.yp,Out.A,Out.B,Out.Base,0);
end
end
dset.XValidation=[];
Out.C = size(Out.XTrain,3);
if Parm.Augment==1
if Parm.AugMeth==1
[Out.XTrain,Out.YTrain] = augmentDeepInsight(Out.XTrain,Out.YTrain);
if Parm.ValidRatio>0
[Out.XValidation,Out.YValidation] = augmentDeepInsight(Out.XValidation,Out.YValidation);
end
elseif Parm.AugMeth==2
[Out.XTrain,Out.YTrain] = augmentDeepInsight2(Out.XTrain,Out.YTrain,Parm.aug_tr);
if Parm.ValidRatio>0
[Out.XValidation,Out.YValidation] = augmentDeepInsight2(Out.XValidation,Out.YValidation,Parm.aug_val);
end
end
end
fprintf('\nMapping of assignment completed.\n');
close all;
end