YOLO-World icon indicating copy to clipboard operation
YOLO-World copied to clipboard

Some undefined keys leading to error while finetuning

Open siddankthep opened this issue 1 year ago • 10 comments

Hi, I am trying to finetune the model on my object detection dataset. I am using the config for Efficient YOLO-World with the no-mask annotation _base_.

In the finetune config file yolo_world_l_dual_vlpan_2e-4_80e_8gpus_finetune_coco.py, there are some fields such as _base_.copypaste_prob or _base_.min_area_ratio that is not present in the base file yolov8_l_syncbn_fast_8xb16-500e_coco.py.

I am currently unable to run the finetune scripts due to the errors caused by these keys. Can you provide some methods to tackle this problem? If any more context is needed, please let me know.

siddankthep avatar Feb 16 '24 09:02 siddankthep

The same problem happened to me. Have you solved this problem?

mio410 avatar Feb 19 '24 09:02 mio410

同问

997897336 avatar Feb 20 '24 08:02 997897336

Hi @siddankthep, @mio410, and @997897336, I'm sorry for the late reply! This problem arises because the fine-tuning configs rely on the instance masks for augmentations, e.g., YOLOv5CopyPaste. And you need turn down the mask-refine for Random

  dict(
      type='YOLOv5RandomAffine',
      max_rotate_degree=0.0,
      max_shear_degree=0.0,
      max_aspect_ratio=100,
      scaling_ratio_range=(1 - affine_scale, 1 + affine_scale),
      # img_scale is (width, height)
      border=(-img_scale[0] // 2, -img_scale[1] // 2),
      border_val=(114, 114, 114),
      use_mask_refine=False)

Note that there are two YOLOv5RandomAffine in the config file.

We will upload the config files without mask-refine for more general fine-tuning.

wondervictor avatar Feb 20 '24 10:02 wondervictor

@wondervictor 我仍未解决该问题,修改的代码为 dict( type='YOLOv5RandomAffine', max_rotate_degree=0.0, max_shear_degree=0.0, max_aspect_ratio=100., scaling_ratio_range=(1 - base.affine_scale, 1 + base.affine_scale), # img_scale is (width, height) border=(-base.img_scale[0] // 2, -base.img_scale[1] // 2), border_val=(114, 114, 114), # min_area_ratio=base.min_area_ratio, # use_mask_refine=base.use_mask2refine) use_mask_refine=False) ]

报错 Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/mmengine/config/config.py", line 109, in getattr value = super().getattr(name) File "/usr/local/lib/python3.8/dist-packages/addict/addict.py", line 67, in getattr return self.getitem(item) File "/usr/local/lib/python3.8/dist-packages/mmengine/config/config.py", line 138, in getitem return self.build_lazy(super().getitem(key)) File "/usr/local/lib/python3.8/dist-packages/mmengine/config/config.py", line 105, in missing raise KeyError(name) KeyError: 'copypaste_prob'

997897336 avatar Feb 21 '24 08:02 997897336

@wondervictor 我仍未解决该问题,修改的代码为 dict( type='YOLOv5RandomAffine', max_rotate_degree=0.0, max_shear_degree=0.0, max_aspect_ratio=100., scaling_ratio_range=(1 - base.affine_scale, 1 + base.affine_scale), # img_scale is (width, height) border=(-base.img_scale[0] // 2, -base.img_scale[1] // 2), border_val=(114, 114, 114), # min_area_ratio=base.min_area_ratio, # use_mask_refine=base.use_mask2refine) use_mask_refine=False) ]

报错 Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/mmengine/config/config.py", line 109, in getattr value = super().getattr(name) File "/usr/local/lib/python3.8/dist-packages/addict/addict.py", line 67, in getattr return self.getitem(item) File "/usr/local/lib/python3.8/dist-packages/mmengine/config/config.py", line 138, in getitem return self.build_lazy(super().getitem(key)) File "/usr/local/lib/python3.8/dist-packages/mmengine/config/config.py", line 105, in missing raise KeyError(name) KeyError: 'copypaste_prob'

我同样修改以后,也遇到同样的情况,而且我没有在配置文件中找到两个YOLOv5RandomAffine。【 Note that there are two YOLOv5RandomAffine in the config file.】

Sally-lxy avatar Feb 21 '24 08:02 Sally-lxy

@997897336 我的问题解决了,在作者提的建议基础上,再注释这一条【dict(type='YOLOv5CopyPaste', prob=base.copypaste_prob)】就可以微调了!

Sally-lxy avatar Feb 21 '24 08:02 Sally-lxy

微信截图_20240221165006

Sally-lxy avatar Feb 21 '24 08:02 Sally-lxy

@Sally-lxy 您好 想问下您有用微调后的模型来检测一些图片吗,因为我微调后却检测不到任何目标。还有就是您有看过图片的标签信息是否成功读取了吗(将train.py最后几行改成下面这样)? image

kkkkkkb avatar Feb 21 '24 10:02 kkkkkkb

Hi @siddankthep, @mio410, @Sally-lxy, I've uploaded the new fine-tuning configs without mask-refine. You can refer to it now: yolo_world_l_dual_vlpan_2e-4_80e_8gpus_finetune_coco.py

wondervictor avatar Feb 21 '24 12:02 wondervictor

不用__base__的值,自己填一个就好了

taofuyu avatar Feb 23 '24 10:02 taofuyu