01
YOLO发展历程
YOLO(You Only Look Once)是一种流行的物体检测和图像分割模型,由华盛顿大学的 Joseph Redmon 和 Ali Farhadi 开发。
目前YOLO11提供两种许可选项,以适应不同的使用情况:
-AGPL-3.0 许可证:这种经 OSI 批准的开源许可证非常适合学生和爱好者使用,可促进开放协作和知识共享。
-企业许可证:该许可证专为商业用途设计,允许将Ultralytics 软件和人工智能模型无缝集成到商业产品和服务中,绕过了AGPL-3.0 的开源要求。
02
模型性能
Ultralytics YOLO11,作为新的SOTA模型,不仅继承了之前YOLO系列的优势,还引入了创新特性和改进,提升了性能和灵活性。它以快速、精准、易用为特点,成为处理目标检测、跟踪、实例分割、图像分类和姿态估计等多种视觉任务的理想选择。
03
最佳实践
我们使用魔搭社区免费算力(GPU)体验YOLO11,希望能够帮助您充分利用 YOLO11。
模型链接:
https://modelscope.cn/models/AI-ModelScope/YOLO11
数据集链接:
https://modelscope.cn/datasets/modelscope/coco2017val/
代码链接:
https://github.com/ultralytics/ultralytics/
技术文档:
环境安装
安装ultralytics并检查运行环境。
%pip install ultralytics import ultralytics ultralytics.checks()
模型推理
在魔搭社区下载模型并推理,YOLO11 可直接在命令行界面 (CLI) 中使用 `yolo` 命令执行各种任务和模式,并接受其他参数,例如 `imgsz=640`。
!modelscope download --model=AI-ModelScope/YOLO11 --local_dir ./ yolo11n.pt !yolo predict model="/mnt/workspace/yolo11n.pt" source='https://ultralytics.com/images/zidane.jpg'
模型评估
下载COCO数据集,并在COCO数据集的 `val` 或 `test` 分割上验证模型的准确性。
# Download COCO val !modelscope download --dataset="modelscope/coco2017val" --local_dir ./ coco2017val.zip !unzip -q coco2017val.zip -d datasets && rm coco2017val.zip # unzip !modelscope download --dataset="modelscope/coco2017val" --local_dir ./ coco8.zip !unzip -q coco8.zip -d datasets && rm coco8.zip # unzip
# Validate YOLO11n on COCO8 val !yolo val model="/mnt/workspace/yolo11n.pt" data=coco8.yaml
模型微调
图片来源:https://raw.githubusercontent.com/ultralytics/assets/
安装和使用可视化日志工具TensorBoard
#@title Select YOLO11 🚀 logger {run: 'auto'} !pip install tensorboard -U logger = 'TensorBoard' #@param ['Comet', 'TensorBoard'] if logger == 'Comet': %pip install -q comet_ml import comet_ml; comet_ml.init() elif logger == 'TensorBoard': %load_ext tensorboard %tensorboard --logdir ./runs
# Train YOLO11n on COCO8 for 3 epochs !yolo train model="/mnt/workspace/yolo11n.pt" data=coco8.yaml epochs=3 imgsz=640
模型导出
使用“format”参数将 YOLO11 模型导出为任何支持的格式,例如“format=onnx”或者“format=torchscript”。
!yolo export model="/mnt/workspace/yolo11n.pt" format=torchscript
04
python体验
YOLO11 采用了 Python 优先原则进行重新设计,从而实现无缝的 Python YOLO 体验。YOLO11 模型可以从经过训练的检查点加载,也可以从头开始创建。如下是使用python来训练、验证、预测和导出模型的示例代码。
from ultralytics import YOLO # Load a model model = YOLO('yolo11n.yaml') # build a new model from scratch model = YOLO('yolo11n.pt') # load a pretrained model (recommended for training) # Use the model results = model.train(data='coco8.yaml', epochs=3) # train the model results = model.val() # evaluate model performance on the validation set results = model('https://ultralytics.com/images/bus.jpg') # predict on an image results = model.export(format='onnx') # export the model to ONNX format
任务模型
YOLO11可以在多种视觉任务上训练,评估,推理和导出。
图片来源:https://raw.githubusercontent.com/ultralytics/assets/
检测任务
YOLO11检测模型没有后缀,使用默认的 YOLO11 模型
# Load YOLO11n, train it on COCO128 for 3 epochs and predict an image with it from ultralytics import YOLO model = YOLO('yolo11n.pt') # load a pretrained YOLO11n detection model model.train(data='coco8.yaml', epochs=3) # train the model model('https://ultralytics.com/images/bus.jpg') # predict on an image
分割任务
# Load YOLO11n-seg, train it on COCO128-seg for 3 epochs and predict an image with it from ultralytics import YOLO !modelscope download --model=AI-ModelScope/YOLO11 --local_dir ./ yolo11n-seg.pt model = YOLO('/mnt/workspace/yolo11n-seg.pt') # load a pretrained YOLO11n segmentation model model.train(data='coco8-seg.yaml', epochs=3) # train the model model('https://ultralytics.com/images/bus.jpg') # predict on an image
分类任务
# Load YOLO11n-cls, train it on mnist160 for 3 epochs and predict an image with it from ultralytics import YOLO !modelscope download --model=AI-ModelScope/YOLO11 --local_dir ./ yolo11n-cls.pt model = YOLO('/mnt/workspace/yolo11n-cls.pt') # load a pretrained YOLO11n classification model model.train(data='mnist160', epochs=3) # train the model model('https://ultralytics.com/images/bus.jpg') # predict on an image
动作检测任务
# Load YOLO11n-pose, train it on COCO8-pose for 3 epochs and predict an image with it from ultralytics import YOLO !modelscope download --model=AI-ModelScope/YOLO11 --local_dir ./ yolo11n-pose.pt model = YOLO('yolo11n-pose.pt') # load a pretrained YOLO11n pose model model.train(data='coco8-pose.yaml', epochs=3) # train the model model('https://ultralytics.com/images/bus.jpg') # predict on an image
定向边界框 (OBB)
# Load YOLOv8n-obb, train it on DOTA8 for 3 epochs and predict an image with it from ultralytics import YOLO !modelscope download --model=AI-ModelScope/YOLO11 --local_dir ./ yolo11n-obb.pt model = YOLO('yolo11n-obb.pt') # load a pretrained YOLOv8n OBB model model.train(data='dota8.yaml', epochs=3) # train the model model('https://ultralytics.com/images/bus.jpg') # predict on an image
点击链接👇,即可跳转模型~
https://modelscope.cn/models/AI-ModelScope/YOLO11?from=alizishequ__text