diff --git a/Lab-4/src/val.py b/Lab-4/src/val.py new file mode 100644 index 0000000..56cd570 --- /dev/null +++ b/Lab-4/src/val.py @@ -0,0 +1,14 @@ +from ultralytics import YOLO + +# 加载训练得到的最佳模型 +best_model = YOLO('runs/detect/yolov8n_coco128_exp1/weights/best.pt') +# 在验证集上评估模型 +metrics = best_model.val() +# 程序会自动打印出mAP、 Precision、 Recall等关键指标 + +# 加载训练得到的最佳模型 +best_model = YOLO('runs/detect/yolov8n_coco128_exp1/weights/best.pt') + +# 在验证集上评估模型 +metrics = best_model.val() +# 程序会自动打印出mAP、 Precision、 Recall等关键指标。