Clear Filters
Clear Filters

I don't know where the error is? Why Group_Test1 does not have the same labeling as the testset?

1 view (last 30 days)
clear all
clc
%Group_Train1=zeros(26459);
%Group_Test1=zeros(6033);
PF = 'D:\Project\DB1\train\' % Parent Folder
SFL = dir(PF) ;% List the sub folders
[mp, np] = size(SFL); % compute size = number of subfolders & files & . & ..
csf=0;% counter of JUST subfolders found in PF
Tr=1;
for i=3:mp
%% keep only folders:
k = strfind(SFL(i).name,'.');
if isempty(strfind(SFL(i).name,'.'))
csf = csf +1; % one sub folder found
SFN = SFL(i).name ;% extract his name
tifList = ls(sprintf('%s%s%s%s',PF,SFN,'\','*.tif')); % list all jpg files
[ms, ns] = size(tifList); % ms = number of image files found
%% Processing for each tif file:
for j=1:ms
tifFileName = tifList(j,:); % extract name of tif file
%for currentImage1 = 1:ms
IM=imread([PF SFN '\' tifFileName]);
%hold on;
%k=1;
%for i=1:csf
%for j=1:ms
Group_Train1(Tr)=[i-2]
Tr=Tr+1;
end
end
PF_SFN_imgName = sprintf('%s%s%s',PF,SFN,'\',tifFileName)
%imshow(PF_SFN_imgName)
%pause(1)
end
save('Group_Train','Group_Train1');
%------------------------------
PF = 'D:\Project\DB1\test\' % Parent Folder
SFL = dir(PF) ;% List the sub folders
[mp1, np] = size(SFL); % compute size = number of subfolders & files & . & ..
csf1=0; % counter of JUST subfolders found in PF
t=1;
for i=3:mp1
%% keep only folders:
P = strfind(SFL(i).name,'.');
if isempty(strfind(SFL(i).name,'.'))
csf1 = csf1 +1; % one sub folder found
SFN = SFL(i).name ;% extract his name
tifList = ls(sprintf('%s%s%s%s',PF,SFN,'\','*.tif')); % list all jpg files
[ms1, ns] = size(tifList); % ms = number of image files found
%% Processing for each tif file:
for j=1:ms1
tifFileName = tifList(j,:); % extract name of tif file
IM=imread([PF SFN '\' tifFileName]);
%hold on;
%t=1;
%for i=1:csf1
% for j=1:ms1
Group_Test1(t)=[i-2]
t=t+1;
% end
end
end
PF_SFN_imgName = sprintf('%s%s%s',PF,SFN,'\',tifFileName);
%
%imshow(PF_SFN_imgName)
%pause(1)
end
save('Group_Test','Group_Test1');
%----------------------

Answers (0)

Categories

Find more on QSP, PKPD, and Systems Biology in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!