Preparing a datastore for a multi-input CNN

2 Ansichten (letzte 30 Tage)
Ali Hajnayeb
Ali Hajnayeb am 23 Dez. 2021
Kommentiert: mingsheng wang am 27 Apr. 2022
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)

Antworten (1)

yanqi liu
yanqi liu am 24 Dez. 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 Kommentar
mingsheng wang
mingsheng wang am 27 Apr. 2022
你好,这个多输入的网络智能用datastore吗?能不能直接用table呢?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Image Data Workflows finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by