Skip to content

add detail on doc explain how to make self defined class of custom dataset registed #7906

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yestimes
Copy link

@yestimes yestimes commented May 4, 2022

Motivation

按照官方文档在mmdet/datasets增加了自定义数据集类,但是总是无法使用,报错该数据集类型不存在,因此增加了如何在自定义数据集类之后的两步,以解决我这样小白可能遇到的问题。
第一次pull request,如有不规范之处,还请见谅

Modification

修改了:

  • docs/en/tutorials/customize_dataset.md
  • docs/zh_cn/tutorials/customize_dataset.md

@mm-assistant
Copy link

mm-assistant bot commented May 4, 2022

Please use English or English & Chinese for pull requests so that we could have broader discussion.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov
Copy link

codecov bot commented May 4, 2022

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.67%. Comparing base (73b4e65) to head (fc9f896).
Report is 143 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7906      +/-   ##
==========================================
- Coverage   64.71%   64.67%   -0.05%     
==========================================
  Files         351      351              
  Lines       28461    28461              
  Branches     4807     4807              
==========================================
- Hits        18418    18406      -12     
- Misses       9055     9067      +12     
  Partials      988      988              
Flag Coverage Δ
unittests 64.67% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yestimes yestimes changed the title 自定义数据集的文档缺少一些细节,增加了这部分 add detail on doc explain how to make self defined class of custom dataset registed May 4, 2022
Comment on lines +291 to +294
last step, recompile source code
```shell
pip install -r requirements/build.txt
pip install -v -e . # or "python setup.py develop"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recompiling is unnecessary. Because mmdet is usually installed with develop mode. All modifications take effect directly.

@@ -276,7 +276,22 @@ class MyDataset(CustomDataset):

def get_ann_info(self, idx):
return self.data_infos[idx]['ann']
```
Add MyDataset to `mmdet/datasets/__init__.py`
Copy link
Collaborator

@jbwang1997 jbwang1997 May 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then, we need to import MyDataset in mmdet/datasets/__init__.py.

Comment on lines +282 to +289
from .my_datasets import MyDataset

__all__ = [
# ......
'OpenImagesDataset', 'OpenImagesChallengeDataset',
# add class name in the end
'MyDataset'
]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from .builder import DATASETS, PIPELINES, build_dataloader, build_dataset
from .cityscapes import CityscapesDataset
from .coco import CocoDataset
#......
from .my_datasets import MyDataset

__all__ = [
    # ......
    'OpenImagesDataset', 'OpenImagesChallengeDataset',
    # add class name in the end
    'MyDataset'
]

@jbwang1997
Copy link
Collaborator

Hello, @yestimes

Thanks very much for contributing to MMDetection. There are three things need to do before merging.

  • CLA has not signed yet. Please remember to sign.
    image
  • Lint failed in this pr. You can follow this tutorial to install pre-commit, which can automatically check all lint errors before commiting.
    image
  • I have left some comments above. Please remember to check.

Regards,

@OpenMMLab-Assistant-004

Hi @yestimes !We are grateful for your efforts in helping improve mmdetection open-source project during your personal time.
Welcome to join OpenMMLab Special Interest Group (SIG) private channel on Discord, where you can share your experiences, ideas, and build connections with like-minded peers. To join the SIG channel, simply message moderator— OpenMMLab on Discord or briefly share your open-source contributions in the #introductions channel and we will assist you. Look forward to seeing you there! Join us :https://discord.gg/UjgXkPWNqA
If you have a WeChat account,welcome to join our community on WeChat. You can add our assistant :openmmlabwx. Please add "mmsig + Github ID" as a remark when adding friends:)
Thank you again for your contribution❤

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants