Preparing a datastore for a multi-input CNN

2 ビュー (過去 30 日間)
Ali Hajnayeb
Ali Hajnayeb 2021 年 12 月 23 日
コメント済み: mingsheng wang 2022 年 4 月 27 日
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 Center および File ExchangeImage Data Workflows についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by