【PYTHON-YOLOV8N】YOLOV8N的HELLO WORLD
2026/6/9 23:22:06 网站建设 项目流程

【PYTHON-YOLOV8N】YOLOV8N的HELLO WORLD

    • 环境配置
    • 入门代码
    • 参考链接

其实官方说的很明白了,这里只是做一个笔记。

环境配置

  1. 先安装python环境,目前yolo支持python版本3.8、3.9、3.10、3.11、3.12
  2. 使用的是python的venv创建虚拟环境,命令是:
    python -m venv yolo_env
  3. 然后激活环境:
    yolo_env\Scripts\activate
  4. 安装
    pip install -U ultralytics
    或者

pip install -U ultralytics -i https://pypi.tuna.tsinghua.edu.cn/simple -i https://mirrors.aliyun.com/pypi/simple/

清华源(推荐,同步最及时)
pip install -U ultralytics -i https://pypi.tuna.tsinghua.edu.cn/simple

阿里云源(国内服务器覆盖广,延迟低)
pip install -U ultralytics -i https://mirrors.aliyun.com/pypi/simple/

腾讯源(适配腾讯云/南方地区,速度快)
pip install -U ultralytics -i https://mirrors.cloud.tencent.com/pypi/simple/

中科大源(老牌稳定源,适合北方地区)
pip install -U ultralytics -i https://pypi.mirrors.ustc.edu.cn/simple/

入门代码

fromultralyticsimportYOLO# Load a COCO-pretrained YOLO11n modelmodel=YOLO("yolo11n.pt")# Display model information (optional)model.info()# Train the model on the COCO8 example dataset for 100 epochsresults=model.train(data="coco8.yaml",epochs=100,imgsz=640)# Run inference with the YOLO11n model on the 'bus.jpg' imageresults=model("path/to/bus.jpg")

参考链接

https://docs.ultralytics.com/zh/quickstart/

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询