当前位置:   article > 正文

YOLOV8训练模型下载_yolov8n.pt下载

yolov8n.pt下载

目录

一、模型下载

二、模型选择

三、模型下载缓慢

四、脚本下载


一、模型下载

1、github上yolo的地址为

https://github.com/ultralytics/ultralytics

2、进入之后点击中文,就进入ultralytics中文文档

3、我们点击模型,进入模型页面

二、模型选择

1、选择我们需要的模型,我这里选择YOLOV8

2、接下来就可以看到YOLOV8的模型,按需下载就行了

三、模型下载缓慢

1、但是由于YOLOV8训练模型都在外网上,国内用户访问速度上有限制,而我们下载的时候经常性几个小时都下不下来。比如下面这张图:

四、脚本下载

1、于是我们另辟蹊径,用python脚本去下载,我们提前将需要下载的模型放入名为model的txt文件内,如下图:

  1. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt
  2. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8s.pt
  3. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8m.pt
  4. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8l.pt
  5. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8x.pt
  6. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n-seg.pt
  7. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8s-seg.pt
  8. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8m-seg.pt
  9. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8l-seg.pt
  10. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8x-seg.pt
  11. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n-pose.pt
  12. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8s-pose.pt
  13. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8m-pose.pt
  14. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8l-pose.pt
  15. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8x-pose.pt
  16. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8x-pose-p6.pt
  17. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n-cls.pt
  18. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8s-cls.pt
  19. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8m-cls.pt
  20. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8l-cls.pt
  21. https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8x-cls.pt

2、再编写一个python脚本名为downloadmodel.py,内容如下:

  1. #!usr/bin/env python
  2. # encoding:utf-8
  3. from __future__ import division
  4. import os
  5. import time
  6. import logging
  7. import subprocess
  8. import urllib
  9. import requests
  10. import torch
  11. import random
  12. from pathlib import Path
  13. def autoDownload(filePath="model.txt", downloadDir="model/yolov8/"):
  14. if not os.path.exists(downloadDir):
  15. os.makedirs(downloadDir)
  16. while True:
  17. with open(filePath) as f:
  18. lists = [one.strip() for one in f.readlines() if one.strip()]
  19. count = 0
  20. for downloadUrl in lists:
  21. print("模型下载地址: ", downloadUrl)
  22. try:
  23. tmpFile = downloadDir + downloadUrl.split("/")[-1].strip()
  24. print("下载文件路径: ", tmpFile)
  25. if not os.path.exists(tmpFile):
  26. torch.hub.download_url_to_file(downloadUrl, str(tmpFile))
  27. else:
  28. print("当前训练模型文件已经下载完成!")
  29. count += 1
  30. except Exception as e:
  31. print("Exception: ", e)
  32. time.sleep(random.randint(1, 5))
  33. print("下载数量为: ", count)
  34. if count == len(lists):
  35. break
  36. if __name__ == "__main__":
  37. autoDownload(filePath="model.txt", downloadDir="model/")

3、脚本文件和txt模型地址文件放在任意目录

4、cmd命令进入脚本文件所在目录,输入如下命令

python downloadmodel.py

脚本文件就会自动给你下载,你就可以解放双手和眼睛了,等着它慢慢下完即可

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/162139
推荐阅读
相关标签
  

闽ICP备14008679号