Azzera filtri
Azzera filtri

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

2 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Khushboo
Khushboo il 31 Ott 2022
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 Commenti
Fahmi Akmal Dzulkifli
Fahmi Akmal Dzulkifli il 31 Ott 2022
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 il 31 Ott 2022
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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Sequence and Numeric Feature Data Workflows in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by