Data preparation for CNN

조회 수: 2 (최근 30일)
Rd
Rd 2020년 11월 1일
댓글: Rd 2020년 11월 2일
I have image folder with 10 subfolders. Each subfolder contain 180 images.
I need to call first 60 images in each subfolder and store it in XTrain1 variable; middle 60 images and store it in XTrain2 variable; last 60 Images and store it in XTrain3 variable.
Each variable (XTrain1, XTrain2, XTrain3) should be 4D double.
I tried the following code.
close all;clear;clc
imagefolder = 'C:\Users\manjurama\Desktop\study\PG\PROJECT\Finger vein database multiple copy\database_10';
imds = imageDatastore(imagefolder,'IncludeSubfolders',true,'LabelSource','foldernames');
numTrainFiles = 0.75;
imageSize = [227 227];
[XTrain,YTrain] = splitEachLabel(imds, numTrainFiles,'randomize');
XTrain = augmentedImageDatastore(imageSize,XTrain);
YTrain = augmentedImageDatastore(imageSize,YTrain);
Xtrain1 = XTrain.Files(1:60);
XTrain2 = XTrain.Files(61:120);
XTrain3 = XTrain.Files(121:160);
classes = categories(YTrain);% retrieve the class information with the type of categorical
numClasses = numel(classes);
Following error i got:
The value assigned to variable XTrain2 might be unused.
checking for missing argument or incorrect argument data type in call to funtion 'categories'.
Anybody help me to solve the issue or suggest any alternatives. Thanks in advance for your help.

채택된 답변

Walter Roberson
Walter Roberson 2020년 11월 1일
That kind of datastore does not have any documented method of retrieving the associated category information.
(I am not at my desk so I do not know if there is an undocumented public method or a private property with the information.)
  댓글 수: 1
Rd
Rd 2020년 11월 2일
Thank you for your response. If you find any ways to meet my need kindly let me know.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by