forked from alok-ai-lab/DeepInsight3D_pkg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
func_SaveModels.m
52 lines (44 loc) · 1.22 KB
/
func_SaveModels.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
function func_SaveModels(Parm)
% Save model files to folder: DeepInsight3D_pkg/Models/...
model = load('model.mat')
netName = Parm.NetName;
cd DeepResults
net = load(model.fileName);
cd ../
FileRun = Parm.FileRun;
Stages = Parm.Stage;
Ask = Parm.SaveModels;
if strcmp(Parm.PATH{1}(end),'/')==0
Parm.PATH{1} = [Parm.PATH{1},'/'];
end
if strcmp(Parm.PATH{2}(end),'/')==0
Parm.PATH{2} = [Parm.PATH{2},'/'];
end
inputSize = net.trainedNet.Layers(1).InputSize(1:2);
classes = net.trainedNet.Layers(end).Classes;
layerName = activationLayerName(netName);
if model.Norm==1
Data = load('Out1.mat');
else
Data = load('Out2.mat');
end
if Parm.Augment==1
Data.YTrain = Data.orgYTrain;
end
if strcmp(lower(Ask),'y')==1
Directory = [Parm.PATH{2},FileRun,'/Stage',num2str(Stages),'/'];
if isfolder(Directory(1:end-8))==0
unix(['mkdir ',Directory(1:end-8)]);
end
if isfolder(Directory)==0
unix(['mkdir ',Directory(1:end-1)]);
end
if model.Norm==1
unix(['cp Out1.mat ',Directory]);
else
unix(['cp Out2.mat ',Directory]);
end
unix(['cp model.mat ',Directory]);
unix(['cp DeepResults/',num2str(model.fileName),' ',Directory]);
disp('Model Files Saved...');
end