[Docs] Fix docstring format and rescale the image (#802)

This commit is contained in:
Zaida Zhou 2022-12-08 14:29:27 +08:00 committed by GitHub
parent 381c5f103c
commit 65eb39bfc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 32 deletions

View File

@ -57,7 +57,9 @@ data
The initialization process of the `BaseDataset` is shown as follows: 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: 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:

View File

@ -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`:获取数据集的元信息,元信息有三种来源,优先级从高到低为: 1. `load metainfo`:获取数据集的元信息,元信息有三种来源,优先级从高到低为:

View File

@ -138,19 +138,19 @@ class Visualizer(ManagerMixin):
>>> # inherit >>> # inherit
>>> class DetLocalVisualizer(Visualizer): >>> class DetLocalVisualizer(Visualizer):
>>> def add_datasample(self, >>> def add_datasample(self,
>>> name, >>> name,
>>> image: np.ndarray, >>> image: np.ndarray,
>>> gt_sample: >>> gt_sample:
>>> Optional['BaseDataElement'] = None, >>> Optional['BaseDataElement'] = None,
>>> pred_sample: >>> pred_sample:
>>> Optional['BaseDataElement'] = None, >>> Optional['BaseDataElement'] = None,
>>> draw_gt: bool = True, >>> draw_gt: bool = True,
>>> draw_pred: bool = True, >>> draw_pred: bool = True,
>>> show: bool = False, >>> show: bool = False,
>>> wait_time: int = 0, >>> wait_time: int = 0,
>>> step: int = 0) -> None: >>> step: int = 0) -> None:
>>> pass >>> pass
""" """
def __init__( def __init__(
@ -375,9 +375,9 @@ class Visualizer(ManagerMixin):
for more details. Defaults to 'g. for more details. Defaults to 'g.
marker (str, optional): The marker style. marker (str, optional): The marker style.
See :mod:`matplotlib.markers` for more information about 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. sizes (Optional[Union[np.ndarray, torch.Tensor]]): The marker size.
Default to None. Defaults to None.
""" """
check_type('positions', positions, (np.ndarray, torch.Tensor)) check_type('positions', positions, (np.ndarray, torch.Tensor))
positions = tensor2ndarray(positions) positions = tensor2ndarray(positions)
@ -443,7 +443,7 @@ class Visualizer(ManagerMixin):
just single value. If ``font_families`` is single value, all just single value. If ``font_families`` is single value, all
the texts will have the same font family. the texts will have the same font family.
font_familiy can be 'serif', 'sans-serif', 'cursive', 'fantasy' 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 bboxes (Union[dict, List[dict]], optional): The bounding box of the
texts. If bboxes is None, there are no bounding box around texts. If bboxes is None, there are no bounding box around
texts. ``bboxes`` can have the same length with texts or texts. ``bboxes`` can have the same length with texts or
@ -689,7 +689,7 @@ class Visualizer(ManagerMixin):
If ``line_widths`` is single value, all the lines will If ``line_widths`` is single value, all the lines will
have the same linewidth. Defaults to 2. have the same linewidth. Defaults to 2.
face_colors (Union[str, tuple, List[str], List[tuple]]): 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. alpha (Union[int, float]): The transparency of bboxes.
Defaults to 0.8. Defaults to 0.8.
""" """
@ -734,7 +734,7 @@ class Visualizer(ManagerMixin):
"""Draw single or multiple bboxes. """Draw single or multiple bboxes.
Args: 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 List[Union[np.ndarray, torch.Tensor]]]): The polygons to draw
with the format of (x1,y1,x2,y2,...,xn,yn). with the format of (x1,y1,x2,y2,...,xn,yn).
edge_colors (Union[str, tuple, List[str], List[tuple]]): The edge_colors (Union[str, tuple, List[str], List[tuple]]): The
@ -756,7 +756,7 @@ class Visualizer(ManagerMixin):
If ``line_widths`` is single value, all the lines will If ``line_widths`` is single value, all the lines will
have the same linewidth. Defaults to 2. have the same linewidth. Defaults to 2.
face_colors (Union[str, tuple, List[str], List[tuple]]): 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. alpha (Union[int, float]): The transparency of polygons.
Defaults to 0.8. Defaults to 0.8.
""" """
@ -871,28 +871,28 @@ class Visualizer(ManagerMixin):
"""Draw featmap. """Draw featmap.
- If `overlaid_image` is not None, the final output image will be the - 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` - If `resize_shape` is specified, `featmap` and `overlaid_image`
are interpolated. are interpolated.
- If `resize_shape` is None and `overlaid_image` is not None, - If `resize_shape` is None and `overlaid_image` is not None,
the feature map will be interpolated to the spatial size of the image the feature map will be interpolated to the spatial size of the image
in the case where the spatial dimensions of `overlaid_image` and in the case where the spatial dimensions of `overlaid_image` and
`featmap` are different. `featmap` are different.
- If `channel_reduction` is "squeeze_mean" and "select_max", - If `channel_reduction` is "squeeze_mean" and "select_max",
it will compress featmap to single channel image and weighted it will compress featmap to single channel image and weighted
sum to `overlaid_image`. sum to `overlaid_image`.
- if `channel_reduction` is None - if `channel_reduction` is None
- If topk <= 0, featmap is assert to be one or three - If topk <= 0, featmap is assert to be one or three
channel and treated as image and will be weighted sum channel and treated as image and will be weighted sum
to ``overlaid_image``. to ``overlaid_image``.
- If topk > 0, it will select topk channel to show by the sum of - 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` each channel. At the same time, you can specify the `arrangement`
to set the window layout. to set the window layout.
Args: Args:
featmap (torch.Tensor): The featmap to draw which format is featmap (torch.Tensor): The featmap to draw which format is