Preparing a datastore for a multi-input CNN

2 views (last 30 days)
I have written the following code based on a question and answer on mathworks website. The problem is that the resulting datastore has only one row:
root_train='E:\DeepNet\Combined\tr';
trdatstore = imageDatastore(root_train,'IncludeSubfolders',true,'LabelSource','foldernames');
imds = trdatstore;
augimdsTrain = augmentedImageDatastore([224 224 3],imds)
augimdsTrain.MiniBatchSize =1
taugimdsTrain = transform(augimdsTrain,@(x)x{1,1})
labelsTrain = transform(augimdsTrain,@(x){x{1,2}})
cds = combine(taugimdsTrain,taugimdsTrain,labelsTrain)

Answers (1)

yanqi liu
yanqi liu on 24 Dec 2021
visiondataPath = fullfile(matlabroot,'toolbox','vision','visiondata');
trdatstore = imageDatastore(visiondataPath,'IncludeSubfolders',true,'LabelSource','foldernames');
imds = trdatstore;
augimdsTrain = augmentedImageDatastore([224 224 3],imds)
augimdsTrain =
augmentedImageDatastore with properties: NumObservations: 2450 Files: {2450×1 cell} AlternateFileSystemRoots: {} MiniBatchSize: 128 DataAugmentation: 'none' ColorPreprocessing: 'none' OutputSize: [224 224] OutputSizeMode: 'resize' DispatchInBackground: 0
augimdsTrain.MiniBatchSize =1
augimdsTrain =
augmentedImageDatastore with properties: NumObservations: 2450 Files: {2450×1 cell} AlternateFileSystemRoots: {} MiniBatchSize: 1 DataAugmentation: 'none' ColorPreprocessing: 'none' OutputSize: [224 224] OutputSizeMode: 'resize' DispatchInBackground: 0
taugimdsTrain = transform(augimdsTrain,@(x)x{1,1})
taugimdsTrain =
TransformedDatastore with properties: UnderlyingDatastores: {augmentedImageDatastore} SupportedOutputFormats: ["txt" "csv" "xlsx" "xls" "parquet" "parq" "png" "jpg" "jpeg" "tif" "tiff" "wav" "flac" "ogg" "mp4" "m4a"] Transforms: {@(x)x{1,1}} IncludeInfo: 0
labelsTrain = transform(augimdsTrain,@(x){x{1,2}})
labelsTrain =
TransformedDatastore with properties: UnderlyingDatastores: {augmentedImageDatastore} SupportedOutputFormats: ["txt" "csv" "xlsx" "xls" "parquet" "parq" "png" "jpg" "jpeg" "tif" "tiff" "wav" "flac" "ogg" "mp4" "m4a"] Transforms: {@(x){x{1,2}}} IncludeInfo: 0
cds = combine(taugimdsTrain,taugimdsTrain,labelsTrain)
cds =
CombinedDatastore with properties: UnderlyingDatastores: {[1×1 matlab.io.datastore.TransformedDatastore] [1×1 matlab.io.datastore.TransformedDatastore] [1×1 matlab.io.datastore.TransformedDatastore]} SupportedOutputFormats: ["txt" "csv" "xlsx" "xls" "parquet" "parq" "png" "jpg" "jpeg" "tif" "tiff" "wav" "flac" "ogg" "mp4" "m4a"]
  1 Comment
mingsheng wang
mingsheng wang on 27 Apr 2022
你好,这个多输入的网络智能用datastore吗?能不能直接用table呢?

Sign in to comment.

Categories

Find more on Image Data Workflows in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!