Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Support using vis_bbox together with vis_instance_segmentation #560

Conversation

yuyu2172
Copy link
Member

@yuyu2172 yuyu2172 commented Apr 9, 2018

figure_1

"""Color map used in PASCAL VOC

Args:
label (int): Class id.
labels (~numpy.ndarray): Class ids.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list of int?

@Hakuyume Hakuyume self-assigned this Apr 12, 2018
@@ -5,7 +5,7 @@ def voc_colormap(labels):
"""Color map used in PASCAL VOC

Args:
labels (~numpy.ndarray): Class ids.
labels (list of ints): Class ids.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about iterable of ints?

@Hakuyume
Copy link
Member

Can we support specifying color for each class in vis_bbox? For example, the box for car is red, the box for dog is blue ...
We can rename the argument color to instance_color and add class_color (label_color).

@yuyu2172
Copy link
Member Author

figure_1-1

@knorth55 knorth55 mentioned this pull request Apr 13, 2018
@knorth55
Copy link
Contributor

@Hakuyume @yuyu2172 Is this PR OK to merge?

@yuyu2172 yuyu2172 added this to the v0.9 milestone Apr 18, 2018
"""Visualize bounding boxes inside image.

Example:

>>> from chainercv.datasets import VOCDetectionDataset
>>> from chainercv.datasets import VOCBboxDataset
>>> from chainercv.datasets import voc_bbox_label_names
>>> from chainercv.visualizations import vis_bbox
>>> import matplotlib.pyplot as plot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plot -> plt (chainer/chainer#3698)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has not been fixed yet in ChainerCV.

@@ -32,6 +51,15 @@ def vis_bbox(img, bbox, label=None, score=None, label_names=None, ax=None):
This is optional.
label_names (iterable of strings): Name of labels ordered according
to label ids. If this is :obj:`None`, labels will be skipped.
instance_colors (iterable of tuple): List of colors.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tuple -> tuples

@@ -54,12 +82,20 @@ def vis_bbox(img, bbox, label=None, score=None, label_names=None, ax=None):
if len(bbox) == 0:
return ax

if instance_colors is None:
# Red
instance_colors = np.ones((len(bbox), 3), dtype=np.float32)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ones -> zeros ?

@Hakuyume Hakuyume merged commit bfbdec8 into chainer:master Apr 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants