Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I specify the number of top blobs allocated for a DataLayer? #1057

Closed
BlGene opened this issue Sep 9, 2014 · 5 comments
Closed

How do I specify the number of top blobs allocated for a DataLayer? #1057

BlGene opened this issue Sep 9, 2014 · 5 comments
Labels

Comments

@BlGene
Copy link
Contributor

BlGene commented Sep 9, 2014

I am trying to implement a net which as the following structure:
Image

I am working in DataLayer::InternalThreadEntry where a Datum is loaded from a DB, then instead of just getting one Datum from DataTransformer::Transform I transfrom the image in three different ways(a,b,c), my question is:

  1. how I specify the DataLayer(i.e. data_layer.cpp) to have 3(+1)* top blobs instead of 1(+1)?
  2. How do I specify the same convolutional layer(s) to run on all top blobs.

* Apparently the label is also provided as a Blob to top, so this is included in the number of top Blobs.

@shelhamer
Copy link
Member

Why change the data layer? Define three data layers and configure the
transformation parameters of each as desired.

For convolution multiple inputs and outputs are supported in the special
case that each is the same size. If that's the case, then just list each
data layer top as a conv bottom. If each data layer top is a different
size, then declare a conv layer for each that take their respective data
layer tops as bottoms, and turn on weight sharing for the convolutions by
setting their param field to the same name like "conv_shared" or whatever
you like.

For the details of weight sharing see #546.

On Tue, Sep 9, 2014 at 4:18 PM, BlGene [email protected] wrote:

I am trying to implement a net which as the following structure:
[image: Image]
https://camo.githubusercontent.com/845f11973526c4c856f00a0793a58f0d70da020b/687474703a2f2f6935372e74696e797069632e636f6d2f6679306e65302e706e67

I am working in DataLayer::InternalThreadEntry where a Datum is loaded
from a DB, then instead of just getting one Datum from
DataTransformer::Transform I transfrom the image in three different
ways(a,b,c), my question is:

how I specify the DataLayer(i.e. data_layer.cpp) to have 3(+1)* top
blobs instead of 1(+1)?
2.

How do I specify the same convolutional layer(s) to run on all top
blobs.

  • Apparently the label is also provided as a Blob to top, so this is
    included in the number of top Blobs.


Reply to this email directly or view it on GitHub
#1057.

@BlGene
Copy link
Contributor Author

BlGene commented Sep 9, 2014

@shelhamer I am working with densely labeled images and I am sampling small patches out of these (see here). This is done using a DataSampler class that frequency balances categories and specifies a random patch from the training set. So I am modifying the data layer anyway. Using this design means that the position of the patch that I sample is chosen in the data layer, which means that I can't have three (independent) data layers.

I'm not sure if this is the best design. Alternativley I could move the patch location sampler out of the data layer but I am using the DataTransformer class as a sensible template to design the DataSampler.

@BlGene
Copy link
Contributor Author

BlGene commented Sep 11, 2014

So from what I've looked at I would need to specify in the network description how many output blobs I want to have, then I would need to use this to add these blobs to the network, by modifying Net::AppendTop.

Since I load/transform the data in a prefetch thread (DataLayer::InternalThreadEntry) which writes to prefetch_data_ I need to modify this variable to hold more Blobs too.

Should I go ahead with this, or is there a better way to achieve what I want?

@shelhamer
Copy link
Member

Seems reasonable given your needs. Please discuss further if you like on the caffe-users mailing list.

@BlGene
Copy link
Contributor Author

BlGene commented Sep 19, 2014

Ty, should have closed issue myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants