ultralytics/val.py
2025-02-25 11:58:34 +08:00

22 lines
1.0 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import warnings
warnings.filterwarnings('ignore')
from ultralytics import YOLO
# BILIBILI UP 魔傀面具
# 验证参数官方详解链接https://docs.ultralytics.com/modes/val/#usage-examples:~:text=of%20each%20category-,Arguments%20for%20YOLO%20Model%20Validation,-When%20validating%20YOLO
# 精度小数点保留位数修改问题可看<使用说明.md>下方的<YOLOV8源码常见疑问解答小课堂>第五点
# 最终论文的参数量和计算量统一以这个脚本运行出来的为准
if __name__ == '__main__':
model = YOLO('runs/train/exp/weights/best.pt') # 选择训练好的权重路径
model.val(data='/home/hjj/Desktop/dataset/dataset_visdrone/data.yaml',
split='val', # split可以选择train、val、test 根据自己的数据集情况来选择.
imgsz=640,
batch=16,
# iou=0.7,
# rect=False,
# save_json=True, # if you need to cal coco metrice
project='runs/val',
name='exp',
)