Repository: open-mmlab/mmdetection3d

Issue:
KeyError: 'CosineAnealingLrUpdaterHook is not in the hook registry'
Cannot use the `CosineAnealing` policy in `lr_config`. Hope for your help!


## Env:
```
2020-08-06 15:21:45,303 - mmdet - INFO - Environment info:
------------------------------------------------------------
sys.platform: linux
Python: 3.7.8 | packaged by conda-forge | (default, Jul 31 2020, 02:25:08) [GCC 7.5.0]
CUDA available: True
CUDA_HOME: /usr/local/cuda-10.0
NVCC: Cuda compilation tools, release 10.0, V10.0.130
GPU 0,1: TITAN X (Pascal)
GCC: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
PyTorch: 1.4.0
PyTorch compiling details: PyTorch built with:
  - GCC 7.3
  - Intel(R) Math Kernel Library Version 2020.0.1 Product Build 20200208 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v0.21.1 (Git Hash 7d2fd500bc78936d1d648ca713b901012f470dbc)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - NNPACK is enabled
  - CUDA Runtime 10.0
  - NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_37,code=compute_37
  - CuDNN 7.6.3
  - Magma 2.5.1
  - Build settings: BLAS=MKL, BUILD_NAMEDTENSOR=OFF, BUILD_TYPE=Release, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -fopenmp -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -O2 -fPIC -Wno-narrowing -Wall -Wextra -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Wno-stringop-overflow, DISABLE_NUMA=1, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_STATIC_DISPATCH=OFF, 

TorchVision: 0.5.0
OpenCV: 4.3.0
MMCV: 1.0.5
MMDetection: 2.3.0
MMDetection3D: 0.5.0+6526459
MMDetection3D Compiler: GCC 5.4
MMDetection3D CUDA Compiler: 10.0
```


## run this command: 
`CUDA_VISIBLE_DEVICES=2,3 PORT=29510 tools/dist_train.sh     configs/mvxnet/dv_mvx-fpn_second_secfpn_adamw_2x8_80e_kitti-3d-3class.py 2`

## Error Traceback:
```
Traceback (most recent call last):
  File "tools/train.py", line 166, in <module>
    main()
  File "tools/train.py", line 162, in main
    meta=meta)
  File "~/proj/3det/mmdetection/mmdet/apis/train.py", line 108, in train_detector
    cfg.get('momentum_config', None))
  File "~/proj/3det/mmcv/mmcv/runner/base_runner.py", line 412, in register_training_hooks
    self.register_lr_hook(lr_config)
  File "~/proj/3det/mmcv/mmcv/runner/base_runner.py", line 342, in register_lr_hook
    hook = mmcv.build_from_cfg(lr_config, HOOKS)
  File "~/proj/3det/mmcv/mmcv/utils/registry.py", line 157, in build_from_cfg
    f'{obj_type} is not in the {registry.name} registry')
KeyError: 'CosineAnealingLrUpdaterHook is not in the hook registry'
Traceback (most recent call last):
  File "tools/train.py", line 166, in <module>
    main()
  File "tools/train.py", line 162, in main
    meta=meta)
  File "~/proj/3det/mmdetection/mmdet/apis/train.py", line 108, in train_detector
    cfg.get('momentum_config', None))
  File "~/proj/3det/mmcv/mmcv/runner/base_runner.py", line 412, in register_training_hooks
    self.register_lr_hook(lr_config)
  File "~/proj/3det/mmcv/mmcv/runner/base_runner.py", line 342, in register_lr_hook
    hook = mmcv.build_from_cfg(lr_config, HOOKS)
  File "~/proj/3det/mmcv/mmcv/utils/registry.py", line 157, in build_from_cfg
    f'{obj_type} is not in the {registry.name} registry')
KeyError: 'CosineAnealingLrUpdaterHook is not in the hook registry'
Traceback (most recent call last):
  File "~/anaconda3/envs/mm3det/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "~/anaconda3/envs/mm3det/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "~/anaconda3/envs/mm3det/lib/python3.7/site-packages/torch/distributed/launch.py", line 263, in <module>
    main()
  File "~/anaconda3/envs/mm3det/lib/python3.7/site-packages/torch/distributed/launch.py", line 259, in main
    cmd=cmd)
subprocess.CalledProcessError: Command '['~/anaconda3/envs/mm3det/bin/python', '-u', 'tools/train.py', '--local_rank=1', 'configs/mvxnet/dv_mvx-fpn_second_secfpn_adamw_2x8_80e_kitti-3d-3class.py', '--launcher', 'pytorch']' returned non-zero exit status 1.
```


Discussion:
Hi @zl9501 ,
Thanks for your bug report.
This is a typo, `CosineAnnealing` should work. We will fix this issue ASAP.

Resolving patch:
diff --git a/configs/dynamic_voxelization/dv_second_secfpn_2x8_cosine_80e_kitti-3d-3class.py b/configs/dynamic_voxelization/dv_second_secfpn_2x8_cosine_80e_kitti-3d-3class.py
--- a/configs/dynamic_voxelization/dv_second_secfpn_2x8_cosine_80e_kitti-3d-3class.py
+++ b/configs/dynamic_voxelization/dv_second_secfpn_2x8_cosine_80e_kitti-3d-3class.py
@@ -27,7 +27,7 @@
     weight_decay=0.001)
 lr_config = dict(
     _delete_=True,
-    policy='CosineAnealing',
+    policy='CosineAnnealing',
     warmup='linear',
     warmup_iters=1000,
     warmup_ratio=1.0 / 10,
diff --git a/configs/mvxnet/dv_mvx-fpn_second_secfpn_adamw_2x8_80e_kitti-3d-3class.py b/configs/mvxnet/dv_mvx-fpn_second_secfpn_adamw_2x8_80e_kitti-3d-3class.py
--- a/configs/mvxnet/dv_mvx-fpn_second_secfpn_adamw_2x8_80e_kitti-3d-3class.py
+++ b/configs/mvxnet/dv_mvx-fpn_second_secfpn_adamw_2x8_80e_kitti-3d-3class.py
@@ -228,7 +228,7 @@
 # max_norm=10 is better for SECOND
 optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2))
 lr_config = dict(
-    policy='CosineAnealing',
+    policy='CosineAnnealing',
     warmup='linear',
     warmup_iters=1000,
     warmup_ratio=1.0 / 10,


Test patch: