Error using matlab.io.​datastore.​ImageDatas​tore/horzc​at Array formation and parentheses-style indexing with objects of class 'matlab.io​.datastore​.ImageData​store' is not allowed. Use objects of class 'matlab.io​.datastore​.ImageData​store' only as scalar

2 visualizaciones (últimos 30 días)
How to solve this error
clc; clear all; close all
digitDatasetPath = fullfile('Dataset Rahma')
imds = imageDatastore(digitDatasetPath, ...
'IncludeSubfolders',true, ...
'LabelSource','foldernames');
tbl = countEachLabel(imds);
minSetCount = min(tbl{:,2});
imds = splitEachLabel(imds, minSetCount, 'randomized')
countEachLabel(imds);
[trainingSet, testSet] = splitEachLabel(imds, 0.3,'randomize');
imageSize = [224 224 3];
% auimds = augmentedImageDatastore(ImageSize,imds);
augmentedTrainingSet= augmentedImageDatastore(imageSize,...
trainingSet, 'ColorPreprocessing','gray2rgb');
%To convert and resize any gray scale image to RGB
augmentedTestSet= augmentedImageDatastore(imageSize,...
testSet, 'ColorPreprocessing','gray2rgb');
encodingLayers = [ ...
convolution2dLayer(3,16,'Padding','same'), ...
reluLayer, ...
maxPooling2dLayer(2,'Padding','same','Stride',2), ...
convolution2dLayer(3,8,'Padding','same'), ...
reluLayer, ...
maxPooling2dLayer(2,'Padding','same','Stride',2), ...
convolution2dLayer(3,8,'Padding','same'), ...
reluLayer, ...
maxPooling2dLayer(2,'Padding','same','Stride',2)];
decodingLayers = [ ...
createUpsampleTransponseConvLayer(2,8), ...
reluLayer, ...
createUpsampleTransponseConvLayer(2,8), ...
reluLayer, ...
createUpsampleTransponseConvLayer(2,16), ...
reluLayer, ...
convolution2dLayer(3,1,'Padding','same'), ...
clippedReluLayer(1.0), ...
regressionLayer];
options = trainingOptions('adam', ...
'MaxEpochs',100, ...
'MiniBatchSize',imds.ReadSize, ...
'Plots','training-progress', ...
'Verbose',false);
layers = [imds,encodingLayers,decodingLayers,options];
net = trainNetwork(imds,layers,options);

Respuestas (1)

Swetha Polemoni
Swetha Polemoni el 20 de Abr. de 2021
Hi
You may find this Matlab answer helpful.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by