fundamentalvision / BEVFormer

[ECCV 2022] This is the official implementation of BEVFormer, a camera-only framework for autonomous driving perception, e.g., 3D object detection and semantic map segmentation.
https://arxiv.org/abs/2203.17270
Apache License 2.0
3.2k stars 524 forks source link

About the eval_model in EpochBasedRunner_video when train the tiny_fp16 #255

Open 1170300714 opened 4 months ago

1170300714 commented 4 months ago

Thanks for your great job

When I train the model with tiny_fp16, I find the followings bug:

Traceback (most recent call last):
File "./tools/train.py", line 263, in
main()
File "./tools/train.py", line 252, in main
custom_train_model(
File "/data/projects/BEVFormer-master/projects/mmdet3d_plugin/bevformer/apis/train.py", line 27, in custom_train_model
custom_train_detector(
File "/data/projects/BEVFormer-master/projects/mmdet3d_plugin/bevformer/apis/mmdet_train.py", line 125, in custom_train_detector
runner = build_runner(
File "/data/projects/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/mmcv/runner/builder.py", line 23, in build_runner
runner = runner_constructor()
File "/data/projects/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/mmcv/runner/default_constructor.py", line 44, in call
return RUNNERS.build(self.runner_cfg, default_args=self.default_args)
File "/data/projects/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/mmcv/utils/registry.py", line 212, in build
return self.build_func(*args, kwargs, registry=self)
File "/data/projects/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/mmcv/utils/registry.py", line 55, in build_from_cfg
raise type(e)(f'{obj_cls.name}: {e}')
AttributeError: EpochBasedRunner_video: 'NoneType' object has no attribute 'eval'
Traceback (most recent call last):
File "/data/projects/anaconda3/envs/open-mmlab/lib/python3.8/site-packages/mmcv/utils/registry.py", line 52, in build_from_cfg
return obj_cls(
args)
File "/data/projects/BEVFormer-master/projects/mmdet3d_plugin/bevformer/runner/epoch_based_runner.py", line 55, in init
self.eval_model.eval()
AttributeError: 'NoneType' object has no attribute 'eval'

This is cause by the init function of class EpochBasedRunner_video, because the para: eval_model is None.

`@RUNNERS.register_module() class EpochBasedRunner_video(EpochBasedRunner): '''

basic logic

input_sequence = [a, b, c] # given a sequence of samples

prev_bev = None
for each in input_sequcene[:-1]
    prev_bev = eval_model(each, prev_bev)) # inference only.

model(input_sequcene[-1], prev_bev) # train the last sample.
'''

def __init__(self,
             model,
             eval_model=None,
             batch_processor=None,
             optimizer=None,
             work_dir=None,
             logger=None,
             meta=None,
             keys=['gt_bboxes_3d', 'gt_labels_3d', 'img'],
             max_iters=None,
             max_epochs=None):
    super().__init__(model,
             batch_processor,
             optimizer,
             work_dir,
             logger,
             meta,
             max_iters,
             max_epochs)
    keys.append('img_metas')
    self.keys = keys
    self.eval_model = eval_model
    self.eval_model.eval()`

May I ask how to solve this problem? In fact, I simply modified the runner from "EpochBasedRunner_video" to "EpochBasedRunner" which the other configs (tiny, base, small), but it will appear new bug when inference

HenryZhangJianhe commented 1 month ago

bash tools/dist_train.sh projects/configs/bevformer/bevformer_tiny.py 1 我用這個可以run

1170300714 commented 1 month ago

收到,感谢您的来件