Skip to content

Commit

Permalink
[Projects] Refine example projects and readme (#1628)
Browse files Browse the repository at this point in the history
* update projects

* powerhsell
  • Loading branch information
gaotongxiao authored Dec 27, 2022
1 parent 24bfb18 commit e81bb13
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 7 deletions.
9 changes: 9 additions & 0 deletions projects/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Projects

Implementing new models and features into OpenMMLab's algorithm libraries could be troublesome due to the rigorous requirements on code quality, which could hinder the fast iteration of SOTA models and might discourage our members from sharing their latest outcome here.

And that's why we have this `Projects/` folder now, where some experimental features, frameworks and models are placed, only needed to satisfy the minimum requirement on the code quality, and can be used as standalone libraries. Users are welcome to use them if they [use MMOCR from source](https://mmocr.readthedocs.io/en/dev-1.x/get_started/install.html#best-practices).

Everyone is welcome to post their implementation of any great ideas in this folder! If you wish to start your own project, please go through the [example project](example_project/) for the best practice.

Note: The core maintainers of MMOCR only ensure the results are reproducible and the code quality meets its claim at the time each project was submitted, but they may not be responsible for future maintenance. The original authors take responsibility for maintaining their own projects.
30 changes: 27 additions & 3 deletions projects/example_project/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,42 @@ This project implements a dummy ResNet wrapper, which literally does nothing new

<!-- For a typical model, this section should contain the commands for training and testing. You are also suggested to dump your environment specification to env.yml by `conda env export > env.yml`. -->

### Prerequisites

- Python 3.7
- PyTorch 1.6 or higher
- [MIM](https://github.com/open-mmlab/mim)
- [MMOCR](https://github.com/open-mmlab/mmocr)

All the commands below rely on the correct configuration of `PYTHONPATH`, which should point to the project's directory so that Python can locate the module files. In `example_project/` root directory, run the following line to add the current directory to `PYTHONPATH`:

```shell
# Linux
export PYTHONPATH=`pwd`:$PYTHONPATH
# Windows PowerShell
$env:PYTHONPATH=Get-Location
```

### Training commands

In MMOCR's root directory, run the following command to train the model:

```bash
python tools/train.py projects/example_project/configs/dbnet_dummy-resnet_fpnc_1200e_icdar2015.py
mim train mmocr configs/dbnet_dummy-resnet_fpnc_1200e_icdar2015.py --work-dir work_dirs/dummy_mae/
```

To train on multiple GPUs, e.g. 8 GPUs, run the following command:

```bash
mim train mmocr configs/dbnet_dummy-resnet_fpnc_1200e_icdar2015.py --work-dir work_dirs/dummy_mae/ --launcher pytorch --gpus 8
```

### Testing commands

In MMOCR's root directory, run the following command to test the model:

```bash
python tools/test.py projects/example_project/confsigs/dbnet_dummy-resnet_fpnc_1200e_icdar2015.py ${CHECKPOINT_PATH}
mim test mmocr configs/dbnet_dummy-resnet_fpnc_1200e_icdar2015.py --work-dir work_dirs/dummy_mae/ --checkpoint ${CHECKPOINT_PATH}
```

## Results
Expand Down Expand Up @@ -60,7 +82,9 @@ year = {2020}

## Checklist

<!-- Here is a checklist illustrating a usual development workflow of a successful project, and also serves as an overview of this project's progress. The PIC (person in charge) or contributors of this project should check all the items that they believe have been finished, which will further be verified by codebase maintainers via a PR.
Here is a checklist illustrating a usual development workflow of a successful project, and also serves as an overview of this project's progress.

<!-- The PIC (person in charge) or contributors of this project should check all the items that they believe have been finished, which will further be verified by codebase maintainers via a PR.
OpenMMLab's maintainer will review the code to ensure the project's quality. Reaching the first milestone means that this project suffices the minimum requirement of being merged into 'projects/'. But this project is only eligible to become a part of the core package upon attaining the last milestone.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
_base_ = [
'../../../configs/textdet/dbnet/dbnet_resnet18_fpnc_1200e_icdar2015.py'
]
_base_ = ['mmocr::textdet/dbnet/dbnet_resnet18_fpnc_1200e_icdar2015.py']

custom_imports = dict(imports=['projects.example_project.dummy'])
custom_imports = dict(imports=['dummy'])

_base_.model.backbone.type = 'DummyResNet'

0 comments on commit e81bb13

Please sign in to comment.