forked from mindspore-Ecosystem/mindspore
!49708 fix: add command for map file
Merge pull request !49708 from guozhijian/code_docs_map_file_r1.10
This commit is contained in:
commit
926a29534b
|
@ -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::
|
||||
|
||||
|
|
|
@ -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).
|
||||
|
|
|
@ -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::
|
||||
|
||||
|
|
Loading…
Reference in New Issue