MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / Net_Init

Function Net_Init

rtpose_wrapper/python/caffe/_caffe.cpp:92–117  ·  view source on GitHub ↗

Net constructor

Source from the content-addressed store, hash-verified

90
91// Net constructor
92shared_ptr<Net<Dtype> > Net_Init(string network_file, int phase,
93 const int level, const bp::object& stages,
94 const bp::object& weights) {
95 CheckFile(network_file);
96
97 // Convert stages from list to vector
98 vector<string> stages_vector;
99 if (!stages.is_none()) {
100 for (int i = 0; i < len(stages); i++) {
101 stages_vector.push_back(bp::extract<string>(stages[i]));
102 }
103 }
104
105 // Initialize net
106 shared_ptr<Net<Dtype> > net(new Net<Dtype>(network_file,
107 static_cast<Phase>(phase), level, &stages_vector));
108
109 // Load weights
110 if (!weights.is_none()) {
111 std::string weights_file_str = bp::extract<std::string>(weights);
112 CheckFile(weights_file_str);
113 net->CopyTrainedLayersFrom(weights_file_str);
114 }
115
116 return net;
117}
118
119// Legacy Net construct-and-load convenience constructor
120shared_ptr<Net<Dtype> > Net_Init_Load(

Callers

nothing calls this directly

Calls 2

CheckFileFunction · 0.85
CopyTrainedLayersFromMethod · 0.80

Tested by

no test coverage detected