-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathget_svm.m
More file actions
25 lines (22 loc) · 1.05 KB
/
Copy pathget_svm.m
File metadata and controls
25 lines (22 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function [cnn_cell, map_cell, trained_flag] = get_svm(config)
%This function checks in the main path if there is a trained cnn.
%Asks if you want to train a new one or use the existing one
path = config.data{1};
svm_filename = 'svm_session.mat';
%first we check if there is a cnn_session.mat file in the main path
if exist(fullfile(path, svm_filename), 'file')
message = ['There is already a trained SVM file in your main file, do you want to create a new one?'];
choice = questdlg(message, 'SkyNet Interface', 'Yes', 'No', 'No');
if strcmp(choice, 'Yes')
svm_cell = cell(1,numel(config.data{7}));%create a cell for each pixel window
map_cell = cell(1,numel(config.data{7}));
trained_flag = 0; %The cnn's are not trained
else
load(fullfile(path, svm_filename))
trained_flag = 1;
end
else %There is no file, so create a new one
cnn_cell = cell(1,numel(config.data{7}));%create a cell for each pixel window
map_cell = cell(1,numel(config.data{7}));
trained_flag = 0; %The cnn's are not trained
end