-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrainer.m
More file actions
45 lines (37 loc) · 1.83 KB
/
Copy pathtrainer.m
File metadata and controls
45 lines (37 loc) · 1.83 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
cover = load('C:\Users\Akaps\Desktop\MAT\cover_9.mat');
stego = load('C:\Users\Akaps\Desktop\MAT\stego_9.mat');
% Both loaded structures contain fields 'd' and 'names'. F is a feature
% matrix with individual samples in rows and individual features in
% columns, i.e., the number of columns corresponds to the feautre-space
% dimensionality. Field 'names' contains image filenames of the
% corresponding cover (or stego) images. Note that this format is
% consistent with the previous version of our ensemble implementation.
% Restriction only to images that have both cover and stego features (only
% those will be considered)
names = intersect(cover.names,stego.names);
names = sort(names);
names(strcmp('',names)) = [];
% Prepare cover features C
cover_names = cover.names(ismember(cover.names,names));
[cover_names,ix] = sort(cover_names);
C = cover.d(ismember(cover.names,names),:);
C = C(ix,:);
% Prepare stego features S
stego_names = stego.names(ismember(stego.names,names));
[stego_names,ix] = sort(stego_names);
S = stego.d(ismember(stego.names,names),:);
S = S(ix,:);
% At this point, we have the cover features C and the corresponding
% stego features S. They are correctly synchronized, i.e., the i-th row of
% the stego matrix S comes from the stego image that was created from the
% cover image with features in the i-th row of the cover matrix C.
training_set = linspace(1,size(names,1),size(names,1));
training_names = names(training_set);
% Prepare training features
TRN_cover = C(training_set,:);
TRN_stego = S(training_set,:);
% Train ensemble with all settings default - automatic stopping criterion for
% the number of base learners (L)
[trained_ensemble,results] = ensemble_training(TRN_cover,TRN_stego)
save C:\Users\Akaps\Desktop\MAT\trained_ensemble2.mat trained_ensemble -v7.3;
%disp(results);