# yolo-seg-ort
<!-- PROJECT SHIELDS -->






<!-- PROJECT LOGO -->
<br />
<p align="center"> <a href="https://github.com/7emotions/yolo-seg-ort/">
<img src="images/logo.png" alt="Logo">
</a>
<h3 align="center">yolo-seg-ort</h3>
<p align="center">
采用纯ONNX Runtime实现YOLOv11-seg的onnx模型。<br />
<a href="https://github.com/7emotions/yolo-seg-ort"><strong>探索本项目的文档 »</strong></a><br />
<br />
<a href="https://github.com/7emotions/yolo-seg-ort/releases">查看发布</a>
·
<a href="https://github.com/7emotions/yolo-seg-ort/issues">报告Bug</a>
·
<a href="https://github.com/7emotions/yolo-seg-ort/issues">提出新特性</a>
</p>
</p>
## 1. 模型转换
```python
from ultralytics import YOLO
# Load the YOLO11 model
model = YOLO("best.pt")
# Export the model to ONNX format
model.export(format="onnx") # creates 'yolo11n.onnx'
```
## 2. 安装依赖
```bash
pip install -r requirements.txt
```
## 3. 用法
```python
from yolo_seg_ort import YOLOSeg
import cv2
onnx_path = "best.onnx"
image_path = "test.jpg"
image = cv2.imread(image_path)
model = YOLOSeg(
onnx_model=onnx_path,
classes=["Grass", "Ground", "Ramp", "Road", "Stairs"],
conf=0.25,
iou=0.7,
imgsz=640,
)
result = model(image)
if result:
result[0].save("./results.jpg")
# result[0].show()
else:
print("未检测到任何对象或结果为空。")
```
## 4. 结果
<img src="test/test.jpg"/><img src="test/results.jpg" />
## 5. 贡献者
[7emotions](https://github.com/7emotions)
## 6. 许可证
本项目采用 MIT 许可证。有关详细信息,请查看 [LICENSE](LICENSE) 文件。
Raw data
{
"_id": null,
"home_page": null,
"name": "yolo-seg-ort",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "yolo-seg, onnx, onnxruntime",
"author": null,
"author_email": "Lorenzo Feng <lorenzo.feng@njust.edu.cn>",
"download_url": "https://files.pythonhosted.org/packages/23/02/e206e6491e6b2c369c47b935d970d23bdb2f527c1a241f7cd179d5f0eea3/yolo_seg_ort-0.1.0.tar.gz",
"platform": null,
"description": "# yolo-seg-ort\n\n\n<!-- PROJECT SHIELDS -->\n\n\n\n\n\n\n\n<!-- PROJECT LOGO -->\n<br />\n\n<p align=\"center\"> <a href=\"https://github.com/7emotions/yolo-seg-ort/\">\n <img src=\"images/logo.png\" alt=\"Logo\">\n </a>\n <h3 align=\"center\">yolo-seg-ort</h3>\n <p align=\"center\">\n \u91c7\u7528\u7eafONNX Runtime\u5b9e\u73b0YOLOv11-seg\u7684onnx\u6a21\u578b\u3002<br />\n <a href=\"https://github.com/7emotions/yolo-seg-ort\"><strong>\u63a2\u7d22\u672c\u9879\u76ee\u7684\u6587\u6863 \u00bb</strong></a><br />\n <br />\n <a href=\"https://github.com/7emotions/yolo-seg-ort/releases\">\u67e5\u770b\u53d1\u5e03</a>\n \u00b7\n <a href=\"https://github.com/7emotions/yolo-seg-ort/issues\">\u62a5\u544aBug</a>\n \u00b7\n <a href=\"https://github.com/7emotions/yolo-seg-ort/issues\">\u63d0\u51fa\u65b0\u7279\u6027</a>\n </p>\n</p>\n\n## 1. \u6a21\u578b\u8f6c\u6362\n\n```python\n\nfrom ultralytics import YOLO\n\n# Load the YOLO11 model\nmodel = YOLO(\"best.pt\")\n\n# Export the model to ONNX format\nmodel.export(format=\"onnx\") # creates 'yolo11n.onnx'\n\n```\n\n## 2. \u5b89\u88c5\u4f9d\u8d56\n\n```bash\npip install -r requirements.txt\n```\n\n## 3. \u7528\u6cd5\n\n```python\nfrom yolo_seg_ort import YOLOSeg\nimport cv2\n\nonnx_path = \"best.onnx\"\nimage_path = \"test.jpg\"\n\nimage = cv2.imread(image_path)\n\nmodel = YOLOSeg(\n onnx_model=onnx_path,\n classes=[\"Grass\", \"Ground\", \"Ramp\", \"Road\", \"Stairs\"],\n conf=0.25,\n iou=0.7,\n imgsz=640,\n)\n\nresult = model(image)\n\nif result:\n result[0].save(\"./results.jpg\")\n # result[0].show()\nelse:\n print(\"\u672a\u68c0\u6d4b\u5230\u4efb\u4f55\u5bf9\u8c61\u6216\u7ed3\u679c\u4e3a\u7a7a\u3002\")\n\n```\n\n## 4. \u7ed3\u679c\n\n<img src=\"test/test.jpg\"/><img src=\"test/results.jpg\" />\n\n## 5. \u8d21\u732e\u8005\n\n[7emotions](https://github.com/7emotions)\n\n## 6. \u8bb8\u53ef\u8bc1\n\n\u672c\u9879\u76ee\u91c7\u7528 MIT \u8bb8\u53ef\u8bc1\u3002\u6709\u5173\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u67e5\u770b [LICENSE](LICENSE) \u6587\u4ef6\u3002\n",
"bugtrack_url": null,
"license": null,
"summary": "Deploy YOLO-Seg ONNX model with ONNX Runtime",
"version": "0.1.0",
"project_urls": {
"Documentation": "https://github.com/7emotions/yolo-seg-ort",
"Homepage": "https://github.com/7emotions/yolo-seg-ort",
"Issues": "https://github.com/7emotions/yolo-seg-ort/issues",
"Source": "https://github.com/7emotions/yolo-seg-ort"
},
"split_keywords": [
"yolo-seg",
" onnx",
" onnxruntime"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "0f7e6754bbe37fa7d10ab7a72bdc7e41ce80caba47976b1a6eed4d7e817215f8",
"md5": "631d20b8e1c9668e2824244a47563032",
"sha256": "38c9178d8766f3c61239459f371f9e24fc4f3083b9f2a2c67def8615f1eee778"
},
"downloads": -1,
"filename": "yolo_seg_ort-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "631d20b8e1c9668e2824244a47563032",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 3191,
"upload_time": "2025-07-12T19:01:58",
"upload_time_iso_8601": "2025-07-12T19:01:58.790476Z",
"url": "https://files.pythonhosted.org/packages/0f/7e/6754bbe37fa7d10ab7a72bdc7e41ce80caba47976b1a6eed4d7e817215f8/yolo_seg_ort-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "2302e206e6491e6b2c369c47b935d970d23bdb2f527c1a241f7cd179d5f0eea3",
"md5": "aab1077dd54e4ed651e78b4640ddd7f3",
"sha256": "6400a416fe18058b6bcea16aba3fd0326322da88994ecf3018bf477f9478e9c1"
},
"downloads": -1,
"filename": "yolo_seg_ort-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "aab1077dd54e4ed651e78b4640ddd7f3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 3200,
"upload_time": "2025-07-12T19:02:00",
"upload_time_iso_8601": "2025-07-12T19:02:00.364226Z",
"url": "https://files.pythonhosted.org/packages/23/02/e206e6491e6b2c369c47b935d970d23bdb2f527c1a241f7cd179d5f0eea3/yolo_seg_ort-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-12 19:02:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "7emotions",
"github_project": "yolo-seg-ort",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "onnxruntime",
"specs": [
[
"~=",
"1.17.1"
]
]
},
{
"name": "numpy",
"specs": [
[
"~=",
"1.23.0"
]
]
},
{
"name": "opencv-python",
"specs": [
[
"~=",
"4.11.0"
]
]
}
],
"lcname": "yolo-seg-ort"
}