From 1936676e4a8d20a9fe4ea7419e4809bec8800d12 Mon Sep 17 00:00:00 2001 From: Yue Zhou <592267829@qq.com> Date: Mon, 21 Nov 2022 14:24:51 +0800 Subject: [PATCH] [Community] Add 'Projects/' folder, and the first example project (#627) * init * Update r3det-oc_dummy-resnet_fpn_1x_dota.py * Update README.md --- .github/workflows/merge_stage_test.yml | 1 + .github/workflows/pr_stage_test.yml | 1 + projects/example_project/README.md | 112 ++++++++++++++++++ .../r3det-oc_dummy-resnet_fpn_1x_dota.py | 5 + projects/example_project/dummy/__init__.py | 3 + .../example_project/dummy/dummy_resnet.py | 15 +++ 6 files changed, 137 insertions(+) create mode 100644 projects/example_project/README.md create mode 100644 projects/example_project/configs/r3det-oc_dummy-resnet_fpn_1x_dota.py create mode 100644 projects/example_project/dummy/__init__.py create mode 100644 projects/example_project/dummy/dummy_resnet.py diff --git a/.github/workflows/merge_stage_test.yml b/.github/workflows/merge_stage_test.yml index fc81b8c53..3178840ee 100644 --- a/.github/workflows/merge_stage_test.yml +++ b/.github/workflows/merge_stage_test.yml @@ -9,6 +9,7 @@ on: - 'demo/**' - '.dev_scripts/**' - '.circleci/**' + - 'projects/**' branches: - dev-1.x diff --git a/.github/workflows/pr_stage_test.yml b/.github/workflows/pr_stage_test.yml index 226b807e9..050395fe4 100644 --- a/.github/workflows/pr_stage_test.yml +++ b/.github/workflows/pr_stage_test.yml @@ -11,6 +11,7 @@ on: - 'demo/**' - '.dev_scripts/**' - '.circleci/**' + - 'projects/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/projects/example_project/README.md b/projects/example_project/README.md new file mode 100644 index 000000000..e0edc13a0 --- /dev/null +++ b/projects/example_project/README.md @@ -0,0 +1,112 @@ +# Dummy ResNet Wrapper + +This is an example README for community `projects/`. We have provided detailed explanations for each field in the form of html comments, which are visible when you read the source of this README file. If you wish to submit your project to our main repository, then all the fields in this README are mandatory for others to understand what you have achieved in this implementation. For more details, read our [contribution guide](https://mmrotate.readthedocs.io/en/1.x/notes/contribution_guide.html) or approach us in [Discussions](https://github.com/open-mmlab/mmrotate/discussions). + +## Description + + + +This project implements a dummy ResNet wrapper, which literally does nothing new but prints "hello world" during initialization. + +## Usage + + + +### Training commands + +In MMRotate's root directory, run the following command to train the model: + +```bash +python tools/train.py projects/example_project/configs/r3det-oc_dummy-resnet_fpn_1x_dota.py +``` + +### Testing commands + +In MMRotate's root directory, run the following command to test the model: + +```bash +python tools/test.py projects/example_project/confsigs/r3det-oc_dummy-resnet_fpn_1x_dota.py ${CHECKPOINT_PATH} +``` + +## Results + + + +| Backbone | mAP | Angle | lr schd | Mem (GB) | Inf Time (fps) | Aug | Batch Size | Configs | Download | +| :----------------------: | :---: | :---: | :-----: | :------: | :------------: | :-: | :--------: | :--------------------------------------------------------------------------------: | :----------------------: | +| ResNet50 (1024,1024,200) | 69.80 | oc | 1x | 3.54 | 12.4 | - | 2 | [r3det-oc_dummy-resnet_fpn_1x_dota](confsigs/r3det-oc_dummy-resnet_fpn_1x_dota.py) | [model](<>) \| [log](<>) | + +## Citation + + + +```bibtex +@inproceedings{zhou2022mmrotate, + title = {MMRotate: A Rotated Object Detection Benchmark using PyTorch}, + author = {Zhou, Yue and Yang, Xue and Zhang, Gefan and Wang, Jiabao and Liu, Yanyi and + Hou, Liping and Jiang, Xue and Liu, Xingzhao and Yan, Junchi and Lyu, Chengqi and + Zhang, Wenwei and Chen, Kai}, + booktitle={Proceedings of the 30th ACM International Conference on Multimedia}, + pages = {7331–7334}, + numpages = {4}, + year={2022} +} +``` + +## Checklist + + + +- [ ] Milestone 1: PR-ready, and acceptable to be one of the `projects/`. + + - [ ] Finish the code + + + + - [ ] Basic docstrings & proper citation + + + + - [ ] Test-time correctness + + + + - [ ] A full README + + + +- [ ] Milestone 2: Indicates a successful model implementation. + + - [ ] Training-time correctness + + + +- [ ] Milestone 3: Good to be a part of our core package! + + - [ ] Type hints and docstrings + + + + - [ ] Unit tests + + + + - [ ] Code polishing + + + + - [ ] Metafile.yml + + + +- [ ] Move your modules into the core package following the codebase's file hierarchy structure. + + + +- [ ] Refactor your modules into the core package following the codebase's file hierarchy structure. diff --git a/projects/example_project/configs/r3det-oc_dummy-resnet_fpn_1x_dota.py b/projects/example_project/configs/r3det-oc_dummy-resnet_fpn_1x_dota.py new file mode 100644 index 000000000..5ce1200e1 --- /dev/null +++ b/projects/example_project/configs/r3det-oc_dummy-resnet_fpn_1x_dota.py @@ -0,0 +1,5 @@ +_base_ = ['../../../configs/r3det/r3det-oc_r50_fpn_1x_dota.py'] + +custom_imports = dict(imports=['projects.example_project.dummy']) + +_base_.model.backbone.type = 'DummyResNet' diff --git a/projects/example_project/dummy/__init__.py b/projects/example_project/dummy/__init__.py new file mode 100644 index 000000000..70df7896d --- /dev/null +++ b/projects/example_project/dummy/__init__.py @@ -0,0 +1,3 @@ +from .dummy_resnet import DummyResNet + +__all__ = ['DummyResNet'] diff --git a/projects/example_project/dummy/dummy_resnet.py b/projects/example_project/dummy/dummy_resnet.py new file mode 100644 index 000000000..10720ebbd --- /dev/null +++ b/projects/example_project/dummy/dummy_resnet.py @@ -0,0 +1,15 @@ +from mmdet.models.backbones import ResNet + +from mmrotate.registry import MODELS + + +@MODELS.register_module() +class DummyResNet(ResNet): + """Implements a dummy ResNet wrapper for demonstration purpose. + Args: + **kwargs: All the arguments are passed to the parent class. + """ + + def __init__(self, **kwargs) -> None: + print('Hello world!') + super().__init__(**kwargs)