Skip to content

Commit

Permalink
add more detailed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Tau-J committed Mar 13, 2024
1 parent 108691a commit 3b504dd
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 47 deletions.
46 changes: 33 additions & 13 deletions docs/en/advanced_guides/customize_datasets.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
...),
)
Expand All @@ -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'),
...),
)
Expand All @@ -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'),
...),
)
Expand All @@ -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
Expand All @@ -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
Expand Down
20 changes: 14 additions & 6 deletions docs/en/guide_to_framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
...),
Expand All @@ -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'),
...),
Expand Down
12 changes: 8 additions & 4 deletions docs/en/user_guides/prepare_datasets.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
...),
Expand Down
48 changes: 34 additions & 14 deletions docs/zh_cn/advanced_guides/customize_datasets.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
...),
)
Expand All @@ -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'),
...),
)
Expand All @@ -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'),
...),
)
Expand All @@ -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=[
# 使用转换器将标注信息统一为需要的格式
Expand All @@ -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
Expand Down
20 changes: 14 additions & 6 deletions docs/zh_cn/guide_to_framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
...),
Expand All @@ -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'),
...),
Expand Down
12 changes: 8 additions & 4 deletions docs/zh_cn/user_guides/prepare_datasets.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,20 @@ 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'),
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'),
...),
Expand Down

0 comments on commit 3b504dd

Please sign in to comment.