sail-sg / poolformer

PoolFormer: MetaFormer Is Actually What You Need for Vision (CVPR 2022 Oral)
https://arxiv.org/abs/2111.11418
Apache License 2.0
1.3k stars 117 forks source link

No module named 'mmcv_ custom.runner.optimizer' #44

Closed yuhua666 closed 1 year ago

yuhua666 commented 1 year ago

Hello, Doctor, I haven't modified the code, but I can't run it. The error prompt is as follows: No module named 'mmcv_ custom.runner.optimizer' I checked the mmdet version and found it correct.

yuhua666 commented 1 year ago

Now it has been solved, but a new problem arises during training:

2023-01-06 21:56:00,339 - mmdet - INFO - load checkpoint from local path: checkpoints/poolformer_s12.pth.tar 2023-01-06 21:56:00,588 - mmdet - INFO - load checkpoint from local path: checkpoints/poolformer_s12.pth.tar 2023-01-06 21:56:00,633 - mmdet - INFO - initialize FPN with init_cfg {'type': 'Xavier', 'layer': 'Conv2d', 'distribution': 'uniform'} 2023-01-06 21:56:00,649 - mmdet - INFO - initialize RPNHead with init_cfg {'type': 'Normal', 'layer': 'Conv2d', 'std': 0.01} 2023-01-06 21:56:00,654 - mmdet - INFO - initialize Shared2FCBBoxHead with init_cfg [{'type': 'Normal', 'std': 0.01, 'override': {'name': 'fc_cls'}}, {'type': 'Normal', 'std': 0.001, 'override': {'name': 'fc_reg'}}, {'type': 'Xavier', 'override': [{'name': 'shared_fcs'}, {'name': 'cls_fcs'}, {'name': 'reg_fcs'}]}] loading annotations into memory... loading annotations into memory... Done (t=14.65s) creating index... Done (t=14.67s) creating index... index created! index created! loading annotations into memory... loading annotations into memory... Done (t=0.39s) creating index... Done (t=0.39s) creating index... index created! index created! 2023-01-06 21:56:18,988 - mmdet - INFO - Start running, host: micro@user-Name, work_dir: /home/micro/users/zjl/poolformer-main/detection/work_dirs/mask_rcnn_poolformer_s12_fpn_1x_coco 2023-01-06 21:56:18,988 - mmdet - INFO - Hooks will be executed in the following order: before_run: (VERY_HIGH ) StepLrUpdaterHook (NORMAL ) CheckpointHook (NORMAL ) DistEvalHook (VERY_LOW ) TextLoggerHook

before_train_epoch: (VERY_HIGH ) StepLrUpdaterHook (NORMAL ) DistSamplerSeedHook (NORMAL ) DistEvalHook (NORMAL ) NumClassCheckHook (LOW ) IterTimerHook (VERY_LOW ) TextLoggerHook

before_train_iter: (VERY_HIGH ) StepLrUpdaterHook (NORMAL ) DistEvalHook (LOW ) IterTimerHook

after_train_iter: (ABOVE_NORMAL) OptimizerHook (NORMAL ) CheckpointHook (NORMAL ) DistEvalHook (LOW ) IterTimerHook (VERY_LOW ) TextLoggerHook

after_train_epoch: (NORMAL ) CheckpointHook (NORMAL ) DistEvalHook (VERY_LOW ) TextLoggerHook

before_val_epoch: (NORMAL ) DistSamplerSeedHook (NORMAL ) NumClassCheckHook (LOW ) IterTimerHook (VERY_LOW ) TextLoggerHook

before_val_iter: (LOW ) IterTimerHook

after_val_iter: (LOW ) IterTimerHook

after_val_epoch: (VERY_LOW ) TextLoggerHook

after_run: (VERY_LOW ) TextLoggerHook

2023-01-06 21:56:18,988 - mmdet - INFO - workflow: [('train', 1)], max: 12 epochs 2023-01-06 21:56:18,989 - mmdet - INFO - Checkpoints will be saved to /home/micro/users/zjl/poolformer-main/detection/work_dirs/mask_rcnn_poolformer_s12_fpn_1x_coco by HardDiskBackend. Traceback (most recent call last): File "./train.py", line 194, in main() File "./train.py", line 183, in main train_detector( File "/home/micro/users/zjl/poolformer-main/detection/mmdet_custom/apis/train.py", line 184, in train_detector runner.run(data_loaders, cfg.workflow) File "/home/micro/anaconda3/envs/poolformer/lib/python3.8/site-packages/mmcv/runner/epoch_based_runner.py", line 127, in run epoch_runner(data_loaders[i], kwargs) File "/home/micro/anaconda3/envs/poolformer/lib/python3.8/site-packages/mmcv/runner/epoch_based_runner.py", line 50, in train self.run_iter(data_batch, train_mode=True, kwargs) File "/home/micro/anaconda3/envs/poolformer/lib/python3.8/site-packages/mmcv/runner/epoch_based_runner.py", line 29, in run_iter outputs = self.model.train_step(data_batch, self.optimizer, File "/home/micro/anaconda3/envs/poolformer/lib/python3.8/site-packages/mmcv/parallel/distributed.py", line 52, in train_step output = self.module.train_step(inputs[0], kwargs[0]) File "/home/micro/users/zjl/poolformer-main/mmdet/models/detectors/base.py", line 248, in train_step losses = self(data) File "/home/micro/anaconda3/envs/poolformer/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(input, kwargs) File "/home/micro/anaconda3/envs/poolformer/lib/python3.8/site-packages/mmcv/runner/fp16_utils.py", line 98, in new_func return old_func(args, kwargs) File "/home/micro/users/zjl/poolformer-main/mmdet/models/detectors/base.py", line 172, in forward return self.forward_train(img, img_metas, kwargs) File "/home/micro/users/zjl/poolformer-main/mmdet/models/detectors/two_stage.py", line 147, in forward_train roi_losses = self.roi_head.forward_train(x, img_metas, proposal_list, File "/home/micro/users/zjl/poolformer-main/mmdet/models/roi_heads/standard_roi_head.py", line 111, in forward_train mask_results = self._mask_forward_train(x, sampling_results, File "/home/micro/users/zjl/poolformer-main/mmdet/models/roi_heads/standard_roi_head.py", line 172, in _mask_forward_train mask_targets = self.mask_head.get_targets(sampling_results, gt_masks, File "/home/micro/users/zjl/poolformer-main/mmdet/models/roi_heads/mask_heads/fcn_mask_head.py", line 143, in get_targets mask_targets = mask_target(pos_proposals, pos_assigned_gt_inds, File "/home/micro/users/zjl/poolformer-main/mmdet/core/mask/mask_target.py", line 59, in mask_target mask_targets = map(mask_target_single, pos_proposals_list, TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "./train.py", line 194, in main() File "./train.py", line 183, in main train_detector( File "/home/micro/users/zjl/poolformer-main/detection/mmdet_custom/apis/train.py", line 184, in train_detector runner.run(data_loaders, cfg.workflow) File "/home/micro/anaconda3/envs/poolformer/lib/python3.8/site-packages/mmcv/runner/epoch_based_runner.py", line 127, in run epoch_runner(data_loaders[i], kwargs) File "/home/micro/anaconda3/envs/poolformer/lib/python3.8/site-packages/mmcv/runner/epoch_based_runner.py", line 50, in train self.run_iter(data_batch, train_mode=True, kwargs) File "/home/micro/anaconda3/envs/poolformer/lib/python3.8/site-packages/mmcv/runner/epoch_based_runner.py", line 29, in run_iter outputs = self.model.train_step(data_batch, self.optimizer, File "/home/micro/anaconda3/envs/poolformer/lib/python3.8/site-packages/mmcv/parallel/distributed.py", line 52, in train_step output = self.module.train_step(inputs[0], kwargs[0]) File "/home/micro/users/zjl/poolformer-main/mmdet/models/detectors/base.py", line 248, in train_step losses = self(data) File "/home/micro/anaconda3/envs/poolformer/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, *kwargs) File "/home/micro/anaconda3/envs/poolformer/lib/python3.8/site-packages/mmcv/runner/fp16_utils.py", line 98, in new_func return old_func(args, kwargs) File "/home/micro/users/zjl/poolformer-main/mmdet/models/detectors/base.py", line 172, in forward return self.forward_train(img, img_metas, **kwargs) File "/home/micro/users/zjl/poolformer-main/mmdet/models/detectors/two_stage.py", line 147, in forward_train roi_losses = self.roi_head.forward_train(x, img_metas, proposal_list, File "/home/micro/users/zjl/poolformer-main/mmdet/models/roi_heads/standard_roi_head.py", line 111, in forward_train mask_results = self._mask_forward_train(x, sampling_results, File "/home/micro/users/zjl/poolformer-main/mmdet/models/roi_heads/standard_roi_head.py", line 172, in _mask_forward_train mask_targets = self.mask_head.get_targets(sampling_results, gt_masks, File "/home/micro/users/zjl/poolformer-main/mmdet/models/roi_heads/mask_heads/fcn_mask_head.py", line 143, in get_targets mask_targets = mask_target(pos_proposals, pos_assigned_gt_inds, File "/home/micro/users/zjl/poolformer-main/mmdet/core/mask/mask_target.py", line 59, in mask_target mask_targets = map(mask_target_single, pos_proposals_list, TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/micro/anaconda3/envs/poolformer/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/home/micro/anaconda3/envs/poolformer/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/micro/anaconda3/envs/poolformer/lib/python3.8/site-packages/torch/distributed/launch.py", line 260, in main() File "/home/micro/anaconda3/envs/poolformer/lib/python3.8/site-packages/torch/distributed/launch.py", line 255, in main raise subprocess.CalledProcessError(returncode=process.returncode, subprocess.CalledProcessError: Command '['/home/micro/anaconda3/envs/poolformer/bin/python', '-u', './train.py', '--local_rank=1', 'configs/mask_rcnn_poolformer_s12_fpn_1x_coco.py', '--launcher', 'pytorch']' returned non-zero exit status 1.