本文整理汇总了Python中modeling.ResNet.add_stage方法的典型用法代码示例。如果您正苦于以下问题:Python ResNet.add_stage方法的具体用法?Python ResNet.add_stage怎么用?Python ResNet.add_stage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modeling.ResNet
的用法示例。
在下文中一共展示了ResNet.add_stage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_ResNet_roi_conv5_head_for_masks
# 需要导入模块: from modeling import ResNet [as 别名]
# 或者: from modeling.ResNet import add_stage [as 别名]
def add_ResNet_roi_conv5_head_for_masks(
model, blob_in, dim_in, spatial_scale, preprefix='_[mask]_',
dilation=1, shared=False):
assert not shared, \
'Using shared ResNet stage not supported (temporarily)'
model.RoIFeatureTransform(
blob_in,
blob_out=preprefix + 'pool5',
blob_rois='mask_rois',
method=cfg.MRCNN.ROI_XFORM_METHOD,
resolution=cfg.MRCNN.ROI_XFORM_RESOLUTION,
sampling_ratio=cfg.MRCNN.ROI_XFORM_SAMPLING_RATIO,
spatial_scale=spatial_scale)
stride_init = int(cfg.MRCNN.ROI_XFORM_RESOLUTION / 7) # by default: 2
if not shared:
s, dim_in = ResNet.add_stage(
model, preprefix + 'res5', preprefix + 'pool5',
3, dim_in, 2048, 512, dilation, stride_init=stride_init)
else:
s, dim_in = ResNet.add_stage_shared(
model, preprefix, 'res5', preprefix + 'pool5',
3, dim_in, 2048, 512, dilation, stride_init=stride_init)
return s, 2048, spatial_scale
示例2: ResNet_roi_conv5_head_for_masks
# 需要导入模块: from modeling import ResNet [as 别名]
# 或者: from modeling.ResNet import add_stage [as 别名]
def ResNet_roi_conv5_head_for_masks(dim_in):
"""ResNet "conv5" / "stage5" head for predicting masks."""
dilation = cfg.MRCNN.DILATION
stride_init = cfg.MRCNN.ROI_XFORM_RESOLUTION // 7 # by default: 2
module, dim_out = ResNet.add_stage(dim_in, 2048, 512, 3, dilation, stride_init)
return module, dim_out
示例3: add_ResNet_roi_conv5_head_for_keypoints
# 需要导入模块: from modeling import ResNet [as 别名]
# 或者: from modeling.ResNet import add_stage [as 别名]
def add_ResNet_roi_conv5_head_for_keypoints(
model, blob_in, dim_in, spatial_scale
):
"""Add a ResNet "conv5" / "stage5" head for Mask R-CNN keypoint prediction.
"""
model.RoIFeatureTransform(
blob_in,
'_[pose]_pool5',
blob_rois='keypoint_rois',
method=cfg.KRCNN.ROI_XFORM_METHOD,
resolution=cfg.KRCNN.ROI_XFORM_RESOLUTION,
sampling_ratio=cfg.KRCNN.ROI_XFORM_SAMPLING_RATIO,
spatial_scale=spatial_scale
)
# Using the prefix '_[pose]_' to 'res5' enables initializing the head's
# parameters using pretrained 'res5' parameters if given (see
# utils.net.initialize_from_weights_file)
s, dim_in = ResNet.add_stage(
model,
'_[pose]_res5',
'_[pose]_pool5',
3,
dim_in,
2048,
512,
cfg.KRCNN.DILATION,
stride_init=int(cfg.KRCNN.ROI_XFORM_RESOLUTION / 7)
)
return s, 2048
示例4: add_ResNet_roi_conv5_head_for_masks
# 需要导入模块: from modeling import ResNet [as 别名]
# 或者: from modeling.ResNet import add_stage [as 别名]
def add_ResNet_roi_conv5_head_for_masks(model, blob_in, dim_in, spatial_scale):
"""Add a ResNet "conv5" / "stage5" head for predicting masks."""
model.RoIFeatureTransform(
blob_in,
blob_out='_[mask]_pool5',
blob_rois='mask_rois',
method=cfg.MRCNN.ROI_XFORM_METHOD,
resolution=cfg.MRCNN.ROI_XFORM_RESOLUTION,
sampling_ratio=cfg.MRCNN.ROI_XFORM_SAMPLING_RATIO,
spatial_scale=spatial_scale
)
dilation = cfg.MRCNN.DILATION
stride_init = int(cfg.MRCNN.ROI_XFORM_RESOLUTION / 7) # by default: 2
s, dim_in = ResNet.add_stage(
model,
'_[mask]_res5',
'_[mask]_pool5',
3,
dim_in,
2048,
512,
dilation,
stride_init=stride_init
)
return s, 2048
示例5: add_ResNet_roi_conv5_head_for_keypoints
# 需要导入模块: from modeling import ResNet [as 别名]
# 或者: from modeling.ResNet import add_stage [as 别名]
def add_ResNet_roi_conv5_head_for_keypoints(
model, blob_in, dim_in, spatial_scale
):
"""Add a ResNet "conv5" / "stage5" head for Mask R-CNN keypoint prediction.
"""
model.RoIFeatureTransform(
blob_in,
'_[pose]_pool5',
blob_rois='keypoint_rois',
method=cfg.KRCNN.ROI_XFORM_METHOD,
resolution=cfg.KRCNN.ROI_XFORM_RESOLUTION,
sampling_ratio=cfg.KRCNN.ROI_XFORM_SAMPLING_RATIO,
spatial_scale=spatial_scale
)
# Using the prefix '_[pose]_' to 'res5' enables initializing the head's
# parameters using pretrained 'res5' parameters if given (see
# utils.net.initialize_gpu_0_from_weights_file)
s, dim_in = ResNet.add_stage(
model,
'_[pose]_res5',
'_[pose]_pool5',
3,
dim_in,
2048,
512,
cfg.KRCNN.DILATION,
stride_init=int(cfg.KRCNN.ROI_XFORM_RESOLUTION / 7)
)
return s, 2048
示例6: add_ResNet_roi_conv5_head_for_masks
# 需要导入模块: from modeling import ResNet [as 别名]
# 或者: from modeling.ResNet import add_stage [as 别名]
def add_ResNet_roi_conv5_head_for_masks(model, blob_in, dim_in, spatial_scale):
"""Add a ResNet "conv5" / "stage5" head for predicting masks."""
model.RoIFeatureTransform(
blob_in,
blob_out='_[mask]_pool5',
blob_rois='mask_rois',
method=cfg.MRCNN.ROI_XFORM_METHOD,
resolution=cfg.MRCNN.ROI_XFORM_RESOLUTION,
sampling_ratio=cfg.MRCNN.ROI_XFORM_SAMPLING_RATIO,
spatial_scale=spatial_scale,
resolution_w=cfg.MRCNN.ROI_XFORM_RESOLUTION_W,
resolution_h=cfg.MRCNN.ROI_XFORM_RESOLUTION_H,
)
dilation = cfg.MRCNN.DILATION
stride_init = int(cfg.MRCNN.ROI_XFORM_RESOLUTION / 7) # by default: 2
s, dim_in = ResNet.add_stage(
model,
'_[mask]_res5',
'_[mask]_pool5',
3,
dim_in,
2048,
512,
dilation,
stride_init=stride_init
)
return s, 2048
示例7: add_ResNet_roi_conv5_head_for_keypoints
# 需要导入模块: from modeling import ResNet [as 别名]
# 或者: from modeling.ResNet import add_stage [as 别名]
def add_ResNet_roi_conv5_head_for_keypoints(
model, blob_in, dim_in, spatial_scale):
model.RoIFeatureTransform(
blob_in, '_[pose]_pool5',
blob_rois='keypoint_rois',
method=cfg.KRCNN.ROI_XFORM_METHOD,
resolution=cfg.KRCNN.ROI_XFORM_RESOLUTION,
sampling_ratio=cfg.KRCNN.ROI_XFORM_SAMPLING_RATIO,
spatial_scale=spatial_scale)
s, dim_in = ResNet.add_stage(
model, '_[pose]_res5', '_[pose]_pool5',
3, dim_in, 2048, 512, cfg.KRCNN.DILATION,
stride_init=int(cfg.KRCNN.ROI_XFORM_RESOLUTION / 7))
return s, 2048, spatial_scale