-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataload.m
61 lines (53 loc) · 1.41 KB
/
dataload.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
X=zeros(10000,3072);
srcFiles = dir('C:\Users\Ritesh\Desktop\brainscans\train\*.png'); % the folder in which ur images exists
for i = 1 : 10000
filename = strcat('C:\Users\Ritesh\Desktop\brainscans\train\',srcFiles(i).name);
Xtemp=imread(filename);
X(i,:) = reshape(Xtemp,[3072,1]);
X(i,1:1024)=X(i,1:1024)-mean(X(i,1:1024));
X(i,1:1024)=X(i,1:1024)/std(X(i,1:1024));
X(i,1025:2048)=X(i,1025:2048)-mean(X(i,1025:2048));
X(i,1025:2048)=X(i,1025:2048)/std(X(i,1025:2048));
X(i,2049:3072)=X(i,2049:3072)-mean(X(i,2049:3072));
X(i,2049:3072)=X(i,2049:3072)/std(X(i,2049:3072));
end
%X=I;
%X=zeros(50000,3073);
%X(:,1)=ones(50000,1);
%X(:,2:3073)=I;
%temp=csvread('trainlabels.csv',0,0,[0,0,499,1]);
T=readtable('trainlabels.csv');
exT=T{1:10000,{'label'}};
Y=zeros(10000,10);
for i=1:10000
if(strcmp(exT(i),"frog"))
Y(i,1)=1;
end
if(strcmp(exT(i),"truck"))
Y(i,2)=1;
end
if(strcmp(exT(i),"deer"))
Y(i,3)=1;
end
if(strcmp(exT(i),"ship"))
Y(i,4)=1;
end
if(strcmp(exT(i),"airplane"))
Y(i,5)=1;
end
if(strcmp(exT(i),"automobile"))
Y(i,6)=1;
end
if(strcmp(exT(i),"horse"))
Y(i,7)=1;
end
if(strcmp(exT(i),"cat"))
Y(i,8)=1;
end
if(strcmp(exT(i),"dog"))
Y(i,9)=1;
end
if(strcmp(exT(i),"bird"))
Y(i,10)=1;
end
end