How to increase network input size for 'Tiny-yolov3-coco'?

3 次查看(过去 30 天)
Greetings,
I want to use 'tiny-yolov3-coco' for detecting the cells. As shown in the Figure, I used a network input size of 416x416. However, the total loss is still high. Therefore I want to increase the network input size to 832x832. The code that I used as follows:
networkInputSize = [832 832 3];
baseNetwork = 'tiny-yolov3-coco';
detector = yolov3ObjectDetector(baseNetwork);
net = detector.Network;
lgraph = layerGraph(net);
imgLayer = imageInputLayer(networkInputSize,"Name","input","Normalization","none");
lgraph = replaceLayer(lgraph,"input",imgLayer);
newbaseNetwork = assembleNetwork(lgraph);
However, I got the error as follows:
Error in trainyolov3 (line 61)
newbaseNetwork = assembleNetwork(lgraph);
Caused by:
Network: Missing output layer. The network must have at least one output layer.
Layer 'conv2d_10': Unconnected output. Each layer output must be connected to the input of another layer.
Layer 'conv2d_13': Unconnected output. Each layer output must be connected to the input of another layer.

采纳的回答

Khushboo
Khushboo 2022-10-31
Hello,
The network that you are using is a dlnetwork (which does not have output layers) and not a DAG network. The assembleNetwork function returns a DAG network ready for prediction. If using a dlnetwork works for your usecase, you can do the following:
networkInputSize = [832 832 3];
baseNetwork = 'tiny-yolov3-coco';
detector = yolov3ObjectDetector(baseNetwork);
net = detector.Network;
lgraph = layerGraph(net);
imgLayer = imageInputLayer(networkInputSize,"Name","input","Normalization","none");
lgraph = replaceLayer(lgraph,"input",imgLayer);
newbaseNetwork = dlnetwork(lgraph);
Hope this answers your question!
  2 个评论
Fahmi Akmal Dzulkifli
Thank you Sir for the responses. I just want to ask one more question. When I want to create the yolov3 detector, the error appears as follows:
Error using yolov3ObjectDetector>iValidateYOLOv3Network (line 1234)
Number of filters in the output convolutional layer must be 56 for 8 anchor boxes and 2 classes.
My code for anhor boxes is:
numAnchors = 16;
[anchors, meanIoU] = estimateAnchorBoxes(trainingDataForEstimation, numAnchors);
area = anchors(:, 1).*anchors(:, 2);
[~, idx] = sort(area, 'descend');
anchors = anchors(idx, :);
anchorBoxes = {anchors(1:8,:)
anchors(9:16,:)
};
classNames = trainingDataTbl.Properties.VariableNames(2:end);
Can you detect what is the problem with the code?
Khushboo
Khushboo 2022-10-31
Hello,
I am not able to understand what this code does. But from what I assume, the error is related to the number of dimensions defined for the last convolution layer. As you are changing the input size, I think the rest of the dimensions will have to be changes correspondingly. Kindly make sure you have done that.

请先登录,再进行评论。

更多回答(0 个)

类别

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

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by