Implement Convolution With Known Fixed Weights in Caffe?

839 views
Skip to first unread message

Wilf Rosenbaum

unread,
Jul 27, 2016, 12:56:52 PM7/27/16
to Caffe Users
Hi Guys, 
  I would like to create a layer in a Caffe network that represents convolution with a known filter with fixed weights. This requires me to specify the initial weights of the convolution filter and to tell Caffe not to modify these weights during training. I believe that I can tell Caffe not to modify the convolution weights by specifying {lr_mult : 0} for the convolution layer. However I don't know the correct way to initialize the fixed weights of the filter. Can someone please point me to the correct syntax in .prototxt format or in python/C++ code? 
Many thanks!
Cheers,
Wilf 

Evan Shelhamer

unread,
Jul 27, 2016, 5:59:54 PM7/27/16
to Wilf Rosenbaum, Caffe Users
Take a look at the editing model parameters notebook for how to manipulate net params through Python. It includes an example of how to insert blur and edge kernels into a convolution layer. Once you set the weights and save the net, you can keep them constant with `lr_mult: 0` as you noted.

Happy brewing,

Evan Shelhamer





--
You received this message because you are subscribed to the Google Groups "Caffe Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to caffe-users...@googlegroups.com.
To post to this group, send email to caffe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/caffe-users/2f3b3179-383f-4733-aca0-53ee01e891a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wilf Rosenbaum

unread,
Jul 28, 2016, 11:27:11 AM7/28/16
to Caffe Users, wilf.ro...@gmail.com
Oh that's great - thanks very much Evan. I am a Caffe noob, and though I had looked through the Net Surgery Python Notebook previously I considered it more of an advanced topic for my simple learning experiments, and thought I will come back to this example when I know a little more. OK, now I'll have a closer read through.

Thanks again for taking the time to answer my question. As I said I am a Caffe noob but I am well aware of your many contributions to Caffe as a developer and as a subject matter expert in this forum. Many thanks - much appreciated. 

Cheers,
Wilf 

Atena Nguyen

unread,
Oct 13, 2017, 1:02:59 PM10/13/17
to Caffe Users
Hi Wilf, 
Do you have any update with fixed weight? I face the same problem now. Your experience would be very helpful. 

Best regards, 
Thuong Nguyen 

Vào 00:27:11 UTC+9 Thứ Sáu, ngày 29 tháng 7 năm 2016, Wilf Rosenbaum đã viết:
Reply all
Reply to author
Forward
0 new messages