本文整理汇总了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())