本文整理匯總了Python中caffe2.python.workspace.HasBlob方法的典型用法代碼示例。如果您正苦於以下問題:Python workspace.HasBlob方法的具體用法?Python workspace.HasBlob怎麽用?Python workspace.HasBlob使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類caffe2.python.workspace
的用法示例。
在下文中一共展示了workspace.HasBlob方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: initialize_model_from_cfg
# 需要導入模塊: from caffe2.python import workspace [as 別名]
# 或者: from caffe2.python.workspace import HasBlob [as 別名]
def initialize_model_from_cfg():
def create_input_blobs(net_def):
for op in net_def.op:
for blob_in in op.input:
if not workspace.HasBlob(blob_in):
workspace.CreateBlob(blob_in)
model = model_builder.create(
cfg.MODEL.TYPE, train=False,
init_params=cfg.TEST.INIT_RANDOM_VARS_BEFORE_LOADING)
model_builder.add_inputs(model)
if cfg.TEST.INIT_RANDOM_VARS_BEFORE_LOADING:
workspace.RunNetOnce(model.param_init_net)
net_utils.initialize_from_weights_file(
model, cfg.TEST.WEIGHTS, broadcast=False)
create_input_blobs(model.net.Proto())
workspace.CreateNet(model.net)
workspace.CreateNet(model.conv_body_net)
if cfg.MODEL.MASK_ON:
create_input_blobs(model.mask_net.Proto())
workspace.CreateNet(model.mask_net)
if cfg.MODEL.KEYPOINTS_ON:
create_input_blobs(model.keypoint_net.Proto())
workspace.CreateNet(model.keypoint_net)
return model
示例2: create_input_blobs
# 需要導入模塊: from caffe2.python import workspace [as 別名]
# 或者: from caffe2.python.workspace import HasBlob [as 別名]
def create_input_blobs(net_def):
for op in net_def.op:
for blob_in in op.input:
if not workspace.HasBlob(blob_in):
workspace.CreateBlob(blob_in)
示例3: create_input_blobs_for_net
# 需要導入模塊: from caffe2.python import workspace [as 別名]
# 或者: from caffe2.python.workspace import HasBlob [as 別名]
def create_input_blobs_for_net(net_def):
for op in net_def.op:
for blob_in in op.input:
if not workspace.HasBlob(blob_in):
workspace.CreateBlob(blob_in)
示例4: add_inference_inputs
# 需要導入模塊: from caffe2.python import workspace [as 別名]
# 或者: from caffe2.python.workspace import HasBlob [as 別名]
def add_inference_inputs(model):
"""Create network input blobs used for inference."""
def create_input_blobs_for_net(net_def):
for op in net_def.op:
for blob_in in op.input:
if not workspace.HasBlob(blob_in):
workspace.CreateBlob(blob_in)
create_input_blobs_for_net(model.net.Proto())
if cfg.MODEL.MASK_ON:
create_input_blobs_for_net(model.mask_net.Proto())
if cfg.MODEL.KEYPOINTS_ON:
create_input_blobs_for_net(model.keypoint_net.Proto())
# ---------------------------------------------------------------------------- #
# ********************** DEPRECATED FUNCTIONALITY BELOW ********************** #
# ---------------------------------------------------------------------------- #
# ---------------------------------------------------------------------------- #
# Hardcoded functions to create various types of common models
#
# *** This type of model definition is deprecated ***
# *** Use the generic composable versions instead ***
#
# ---------------------------------------------------------------------------- #
示例5: _get_result_blobs
# 需要導入模塊: from caffe2.python import workspace [as 別名]
# 或者: from caffe2.python.workspace import HasBlob [as 別名]
def _get_result_blobs(check_blobs):
ret = {}
for x in check_blobs:
sn = core.ScopedName(x)
if workspace.HasBlob(sn):
ret[x] = workspace.FetchBlob(sn)
else:
ret[x] = None
return ret
示例6: add_inference_inputs
# 需要導入模塊: from caffe2.python import workspace [as 別名]
# 或者: from caffe2.python.workspace import HasBlob [as 別名]
def add_inference_inputs(model):
"""Create network input blobs used for inference."""
def create_input_blobs_for_net(net_def):
for op in net_def.op:
for blob_in in op.input:
if not workspace.HasBlob(blob_in):
workspace.CreateBlob(blob_in)
create_input_blobs_for_net(model.net.Proto())