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

Test labels for regression caffe, float not allowed? #2847

Closed
imdeven opened this issue Aug 2, 2015 · 3 comments
Closed

Test labels for regression caffe, float not allowed? #2847

imdeven opened this issue Aug 2, 2015 · 3 comments

Comments

@imdeven
Copy link

imdeven commented Aug 2, 2015

Hi,

I am doing regression using caffe, and my test.txt ans train.txt files are like this:

/home/foo/caffe/data/finetune/flickr/3860781056.jpg 2.0
/home/foo/caffe/data/finetune/flickr/4559004485.jpg 3.6
/home/foo/caffe/data/finetune/flickr/3208038920.jpg 3.2
/home/foo/caffe/data/finetune/flickr/6170430622.jpg 4.0
/home/foo/caffe/data/finetune/flickr/7508671542.jpg 2.7272

My problem is it seems caffe does not allow float labels like 2.0, when I use float labels while reading , for example the test.txt file caffe only
recognizes "a total of 1 images", which is wrong.

But when I for example change the 2.0 to 2 in the file and the following lines same, caffe now gives "a total of 2 images" implying that the float labels are responsible for the problem.

Can anyone help me here, to solve this problem, I definitely need to use float labels for regression, so does anyone know about a work around or solution for this? Thanks in advance.

@rorschachhb
Copy link

In caffe.proto you can see that label is defined as int32, so you can't use float labels directly.
An alternative method is to use two data layer, you can read images from the first data layer and read labels from the other one.

@imdeven
Copy link
Author

imdeven commented Aug 2, 2015

This is my train data layer.
name: "MyCaffeNet"
layer {
name: "data"
type: "ImageData"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
mirror: true
crop_size: 227
mean_file: "data/ilsvrc12/imagenet_mean.binaryproto"
}
image_data_param {
source: "data/finetune_dev/train.txt"
batch_size: 50
new_height: 256
new_width: 256
}
}
Can you please elaborately, explain how would I go on about writing 2 layers from this one. For example, what would be the type for the new layer, and how would the existing imagedata layer be modified. Please, I would be very much obliged.

@longjon
Copy link
Contributor

longjon commented Aug 2, 2015

Closing as this looks like a usage issue/request for help.

This tracker is reserved for specific Caffe development issues and bugs; please ask usage questions on the caffe-users list.

For more information, see our contributing guide.

Thanks!

@longjon longjon closed this as completed Aug 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants