Hi, I have a problem to extract the lgraph of my 3d CNN
when I write
net=googlenet;
lgraph = layerGraph(net);
there is no problem.
But when I write
net=myCNNnet;
lgraph = layerGraph(net);
There is an error
"Error using layerGraph (line 58)
The value of 'Layers' is invalid. Layers must be an array of layers."
The analysis of the network is problem free so what seems to be the problem, could you help me?

댓글 수: 1

The 3d CNN I have been using is the code shared ResNET-18 3d function
I have extracted the final graph of the network like this, so there is not a problem while replacing the layers.
lgraph = layerGraph(net.Layers);
But when I have come to the part to train the network, there is still an error, like the previous one.
netTransfer = trainNetwork(dsTrain,fdsTrain.Labels,layers,options);
Error using trainNetwork (line 170)
Layers argument must be an array of layers or a layer graph.
Please help me how can I fix this, I can't understand where the problem is?

댓글을 달려면 로그인하십시오.

 채택된 답변

Amir Ebrahimi
Amir Ebrahimi 2021년 1월 19일

0 개 추천

Hi Esra,
The output argument of ResNET-18 3d function is a layergraph itself. so you do not need to use layerGraph function. Use the output argument of resnet18TL3Dfunction() directly for training.

댓글 수: 4

Esra Kaya
Esra Kaya 2021년 1월 19일
편집: Esra Kaya 2021년 1월 19일
I have to change the input, fully connected layer and classification layer, because my input has 224x224x60x1 size and 4 different classes so I can't use your function directly, how can I apply it, by saving your network with my changes and directly using it for training? Thanks by the way for quick reply.
I have tried it like this but still got the same error, unfortunately.
lgraph=resnet18TL3Dfunction();
netTransfer = trainNetwork(dsTrain,fdsTrain.Labels,lgraph,options);
Error using trainNetwork (line 170)
Layers argument must be an array of layers or a layer graph.
Amir Ebrahimi
Amir Ebrahimi 2021년 1월 20일
Use replaceLayer function to replace any layer you want. Then, use analyzeNetwork function to analyze the network to see if the dimension of weights matches your new input data. Remeber, at the end, you should have a layerGraph for training.
Esra Kaya
Esra Kaya 2021년 1월 22일
I will accept the answer but, still got the same problem, I can not think of anything else to solve this.
Amir Ebrahimi
Amir Ebrahimi 2021년 1월 22일
Send me your email address via private message. Your profile is close to receive direct messages.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

태그

질문:

2021년 1월 12일

댓글:

2021년 1월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by