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

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)

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

At first I want to update my Question:
I executed the code on a windows computer with much better hardware than my laptop.
Hardware setting of the used computer:
Mainboard: Gigabyte Z390 UD; Prozessor: Intel I9-9900K; Grafikkarte: NVIDIA TITAN Xp; Arbeitsspeicher: 32GB; Festplatte: SSD mit 232GB
Befor executoin i resized all images and labels to a new size of 240x320 and the code worked and i have trained my neural network.
@ Gabija Marsalkaite to answer you qestion about gpuDevice
I am very sure that i am using R2019a and Computer Vision Toolbox,
as i typed in the command, i got this answer:
5.JPG
>> gpuDevice
Error using gpuDevice (line 26)
There is a problem with the graphics driver or with this GPU device. Be sure that you have a supported GPU and that the latest
driver is installed.
Caused by:
The CUDA driver could not be loaded. The library name used was 'libcuda.so.1'. The error was:
libcuda.so.1: cannot open shared object file: No such file or directory
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).
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

Community Treasure Hunt

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

Start Hunting!

Translated by