SyntaxError: cannot assign to None && missing batch_img_metas
When I fine tuned, this error occurred:
File "/xx/YOLO-World-master/yolo_world/models/detectors/init.py", line 2, in
Change 'None' to '_' and then it appears:
File "/home/xx/workspace/YOLO-World-master/yolo_world/models/dense_heads/yolo_world_head.py", line 366, in loss losses = self.loss_by_feat(*loss_inputs) TypeError: loss_by_feat() missing 1 required positional argument: 'batch_img_metas'
How to solve it? Is it because there is a problem with the latest project code?
I'm having the same problem.
I'm having the same problem.
Did you resolve the second issue?
@qilvzhuihuojian If you manage to solve it, please let me know if possible.
@doilion second question: yolo_world/models/dense_heads/yolo_world_head.py line:357 ` def loss(self, img_feats: Tuple[Tensor], txt_feats: Tensor, txt_masks: Tensor, batch_data_samples: Union[list, dict]) -> dict: """Perform forward propagation and loss calculation of the detection head on the features of the upstream network."""
outs = self(img_feats, txt_feats, txt_masks)
# Fast version
loss_inputs = outs + (txt_masks,batch_data_samples['bboxes_labels'],
batch_data_samples['img_metas'])
losses = self.loss_by_feat(*loss_inputs)
return losses`
@qilvzhuihuojian @llllllfy @YuLionel I asked Claude 3.7, and it also suggested that the issue might be related to this part, but I’m not entirely sure if it’s really the root cause. I reverted to a few earlier versions using git checkout 4826695, and the problem was resolved.
@qilvzhuihuojian It works for me. Thank you for your sharing.
@doilion @qilvzhuihuojian Thank you. Combine your sharing, it works for me.
Use python tools/train.py
- git checkout 4826695
- change yolo_world/models/dense_heads/yolo_world_head.py line:357
def loss(self, img_feats: Tuple[Tensor], txt_feats: Tensor,
txt_masks: Tensor, batch_data_samples: Union[list, dict]) -> dict:
"""Perform forward propagation and loss calculation of the detection
head on the features of the upstream network."""
outs = self(img_feats, txt_feats, txt_masks)
# Fast version
loss_inputs = outs + (txt_masks,batch_data_samples['bboxes_labels'],
batch_data_samples['img_metas'])
losses = self.loss_by_feat(*loss_inputs)
return losses
However, it doesn't work when use tools/dist_train.sh
File "YOLO-World/yolo_world/models/detectors/yolo_world.py", line 32, in loss
losses = self.bbox_head.loss(img_feats, txt_feats, batch_data_samples)
TypeError: loss() missing 1 required positional argument: 'batch_data_samples'
File "YOLO-World/yolo_world/models/detectors/yolo_world.py", line 32, in loss
losses = self.bbox_head.loss(img_feats, txt_feats, batch_data_samples)
TypeError: loss() missing 1 required positional argument: 'batch_data_samples'
May I ask if this problem has been solved? I also encountered the same problem. @M3Dade
yolo_world/models/dense_heads/yolo_world_head.py line:357 def loss(self, img_feats: Tuple[Tensor], txt_feats: Tensor, txt_masks: Tensor, batch_data_samples: Union[list, dict]) -> dict: """Perform forward propagation and loss calculation of the detection head on the features of the upstream network.""" self.head_module.training = True ##add outs = self(img_feats, txt_feats, txt_masks) yolo_world/models/dense_heads/yolo_world_head.py line:401 def predict(self, img_feats: Tuple[Tensor], txt_feats: Tensor, txt_masks: Tensor, batch_data_samples: SampleList, rescale: bool = False) -> InstanceList: """Perform forward propagation of the detection head and predict detection results on the features of the upstream network. """ self.head_module.training = False ##add batch_img_metas = [ data_samples.metainfo for data_samples in batch_data_samples ]
Thanks a lot,it work. git checkout 4826695
when use tools/dist_train.sh
File "YOLO-World/yolo_world/models/detectors/yolo_world.py", line 166, in loss
losses = self.bbox_head.loss(img_feats, txt_feats, batch_data_samples)
TypeError: loss() missing 1 required positional argument: 'batch_data_samples' @M3Dade @connorye @GuanRunwei How to modify the code specifically,
Thank you very much
@sqh85
https://github.com/AILab-CVC/YOLO-World/commit/4826695a84ce370dad7fe4cb555a6c7162f3751d
dowanload and use the provided version
dowanload and use the provided version 4826695, when use tools/dist_train.sh。 data['category_id'] = self.cat_ids[label] IndexError:list index out of range ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode:1) local_rank:0 (pid:23980) of binary: /home....../python @M3Dade @connorye @GuanRunwei Thank you very much