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

DataParameter field 'mean_file' should be deprecated? #6131

Open
shanyucha opened this issue Dec 25, 2017 · 1 comment
Open

DataParameter field 'mean_file' should be deprecated? #6131

shanyucha opened this issue Dec 25, 2017 · 1 comment

Comments

@shanyucha
Copy link

Issue summary

I wondered, what is the use of mean_file param under data_param. If it is deprecated, I didn't found any comments in the proto file indicating that. Apparently, it didn't work like its literal meaning.

Steps to reproduce

I was using googlenet to do classifications. I got high validation accuracy during training. Unfortunately, I got weird low test accuracy during testing. I tried to many things like adjusting train sets, modifying learning rate, gamma and so on, I got totally different results even if the modifications were very subtle.

At last, I found that I used the 'mean_file' param under 'data_param' in data layer instead of in 'transform_param'. And it was the cause of weird output of testing. In fact, during initialization of network, it didn't load the mean_file param if it was under the data_param.

And I looked into the caffe.proto file and indeed there is a mean_file param in data_param. That's why no error raised. But still it seems that it is of no use.

Your system configuration

Operating system:
Compiler:
CUDA version (if applicable):
CUDNN version (if applicable):
BLAS:
Python or MATLAB version (for pycaffe and matcaffe respectively):

@Noiredd Noiredd changed the title What is the use of param 'mean_file' under data_param DataParameter field 'mean_file' should be deprecated? Jan 12, 2018
@Noiredd
Copy link
Member

Noiredd commented Jan 12, 2018

Interesting. Initially mean_file and similar parameters were fields of a DataParameter message and the DataLayer handled all preprocessing. Then (#954) the code was refactored into the Transformer class with its own TransformerParameter message that took over mean_file and other preprocessing fields. Later (#963) the fields were brought back for compatibility reasons, and finally (#995) the preprocessing was entirely moved to the Transformer. Legacy proto definitions are upgraded using the upgrade_proto.cpp utility which moves any mean_file passed as data_param into the transform_param - but indeed it seems that caffe.proto is not very clear about this fact:

  // DEPRECATED. See TransformationParameter. For data pre-processing, we can do
  // simple scaling and subtracting the data mean, if provided. Note that the
  // mean subtraction is always carried out before scaling.
  optional float scale = 2 [default = 1];
  optional string mean_file = 3;

(lines 657-661)

@shelhamer Would it be a right thing to do to add // DEPRECATED comment above the mean_file line?

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

No branches or pull requests

2 participants