THU-MIG / yolov10

YOLOv10: Real-Time End-to-End Object Detection
https://arxiv.org/abs/2405.14458
GNU Affero General Public License v3.0
8.53k stars 744 forks source link

AttributeError: 'dict' object has no attribute 'shape' #233

Open kunsungwoo opened 1 month ago

kunsungwoo commented 1 month ago

For example, after training for 20 epochs, best.pt works normally in Python. However, if you download and use, for example, epoch17.pt instead of best.pt, an error will occur. An error occurs in epoch14.pt and epoch17.pt, but best.pt operates normally.

File "C:\yolov10\ultralytics\engine\model.py", line 441, in predict return self.predictor.predict_cli(source=source) if is_cli else self.predictor(source=source, stream=stream) File "C:\yolov10\ultralytics\engine\predictor.py", line 168, in call return list(self.stream_inference(source, model, *args, **kwargs)) # merge list of Result into one File "C:\anaconda\envs\yolov10\lib\site-packages\torch\utils_contextlib.py", line 35, in generator_context response = gen.send(None) File "C:\yolov10\ultralytics\engine\predictor.py", line 255, in stream_inference self.results = self.postprocess(preds, im, im0s) File "C:\yolov10\ultralytics\models\yolo\detect\predict.py", line 25, in postprocess preds = ops.non_max_suppression( File "C:\yolov10\ultralytics\utils\ops.py", line 216, in non_max_suppression bs = prediction.shape[0] # batch size AttributeError: 'dict' object has no attribute 'shape'

sanha9999 commented 1 month ago

Is codebase the latest version?

kunsungwoo commented 1 month ago

Yes, it is the latest version.

sanha9999 commented 1 month ago

could you tell me the command you entered CLI? and What model did you use? (yolov10n/s...)

kunsungwoo commented 1 month ago

I used yolov10n and used it in colab.

from ultralytics import YOLOv10

model = YOLOv10('/content/drive/MyDrive/yolo1/model/epoch7.pt') results= model.train(data='/content/sample_data/test/data.yaml',epochs=20,imgsz=640,batch=16,patience=2,save_period=1,name='yolo2',lr0=0.001,lrf=0.001,exist_ok=True,pretrained=True ,translate=0.01,scale=0.01,mosaic=0.01,mixup=0.00,box=20,close_mosaic=5,shear=0.0,erasing=0,perspective=0.0,flipud=0,fliplr=0,iou=0.95,copy_paste=0,optimizer='AdamW',cos_lr=True)

18780165950 commented 1 month ago

I met the same problem!!! It seems like the one2one and one2many selection

企业微信截图_17188465965623

![Uploading 企业微信截图_17188466767849.png…]()

jiheng1982 commented 1 month ago

the same error

18780165950 commented 1 month ago

  您好,您发的邮件我已收到,我尽快给您回复。

jiheng1982 commented 1 month ago

找到问题了,prdeication是个字典,dict_keys(['one2many', 'one2one'])