open-mmlab / mmyolo

OpenMMLab YOLO series toolbox and benchmark. Implemented RTMDet, RTMDet-Rotated,YOLOv5, YOLOv6, YOLOv7, YOLOv8,YOLOX, PPYOLOE, etc.
https://mmyolo.readthedocs.io/zh_CN/dev/
GNU General Public License v3.0
2.98k stars 535 forks source link

rtmdet-ins training error :TypeError: loss_by_feat() takes from 5 to 6 positional arguments but 7 were given #881

Open W-hary opened 1 year ago

W-hary commented 1 year ago

Prerequisite

🐞 Describe the bug

Install and successfully run the demo test according to ‘15_minutes_instance_segmentation.md‘. An error occurred when training the balloon data set using ‘rtmdet-ins_s_syncbn_fast_8xb32-300e_coco.py’

python tools/train.py configs/rtmdet/rtmdet-ins_s_syncbn_fast_8xb32-300e_coco.py

Traceback (most recent call last): File "tools/train.py", line 123, in main() File "tools/train.py", line 119, in main runner.train() File "/root/miniconda3/lib/python3.8/site-packages/mmengine/runner/runner.py", line 1745, in train model = self.train_loop.run() # type: ignore File "/root/miniconda3/lib/python3.8/site-packages/mmengine/runner/loops.py", line 96, in run self.run_epoch() File "/root/miniconda3/lib/python3.8/site-packages/mmengine/runner/loops.py", line 112, in run_epoch self.run_iter(idx, data_batch) File "/root/miniconda3/lib/python3.8/site-packages/mmengine/runner/loops.py", line 128, in run_iter outputs = self.runner.model.train_step( File "/root/miniconda3/lib/python3.8/site-packages/mmengine/model/base_model/base_model.py", line 114, in train_step losses = self._run_forward(data, mode='loss') # type: ignore File "/root/miniconda3/lib/python3.8/site-packages/mmengine/model/base_model/base_model.py", line 340, in _run_forward results = self(*data, mode=mode) File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(input, *kwargs) File "/root/miniconda3/lib/python3.8/site-packages/mmdet/models/detectors/base.py", line 92, in forward return self.loss(inputs, data_samples) File "/root/miniconda3/lib/python3.8/site-packages/mmdet/models/detectors/single_stage.py", line 78, in loss losses = self.bbox_head.loss(x, batch_data_samples) File "/root/autodl-tmp/mmyolo/mmyolo/models/dense_heads/yolov5_head.py", line 470, in loss losses = self.loss_by_feat(loss_inputs) TypeError: loss_by_feat() takes from 5 to 6 positional arguments but 7 were given

Environment

PyTorch 1.11.0 Python 3.8(ubuntu20.04) Cuda 11.3

Additional information

No response

collinmccarthy commented 1 year ago

This is indirectly because loss_by_feat() isn't implemented for the instance segmentation head. That is, instance segmentation is only supported currently for inference. I don't think it is that difficult to implement this function (you can look at the YOLOv5 detection vs. instance seg versions, and then the RTMDet detection version) but I haven't tried to get it working yet.

If I get it working I'll submit a PR, but I'm not sure when that will be.

Related to #649, #853

confusedgreenhand commented 1 year ago

Hi, I would like to ask if this problem has been solved

rbli-john commented 12 months ago

Same question. Look forward to seeing the fast training for Rtmdet-ins

jslok commented 8 months ago

No update on this?

Am I correct in assuming rtmdet-ins on mmdetection is the same as on mmyolo anyways but just slower training?

One difference I found is mmdeploy only offers deployment to Core ML with segmentation through mmseg.

collinmccarthy commented 8 months ago

Does mmdetection support instance segmentation training with rtmdet? Or just inference like mmyolo? -CollinOn Feb 6, 2024, at 6:19 PM, jlok @.***> wrote: No update on this? Am I correct in assuming rtmdet-ins on mmdetection is the same as on mmyolo anyways but just slower training?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

jslok commented 8 months ago

Mmdet supports training and inference on rtmdet-ins

HanTnx commented 6 months ago

Mmdet supports training and inference on rtmdet-ins

can you provide more information about configuration of mmdet, mmcv, and related mmyolo version ? Thank you

lijoe123 commented 5 months ago

The same error with the yolov8_ins, could you please tell me how to fix the problem #636