Move data_mean into data_transformer

Move data_mean into the data_transform class to facilitate data transformation. 
This way Data layers don't need to hold it and pass it all the time. 

Just to cover the case where there was no mean_file in the parameters, and
therefore was not known the size a priori.

Sergio

2014-09-16 10:47 GMT-07:00 Jeff Donahue <notifications@github.com>:

> In src/caffe/data_transformer.cpp:
>
> > +    ReadProtoFromBinaryFileOrDie(mean_file.c_str(), &blob_proto);
> > +    data_mean_.FromProto(blob_proto);
> > +  }
> > +}
> > +
> > +template<typename Dtype>
> > +void DataTransformer<Dtype>::Transform(const int batch_item_id,
> > +                                       const Datum& datum,
> > +                                       Dtype* transformed_data) {
> > +  CHECK_GT(datum.channels(), 0);
> > +  CHECK_GE(datum.height(), param_.crop_size());
> > +  CHECK_GE(datum.height(), param_.crop_size());
> > +  const int size = datum.channels() * datum.height() * datum.width();
> > +  if (data_mean_.count() < size) {
> > +    data_mean_.Reshape(1, datum.channels(), datum.height(), datum.width());
> > +    LOG(INFO) << "Transform without mean";
>
> I don't think I understand what's going on here -- why reshape the mean
> inside Transform?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/BVLC/caffe/pull/1070/files#r17617821>.
>