Problem with lgraph generation

5 次查看(过去 30 天)
Eva
Eva 2023-7-12
回答: Eva 2023-7-12
I am trying to implement a trainRCNNObjectDetector task.
I am closely following the example on the following webpage:
I have finally gotten all of my data into the correct input format, where the MATLAB commands are no longer giving me error feedback on the structure of the input data.
Next, in my code, I invoke usage of the following command to create an lgraph for my application, and I later successfully train the network :
lgraph = resnetLayers([740 1400 3], 2);
...
net = trainNetwork(imageDatastoreObj,lgraph,options);
Ok?
Next, I want to invoke the trainRCNNObjectDetector code, and I execute the following (note:not all declared variables are shown here):
load('myTable.mat')
T(:,1) = XTrain(:,1);
valsTable = T;
rcnn = trainRCNNObjectDetector(valsTable, net.Layers, options, 'NegativeOverlapRange', [0 0.3]);
I get the following error:
Error using trainRCNNObjectDetector
Invalid network.
Caused by:
Layer 'stack1_block1_add': Unconnected input. Each layer input must be connected to the output of another layer.
Layer 'stack1_block2_add': Unconnected input. Each layer input must be connected to the output of another layer.
Layer 'stack1_block3_add': Unconnected input. Each layer input must be connected to the output of another layer.
Layer 'stack2_block1_add': Unconnected input. Each layer input must be connected to the output of another layer.
Layer 'stack2_block2_add': Unconnected input. Each layer input must be connected to the output of another layer.
Layer 'stack2_block3_add': Unconnected input. Each layer input must be connected to the output of another layer.
Layer 'stack2_block4_add': Unconnected input. Each layer input must be connected to the output of another layer.
Layer 'stack3_block1_add': Unconnected input. Each layer input must be connected to the output of another layer.
Layer 'stack3_block2_add': Unconnected input. Each layer input must be connected to the output of another layer.
Layer 'stack3_block3_add': Unconnected input. Each layer input must be connected to the output of another layer.
Layer 'stack3_block4_add': Unconnected input. Each layer input must be connected to the output of another layer.
Layer 'stack3_block5_add': Unconnected input. Each layer input must be connected to the output of another layer.
Layer 'stack3_block6_add': Unconnected input. Each layer input must be connected to the output of another layer.
Layer 'stack4_block1_add': Unconnected input. Each layer input must be connected to the output of another layer.
Layer 'stack4_block2_add': Unconnected input. Each layer input must be connected to the output of another layer.
Layer 'stack4_block3_add': Unconnected input. Each layer input must be connected to the output of another layer.
Next, after researching on chatGPT and other sources,
I attempt the following code and get the following error:
>> lgraph = connectLayers(lgraph, 'stack1_block1_bn3', 'stack1_block1_add/in2');
lgraph = connectLayers(lgraph, 'stack1_block1_skip_bn', 'stack1_block1_add/in1');
Error using nnet.cnn.LayerGraph/connectLayers
Unable to connect to 'stack1_block1_add/in2'. This input is already connected.
>> lgraph = connectLayers(lgraph, 'stack1_block1_skip_bn', 'stack1_block1_add/in1');
Error using nnet.cnn.LayerGraph/connectLayers
Unable to connect to 'stack1_block1_add/in1'. This input is already connected.
When I perform analyzeNetwork(net), all of the connections show that they are connected. None of the points in the analyzeNetwork(net)-generated graphic look disconnected.
What am I possibly doing wrong here ? OR, is this a MATLAB issue? If you need to see more code, just ask and I will post my code.

采纳的回答

Eva
Eva 2023-7-12
No need to burn time on this,
found the solution:
https://www.mathworks.com/matlabcentral/answers/411767-trainnetwork-invalid-network

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

标签

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by