val.py 676 B

123456789101112131415161718
  1. import warnings
  2. warnings.filterwarnings('ignore')
  3. from ultralytics import YOLO
  4. # 验证参数官方详解链接:https://docs.ultralytics.com/modes/val/#usage-examples:~:text=of%20each%20category-,Arguments%20for%20YOLO%20Model%20Validation,-When%20validating%20YOLO
  5. if __name__ == '__main__':
  6. model = YOLO('runs/train/exp/weights/best.pt')
  7. model.val(data='/root/dataset/dataset_voc/data.yaml',
  8. split='val',
  9. imgsz=640,
  10. batch=16,
  11. # iou=0.7,
  12. # rect=False,
  13. # save_json=True, # if you need to cal coco metrice
  14. project='runs/val',
  15. name='exp',
  16. )