0

I would like to ask if it is possible to set some weights in a layer to particular number or zero of pretrained model.

For example, I want to download Lecun model and set some weights in the last layer to number e.x 4 and calculate the accuracy.

How can I do that?

double-beep
  • 5,031
  • 17
  • 33
  • 41
S.AMEEN
  • 1,461
  • 4
  • 16
  • 23

1 Answers1

1

You are after "net surgery". In python you can load the net and get direct access to the stored weights. Then you can tweak them as you pleased and save the modified net.

Shai
  • 111,146
  • 38
  • 238
  • 371
  • Many thanks, is there any example to do so and access to a particular weight in a layer as I am new in programming. – S.AMEEN Dec 24 '15 at 15:02
  • 1
    @S.AMEEN please go through the "net surgery" notebook tutorial I linked to in the answer. It contains examples of setting filter weights to specific values (near `In [4]`, and `In [5]`). – Shai Dec 24 '15 at 15:22