Read dataset file name only
Mostrar comentarios más antiguos
Hello, i want to ask how i want my code can read dataset folder name only like the folder name like 0,1,2,3,4,5
Right now i can only read image name only. So, i want the system can read and call dataset folder name.
Here my code
SelectFile.m
%N = 'C:\Users\USER\Documents\MATLAB\Project\asl_dataset\asl_dataset';
function d = SelectFile(A,N)
M = 6; % number of class [0 to 5 ]
cnt(1:M)=0; % counter for each class
% get all filenames in the data directory
D = dir(A);
% extract only N file
d =D(1:N);
% see the statistic of each class pattern
for i=1:N
fn = D(i).asl_dataset; %file name
x = fn(38); % extract target from filename
%find the distribution of file being extracted per class
if (x == '0')
cnt(1)=cnt(1)+1;
elseif (x=='1')
cnt(2)=cnt(2)+1;
elseif (x=='2')
cnt(3)=cnt(3)+1;
elseif (x=='3')
cnt(4)=cnt(4)+1;
elseif (x=='4')
cnt(5)=cnt(5)+1;
elseif (x=='5')
cnt(6)=cnt(6)+1;
end
end
cnt
bar([0 1 2 3 4 5],cnt);
title('statistic number of pattern per class');
text(0:5,cnt,num2str(cnt'),'vert','bottom','horiz','center');
end
sample.m
D = 'C:\Users\USER\Documents\MATLAB\Project\asl_dataset\asl_dataset';
d1 = SelectFile(D,360);
[Dat,Trgt] = FExtraction(d1);
net = NNTrain(Dat,Trgt);
%Test NN using Test Patterns
%D = 'C:\RESEARCH\pattern\fingers\test\*.png';
D = 'C:\Users\USER\Documents\MATLAB\Project\asl_dataset\asl_dataset';
d2 = SelectFile(D,60);
[Data,Target] = FExtraction(d2);
O = NNTest(net,Data,Target);
disp('recognition rate is : ');
disp(O);
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Deep Learning Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!