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 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