필터 지우기
필터 지우기

Error in createLgra​phUsingCon​nections

조회 수: 6 (최근 30일)
Muhammad
Muhammad 2023년 5월 21일
답변: Muhammad 2023년 7월 6일
I am trying to implement Deep Learning model with my dataset and doing tranfer learning. When I run the given code below:
NumberOfClasses = 2;
nn = inceptionv3;
imageSize = nn.Layers(1, 1).InputSize;
lgraph = layerGraph(nn);
lgraph = replaceLayer(lgraph, 'predictions', fullyConnectedLayer(NumberOfClasses, 'Name', 'FC2'));
lgraph = replaceLayer(lgraph, 'ClassificationLayer_predictions', classificationLayer('Name', 'Output'));
layers = lgraph.Layers;
connections = lgraph.Connections;
obj.NN = createLgraphUsingConnections(layers, connections);
'createLgraphUsingConnections' is used in Train Deep Learning Network to Classify New Images.
I get error: 'createLgraphUsingConnections' is used in Train Deep Learning Network to Classify New Images.
How I can fix this issue?
Note: I am using MATLAB R2022a version.

채택된 답변

Muhammad
Muhammad 2023년 7월 6일
% lgraph = createLgraphUsingConnections(layers,connections) creates a layer
% graph with the layers in the layer array |layers| connected by the
% connections in |connections|.
function lgraph = createLgraphUsingConnections(layers,connections)
lgraph = layerGraph();
for i = 1:numel(layers)
lgraph = addLayers(lgraph,layers(i));
end
for c = 1:size(connections,1)
lgraph = connectLayers(lgraph,connections.Source{c},connections.Destination{c});
end
end
I found this code @ Link.

추가 답변 (1개)

Yomna Genina
Yomna Genina 2023년 5월 22일
createLgraphUsingConnections is a helper function used by the example. You can access this function by opening the example files in MATLAB:
openExample('nnet/TransferLearningUsingGoogLeNetExample')
Make sure the function is on the MATLAB path before calling it.

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by