Preparing a datastore for a multi-input CNN

2 次查看(过去 30 天)
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)

回答(1 个)

yanqi liu
yanqi liu 2021-12-24
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 个评论
mingsheng wang
mingsheng wang 2022-4-27
你好,这个多输入的网络智能用datastore吗?能不能直接用table呢?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by