-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetValidationData.m
64 lines (37 loc) · 1.38 KB
/
getValidationData.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
% only upright test images in directory
testFolder='pictures\'; %%%%% your test directory
files=dir(testFolder);
%get images
clear filenames
for i=3:size(files,1)
filenames{i-2,1}=files(i).name;
end
%generate train data
for i=1:size(filenames,1)
type=strsplit(filenames{i},'-');
type=strsplit(type{2},'.');
type=str2double(type{1});
if(type == 5 | type == 3| type == 4)
disp(i + "/" + size(filenames,1));
I=imread(strcat(testFolder,(filenames{i})));
I = getValidationImage(I);
correctId=strsplit(filenames{i},'-');
correctId=str2double(correctId{1});
mkdir("validationImages/"+correctId+"/")
imwrite(I,"validationImages/"+correctId+'/'+type+'.png')
% trainingInput = cat(3, trainingInput, I);
% trainingOutput=[trainingOutput, correctId];
% size(trainingInput)
% size(trainingOutput)
end
end
% save('training','trainingInput','trainingOutput')
%This function is going to make the image lighter from the basic image
function [Image] = getValidationImage(Image)
% input : I (upright raw RGB image)
% output : Image made for the training dataset
%get
% Image = getFaceCropped(Image);
Image = imresize(Image, [224 224]);
% Image = rgb2gray(Image);
end