问题一
- [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文件官方链接
解决方法
- 点击蓝色字即可下载对应模型文件,然后放到你的项目中。
最终
- 运行成功。