From 8890aa3cdefa1b12d12268ec77a120baf0b2ab58 Mon Sep 17 00:00:00 2001 From: Yining Li Date: Wed, 15 Jun 2022 20:53:55 +0800 Subject: [PATCH] [Fix] rename `custom_hooks_config` to `custom_hooks` (#1427) * rename custom_hooks_config to custom_hooks --- .../mtut/nvgesture/i3d_nvgesture_224x224_fps30.py | 2 +- .../mtut/nvgesture/i3d_nvgesture_bbox_112x112_fps15.py | 2 +- .../nvgesture/i3d_nvgesture_bbox_112x112_fps15_rgb.py | 2 +- .../mtut/nvgesture/i3d_nvgesture_bbox_224x224_fps30.py | 2 +- mmpose/apis/train.py | 10 +++++++++- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/configs/hand/gesture_sview_rgbd_vid/mtut/nvgesture/i3d_nvgesture_224x224_fps30.py b/configs/hand/gesture_sview_rgbd_vid/mtut/nvgesture/i3d_nvgesture_224x224_fps30.py index 4c2e2b400f..a875f60dfb 100644 --- a/configs/hand/gesture_sview_rgbd_vid/mtut/nvgesture/i3d_nvgesture_224x224_fps30.py +++ b/configs/hand/gesture_sview_rgbd_vid/mtut/nvgesture/i3d_nvgesture_224x224_fps30.py @@ -17,7 +17,7 @@ total_epochs = 75 log_config = dict(interval=10) -custom_hooks_config = [dict(type='ModelSetEpochHook')] +custom_hooks = [dict(type='ModelSetEpochHook')] model = dict( type='GestureRecognizer', diff --git a/configs/hand/gesture_sview_rgbd_vid/mtut/nvgesture/i3d_nvgesture_bbox_112x112_fps15.py b/configs/hand/gesture_sview_rgbd_vid/mtut/nvgesture/i3d_nvgesture_bbox_112x112_fps15.py index ae2fe2e960..1125e55406 100644 --- a/configs/hand/gesture_sview_rgbd_vid/mtut/nvgesture/i3d_nvgesture_bbox_112x112_fps15.py +++ b/configs/hand/gesture_sview_rgbd_vid/mtut/nvgesture/i3d_nvgesture_bbox_112x112_fps15.py @@ -17,7 +17,7 @@ total_epochs = 130 log_config = dict(interval=10) -custom_hooks_config = [dict(type='ModelSetEpochHook')] +custom_hooks = [dict(type='ModelSetEpochHook')] model = dict( type='GestureRecognizer', diff --git a/configs/hand/gesture_sview_rgbd_vid/mtut/nvgesture/i3d_nvgesture_bbox_112x112_fps15_rgb.py b/configs/hand/gesture_sview_rgbd_vid/mtut/nvgesture/i3d_nvgesture_bbox_112x112_fps15_rgb.py index 9777dda67e..ac9fc89b7b 100644 --- a/configs/hand/gesture_sview_rgbd_vid/mtut/nvgesture/i3d_nvgesture_bbox_112x112_fps15_rgb.py +++ b/configs/hand/gesture_sview_rgbd_vid/mtut/nvgesture/i3d_nvgesture_bbox_112x112_fps15_rgb.py @@ -18,7 +18,7 @@ total_epochs = 130 log_config = dict(interval=10) -custom_hooks_config = [dict(type='ModelSetEpochHook')] +custom_hooks = [dict(type='ModelSetEpochHook')] model = dict( type='GestureRecognizer', diff --git a/configs/hand/gesture_sview_rgbd_vid/mtut/nvgesture/i3d_nvgesture_bbox_224x224_fps30.py b/configs/hand/gesture_sview_rgbd_vid/mtut/nvgesture/i3d_nvgesture_bbox_224x224_fps30.py index 8a00d1e9f4..1cbc1f5011 100644 --- a/configs/hand/gesture_sview_rgbd_vid/mtut/nvgesture/i3d_nvgesture_bbox_224x224_fps30.py +++ b/configs/hand/gesture_sview_rgbd_vid/mtut/nvgesture/i3d_nvgesture_bbox_224x224_fps30.py @@ -17,7 +17,7 @@ total_epochs = 75 log_config = dict(interval=10) -custom_hooks_config = [dict(type='ModelSetEpochHook')] +custom_hooks = [dict(type='ModelSetEpochHook')] model = dict( type='GestureRecognizer', diff --git a/mmpose/apis/train.py b/mmpose/apis/train.py index 1fbfb0edc8..9c30e32fee 100644 --- a/mmpose/apis/train.py +++ b/mmpose/apis/train.py @@ -168,6 +168,14 @@ def train_model(model, else: optimizer_config = cfg.optimizer_config + custom_hooks_cfg = cfg.get('custom_hooks', None) + if custom_hooks_cfg is None: + custom_hooks_cfg = cfg.get('custom_hooks_config', None) + if custom_hooks_cfg is not None: + warnings.warn( + '"custom_hooks_config" is deprecated, please use ' + '"custom_hooks" instead.', DeprecationWarning) + # register hooks runner.register_training_hooks( cfg.lr_config, @@ -175,7 +183,7 @@ def train_model(model, cfg.checkpoint_config, cfg.log_config, cfg.get('momentum_config', None), - custom_hooks_config=cfg.get('custom_hooks_config', None)) + custom_hooks_config=custom_hooks_cfg) if distributed: runner.register_hook(DistSamplerSeedHook())