Skip to content
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

[Doc] Chinese doc of customize_runtime #829

Merged
merged 5 commits into from
Aug 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ In order to fix the problem that the priority of EvalHook is too low, all hook p
#### Highlights

- Support a new multi-modality method [ImVoteNet](https://arxiv.org/abs/2001.10692).
- Support pytorch 1.7 and 1.8
- Support PyTorch 1.7 and 1.8
- Refactor the structure of tools and [train.py](https://github.com/open-mmlab/mmdetection3d/blob/master/tools/train.py)/[test.py](https://github.com/open-mmlab/mmdetection3d/blob/master/tools/test.py)

#### New Features
Expand Down Expand Up @@ -157,7 +157,7 @@ In order to fix the problem that the priority of EvalHook is too low, all hook p
- Fix the SECOND results on Waymo in the corresponding [README](https://github.com/open-mmlab/mmdetection3d/tree/master/configs/second) (#363)
- Fix the incorrect adopted pipeline when adding val to workflow (#370)
- Fix a potential bug when indices used in the backwarding in ThreeNN (#377)
- Fix a compilation error triggered by [scatter_points_cuda.cu](https://github.com/open-mmlab/mmdetection3d/blob/master/mmdet3d/ops/voxel/src/scatter_points_cuda.cu) in pytorch 1.7 (#393)
- Fix a compilation error triggered by [scatter_points_cuda.cu](https://github.com/open-mmlab/mmdetection3d/blob/master/mmdet3d/ops/voxel/src/scatter_points_cuda.cu) in PyTorch 1.7 (#393)

### v0.11.0 (1/3/2021)

Expand All @@ -183,7 +183,7 @@ In order to fix the problem that the priority of EvalHook is too low, all hook p
- Fix an unsupported bias setting in the unit test for centerpoint head (#304)
- Fix errors due to typos in the centerpoint head (#308)
- Fix a minor bug in [points_in_boxes.py](https://github.com/open-mmlab/mmdetection3d/blob/master/mmdet3d/ops/roiaware_pool3d/points_in_boxes.py) when tensors are not in the same device. (#317)
- Fix warning of deprecated usages of nonzero during training with pytorch 1.6 (#330)
- Fix warning of deprecated usages of nonzero during training with PyTorch 1.6 (#330)

### v0.10.0 (1/2/2021)

Expand Down Expand Up @@ -285,15 +285,15 @@ In order to fix the problem that the priority of EvalHook is too low, all hook p
#### Highlights

- Support mixed precision training of voxel-based methods
- Support docker with pytorch 1.6.0
- Support docker with PyTorch 1.6.0
- Update baseline configs and results ([CenterPoint](https://github.com/open-mmlab/mmdetection3d/tree/master/configs/centerpoint) on nuScenes and [PointPillars](https://github.com/open-mmlab/mmdetection3d/tree/master/configs/pointpillars) on Waymo with full dataset)
- Switch model zoo to download.openmmlab.com

#### New Features

- Support dataset pipeline `VoxelBasedPointSampler` to sample multi-sweep points based on voxelization. (#125)
- Support mixed precision training of voxel-based methods (#132)
- Support docker with pytorch 1.6.0 (#160)
- Support docker with PyTorch 1.6.0 (#160)

#### Improvements

Expand Down Expand Up @@ -350,7 +350,7 @@ In order to fix the problem that the priority of EvalHook is too low, all hook p

#### Improvements

- Fix all warnings and bugs in Pytorch 1.6.0 (#70, #72)
- Fix all warnings and bugs in PyTorch 1.6.0 (#70, #72)
- Update issue templates (#43)
- Update unit tests (#20, #24, #30)
- Update documentation for using `ply` format point cloud data (#41)
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Here is a full script for setting up MMdetection3D with conda.
conda create -n open-mmlab python=3.7 -y
conda activate open-mmlab

# install latest pytorch prebuilt with the default prebuilt CUDA version (usually the latest)
# install latest PyTorch prebuilt with the default prebuilt CUDA version (usually the latest)
conda install -c pytorch pytorch torchvision -y

# install mmcv
Expand Down
20 changes: 11 additions & 9 deletions docs/tutorials/customize_runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Customize optimization settings

### Customize optimizer supported by Pytorch
### Customize optimizer supported by PyTorch

We already support to use all the optimizers implemented by PyTorch, and the only modification is to change the `optimizer` field of config files.
For example, if you want to use `ADAM` (note that the performance could drop a lot), the modification could be as the following.
Expand Down Expand Up @@ -67,7 +67,7 @@ The module `mmdet3d.core.optimizer.my_optimizer` will be imported at the beginni
Note that only the package containing the class `MyOptimizer` should be imported.
`mmdet3d.core.optimizer.my_optimizer.MyOptimizer` **cannot** be imported directly.

Actually users can use a totally different file directory structure using this importing method, as long as the module root can be located in `PYTHONPATH`.
Actually users can use a totally different file directory structure in this importing method, as long as the module root can be located in `PYTHONPATH`.

#### 3. Specify the optimizer in the config file

Expand All @@ -87,7 +87,7 @@ optimizer = dict(type='MyOptimizer', a=a_value, b=b_value, c=c_value)
### Customize optimizer constructor

Some models may have some parameter-specific settings for optimization, e.g. weight decay for BatchNorm layers.
The users can do those fine-grained parameter tuning through customizing optimizer constructor.
The users can tune those fine-grained parameters through customizing optimizer constructor.

```python
from mmcv.utils import build_from_cfg
Expand Down Expand Up @@ -115,16 +115,18 @@ The default optimizer constructor is implemented [here](https://github.com/open-
Tricks not implemented by the optimizer should be implemented through optimizer constructor (e.g., set parameter-wise learning rates) or hooks. We list some common settings that could stabilize the training or accelerate the training. Feel free to create PR, issue for more settings.

- __Use gradient clip to stabilize training__:

Some models need gradient clip to clip the gradients to stabilize the training process. An example is as below:

```python
optimizer_config = dict(
_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
```

If your config inherits the base config which already sets the `optimizer_config`, you might need `_delete_=True` to overide the unnecessary settings. See the [config documenetation](https://mmdetection.readthedocs.io/en/latest/tutorials/config.html) for more details.
If your config inherits the base config which already sets the `optimizer_config`, you might need `_delete_=True` to overide the unnecessary settings in the base config. See the [config documentation](https://mmdetection.readthedocs.io/en/latest/tutorials/config.html) for more details.

- __Use momentum schedule to accelerate model convergence__:

We support momentum scheduler to modify model's momentum according to learning rate, which could make the model converge in a faster way.
Momentum scheduler is usually used with LR scheduler, for example, the following config is used in 3D detection to accelerate convergence.
For more details, please refer to the implementation of [CyclicLrUpdater](https://github.com/open-mmlab/mmcv/blob/v1.3.7/mmcv/runner/hooks/lr_updater.py#L358) and [CyclicMomentumUpdater](https://github.com/open-mmlab/mmcv/blob/v1.3.7/mmcv/runner/hooks/momentum_updater.py#L225).
Expand Down Expand Up @@ -234,7 +236,7 @@ Depending on the functionality of the hook, the users need to specify what the h

#### 2. Register the new hook

Then we need to make `MyHook` imported. Assuming the file is in `mmdet3d/core/utils/my_hook.py` there are two ways to do that:
Then we need to make `MyHook` imported. Assuming the hook is in `mmdet3d/core/utils/my_hook.py` there are two ways to do that:

- Modify `mmdet3d/core/utils/__init__.py` to import it.

Expand Down Expand Up @@ -262,7 +264,7 @@ custom_hooks = [
]
```

You can also set the priority of the hook by adding key `priority` to `'NORMAL'` or `'HIGHEST'` as below
You can also set the priority of the hook by setting key `priority` to `'NORMAL'` or `'HIGHEST'` as below

```python
custom_hooks = [
Expand Down Expand Up @@ -305,12 +307,12 @@ The MMCV runner will use `checkpoint_config` to initialize [`CheckpointHook`](ht
checkpoint_config = dict(interval=1)
```

The users could set `max_keep_ckpts` to save only small number of checkpoints or decide whether to store state dict of optimizer by `save_optimizer`. More details of the arguments are [here](https://mmcv.readthedocs.io/en/latest/api.html#mmcv.runner.CheckpointHook)
The users could set `max_keep_ckpts` to save only small number of checkpoints or decide whether to store state dict of optimizer by `save_optimizer`. More details of the arguments are [here](https://mmcv.readthedocs.io/en/latest/api.html#mmcv.runner.CheckpointHook).

#### Log config

The `log_config` wraps multiple logger hooks and enables to set intervals. Now MMCV supports `WandbLoggerHook`, `MlflowLoggerHook`, and `TensorboardLoggerHook`.
The detail usages can be found in the [doc](https://mmcv.readthedocs.io/en/latest/api.html#mmcv.runner.LoggerHook).
The detailed usages can be found in the [docs](https://mmcv.readthedocs.io/en/latest/api.html#mmcv.runner.LoggerHook).

```python
log_config = dict(
Expand All @@ -324,7 +326,7 @@ log_config = dict(
#### Evaluation config

The config of `evaluation` will be used to initialize the [`EvalHook`](https://github.com/open-mmlab/mmdetection/blob/v2.13.0/mmdet/core/evaluation/eval_hooks.py#L9).
Except the key `interval`, other arguments such as `metric` will be passed to the `dataset.evaluate()`
Except the key `interval`, other arguments such as `metric` will be passed to the `dataset.evaluate()`.

```python
evaluation = dict(interval=1, metric='bbox')
Expand Down
8 changes: 4 additions & 4 deletions docs_zh-CN/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ conda install pytorch=1.3.1 cudatoolkit=9.2 torchvision=0.4.2 -c pytorch

如果不是安装预构建的包,而是从源码中构建 PyTorch,则可以使用更多的 CUDA 版本,例如 CUDA 9.0。

**c. 安装 [MMCV](https://mmcv.readthedocs.io/en/latest/).**
**c. 安装 [MMCV](https://mmcv.readthedocs.io/en/latest/).**
需要安装 *mmcv-full*,因为 MMDetection3D 依赖 MMDetection 且需要 *mmcv-full* 中基于 CUDA 的程序。

`例` 可以使用下面命令安装预编译版本的 *mmcv-full* :(可使用的版本在[这里](https://mmcv.readthedocs.io/en/latest/#install-with-pip)可以找到)
Expand Down Expand Up @@ -90,7 +90,7 @@ pip install mmcv-full
pip install mmdet==2.14.0
```

同时,如果你想修改这部分的代码,也可以通过以下命令从源码编译 MMDetection:
同时,如果你想修改这部分的代码,也可以通过以下命令从源码编译 MMDetection:

```shell
git clone https://github.com/open-mmlab/mmdetection.git
Expand Down Expand Up @@ -157,13 +157,13 @@ docker run --gpus all --shm-size=8g -it -v {DATA_DIR}:/mmdetection3d/data mmdete

## 从零开始的安装脚本

以下是一个基于 conda 安装 MMdetection3D 的脚本
以下是一个基于 conda 安装 MMdetection3D 的脚本

```shell
conda create -n open-mmlab python=3.7 -y
conda activate open-mmlab

# 安装基于环境中默认 CUDA 版本下最新的PyTorch (通常使用最新版本)
# 安装基于环境中默认 CUDA 版本下最新的 PyTorch (通常使用最新版本)
conda install -c pytorch pytorch torchvision -y

# 安装 mmcv
Expand Down
Loading