Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Fix docstring format and rescale the images #802

Merged
merged 1 commit into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/en/advanced_tutorials/basedataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ data

The initialization process of the `BaseDataset` is shown as follows:

![image](https://user-images.githubusercontent.com/26813582/201585974-1360e2b5-f95f-4273-8cbf-6024e33204ab.png)
<div align="center">
<img src="https://user-images.githubusercontent.com/26813582/201585974-1360e2b5-f95f-4273-8cbf-6024e33204ab.png" height="500"/>
</div>

1. `load metainfo`: Obtain the meta information of the dataset. The meta information can be obtained from three sources with the priority from high to low:

Expand Down
4 changes: 3 additions & 1 deletion docs/zh_cn/advanced_tutorials/basedataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ data

数据集基类的初始化流程如下图所示:

![image](https://user-images.githubusercontent.com/26813582/201585974-1360e2b5-f95f-4273-8cbf-6024e33204ab.png)
<div align="center">
<img src="https://user-images.githubusercontent.com/26813582/201585974-1360e2b5-f95f-4273-8cbf-6024e33204ab.png" height="500"/>
</div>

1. `load metainfo`:获取数据集的元信息,元信息有三种来源,优先级从高到低为:

Expand Down
60 changes: 30 additions & 30 deletions mmengine/visualization/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,19 @@ class Visualizer(ManagerMixin):

>>> # inherit
>>> class DetLocalVisualizer(Visualizer):
>>> def add_datasample(self,
>>> name,
>>> image: np.ndarray,
>>> gt_sample:
>>> Optional['BaseDataElement'] = None,
>>> pred_sample:
>>> Optional['BaseDataElement'] = None,
>>> draw_gt: bool = True,
>>> draw_pred: bool = True,
>>> show: bool = False,
>>> wait_time: int = 0,
>>> step: int = 0) -> None:
>>> pass
>>> def add_datasample(self,
>>> name,
>>> image: np.ndarray,
>>> gt_sample:
>>> Optional['BaseDataElement'] = None,
>>> pred_sample:
>>> Optional['BaseDataElement'] = None,
>>> draw_gt: bool = True,
>>> draw_pred: bool = True,
>>> show: bool = False,
>>> wait_time: int = 0,
>>> step: int = 0) -> None:
>>> pass
"""

def __init__(
Expand Down Expand Up @@ -375,9 +375,9 @@ def draw_points(self,
for more details. Defaults to 'g.
marker (str, optional): The marker style.
See :mod:`matplotlib.markers` for more information about
marker styles. Default to None.
marker styles. Defaults to None.
sizes (Optional[Union[np.ndarray, torch.Tensor]]): The marker size.
Default to None.
Defaults to None.
"""
check_type('positions', positions, (np.ndarray, torch.Tensor))
positions = tensor2ndarray(positions)
Expand Down Expand Up @@ -443,7 +443,7 @@ def draw_texts(
just single value. If ``font_families`` is single value, all
the texts will have the same font family.
font_familiy can be 'serif', 'sans-serif', 'cursive', 'fantasy'
or 'monospace'. Defaults to 'sans-serif'.
or 'monospace'. Defaults to 'sans-serif'.
bboxes (Union[dict, List[dict]], optional): The bounding box of the
texts. If bboxes is None, there are no bounding box around
texts. ``bboxes`` can have the same length with texts or
Expand Down Expand Up @@ -689,7 +689,7 @@ def draw_bboxes(
If ``line_widths`` is single value, all the lines will
have the same linewidth. Defaults to 2.
face_colors (Union[str, tuple, List[str], List[tuple]]):
The face colors. Default to None.
The face colors. Defaults to None.
alpha (Union[int, float]): The transparency of bboxes.
Defaults to 0.8.
"""
Expand Down Expand Up @@ -734,7 +734,7 @@ def draw_polygons(
"""Draw single or multiple bboxes.

Args:
polygons (Union[Union[np.ndarray, torch.Tensor],
polygons (Union[Union[np.ndarray, torch.Tensor],\
List[Union[np.ndarray, torch.Tensor]]]): The polygons to draw
with the format of (x1,y1,x2,y2,...,xn,yn).
edge_colors (Union[str, tuple, List[str], List[tuple]]): The
Expand All @@ -756,7 +756,7 @@ def draw_polygons(
If ``line_widths`` is single value, all the lines will
have the same linewidth. Defaults to 2.
face_colors (Union[str, tuple, List[str], List[tuple]]):
The face colors. Default to None.
The face colors. Defaults to None.
alpha (Union[int, float]): The transparency of polygons.
Defaults to 0.8.
"""
Expand Down Expand Up @@ -871,28 +871,28 @@ def draw_featmap(featmap: torch.Tensor,
"""Draw featmap.

- If `overlaid_image` is not None, the final output image will be the
weighted sum of img and featmap.
weighted sum of img and featmap.

- If `resize_shape` is specified, `featmap` and `overlaid_image`
are interpolated.
are interpolated.

- If `resize_shape` is None and `overlaid_image` is not None,
the feature map will be interpolated to the spatial size of the image
in the case where the spatial dimensions of `overlaid_image` and
`featmap` are different.
the feature map will be interpolated to the spatial size of the image
in the case where the spatial dimensions of `overlaid_image` and
`featmap` are different.

- If `channel_reduction` is "squeeze_mean" and "select_max",
it will compress featmap to single channel image and weighted
sum to `overlaid_image`.
it will compress featmap to single channel image and weighted
sum to `overlaid_image`.

- if `channel_reduction` is None

- If topk <= 0, featmap is assert to be one or three
channel and treated as image and will be weighted sum
to ``overlaid_image``.
channel and treated as image and will be weighted sum
to ``overlaid_image``.
- If topk > 0, it will select topk channel to show by the sum of
each channel. At the same time, you can specify the `arrangement`
to set the window layout.
each channel. At the same time, you can specify the `arrangement`
to set the window layout.

Args:
featmap (torch.Tensor): The featmap to draw which format is
Expand Down