ultralytics icon indicating copy to clipboard operation
ultralytics copied to clipboard

modified configs and modules to test and train yolov5, a error occurs here

Open isLinXu opened this issue 3 years ago • 9 comments

Search before asking

  • [X] I have searched the YOLOv8 issues and discussions and found no similar questions.

Question

I modified some configs and modules on the ultralytics repo to test and train yolov5, and the following errors occurred: File "/home/linxu/PycharmProjects/ultralytics/ultralytics/nn/tasks.py", line 291, in attempt_load_weights args = {**DEFAULT_CONFIG_DICT, **ckpt['train_args']} # combine model and default args, preferring model args KeyError: 'train_args' 截图_选择区域_20230112100223

Additional

No response

isLinXu avatar Jan 12 '23 02:01 isLinXu

@isLinXu oh that's because train_args is designed for yolov8 weights, yolov5 weights don't have this key. Can you try again with weights=''? or just don't set weights, just use yaml file of model.

Laughing-q avatar Jan 12 '23 02:01 Laughing-q

Um, I also found this problem, I will try the way you said 截图_选择区域_20230112103054

isLinXu avatar Jan 12 '23 02:01 isLinXu

@isLinXu We'll make other models i.e yolov5 compatible with this. Once we support it I'll let you know. :)

Laughing-q avatar Jan 12 '23 02:01 Laughing-q

Okay,I got it. And I tried what you said, and it didn't seem to work. Look forward to your follow-up work,thanks

isLinXu avatar Jan 12 '23 03:01 isLinXu

@AyushExel can you take a look at this one?

Laughing-q avatar Jan 12 '23 05:01 Laughing-q

I am facing the same issue; albeit from a different file. I have converted a weights file from a pre-trained YoLov4 model to a .pt file via this repo. I'm facing the concerned issue of using that file.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Microsoft\miniconda3\envs\ultralytics_dev\lib\site-packages\ultralytics\yolo\engine\model.py", line 55, in __init__
    {'.pt': self._load, '.yaml': self._new}[Path(model).suffix](model)
  File "C:\Users\Microsoft\miniconda3\envs\ultralytics_dev\lib\site-packages\ultralytics\yolo\engine\model.py", line 83, in _load
    self.model, self.ckpt = attempt_load_one_weight(weights)
  File "C:\Users\Microsoft\miniconda3\envs\ultralytics_dev\lib\site-packages\ultralytics\nn\tasks.py", line 345, in attempt_load_one_weight
    args = {**DEFAULT_CONFIG_DICT, **ckpt['train_args']}  # combine model and default args, preferring model args
KeyError: 'train_args'

pronoym99 avatar Jan 16 '23 19:01 pronoym99

@Laughing-q @isLinXu I think we'll need to train YOLOv5 from scratch on this repo to fix this problem.. Or can we just transfer weights as a temporary solution?

AyushExel avatar Jan 16 '23 22:01 AyushExel

@AyushExel for now I think latter could be fine.

Laughing-q avatar Jan 17 '23 01:01 Laughing-q

@Laughing-q How can weights transfer be implemented while creating an instance of YOLO? I have access to a weights file as well as it's equivalent .pt file.

pronoym99 avatar Jan 17 '23 07:01 pronoym99

👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

  • Docs: https://docs.ultralytics.com
  • HUB: https://hub.ultralytics.com
  • Community: https://community.ultralytics.com

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLO 🚀 and Vision AI ⭐

github-actions[bot] avatar Mar 23 '23 00:03 github-actions[bot]

@AyushExel can you take a look at this one?

@isLinXu We'll make other models i.e yolov5 compatible with this. Once we support it I'll let you know. :)

Can't the weight files(best.pt) generated by YOLOv5 training be used as pre-training weights for YOLOv8?

CTBULJ avatar Apr 21 '23 10:04 CTBULJ