一、安装

查看cuda版本

nvidia-smi 或者 nvcc -V

创建YOLOv10文件加,在此文件夹下进入终端cmd

python创建虚拟环境

python -m venv yolov10

激活虚拟环境

call yolov10\Scripts\activate

安装依赖包

pip install supervision labelme  labelme2yolo huggingface_hub google_cloud_audit_log
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install git+https://github.com/THU-MIG/yolov10.git

如果最后一条执行不了,在YOLOv10创建requirements.txt文件,添加以下内容

onnx==1.14.0
pycocotools==2.0.7
onnxsim==0.4.36
onnxruntime-gpu==1.18.0
gradio==4.31.5
safetensors==0.4.3

安装以上模块

pip install -r requirements.txt

重新运行此条命令

pip install git+https://github.com/THU-MIG/yolov10.git

二、yolo10 摄像头检测物体

1、python yolov10-infer.py 训练之前测试

2、python gen-imgs.py 运行截图程序准备训练数据

3、roboflow在线标注(或者本地用labelme标注 )

4、yolo detect train data=yolo10-test/data.yaml model=yolov10n.pt epochs=30 batch=8 imgsz=640 device=0

5、python yolov10-detect.py 测试训练后的模型

三、本地标注工具

1、labelme 运行本地标注工具

2、labelme2yolo --json_dir D:\github\yolo10\output_images