3 篇文章带有标签 “ultralytics”

基于 FastAPI 开发 Ultralytics Serving

Ultralytics Serving

Inference service based on Ultralytics

创建虚拟环境

python -m venv venv source venv/bin/activate

安装依赖包

创建 requirements.txt

fastapi
python-multipart
aiofiles
onnxruntime
ultralytics
uvicorn[standard]
gunicorn
pytest
httpx

安装

pip install -r requirements.txt

调试

创建 launch.json 文件,用于调试 FastAPI 应用。

.vscode/launch.json { "version": "0.2.0", "configurations": [ { "name": "Python: FastAPI", "type": "python", "request": "launch", "module": "uvicorn", "args": [ "app.

Ultralytics Hub 快速入门

准备数据集

目录结构

data.yaml

train: ../train/images
val: ../valid/images
test: ../test/images

nc: 1
names: ['logo']

压缩成 zip 文件

登录 Ultralytics Hub

Projects

创建项目

Datasets

上传数据集

数据集图像

数据集概貌

Train

选择数据集

选择模型

选择训练参数

Google Colab 训练模型

使用上图的 API key 替换 PASTE_API_KEY_HERE

Done

Models

模型训练的性能指标

模型测试

模型部署

参考资料

Ultralytics YOLOv8

Ultralytics

构建环境

Ultralytics 镜像

  • GPU
docker pull ultralytics/ultralytics:latest
  • CPU
docker pull ultralytics/ultralytics:latest-cpu
  • Apple Silicon
docker pull ultralytics/ultralytics:latest-arm64

本地安装

pip install ultralytics

基于 COCO128 数据集的目标检测范例

运行容器

git clone https://github.com/ultralytics/ultralytics.git
docker run --runtime=nvidia -it --name ultralytics -v `pwd`/ultralytics:/usr/src/ultralytics ultralytics/ultralytics:latest

yolo 命令的使用参数

yolo TASK MODE ARGS

训练模型

yolo train data=coco128.yaml model=yolov8n.pt

训练可视化(Comet) pip install comet_ml export