caffe icon indicating copy to clipboard operation
caffe copied to clipboard

Layertype: Locally connected is not available?

Open shreyassaxena opened this issue 12 years ago • 11 comments

Some of papers using CNN [1] have a small trick. Instead of sharing the weights of a filter over an entire image, the weights depend on the local position. These are called as locally connected CNN.

Is it possible that this functionality could be added?

Update: I checked the previous issues, and found that this is an open issue.

[1] DeepFace: Closing the Gap to Human-Level Performance in Face Verification

shreyassaxena avatar Aug 01 '14 14:08 shreyassaxena

It is not available as of now. It is relatively easy to simulate, though - having an im2col layer followed by a fully connected layer will do. Of course, for large batches you may encounter some numerical issues.

Another (more reasonable option) is to change the convolutional layer to have untied weights at different locations.

Not sure if this is on our radar since everyone is busy with his/her own research, but if you decide to implement it, a pull request is highly appreciated :)

Yangqing avatar Aug 01 '14 17:08 Yangqing

I would love to contribute. I am looking forward to contribute to MATLAB wrappers, at the moment I am getting familiar with the code.

The second suggestion is more reasonable though.

If I get around it, I will def. send a pull request. If you get time, I would highly appreciate it ( along with others who had similar request ). Having this layer, attracts mainly people working on faces as this is a common layer in the network arch.

shreyassaxena avatar Aug 01 '14 17:08 shreyassaxena

Closing: duplicate of #259 #295 #563. Please do send a PR if you add a locally-connected layer.

shelhamer avatar Aug 07 '14 06:08 shelhamer

Yes sure, I will.

shreyassaxena avatar Aug 07 '14 07:08 shreyassaxena

Hi, I wanted to ask if you implemented the locally connected layer and willing to share the code? Thank you.

benjaminklein avatar Aug 15 '14 11:08 benjaminklein

Hi, have you implemented the locally connected layer?I am quite interested in this, thank you! @shreyassaxena

lixin7895123 avatar Oct 09 '14 12:10 lixin7895123

Hello, No due to time-constraints I have not. I moved to cuda-convnet, since they have the local filters implemented. Hope it helps. @benjaminklein @lixin7895123

shreyassaxena avatar Oct 09 '14 12:10 shreyassaxena

thanks!

[email protected]

From: shreyassaxena Date: 2014-10-09 20:23 To: BVLC/caffe CC: lixin7895123 Subject: Re: [caffe] Layertype: Locally connected is not available? (#837) Hello, No due to time-constraints I have not. I moved to cuda-convnet, since they have the local filters implemented. Hope it helps. @benjaminklein @lixin7895123 — Reply to this email directly or view it on GitHub.

lixin7895123 avatar Oct 09 '14 12:10 lixin7895123

Hi @Yangqing, seems the first option you've proposed should be an im2col layer followed by a conv layer (1 stride, 1 kernel size, 0 padding) but not by a fc layer.

7hil avatar Dec 02 '14 08:12 7hil

Could anyone help me on how to use the im2col layer? I'm using the Python interface and would normally add a layer into the prototxt file, but this layer is not described in caffe.proto

kevin-li avatar Jun 29 '16 10:06 kevin-li

I implement a local convolution layer here and will appreciate any suggestions.

knsong avatar Oct 10 '16 12:10 knsong