查看 Markdown

YOLOv1

YOLOv1 是 2016 年那个最初的检测器,YOLO 家族的名字就来自它:一个卷积网络配上一个全连接 head,一次前向就预测出所有检测框和类别分数,不用锚框。LibreYOLO 以冻结、仅推理的展品形式收录它。

任务
detection
尺寸
t, b at 448 px
安装
pip install libreyolo
支持层级
博物馆,自 v 起。一件冻结的展品。只修 bug。
上游
YOLOv1,由 Joseph Redmon 发布,采用 Public domain (Darknet "YOLO LICENSE") 许可。论文源码
许可
代码采用 MIT,权重采用 Public domain (Darknet "YOLO LICENSE")。商用

安装

YOLOv1 在基础包之外不需要任何 extra。

bash
pip install libreyolo

预测

这个家族只提供推理:train() 会抛出 NotImplementedError,所以本页没有训练一节。 预测、验证和导出都支持。权重在首次使用时从 Hugging Face 下载,并缓存在本地。

Python
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreYOLO1b.pt")result = model(SAMPLE_IMAGE, save=True) for box in result.boxes:    print(box.cls, box.conf, box.xyxy)
CLI
libreyolo predict model=LibreYOLO1b.pt source=https://raw.githubusercontent.com/LibreYOLO/libreyolo/release/libreyolo/assets/parkour.jpg save=True

返回的 Results 对象就是每个家族都会返回的那一个,所以换成另一个检测器只是改一行 的事。有两点是这个家族特有的。已发布的检查点(checkpoint)是在 Pascal VOC (2007+2012)上训练的,不是 COCO,所以 box.cls 索引的是 VOC 的 20 个类别 (aeroplane、bicycle、bird、boat、bottle、bus、car、cat、chair、cow、diningtable、 dog、horse、motorbike、person、pottedplant、sheep、sofa、train、tvmonitor),而不是 COCO 的 80 个。另外,全连接的检测 head 一次只接受一张图片,所以给它一个数据源列表 是循环跑完的,而不是作为真正的批次运行。数据源、流式处理和结果处理见 预测

验证

val() 返回一个由 metrics/ 键组成的字典,涵盖查准率、查全率、mAP 50 和 mAP 50-95,在一个使用检查点训练时那套 VOC 风格标签空间的数据集上测得。

Python
from libreyolo import LibreYOLO model = LibreYOLO("LibreYOLO1b.pt")metrics = model.val(data="my-dataset.yaml") print(metrics["metrics/mAP50-95"])print(metrics["metrics/mAP50"])
CLI
libreyolo val model=LibreYOLO1b.pt data=my-dataset.yaml

导出

任务ONNXTorchScriptExecuTorchTensorRTOpenVINOPaddleMNNRKNNncnnTFLiteCoreMLCore AI
DetectionDetection to ONNX:支持Detection to TorchScript:支持Detection to ExecuTorch:支持Detection to TensorRT:支持Detection to OpenVINO:支持Detection to Paddle:不支持Detection to MNN:不支持Detection to RKNN:不支持Detection to ncnn:支持Detection to TFLite:不支持Detection to CoreML:不支持Detection to Core AI:支持

导出的产物按文件后缀经由 LibreYOLO() 重新加载,所以一个 .onnx.engine 文件的表现和检查点一样,返回同样的 Results。在不装 LibreYOLO 的裸运行时里跑这张 计算图也是支持的,但那样预处理和后处理就得你自己写。

Python
from libreyolo import LibreYOLO model = LibreYOLO("LibreYOLO1b.pt")model.export(format="onnx")model.export(format="tensorrt", half=True)
CLI
libreyolo export model=LibreYOLO1b.pt format=onnxlibreyolo export model=LibreYOLO1b.pt format=tensorrt half=True
使用导出的文件
from libreyolo import LibreYOLO, SAMPLE_IMAGE # 工厂按文件后缀分发,所以导出的产物加载方式和任何检查点一样,# 返回的也是同一个 Results 对象model = LibreYOLO("LibreYOLO1b.onnx")result = model(SAMPLE_IMAGE) print(result.boxes.xyxy)

检查点

这个家族已发布的全部权重文件。

文件输入(px)权重许可
Detection
LibreYOLO1b.pt448other

上面的每个文件目前都在 LibreYOLO 组织中,并会在首次使用时下载。

许可证

请检查你所下载的具体权重在 Hugging Face 仓库中的许可。LibreYOLO 组织里的每个检查点都附有许可,同一家族内也不一定相同。该仓库是权威来源;以下摘要说明本页上次验证时适用的情况。

这里只说明涉及的许可证,不构成法律意见。如果答案对商用很重要,请自行阅读许可证并咨询法律顾问。

原始工作
YOLOv1, Joseph Redmon
上游许可
Public domain (Darknet "YOLO LICENSE")
LibreYOLO 代码
MIT
权重
采用 Public domain (Darknet "YOLO LICENSE") 许可,重新发布在 huggingface.co/LibreYOLO
解读
Darknet's bundled NOTICE quotes its own license in full: "Darknet is public domain. Do whatever you want with it." That covers both the architecture and the pretrained weights LibreYOLO converts from it, with no attribution requirement and no restriction on commercial use. LibreYOLO's own code around this architecture is MIT. One thing to know before deploying this checkpoint: it is trained on Pascal VOC 2007+2012, not COCO, so it detects and names the 20 VOC categories rather than the 80 COCO ones.

已针对 LibreYOLO v1.5.0 验证。本页的支持表、检查点和基准测试数据由已发布的库和权重生成,并非手工编写。