YOLOV8初体验-报错合集

文章介绍了在使用YOLOv8进行深度学习时遇到的四个问题,包括分页文件大小不足、训练过程中新进程启动错误、ONNX导出失败和PytorchStreamReader读取错误。提供了解决这些问题的方法,如调整workers参数、正确处理新进程启动和ONNX安装等。
摘要由CSDN通过智能技术生成

问题一

  • [WinError 1455] 分页文件太小,无法完成此操作。加载“C:\ProgramData\Anaconda3\lib\site-packages\torch…
  • 报错代码为官方的示例运行代码
from ultralytics import YOLO

# Create a new YOLO model from scratch
model = YOLO('yolov8n.yaml')

# Load a pretrained YOLO model (recommended for training)
model = YOLO('yolov8n.pt')

# Train the model using the 'coco128.yaml' dataset for 3 epochs
results = model.train(data='coco128.yaml', epochs=3)

# Evaluate the model's performance on the validation set
results = model.val()

# Perform object detection on an image using the model
results = model('https://ultralytics.com/images/bus.jpg')

# Export the model to ONNX format
success = model.export(format='onnx')

解决方法

  • 设置workers参数为0
results = model.train(data='coco128.yaml', epochs=3, workers=0)

问题二

  • RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase

解决方法

https://stackoverflow.com/questions/75111196/yolov8-runtimeerror-an-attempt-has-been-made-to-start-a-new-process-before-th

from ultralytics import YOLO

# Create a new YOLO model from scratch
model = YOLO('yolov8n.yaml')

# Load a pretrained YOLO model (recommended for training)
model = YOLO('yolov8n.pt')

if __name__ == '__main__':

    # Train the model using the 'coco128.yaml' dataset for 3 epochs
    results = model.train(data='coco128.yaml', epochs=3, workers=0)

    # Evaluate the model's performance on the validation set
    results = model.val()

    # Perform object detection on an image using the model
    results = model('https://ultralytics.com/images/bus.jpg')

    # Export the model to ONNX format
    success = model.export(format='onnx')

问题三

  • ONNX: export failure

https://github.com/ultralytics/ultralytics/issues/3649
https://github.com/ultralytics/yolov5/issues/11819

解决方法

  • 在当前项目环境中执行
pip install onnx

问题四

  • RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

https://github.com/ultralytics/ultralytics/issues/5793

  • 建议直接从官网下载模型文件,如果使用他自动下载的pt文件,你会发现跟官网下的大小不同。
  • yolo8模型下载地址如下
  • yolo8pt文件官方链接

解决方法

在这里插入图片描述

  • 点击蓝色字即可下载对应模型文件,然后放到你的项目中。

最终

在这里插入图片描述

  • 运行成功。
  • 21
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值