未验证 提交 e2e1bb28 编写于 作者: 走神的阿圆's avatar 走神的阿圆 提交者: GitHub

add docs for dataformats in add_image (#803)

Co-authored-by: NPeter Pan <littlepanzh@gmail.com>
上级 8e562d4e
...@@ -201,7 +201,7 @@ Image 组件用于显示图片数据随训练的变化。在模型训练过程 ...@@ -201,7 +201,7 @@ Image 组件用于显示图片数据随训练的变化。在模型训练过程
Image 组件的记录接口如下: Image 组件的记录接口如下:
```python ```python
add_image(tag, img, step, walltime=None) add_image(tag, img, step, walltime=None, dataformats="HWC")
``` ```
接口参数说明如下: 接口参数说明如下:
| 参数 | 格式 | 含义 | | 参数 | 格式 | 含义 |
...@@ -210,6 +210,7 @@ add_image(tag, img, step, walltime=None) ...@@ -210,6 +210,7 @@ add_image(tag, img, step, walltime=None)
| img | numpy.ndarray | 以ndarray格式表示的图片 | | img | numpy.ndarray | 以ndarray格式表示的图片 |
| step | int | 记录的步数 | | step | int | 记录的步数 |
| walltime | int | 记录数据的时间戳,默认为当前时间戳 | | walltime | int | 记录数据的时间戳,默认为当前时间戳 |
| dataformats| string | 传入的图片格式,包括`NCHW``HWC``HW`,默认为`HWC`|
### Demo ### Demo
下面展示了使用 Image 组件记录数据的示例,代码文件请见[Image组件](https://github.com/PaddlePaddle/VisualDL/blob/develop/demo/components/image_test.py) 下面展示了使用 Image 组件记录数据的示例,代码文件请见[Image组件](https://github.com/PaddlePaddle/VisualDL/blob/develop/demo/components/image_test.py)
......
...@@ -203,7 +203,7 @@ The Image is used to present the change of image data during training. Developer ...@@ -203,7 +203,7 @@ The Image is used to present the change of image data during training. Developer
The interface of the Image is shown as follows: The interface of the Image is shown as follows:
```python ```python
add_image(tag, img, step, walltime=None) add_image(tag, img, step, walltime=None, dataformats="HWC")
``` ```
The interface parameters are described as follows: The interface parameters are described as follows:
| parameter | format | meaning | | parameter | format | meaning |
...@@ -212,6 +212,7 @@ The interface parameters are described as follows: ...@@ -212,6 +212,7 @@ The interface parameters are described as follows:
| img | numpy.ndarray | Images in ndarray format | | img | numpy.ndarray | Images in ndarray format |
| step | int | Record the training steps | | step | int | Record the training steps |
| walltime | int | Record the time-stamp of the data, the default is the current time-stamp | | walltime | int | Record the time-stamp of the data, the default is the current time-stamp |
| dataformats| string | Format of image,include `NCHW``HWC``HW`,default is `HWC`|
### Demo ### Demo
The following shows an example of using Image to record data, and the script can be found in [Image Demo](https://github.com/PaddlePaddle/VisualDL/blob/develop/demo/components/image_test.py). The following shows an example of using Image to record data, and the script can be found in [Image Demo](https://github.com/PaddlePaddle/VisualDL/blob/develop/demo/components/image_test.py).
......
...@@ -146,6 +146,7 @@ def image(tag, image_array, step, walltime=None, dataformats="HWC"): ...@@ -146,6 +146,7 @@ def image(tag, image_array, step, walltime=None, dataformats="HWC"):
image_array (numpy.ndarray): Value of iamge image_array (numpy.ndarray): Value of iamge
step (int): Step of image step (int): Step of image
walltime (int): Wall time of image walltime (int): Wall time of image
dataformats (string): Format of image
Return: Return:
Package with format of record_pb2.Record Package with format of record_pb2.Record
......
...@@ -171,6 +171,7 @@ class LogWriter(object): ...@@ -171,6 +171,7 @@ class LogWriter(object):
img (numpy.ndarray): Image represented by a numpy.array img (numpy.ndarray): Image represented by a numpy.array
step (int): Step of image step (int): Step of image
walltime (int): Wall time of image walltime (int): Wall time of image
dataformats (string): Format of image
Example: Example:
from PIL import Image from PIL import Image
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册