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