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


Python mmcv.bgr2rgb方法代码示例

本文整理汇总了Python中mmcv.bgr2rgb方法的典型用法代码示例。如果您正苦于以下问题:Python mmcv.bgr2rgb方法的具体用法?Python mmcv.bgr2rgb怎么用?Python mmcv.bgr2rgb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mmcv的用法示例。


在下文中一共展示了mmcv.bgr2rgb方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: show_result_pyplot

# 需要导入模块: import mmcv [as 别名]
# 或者: from mmcv import bgr2rgb [as 别名]
def show_result_pyplot(model, img, result, score_thr=0.3, fig_size=(15, 10)):
    """Visualize the detection results on the image.

    Args:
        model (nn.Module): The loaded detector.
        img (str or np.ndarray): Image filename or loaded image.
        result (tuple[list] or list): The detection result, can be either
            (bbox, segm) or just bbox.
        score_thr (float): The threshold to visualize the bboxes and masks.
        fig_size (tuple): Figure size of the pyplot figure.
    """
    if hasattr(model, 'module'):
        model = model.module
    img = model.show_result(img, result, score_thr=score_thr, show=False)
    plt.figure(figsize=fig_size)
    plt.imshow(mmcv.bgr2rgb(img))
    plt.show() 
开发者ID:open-mmlab,项目名称:mmdetection,代码行数:19,代码来源:inference.py

示例2: show_result_pyplot

# 需要导入模块: import mmcv [as 别名]
# 或者: from mmcv import bgr2rgb [as 别名]
def show_result_pyplot(img,
                       result,
                       class_names,
                       score_thr=0.3,
                       fig_size=(15, 10)):
    """Visualize the detection results on the image.

    Args:
        img (str or np.ndarray): Image filename or loaded image.
        result (tuple[list] or list): The detection result, can be either
            (bbox, segm) or just bbox.
        class_names (list[str] or tuple[str]): A list of class names.
        score_thr (float): The threshold to visualize the bboxes and masks.
        fig_size (tuple): Figure size of the pyplot figure.
        out_file (str, optional): If specified, the visualization result will
            be written to the out file instead of shown in a window.
    """
    img = show_result(
        img, result, class_names, score_thr=score_thr, show=False)
    plt.figure(figsize=fig_size)
    plt.imshow(mmcv.bgr2rgb(img)) 
开发者ID:open-mmlab,项目名称:mmfashion,代码行数:23,代码来源:inference.py

示例3: show_ann

# 需要导入模块: import mmcv [as 别名]
# 或者: from mmcv import bgr2rgb [as 别名]
def show_ann(coco, img, ann_info):
    plt.imshow(mmcv.bgr2rgb(img))
    plt.axis('off')
    coco.showAnns(ann_info)
    plt.show() 
开发者ID:dingjiansw101,项目名称:AerialDetection,代码行数:7,代码来源:utils.py

示例4: test_bgr2rgb

# 需要导入模块: import mmcv [as 别名]
# 或者: from mmcv import bgr2rgb [as 别名]
def test_bgr2rgb():
    in_img = np.random.rand(10, 10, 3).astype(np.float32)
    out_img = mmcv.bgr2rgb(in_img)
    assert out_img.shape == in_img.shape
    assert_array_equal(out_img[..., 0], in_img[..., 2])
    assert_array_equal(out_img[..., 1], in_img[..., 1])
    assert_array_equal(out_img[..., 2], in_img[..., 0]) 
开发者ID:open-mmlab,项目名称:mmcv,代码行数:9,代码来源:test_colorspace.py


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