首页 > 解决方案 > 在经过固定次数的迭代后进行训练时,有什么方法可以备份 YOLOv5 中的权重?

问题描述

我想在训练 YOLOv5 时备份权重,这样如果训练由于某种原因停止,我不必像在 yolov3 中那样重新开始,您可以提及每 100 次迭代后备份权重的文件夹

标签: pythonyoloresuming-training

解决方案


在“runs”文件夹中,您可以在名为您的项目的文件夹下找到权重文件 (*.pt)。

例如,

在此处输入图像描述

保存 pt 文件,并在检测到类似情况时加载一个。

!python detect.py --weights '/content/drive/My Drive/yolov5/runs/exp8_i2_PA+pano_yolov5x_results/weights/best_i2_PA+pano_yolov5x_results.pt' --img 512 --conf 0.5 --source "{test_img_path}"

推荐阅读