From 7506596d00f0ccab2fd4db158852c78aa698d2e9 Mon Sep 17 00:00:00 2001 From: luminxu Date: Thu, 22 Jul 2021 17:06:33 +0800 Subject: [PATCH 1/3] add docs zh-CN tutorial2 --- docs/tutorials/2_new_dataset.md | 2 +- docs_zh-CN/tutorials/2_new_dataset.md | 93 ++++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 2 deletions(-) diff --git a/docs/tutorials/2_new_dataset.md b/docs/tutorials/2_new_dataset.md index 06be91f18b..bb0bddf990 100644 --- a/docs/tutorials/2_new_dataset.md +++ b/docs/tutorials/2_new_dataset.md @@ -58,7 +58,7 @@ The annotation json files in COCO format has the following necessary keys: There are three necessary keys in the json file: -- `images`: contains a list of images with theire informations like `file_name`, `height`, `width`, and `id`. +- `images`: contains a list of images with their information like `file_name`, `height`, `width`, and `id`. - `annotations`: contains the list of instance annotations. - `categories`: contains the category name ('person') and its ID (1). diff --git a/docs_zh-CN/tutorials/2_new_dataset.md b/docs_zh-CN/tutorials/2_new_dataset.md index 98c1cfc565..c664db68ca 100644 --- a/docs_zh-CN/tutorials/2_new_dataset.md +++ b/docs_zh-CN/tutorials/2_new_dataset.md @@ -1,3 +1,94 @@ # 教程 2: 增加新的数据集 -内容建设中…… +## 通过重组数据来自定义数据集 + +### 将数据集重新组织为现有格式 + +使用自定义数据集最简单的方法是将其转换为现有的COCO数据集格式。 + +COCO数据集格式的json标注文件有以下关键字: + +```python +'images': [ + { + 'file_name': '000000001268.jpg', + 'height': 427, + 'width': 640, + 'id': 1268 + }, + ... +], +'annotations': [ + { + 'segmentation': [[426.36, + ... + 424.34, + 223.3]], + 'keypoints': [0,0,0, + 0,0,0, + 0,0,0, + 427,220,2, + 443,222,2, + 414,228,2, + 449,232,2, + 408,248,1, + 454,261,2, + 0,0,0, + 0,0,0, + 411,287,2, + 431,287,2, + 0,0,0, + 458,265,2, + 0,0,0, + 466,300,1], + 'num_keypoints': 10, + 'area': 3894.5826, + 'iscrowd': 0, + 'image_id': 1268, + 'bbox': [402.34, 205.02, 65.26, 88.45], + 'category_id': 1, + 'id': 215218 + }, + ... +], +'categories': [ + {'id': 1, 'name': 'person'}, + ] +``` + +Json文件中必须包含以下三个关键字: + +- `images`: 包含图片信息的列表,提供图片的 `file_name`, `height`, `width` 和 `id` 等信息。 +- `annotations`: 包含实例标注的列表。 +- `categories`: 包含数据集中分类的名称 ('person') 和对应的 ID (1)。 + +在数据预处理完成后,用户需要修改配置文件以使用该数据集。 + +在 `configs/my_custom_config.py`下: + +```python +... +# 数据集设定 +dataset_type = 'MyCustomDataset' +classes = ('a', 'b', 'c', 'd', 'e') +... +data = dict( + samples_per_gpu=2, + workers_per_gpu=2, + train=dict( + type=dataset_type, + ann_file='path/to/your/train/json', + img_prefix='path/to/your/train/img', + ...), + val=dict( + type=dataset_type, + ann_file='path/to/your/val/json', + img_prefix='path/to/your/val/img', + ...), + test=dict( + type=dataset_type, + ann_file='path/to/your/test/json', + img_prefix='path/to/your/test/img', + ...)) +... +``` From 4b813964b8917261142a4fa5ffefd622cc2d6390 Mon Sep 17 00:00:00 2001 From: luminxu Date: Thu, 22 Jul 2021 17:23:38 +0800 Subject: [PATCH 2/3] add docs zh-CN tutorial2 --- docs_zh-CN/tutorials/2_new_dataset.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs_zh-CN/tutorials/2_new_dataset.md b/docs_zh-CN/tutorials/2_new_dataset.md index c664db68ca..e71063df14 100644 --- a/docs_zh-CN/tutorials/2_new_dataset.md +++ b/docs_zh-CN/tutorials/2_new_dataset.md @@ -1,8 +1,8 @@ # 教程 2: 增加新的数据集 -## 通过重组数据来自定义数据集 +## 通过组织数据格式来自定义数据集 -### 将数据集重新组织为现有格式 +### 将数据集组织为现有格式 使用自定义数据集最简单的方法是将其转换为现有的COCO数据集格式。 @@ -64,7 +64,7 @@ Json文件中必须包含以下三个关键字: 在数据预处理完成后,用户需要修改配置文件以使用该数据集。 -在 `configs/my_custom_config.py`下: +在 `configs/my_custom_config.py` 文件中,需要进行如下修改: ```python ... From 382f56de12bba7f9e919b48b52fa45b15b49b928 Mon Sep 17 00:00:00 2001 From: luminxu Date: Thu, 22 Jul 2021 19:11:44 +0800 Subject: [PATCH 3/3] add docs zh-CN tutorial2 --- docs_zh-CN/tutorials/2_new_dataset.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs_zh-CN/tutorials/2_new_dataset.md b/docs_zh-CN/tutorials/2_new_dataset.md index e71063df14..b6327828db 100644 --- a/docs_zh-CN/tutorials/2_new_dataset.md +++ b/docs_zh-CN/tutorials/2_new_dataset.md @@ -1,8 +1,6 @@ # 教程 2: 增加新的数据集 -## 通过组织数据格式来自定义数据集 - -### 将数据集组织为现有格式 +## 通过将数据组织为已有格式来添加自定义数据集 使用自定义数据集最简单的方法是将其转换为现有的COCO数据集格式。 @@ -60,7 +58,7 @@ Json文件中必须包含以下三个关键字: - `images`: 包含图片信息的列表,提供图片的 `file_name`, `height`, `width` 和 `id` 等信息。 - `annotations`: 包含实例标注的列表。 -- `categories`: 包含数据集中分类的名称 ('person') 和对应的 ID (1)。 +- `categories`: 包含类别名称 ('person') 和对应的 ID (1)。 在数据预处理完成后,用户需要修改配置文件以使用该数据集。