フィルターのクリア

Change 'yolov4ObjectDetector' from read-only settings.

8 ビュー (過去 30 日間)
Rodrigo
Rodrigo 2024 年 1 月 10 日
コメント済み: Rodrigo 2024 年 1 月 11 日
Hey.
I am trying to use the yolov4ObjectDetector to complement my Network but I am struggling with one error regarding the name of the ouput layer. However, when I try to replace the layer with an equivalent layer but with the appropriate name I receive the following error:
Unable to set the 'Network' property of class 'yolov4ObjectDetector' because it is read-only.
Error in main (line 57)
detector.Network = replaceLayer(detector.Network,'customOutputConv1',newoutput);
Do you know if it is possible to change this read-only settings?

採用された回答

Ayush Anand
Ayush Anand 2024 年 1 月 10 日
Hi Rodrigo,
In MATLAB, the "Network" property of the "yolov4ObjectDetector" is read-only, which means you cannot directly modify it after the object is created. This is to ensure the integrity of the pre-trained networks and their associated properties.
If you want to modify the network architecture, such as replacing a layer with a different one, you should do this before creating the "yolov4ObjectDetector" object. You would typically modify the layers of the deep learning network and then create the object detector with the modified network.
Here's a general approach on how you could do the same:
% Load the pre-trained YOLOv4 network
net = load('yolov4Network.mat'); % Replace with your network source
lgraph = layerGraph(net);
% Replace the layer with the new layer with the correct name
newLayer = convolution2dLayer([1, 1], numFilters, 'Name', 'newOutputLayerName', 'WeightLearnRateFactor',1, 'BiasLearnRateFactor',1);
lgraph = replaceLayer(lgraph, 'customOutputConv1', newLayer);
% Create the yolov4ObjectDetector with the modified network
detector = yolov4ObjectDetector(lgraph, anchorBoxes, classNames);`
You can refer to the following link to read more on the "replaceLayer" function:
I hope this helps!
  1 件のコメント
Rodrigo
Rodrigo 2024 年 1 月 11 日
Hello, Ayush.
Thank you so much for the reply. I ended up generating the network code of yolov4ObjectDetector using the Deep Network Designer, so now I can manipulate the output layers since there were some changes I needed to do for my application.
Thanks for the help :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by