MCPcopy Create free account
hub / github.com/PeizeSun/SparseR-CNN / load_protobuf

Method load_protobuf

detectron2/export/api.py:266–284  ·  view source on GitHub ↗

Args: dir (str): a directory used to save Caffe2Model with :meth:`save_protobuf`. The files "model.pb" and "model_init.pb" are needed. Returns: Caffe2Model: the caffe2 model loaded from this directory.

(dir)

Source from the content-addressed store, hash-verified

264
265 @staticmethod
266 def load_protobuf(dir):
267 """
268 Args:
269 dir (str): a directory used to save Caffe2Model with
270 :meth:`save_protobuf`.
271 The files "model.pb" and "model_init.pb" are needed.
272
273 Returns:
274 Caffe2Model: the caffe2 model loaded from this directory.
275 """
276 predict_net = caffe2_pb2.NetDef()
277 with PathManager.open(os.path.join(dir, "model.pb"), "rb") as f:
278 predict_net.ParseFromString(f.read())
279
280 init_net = caffe2_pb2.NetDef()
281 with PathManager.open(os.path.join(dir, "model_init.pb"), "rb") as f:
282 init_net.ParseFromString(f.read())
283
284 return Caffe2Model(predict_net, init_net)
285
286 def __call__(self, inputs):
287 """

Callers 1

_test_modelMethod · 0.80

Calls 1

Caffe2ModelClass · 0.85

Tested by 1

_test_modelMethod · 0.64