当前位置: 首页>>代码示例>>Python>>正文


Python ResNet.add_stage方法代码示例

本文整理汇总了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 
开发者ID:facebookresearch,项目名称:DetectAndTrack,代码行数:27,代码来源:mask_rcnn_heads.py

示例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 
开发者ID:roytseng-tw,项目名称:Detectron.pytorch,代码行数:8,代码来源:mask_rcnn_heads.py

示例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 
开发者ID:ronghanghu,项目名称:seg_every_thing,代码行数:31,代码来源:keypoint_rcnn_heads.py

示例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 
开发者ID:ronghanghu,项目名称:seg_every_thing,代码行数:30,代码来源:mask_rcnn_heads.py

示例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 
开发者ID:lvpengyuan,项目名称:masktextspotter.caffe2,代码行数:31,代码来源:keypoint_rcnn_heads.py

示例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 
开发者ID:lvpengyuan,项目名称:masktextspotter.caffe2,代码行数:32,代码来源:text_mask_rcnn_heads.py

示例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 
开发者ID:facebookresearch,项目名称:DetectAndTrack,代码行数:16,代码来源:keypoint_rcnn_heads.py


注:本文中的modeling.ResNet.add_stage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。