1

Hello I have recently started working on fine tuning the Alexnet model for my own dataset.

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.

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:

enter image description here

Nick
  • 138,499
  • 22
  • 57
  • 95
Addee
  • 663
  • 10
  • 21

1 Answers1

0

It seems that your net is a DagNN. You can't add layer like a 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 (i.e., removeLayer and addLayer) provided in the @DagNN folder. Note that removeLayer and addLayer are private functions of class DagNN.

DataHungry
  • 351
  • 2
  • 9