當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。