Why do I get the error"Training using trainNetwork failed. Duplicate table variable name: 'input'"

4 Ansichten (letzte 30 Tage)
When I use ’combine‘ to connet 'TrainA_Train' and 'TrainB_Train' , then I get the error"Training using trainNetwork failed. Duplicate table variable name: 'input'"
Regarding ’TranA‘, it is a file read using the 'imageDatastore'.
Regarding ’TranB‘, it is also a file read using the 'imageDatastore'.
this is my code:
TrainA = imageDatastore("C:\Users\Administrator\Desktop\data1","IncludeSubfolders",true,"LabelSource","foldernames");
[TrainA_Train, TrainA_Valid, TrainA_test] = splitEachLabel(imdsTraingray,0.6,0.2,"randomized");
TrainB = imageDatastore("C:\Users\Administrator\Desktop\data2","IncludeSubfolders",true,"LabelSource","foldernames");
[TrainB_Train, TrainB_Valid, TrainB_test] = splitEachLabel(imdsTraingray,0.6,0.2,"randomized");
Train = combine(TrainA_Train,TrainB_Train);
Valid = combine(TrainA_Valid,TrainB_Valid);
opts = trainingOptions("adam",...
"ExecutionEnvironment","auto",...
"InitialLearnRate",0.0001,...
"LearnRateDropFactor",0.01,...
"LearnRateDropPeriod",10,...
"LearnRateSchedule","piecewise",...
"MaxEpochs",20,...
"MiniBatchSize",40,...
"Shuffle","every-epoch",...
"Plots","training-progress",...
"ValidationData",Valid);
[net, traininfo] = trainNetwork(Train,lgraph,opts);
Note:I omitted the network model
I want to train a deep neural network with 2 inputs and 1 output,but I don't konw how to revise this problem.

Antworten (1)

Cris LaPierre
Cris LaPierre am 11 Mai 2023
I think this is because you are incorrectly using the same datastore (imdsTraingray?) for your splitEachLabel commands. I think you should be using TrainA and TrainB.
TrainA = imageDatastore("C:\Users\Administrator\Desktop\data1","IncludeSubfolders",true,"LabelSource","foldernames");
[TrainA_Train, TrainA_Valid, TrainA_test] = splitEachLabel(imdsTraingray,0.6,0.2,"randomized");
TrainB = imageDatastore("C:\Users\Administrator\Desktop\data2","IncludeSubfolders",true,"LabelSource","foldernames");
[TrainB_Train, TrainB_Valid, TrainB_test] = splitEachLabel(imdsTraingray,0.6,0.2,"randomized");
Try the following instead
TrainA = imageDatastore("C:\Users\Administrator\Desktop\data1","IncludeSubfolders",true,"LabelSource","foldernames");
[TrainA_Train, TrainA_Valid, TrainA_test] = splitEachLabel(TrainA,0.6,0.2,"randomized");
TrainB = imageDatastore("C:\Users\Administrator\Desktop\data2","IncludeSubfolders",true,"LabelSource","foldernames");
[TrainB_Train, TrainB_Valid, TrainB_test] = splitEachLabel(TrainB,0.6,0.2,"randomized");

Kategorien

Mehr zu Deep Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by