MCPcopy Create free account
hub / github.com/BVLC/caffe / DataTransformer

Method DataTransformer

src/caffe/data_transformer.cpp:16–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14
15template<typename Dtype>
16DataTransformer<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
41template<typename Dtype>
42void DataTransformer<Dtype>::Transform(const Datum& datum,

Callers

nothing calls this directly

Calls 2

FromProtoMethod · 0.80

Tested by

no test coverage detected