文章目录
- 1. train.py
- 2. 执行命令
1. train.py
from ultralytics import YOLO
import cv2
from PIL import Image
import osif __name__ == '__main__':os.environ["CUDA_VISIBLE_DEVICES"]="0,1"# 加载一个模型model = YOLO('/home/8888/yolov8-test/yolov8s.pt') # 加载预训练模型(推荐用于训练)# 训练模型results = model.train(data='/home/8888/yolov8-test/data/coco.yaml', epochs=5000, imgsz=640, batch=8, device=[0,1], workers=8, patience=50)
2. 执行命令
python -m torch.distributed.launch --nproc_per_node=2 train.py