From d7fdf20aafc1fcc6aeb9278bc5126d3aaea84090 Mon Sep 17 00:00:00 2001 From: jonyguo Date: Wed, 4 Jan 2023 14:37:35 +0800 Subject: [PATCH] update md docs --- .../mindrecord/mindspore.mindrecord.ImageNetToMR.rst | 2 +- .../mindspore/dataset/engine/datasets_standard_format.py | 4 ++-- .../python/mindspore/mindrecord/tools/imagenet_to_mr.py | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/api/api_python/mindrecord/mindspore.mindrecord.ImageNetToMR.rst b/docs/api/api_python/mindrecord/mindspore.mindrecord.ImageNetToMR.rst index e720820c150..4fab1ff5082 100644 --- a/docs/api/api_python/mindrecord/mindspore.mindrecord.ImageNetToMR.rst +++ b/docs/api/api_python/mindrecord/mindspore.mindrecord.ImageNetToMR.rst @@ -4,7 +4,7 @@ 将ImageNet数据集转换为MindRecord格式数据集。 参数: - - **map_file** (str) - 标签映射文件的路径。映射文件内容如下: + - **map_file** (str) - 标签映射文件的路径。该文件可通过命令: :code:`ls -l [image_dir] | grep -vE "总用量|total|\." | awk -F " " '{print $9, NR-1;}' > [file_path]` 生成,其中 `image_dir` 为ImageNet数据集的目录路径, `file_path` 为生成的 `map_file` 文件 。 `map_file` 文件内容示例如下: .. code-block:: diff --git a/mindspore/python/mindspore/dataset/engine/datasets_standard_format.py b/mindspore/python/mindspore/dataset/engine/datasets_standard_format.py index 2b8280db5fc..e5519b09506 100644 --- a/mindspore/python/mindspore/dataset/engine/datasets_standard_format.py +++ b/mindspore/python/mindspore/dataset/engine/datasets_standard_format.py @@ -112,9 +112,9 @@ class MindDataset(MappableDataset, UnionBaseDataset): The columns of generated dataset depend on the source MindRecord files. Args: - dataset_files (Union[str, list[str]]): If dataset_file is a str, it represents for + dataset_files (Union[str, list[str]]): If `dataset_files` is a str, it represents for a file name of one component of a mindrecord source, other files with identical source - in the same path will be found and loaded automatically. If dataset_file is a list, + in the same path will be found and loaded automatically. If `dataset_files` is a list, it represents for a list of dataset files to be read directly. columns_list (list[str], optional): List of columns to be read (default=None). num_parallel_workers (int, optional): The number of readers (default=None). diff --git a/mindspore/python/mindspore/mindrecord/tools/imagenet_to_mr.py b/mindspore/python/mindspore/mindrecord/tools/imagenet_to_mr.py index 724152e2914..3e6e36d1dea 100644 --- a/mindspore/python/mindspore/mindrecord/tools/imagenet_to_mr.py +++ b/mindspore/python/mindspore/mindrecord/tools/imagenet_to_mr.py @@ -27,11 +27,14 @@ __all__ = ['ImageNetToMR'] class ImageNetToMR: - """ + r""" A class to transform from imagenet to MindRecord. Args: - map_file (str): The map file that indicates label. The map file content should be like this: + map_file (str): The map file that indicates label. This file can be generated by command + :code:`ls -l [image_dir] | grep -vE "total|\." | awk -F " " '{print $9, NR-1;}' > [file_path]` , + where `image_dir` is image directory contains n02119789, n02100735, n02110185 and n02096294 directory + and `file_path` is the generated `map_file` . An example of `map_file` is as below: .. code-block::