Caffe-LMDBCreation-MultiLabel icon indicating copy to clipboard operation
Caffe-LMDBCreation-MultiLabel copied to clipboard

LMDB multidim labels

Open AlexTS1980 opened this issue 7 years ago • 4 comments

I created train and test datasets with each entry looking like:

/Data/train/00001.png 347.0 178.0 408.0 283.0

where the four digits are bounding box values (x,y,h,w) of a bounding box. The label file was created, where every label entry looked like this:

<type 'numpy.int64'>
channels: 1
height: 1
width: 4
float_data: 347
float_data: 178
float_data: 408
float_data: 283

When training in caffe, I added a 4-neuron fully connected layer at the very end (before the error function) with relu activator. Is this the correct way of doing things? I get a huge error. Caffe reports a seemingly correct shape:

I0310 11:05:16.992735 4867 net.cpp:86] Creating Layer relu_fc8_cows I0310 11:05:16.992741 4867 net.cpp:408] relu_fc8_cows <- fc8cows I0310 11:05:16.992748 4867 net.cpp:369] relu_fc8_cows -> fc8cows (in-place) I0310 11:05:16.993499 4867 net.cpp:124] Setting up relu_fc8_cows I0310 11:05:16.993512 4867 net.cpp:131] Top shape: 1 4 (4)

AlexTS1980 avatar Mar 10 '17 11:03 AlexTS1980

This is the incorrect way of specifying labels !! I urge you to please read the README instructions to rectify this !!

On 10 Mar 2017, at 11:23, Alex Ter-Sarkisov [email protected] wrote:

I created train and test datasets with each entry looking like:

/Data/train/00001.png 347.0 178.0 408.0 283.0

where the four digits are bounding box values (x,y,h,w) of a bounding box. The label file was created, where every label entry looked like this:

<type 'numpy.int64'> channels: 1 height: 1 width: 4 float_data: 347 float_data: 178 float_data: 408 float_data: 283

When training in caffe, I added a 4-neuron fully connected layer at the very end (before the error function) with relu activator. Is this the correct way of doing things? I get a huge error. Caffe reports a seemingly correct shape:

I0310 11:05:16.992735 4867 net.cpp:86] Creating Layer relu_fc8_cows I0310 11:05:16.992741 4867 net.cpp:408] relu_fc8_cows <- fc8cows I0310 11:05:16.992748 4867 net.cpp:369] relu_fc8_cows -> fc8cows (in-place) I0310 11:05:16.993499 4867 net.cpp:124] Setting up relu_fc8_cows I0310 11:05:16.993512 4867 net.cpp:131] Top shape: 1 4 (4)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

sukritshankar avatar Mar 10 '17 15:03 sukritshankar

I'm sorry, I don't understand why label values have to be between 0 and 255? If a label in my case is (x,y,h,w) bouding box parameters, for example?

AlexTS1980 avatar Mar 14 '17 16:03 AlexTS1980

You just have to scale the values of your bounding box parameters to a range [0,255]. Internally since we are using a data layer for labels, Caffe rescales it by 255, so that will be your correct numbers then !! In a nutshell, you can have any range of your values, just scale it to [0,255] for inputting purposes !!

sukritshankar avatar Mar 14 '17 16:03 sukritshankar

But this means most numbers will be fractional. This is a problem.

AlexTS1980 avatar Mar 14 '17 17:03 AlexTS1980