简体   繁体   English

更新最终 FC 层以微调 AlexNet 时出错

[英]Error in updating final FC layer for fine tuning AlexNet

Hello I have recently started working on fine tuning the Alexnet model for my own dataset.您好,我最近开始为我自己的数据集微调 Alexnet 模型。

I want to modify the final two layer as I have only two classes:我想修改最后两层,因为我只有两个类:

net.layers = net.layers(1:end-2); 

But when I modify the final FC layer like that and it gives me error.但是当我像这样修改最终的 FC 层时,它给了我错误。

net.layers{end+1} = struct('type', 'conv',...
'weights', {{f*randn(1,1,4196,2, 'single'), zeros(1,2,'single')}},...
'stride', [1 1],...
'pad', [0 0 0 0]) ;
Cell contents assignment to a non-cell array object.

Anyone, please help me resolve the error任何人,请帮我解决错误

Thanks谢谢

UPDATE:更新:

在此处输入图片说明

It seems that your net is a DagNN.看来你的网络是一个 DagNN。 You can't add layer like a simplenn.您不能像 simplenn 那样添加图层。 You can either modify the weight matrix in the corresponding net.param(.) of net.layer(end) (assuming net.layer(end) is the final FC) or remove the last layer and add a new one yourself using the helper functions (ie, removeLayer and addLayer) provided in the @DagNN folder.您可以修改 net.layer(end) 的相应 net.param(.) 中的权重矩阵(假设 net.layer(end) 是最终的 FC)或删除最后一层并使用帮助程序自己添加一个新层@DagNN 文件夹中提供的函数(即 removeLayer 和 addLayer)。 Note that removeLayer and addLayer are private functions of class DagNN.请注意,removeLayer 和 addLayer 是类 DagNN 的私有函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM