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

HDF5 output layer produces incorrect output #750

Closed
to3i opened this issue Jul 21, 2014 · 2 comments
Closed

HDF5 output layer produces incorrect output #750

to3i opened this issue Jul 21, 2014 · 2 comments

Comments

@to3i
Copy link
Contributor

to3i commented Jul 21, 2014

Using the HDF5 output layer to extract the label and the prediction of a network I run into the following problem. The created HDF5 file contains two tables, however, both seem to be populated with data from the first bottom blob specified in the network file. At least the first value in both tables is identical and depending on the dimensions sometimes the complete table. A boiled down network example that reproduces the issue is the following:

name: "dummy"
layers{
  name: "dummy1"
  type: DUMMY_DATA
  dummy_data_param {
    num: 32
    channels: 32
    height: 24
    width: 24
    data_filler {
      type: "uniform"
      min: 10
      max: 256
    }
  }
  top: "data1"
}
layers{
  name: "dummy0"
  type: DUMMY_DATA
  dummy_data_param {
    num: 32
    channels: 1
    height: 1
    width: 1
    data_filler {
      type: "uniform"
      min: 1
      max: 2
    }
  }
  top: "label1"
}
layers {
  name: "hdf5out"
  type: HDF5_OUTPUT
  bottom: "data1"
  bottom: "label1"
  hdf5_output_param {
    file_name: "dummy_output.h5"
  }
}

You will find that the dummy_output.h5 contains two tables (data and label) where both contain values that fall in the range of 10...256 and that the first entry in both tables is identical.

I assume that somehow the hdf5 ouput layer does not correctly access the second bottom blob. I remember having used this layer successfully before, so maybe the problem is due to some recent changes?!

@to3i
Copy link
Contributor Author

to3i commented Jul 21, 2014

After having a look into the code I found the mistake. The second caffe_copy uses the wrong bottom blob (0 instead of 1) in the cpu and gpu version of the layer. Error was introduced recently when replacing mem_copy and probably only needs to be fixed in dev branch.

   caffe_copy(data_datum_dim, &bottom[0]->cpu_data()[i * data_datum_dim],
        &data_blob_.mutable_cpu_data()[i * data_datum_dim]);
    caffe_copy(label_datum_dim, &bottom[**0**]->cpu_data()[i * label_datum_dim],
        &label_blob_.mutable_cpu_data()[i * label_datum_dim]);

@sergeyk
Copy link
Contributor

sergeyk commented Jul 28, 2014

thanks, i'll fix this!

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

2 participants