[Bug] Can not use ConcatImageVisualizer
in train step. / 在Train阶段可视化存在bug
#2118
Labels
kind/bug
something isn't working
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/mmagic
Environment
English is bad, so I write it in Chinese.
BasicViaualizationHook
里的_after_iter
在Train
和Val
和Test
的after_iter
阶段被调用,来进行相关可视化操作,通过接受outputs
来进行可视化,这里outputs
需要是DataSample
类型在
BaseEditModel
里,IterTrainLoop
和EpochBasedLoop
的outputs
是仅含有 loss 的字典,不是DataSample类型,所以不能在BasicViaualizationHook
里的_after_iter
函数被解析,从而报错。下面是我的修改,有点low,修改位置是
mmagic/engine/hooks/visualization_hook.py
的BasicVisualizationHook._after_iter
函数Reproduces the problem - code sample
vis_backends = [dict(type='LocalVisBackend')]
visualizer = dict(
scope='mmagic',
type='ConcatImageVisualizer',
vis_backends=vis_backends,
pixel_range = {
'img_vis': [0,1],
'gt_img': [0,1]
},
fn_key='gt_path',
img_keys=['gt_img', 'img_vis'],
bgr2rgb=False,
)
custom_hooks = [dict(scope='mmagic',type='BasicVisualizationHook', interval=1, on_train=True, on_val=False)]
Reproduces the problem - command or script
CUDA_VISIBLE_DEVICES=0,1,2,3 PORT=29999 tools/dist_train.sh
configs/gaussSharpen_noAdjust.py 4
Reproduces the problem - error message
Traceback (most recent call last):
File "/mmagic/mmagic/visualization/concat_visualizer.py", line 70, in add_datasample
**data_sample.to_dict(),
AttributeError: 'str' object has no attribute 'to_dict'
Additional information
No response
The text was updated successfully, but these errors were encountered: