Error using trainNetwork (line 165) - Dot indexing is not supported for variables of this type

4 vues (au cours des 30 derniers jours)
I am trying to do Deep Learning Image Segmentation on a MATLAB Linux Data Center application. I changed the code that it should be executable on any windows computer. All required data to execute the code is attached. To decrease the data size i reduced the image and label date, actually i use 14099 data pairs. For execution save all data and the code as .mat file in the same folder.
clear all
clc
close all
%% randome string for save variables in workspace before and after learning procoess
symbols = ['a':'z' 'A':'Z' '0':'9'];
MAX_ST_LENGTH = 50;
stLength = randi(MAX_ST_LENGTH);
numssss = randi(numel(symbols),[1 stLength]);
st = symbols (numssss);
%% Read paths of images and labels
ms.UseParallel = true;
f = dir(fullfile('Bilder\*.jpg'));
n = length(f);
g = dir(fullfile('Labels\*.jpg'));
m = length(g);
%% creat table of images and labels with full paths
ANZ = 10;
m = 0;
y = 1;
m = m+ANZ; %14099
sz = [ANZ 2];
varTypes = {'char','char'};
varNames = {'imageSource','labelSource'};
data = table('Size',sz,'VariableTypes',varTypes,'VariableNames',varNames);
s = 1;
for i = y:1:m
data.imageSource(s) = cellstr(strcat(f(i).folder, '\', f(i).name));
data.labelSource(s) = cellstr(strcat(g(i).folder, '\', g(i).name));
s = s+1;
end
%% devide data in train, test and validation data
idx = randperm(ANZ);
train = (ANZ*0:ANZ*0.6);
test = (ANZ*0.8:ANZ);
trainmax = int64(max(train));
testmin = int64(min(test));
testmax = int64(max(test));
TRAIN = data(1:trainmax,:);
TEST = data(testmin:testmax,:);
VAL = data(trainmax:testmin,:);
%% calculate distribution of classes
classes = ["Schiene","Bild"];
pixelLabelIDs = [1 0];
location = data.labelSource;
% C = readimage(pxds,1);
cmap = colormap;
% B = labeloverlay(I,C,'ColorMap',cmap);
% imshow(B)
% colorbar;
pxds = pixelLabelDatastore(location,classes,pixelLabelIDs);
tbl = countEachLabel(pxds);
frequency = tbl.PixelCount/sum(tbl.PixelCount);
% bar(1:numel(classes),frequency)
% xticks(1:numel(classes))
% xticklabels(tbl.Name)
% xtickangle(45)
% ylabel('Frequency')
%% load options and layer structure of network
% gpuDevice(1)
% Specify the network image size. This is typically the same as the traing image sizes.
imageSize = [1080 1920 3];
% Specify the number of classes.
numClasses = numel(classes);
% Create DeepLab v3+.
lgraph = helperDeeplabv3PlusResnet18(imageSize, numClasses);
imageFreq = tbl.PixelCount ./ tbl.ImagePixelCount;
classWeights = median(imageFreq) ./ imageFreq
pxLayer = pixelClassificationLayer('Name','labels','Classes',tbl.Name,'ClassWeights',classWeights);
lgraph = replaceLayer(lgraph,"classification",pxLayer);
% Define validation data.
pximdsVal = pixelLabelImageDatastore(imageDatastore(VAL.imageSource),pixelLabelDatastore(VAL.labelSource,classes,pixelLabelIDs));
% Define training options.
options = trainingOptions('sgdm', ...
'LearnRateSchedule','piecewise',...
'LearnRateDropPeriod',2,...
'LearnRateDropFactor',0.25,...
'Momentum',0.95, ... % nur bei sgdm-Algorithmus, nicht bei 'adam'
'InitialLearnRate',0.0075, ...
'L2Regularization',0.0025, ...
'ValidationData',pximdsVal,...
'MaxEpochs',30, ...
'MiniBatchSize',48, ...
'Shuffle','every-epoch', ...
'CheckpointPath', tempdir, ...
'VerboseFrequency',2,...
'ExecutionEnvironment','multi-gpu',...
'ValidationPatience', 26); ... % 'Plots','training-progress',...
augmenter = imageDataAugmenter('RandXReflection',true,...
'RandXTranslation',[-10 10],'RandYTranslation',[-10 10]);
pximds = pixelLabelImageDatastore(imageDatastore(TRAIN.imageSource),pixelLabelDatastore(TRAIN.labelSource,classes,pixelLabelIDs));
% 'DataAugmentation',augmenter
%% Save workspace before learning process
f1 = strcat('before_',st);
save(f1)
%% learning process
doTraining = true; % Start training using trainNetwork if the doTraining flag is true. Otherwise, load a pretrained network.
if doTraining
net = trainNetwork(pximds,lgraph,options);
else
end
%% save workspace after learning process
f2 = strcat('after_',st);
save(f2)
After execution of this code on my windows computer i got this error:
windows_error.JPG
I know that my hardware on my laptop is still too weak to calculate the learning process, but on MATLAB Linux Data Center application i use the following hardware:
CPU: Intel Xeon Gold 6134 („Skylake“) @3.2 GHz = 16 cores
GPU: 2x NVIDIA Tesla V100 32GB
RAM: 48GB
So i think the hardware on the Data Center application is still strong enough.
But after execution the same code with changed data paths on MATLAB Linux Data Center application, i got this error:
linux_error.JPG

Réponses (1)

Gabija Marsalkaite
Gabija Marsalkaite le 18 Juil 2019
Dot indexing is not supported for variables of this type may be caused by missing or unsupported layer. Please make sure that you have R2019a, Vision Toolbox and correct support packages. GPU error can be caused by out of date drivers - check that by typing gpuDevice. Let us know if that helped.
  3 commentaires
Silvia Giannini
Silvia Giannini le 22 Juil 2019
Are the two V100 on the same machine from which you are running MATLAB? Check also that you have installed the Parallel Computing Toolbox (you can type ver in the command line to verify installed products and versions).
Johannes Decker
Johannes Decker le 22 Juil 2019
So far as i know the two V100 should be on the same machine where matlab is running.
Parallel Computing Toolbox, Computer Vision Toolbox and Deep Learning Toolbox are installed.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by