From f84ccf72b97204796f43d341ca1e5760bfbe8185 Mon Sep 17 00:00:00 2001 From: Tau Date: Wed, 13 Mar 2024 15:22:00 +0800 Subject: [PATCH] [Doc] Add more detailed comments (#2982) * add more detailed comments * add more detailed comments --- docs/en/advanced_guides/customize_datasets.md | 46 +++++++++++++----- docs/en/guide_to_framework.md | 20 +++++--- docs/en/user_guides/prepare_datasets.md | 12 +++-- .../advanced_guides/customize_datasets.md | 48 +++++++++++++------ docs/zh_cn/guide_to_framework.md | 20 +++++--- docs/zh_cn/user_guides/prepare_datasets.md | 14 ++++-- 6 files changed, 112 insertions(+), 48 deletions(-) diff --git a/docs/en/advanced_guides/customize_datasets.md b/docs/en/advanced_guides/customize_datasets.md index aec7520a30..e0210ede19 100644 --- a/docs/en/advanced_guides/customize_datasets.md +++ b/docs/en/advanced_guides/customize_datasets.md @@ -171,9 +171,13 @@ train_dataloader = dict( batch_size=2, dataset=dict( type=dataset_type, - data_root='root/of/your/train/data', - ann_file='path/to/your/train/json', - data_prefix=dict(img='path/to/your/train/img'), + data_root='aaa', + # ann file is stored at {data_root}/{ann_file} + # e.g. aaa/annotations/xxx.json + ann_file='annotations/xxx.json', + # img is stored at {data_root}/{img}/ + # e.g. aaa/train/c.jpg + data_prefix=dict(img='train'), metainfo=dict(from_file='configs/_base_/datasets/custom.py'), ...), ) @@ -182,9 +186,13 @@ val_dataloader = dict( batch_size=2, dataset=dict( type=dataset_type, - data_root='root/of/your/val/data', - ann_file='path/to/your/val/json', - data_prefix=dict(img='path/to/your/val/img'), + data_root='aaa', + # ann file is stored at {data_root}/{ann_file} + # e.g. aaa/annotations/yyy.json + ann_file='annotations/yyy.json', + # img is stored at {data_root}/{img}/ + # e.g. aaa/val/c.jpg + data_prefix=dict(img='val'), metainfo=dict(from_file='configs/_base_/datasets/custom.py'), ...), ) @@ -193,9 +201,13 @@ test_dataloader = dict( batch_size=2, dataset=dict( type=dataset_type, - data_root='root/of/your/test/data', - ann_file='path/to/your/test/json', - data_prefix=dict(img='path/to/your/test/img'), + data_root='aaa', + # ann file is stored at {data_root}/{ann_file} + # e.g. aaa/annotations/zzz.json + ann_file='annotations/zzz.json', + # img is stored at {data_root}/{img}/ + # e.g. aaa/test/c.jpg + data_prefix=dict(img='test'), metainfo=dict(from_file='configs/_base_/datasets/custom.py'), ...), ) @@ -218,8 +230,12 @@ MMPose provides [CombinedDataset](https://github.com/open-mmlab/mmpose/blob/dev- ```python dataset_1 = dict( type='dataset_type_1', - data_root='root/of/your/dataset1', - data_prefix=dict(img_path='path/to/your/img'), + data_root='aaa', + # ann file is stored at {data_root}/{ann_file} + # e.g. aaa/annotations/train.json + data_prefix=dict(img_path='train'), + # img is stored at {data_root}/{img}/ + # e.g. aaa/train/c.jpg ann_file='annotations/train.json', pipeline=[ # the converter transforms convert data into a unified format @@ -228,8 +244,12 @@ dataset_1 = dict( dataset_2 = dict( type='dataset_type_2', - data_root='root/of/your/dataset2', - data_prefix=dict(img_path='path/to/your/img'), + data_root='bbb', + # ann file is stored at {data_root}/{ann_file} + # e.g. bbb/annotations/train.json + data_prefix=dict(img_path='train'), + # img is stored at {data_root}/{img}/ + # e.g. bbb/train/c.jpg ann_file='annotations/train.json', pipeline=[ converter_transform_2 diff --git a/docs/en/guide_to_framework.md b/docs/en/guide_to_framework.md index 167a65d949..669eeb3410 100644 --- a/docs/en/guide_to_framework.md +++ b/docs/en/guide_to_framework.md @@ -171,9 +171,13 @@ train_dataloader = dict( batch_size=2, dataset=dict( type=dataset_type, - data_root='root of your train data', - ann_file='path to your json file', - data_prefix=dict(img='path to your train img'), + data_root='aaa', + # ann file is stored at {data_root}/{ann_file} + # e.g. aaa/annotations/train.json + ann_file='annotations/train.json', + # img is stored at {data_root}/{img}/ + # e.g. aaa/train/c.jpg + data_prefix=dict(img='train'), # specify the new dataset meta information config file metainfo=dict(from_file='configs/_base_/datasets/custom.py'), ...), @@ -183,9 +187,13 @@ val_dataloader = dict( batch_size=2, dataset=dict( type=dataset_type, - data_root='root of your val data', - ann_file='path to your val json', - data_prefix=dict(img='path to your val img'), + data_root='aaa', + # ann file is stored at {data_root}/{ann_file} + # e.g. aaa/annotations/val.json + ann_file='annotations/val.json', + # img is stored at {data_root}/{img}/ + # e.g. aaa/val/c.jpg + data_prefix=dict(img='val'), # specify the new dataset meta information config file metainfo=dict(from_file='configs/_base_/datasets/custom.py'), ...), diff --git a/docs/en/user_guides/prepare_datasets.md b/docs/en/user_guides/prepare_datasets.md index be47e07b8f..9e164c1ea4 100644 --- a/docs/en/user_guides/prepare_datasets.md +++ b/docs/en/user_guides/prepare_datasets.md @@ -96,16 +96,20 @@ The [Customize Datasets](../advanced_guides/customize_datasets.md) guide provide - Determine the dataset class name. If you reorganize your dataset into the COCO format, you can simply use `CocoDataset` as the value for `dataset_type`. Otherwise, you will need to use the name of the custom dataset class you added. -- Specify the meta information config file. MMPose 1.x employs a different strategy for specifying meta information compared to MMPose 0.x. In MMPose 1.x, users can specify the meta information config file as follows: +- Specify the meta information config file. Suppose the path of the annotation file is `aaa/annotations/xxx.json`, and the path of imgs is `aaa/train/c.jpg`, you should specify the meta information config file as follows: ```python train_dataloader = dict( ... dataset=dict( type=dataset_type, - data_root='root/of/your/train/data', - ann_file='path/to/your/train/json', - data_prefix=dict(img='path/to/your/train/img'), + data_root='aaa', + # ann file is stored at {data_root}/{ann_file} + # e.g. aaa/annotations/xxx.json + ann_file='annotations/xxx.json', + # img is stored at {data_root}/{img}/ + # e.g. aaa/train/c.jpg + data_prefix=dict(img='train'), # specify dataset meta information metainfo=dict(from_file='configs/_base_/datasets/custom.py'), ...), diff --git a/docs/zh_cn/advanced_guides/customize_datasets.md b/docs/zh_cn/advanced_guides/customize_datasets.md index 9d1db35ceb..e177b60ca2 100644 --- a/docs/zh_cn/advanced_guides/customize_datasets.md +++ b/docs/zh_cn/advanced_guides/customize_datasets.md @@ -175,16 +175,20 @@ dataset_info = dict( ```python ... -# 自定义数据集类 +# 自定义数据集 dataset_type = 'MyCustomDataset' # or 'CocoDataset' train_dataloader = dict( batch_size=2, dataset=dict( type=dataset_type, - data_root='root/of/your/train/data', - ann_file='path/to/your/train/json', - data_prefix=dict(img='path/to/your/train/img'), + data_root='aaa', + # 标注文件路径为 {data_root}/{ann_file} + # 例如: aaa/annotations/xxx.json + ann_file='annotations/xxx.json', + # 图片路径为 {data_root}/{img}/ + # 例如: aaa/train/c.jpg + data_prefix=dict(img='train'), metainfo=dict(from_file='configs/_base_/datasets/custom.py'), ...), ) @@ -193,9 +197,13 @@ val_dataloader = dict( batch_size=2, dataset=dict( type=dataset_type, - data_root='root/of/your/val/data', - ann_file='path/to/your/val/json', - data_prefix=dict(img='path/to/your/val/img'), + data_root='aaa', + # 标注文件路径为 {data_root}/{ann_file} + # 例如: aaa/annotations/yyy.json + ann_file='annotations/yyy.json', + # 图片路径为 {data_root}/{img}/ + # 例如: aaa/val/c.jpg + data_prefix=dict(img='val'), metainfo=dict(from_file='configs/_base_/datasets/custom.py'), ...), ) @@ -204,9 +212,13 @@ test_dataloader = dict( batch_size=2, dataset=dict( type=dataset_type, - data_root='root/of/your/test/data', - ann_file='path/to/your/test/json', - data_prefix=dict(img='path/to/your/test/img'), + data_root='aaa', + # 标注文件路径为 {data_root}/{ann_file} + # 例如: aaa/annotations/zzz.json + ann_file='annotations/zzz.json', + # 图片路径为 {data_root}/{img}/ + # 例如: aaa/test/c.jpg + data_prefix=dict(img='test'), metainfo=dict(from_file='configs/_base_/datasets/custom.py'), ...), ) @@ -229,8 +241,12 @@ MMPose 提供了一个 [CombinedDataset](https://github.com/open-mmlab/mmpose/bl ```python dataset_1 = dict( type='dataset_type_1', - data_root='root/of/your/dataset1', - data_prefix=dict(img_path='path/to/your/img'), + data_root='aaa', + # 图片路径为 {data_root}/{img_path}/ + # 例如: aaa/train/c.jpg + data_prefix=dict(img_path='train'), + # 标注文件路径为 {data_root}/{ann_file} + # 例如: aaa/annotations/train.json ann_file='annotations/train.json', pipeline=[ # 使用转换器将标注信息统一为需要的格式 @@ -239,8 +255,12 @@ dataset_1 = dict( dataset_2 = dict( type='dataset_type_2', - data_root='root/of/your/dataset2', - data_prefix=dict(img_path='path/to/your/img'), + data_root='bbb', + # 图片路径为 {data_root}/{img_path}/ + # 例如: bbb/train/c.jpg + data_prefix=dict(img_path='train'), + # 标注文件路径为 {data_root}/{ann_file} + # 例如: bbb/annotations/train.json ann_file='annotations/train.json', pipeline=[ converter_transform_2 diff --git a/docs/zh_cn/guide_to_framework.md b/docs/zh_cn/guide_to_framework.md index df86f8634f..4aeda2520b 100644 --- a/docs/zh_cn/guide_to_framework.md +++ b/docs/zh_cn/guide_to_framework.md @@ -176,9 +176,13 @@ train_dataloader = dict( batch_size=2, dataset=dict( type=dataset_type, - data_root='root of your train data', - ann_file='path to your json file', - data_prefix=dict(img='path to your train img'), + data_root='aaa', + # 标注文件路径为 {data_root}/{ann_file} + # 例如: aaa/annotations/train.json + ann_file='annotations/train.json', + # 图片路径为 {data_root}/{img_path}/ + # 例如: aaa/train/c.jpg + data_prefix=dict(img='train'), # 指定对应的元信息配置文件 metainfo=dict(from_file='configs/_base_/datasets/custom.py'), ...), @@ -187,9 +191,13 @@ val_dataloader = dict( batch_size=2, dataset=dict( type=dataset_type, - data_root='root of your val data', - ann_file='path to your val json', - data_prefix=dict(img='path to your val img'), + data_root='aaa', + # 标注文件路径为 {data_root}/{ann_file} + # 例如: aaa/annotations/val.json + ann_file='annotations/val.json', + # 图片路径为 {data_root}/{img_path}/ + # 例如: aaa/val/c.jpg + data_prefix=dict(img='val'), # 指定对应的元信息配置文件 metainfo=dict(from_file='configs/_base_/datasets/custom.py'), ...), diff --git a/docs/zh_cn/user_guides/prepare_datasets.md b/docs/zh_cn/user_guides/prepare_datasets.md index 4452405819..defa88daef 100644 --- a/docs/zh_cn/user_guides/prepare_datasets.md +++ b/docs/zh_cn/user_guides/prepare_datasets.md @@ -96,17 +96,21 @@ MMPose 支持多种任务和相应的数据集。你可以在 [数据集仓库]( - 确定数据集类名。如果你将数据集重组为 COCO 格式,你可以简单地使用 `CocoDataset` 作为 `dataset_type` 的值。否则,你将需要使用你添加的自定义数据集类的名称。 -- 指定元信息配置文件。MMPose 1.x 采用了与 MMPose 0.x 不同的策略来指定元信息。在 MMPose 1.x 中,用户可以按照以下方式指定元信息配置文件: +- 指定元信息配置文件。假设你的数据集标注文件存储路径为 `aaa/annotations/xxx.json`,图片存储路径为 `aaa/train/c.jpg`,你应该按照以下方式指定元信息配置文件: ```python train_dataloader = dict( ... dataset=dict( type=dataset_type, - data_root='root/of/your/train/data', - ann_file='path/to/your/train/json', - data_prefix=dict(img='path/to/your/train/img'), - # specify dataset meta information + data_root='aaa', + # 标注文件路径为 {data_root}/{ann_file} + # 例如: aaa/annotations/xxx.json + ann_file='annotations/xxx.json', + # 图片路径为 {data_root}/{img}/ + # 例如: aaa/train/c.jpg + data_prefix=dict(img='train'), + # 指定元信息配置文件 metainfo=dict(from_file='configs/_base_/datasets/custom.py'), ...), )