multiview_pose icon indicating copy to clipboard operation
multiview_pose copied to clipboard

TypeError: __init__() got an unexpected keyword argument 'keypoint_head'

Open jaychou-max opened this issue 2 years ago • 1 comments

I had this error in replicating your code. Traceback (most recent call last): File "D:\anaconda3\envs\PRGN\lib\site-packages\mmcv\utils\registry.py", line 69, in build_from_cfg return obj_cls(**args) File "E:\code\multiview_pose-main\multiview_pose\models\detectors\multiview_pose.py", line 13, in init super(GraphBasedModel, self).init(*args, **kwargs) TypeError: init() got an unexpected keyword argument 'keypoint_head'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "tools/train.py", line 206, in main() File "tools/train.py", line 180, in main model = build_posenet(cfg.model) File "D:\anaconda3\envs\PRGN\lib\site-packages\mmpose\models\builder.py", line 39, in build_posenet return POSENETS.build(cfg) File "D:\anaconda3\envs\PRGN\lib\site-packages\mmcv\utils\registry.py", line 237, in build return self.build_func(*args, **kwargs, registry=self) File "D:\anaconda3\envs\PRGN\lib\site-packages\mmcv\cnn\builder.py", line 27, in build_model_from_cfg return build_from_cfg(cfg, registry, default_args) File "D:\anaconda3\envs\PRGN\lib\site-packages\mmcv\utils\registry.py", line 72, in build_from_cfg raise type(e)(f'{obj_cls.name}: {e}') TypeError: GraphBasedModel: init() got an unexpected keyword argument 'keypoint_head' ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 9732) of binary: D:\anaconda3\envs\PRGN\python.exe Traceback (most recent call last): File "D:\anaconda3\envs\PRGN\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "D:\anaconda3\envs\PRGN\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "D:\anaconda3\envs\PRGN\lib\site-packages\torch\distributed\launch.py", line 193, in main() File "D:\anaconda3\envs\PRGN\lib\site-packages\torch\distributed\launch.py", line 189, in main launch(args) File "D:\anaconda3\envs\PRGN\lib\site-packages\torch\distributed\launch.py", line 174, in launch run(args) File "D:\anaconda3\envs\PRGN\lib\site-packages\torch\distributed\run.py", line 755, in run )(*cmd_args) File "D:\anaconda3\envs\PRGN\lib\site-packages\torch\distributed\launcher\api.py", line 131, in call return launch_agent(self._config, self._entrypoint, list(args)) File "D:\anaconda3\envs\PRGN\lib\site-packages\torch\distributed\launcher\api.py", line 247, in launch_agent failures=result.failures, torch.distributed.elastic.multiprocessing.errors.ChildFailedError:

tools/train.py FAILED

I changed the code in the GraphBasedModel class to look like this: @POSENETS.register_module() class GraphBasedModel(DetectAndRegress): def init(self, num_joints, pose_refiner, test_with_refine=True, freeze_keypoint_head=True,keypoint_head=None, *args, **kwargs): super(GraphBasedModel, self).init(*args, **kwargs) self.num_joints = num_joints if pose_refiner is not None: self.pose_refiner = GCNS.build(pose_refiner) else: self.pose_refiner = None self.test_with_refine = test_with_refine self.freeze_keypoint_head = freeze_keypoint_head self.keypoint_head = keypoint_head There was this mistake again: Traceback (most recent call last): File "tools/train.py", line 206, in main() File "tools/train.py", line 202, in main meta=meta) File "D:\anaconda3\envs\PRGN\lib\site-packages\mmpose\apis\train.py", line 213, in train_model runner.run(data_loaders, cfg.workflow, cfg.total_epochs) File "D:\anaconda3\envs\PRGN\lib\site-packages\mmcv\runner\epoch_based_runner.py", line 136, in run epoch_runner(data_loaders[i], **kwargs) File "D:\anaconda3\envs\PRGN\lib\site-packages\mmcv\runner\epoch_based_runner.py", line 53, in train self.run_iter(data_batch, train_mode=True, **kwargs) File "D:\anaconda3\envs\PRGN\lib\site-packages\mmcv\runner\epoch_based_runner.py", line 32, in run_iter **kwargs) File "D:\anaconda3\envs\PRGN\lib\site-packages\mmcv\parallel\data_parallel.py", line 77, in train_step return self.module.train_step(*inputs[0], **kwargs[0]) File "D:\anaconda3\envs\PRGN\lib\site-packages\mmpose\models\detectors\multiview_pose.py", line 273, in train_step losses = self.forward(**data_batch) File "E:\code\multiview_pose-main\multiview_pose\models\detectors\multiview_pose.py", line 58, in forward targets_3d, input_heatmaps, **kwargs) File "E:\code\multiview_pose-main\multiview_pose\models\detectors\multiview_pose.py", line 79, in forward_train feature_maps.append(self.predict_heatmap(img_)[0]) File "D:\anaconda3\envs\PRGN\lib\site-packages\torch\nn\modules\module.py", line 1208, in getattr type(self).name, name)) AttributeError: 'GraphBasedModel' object has no attribute 'predict_heatmap' ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 19796) of binary: D:\anaconda3\envs\PRGN\python.exe Traceback (most recent call last): File "D:\anaconda3\envs\PRGN\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "D:\anaconda3\envs\PRGN\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "D:\anaconda3\envs\PRGN\lib\site-packages\torch\distributed\launch.py", line 193, in main() File "D:\anaconda3\envs\PRGN\lib\site-packages\torch\distributed\launch.py", line 189, in main launch(args) File "D:\anaconda3\envs\PRGN\lib\site-packages\torch\distributed\launch.py", line 174, in launch run(args) File "D:\anaconda3\envs\PRGN\lib\site-packages\torch\distributed\run.py", line 755, in run )(*cmd_args) File "D:\anaconda3\envs\PRGN\lib\site-packages\torch\distributed\launcher\api.py", line 131, in call return launch_agent(self._config, self._entrypoint, list(args)) File "D:\anaconda3\envs\PRGN\lib\site-packages\torch\distributed\launcher\api.py", line 247, in launch_agent failures=result.failures, torch.distributed.elastic.multiprocessing.errors.ChildFailedError:

jaychou-max avatar Dec 06 '23 07:12 jaychou-max

Hi! May I know the version of MMPose you used?

wusize avatar Dec 09 '23 05:12 wusize