| 14 | |
| 15 | template<typename Dtype> |
| 16 | DataTransformer<Dtype>::DataTransformer(const TransformationParameter& param, |
| 17 | Phase phase) |
| 18 | : param_(param), phase_(phase) { |
| 19 | // check if we want to use mean_file |
| 20 | if (param_.has_mean_file()) { |
| 21 | CHECK_EQ(param_.mean_value_size(), 0) << |
| 22 | "Cannot specify mean_file and mean_value at the same time"; |
| 23 | const string& mean_file = param.mean_file(); |
| 24 | if (Caffe::root_solver()) { |
| 25 | LOG(INFO) << "Loading mean file from: " << mean_file; |
| 26 | } |
| 27 | BlobProto blob_proto; |
| 28 | ReadProtoFromBinaryFileOrDie(mean_file.c_str(), &blob_proto); |
| 29 | data_mean_.FromProto(blob_proto); |
| 30 | } |
| 31 | // check if we want to use mean_value |
| 32 | if (param_.mean_value_size() > 0) { |
| 33 | CHECK(param_.has_mean_file() == false) << |
| 34 | "Cannot specify mean_file and mean_value at the same time"; |
| 35 | for (int c = 0; c < param_.mean_value_size(); ++c) { |
| 36 | mean_values_.push_back(param_.mean_value(c)); |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | template<typename Dtype> |
| 42 | void DataTransformer<Dtype>::Transform(const Datum& datum, |
nothing calls this directly
no test coverage detected