open-mmlab / mmdetection3d

OpenMMLab's next-generation platform for general 3D object detection.
https://mmdetection3d.readthedocs.io/en/latest/
Apache License 2.0
5.31k stars 1.54k forks source link

[Bug] WandB hook not working #2635

Open BalazsSzekeres opened 1 year ago

BalazsSzekeres commented 1 year ago

Prerequisite

Task

I have modified the scripts/configs, or I'm working on my own tasks/models/datasets.

Branch

main branch https://github.com/open-mmlab/mmdetection3d

Environment

Using the provided docker file.

Reproduces the problem - code sample

import wandb
...

config_file = 'mmdetection/configs/path/to/config.py'
cfg = Config.fromfile(config_file)

cfg.log_config.hooks = [
    dict(type='TextLoggerHook'),
    dict(type='MMDetWandbHook',
         init_kwargs={'project': 'mmdetection'},
         interval=10,
         log_checkpoint=True,
         log_checkpoint_metadata=True,
         num_eval_images=100,
         bbox_score_thr=0.3)]

Reproduces the problem - command or script

train.py

Reproduces the problem - error message

AttributeError: 'ConfigDict' object has no attribute 'log_config'

Additional information

No response

sunjiahao1999 commented 1 year ago

Modify the config file to use wandb in the following way:

vis_backends = [dict(type='LocalVisBackend'), dict(type='WandbVisBackend')]
visualizer = dict(
    type='Det3DLocalVisualizer', vis_backends=vis_backends, name='visualizer')
JennySeidenschwarz commented 1 year ago

I actually have the same issue and adding this to configs/pointpillars/pointpillars_hv_secfpn_sbn-all_16xb2-2x_waymo-3d-3class.py did not solve the problem unfortunately. Any suggesttion?

JennySeidenschwarz commented 1 year ago

Can be solved by this:

# add wandb
wandb.login(key=<Your Key>)
cfg['log_config'] = {'hooks': [
        dict(type='TextLoggerHook'),
        dict(type='MMDetWandbHook',
             init_kwargs={'project': 'TrainPointPillars'},
             interval=10,
             log_checkpoint=True,
             log_checkpoint_metadata=True,
             num_eval_images=100,
             bbox_score_thr=0.3)]}