问题描述
在用yolov5训练数据的过程中由于突发情况训练过程突然中断,从头训练耗时,想接着上次训练继续训练怎么办。放心,在yolov5中给我们提供现成的参数--resume
解决方法
先将train.py
中的--resume
的default
改为True
,表示默认是打开状态
接着在runs/train/exp*/weights/
路径下找到上次训练的最后的保存的权重,名字叫last.pt
,并且记下路径
这里说一下,
weights
下应该会有两个pt文件,last.pt
表示最后的权重,best.pt
表示最好的权重
最后在执行train.py
的时候加上--weights runs/train/exp*/weights/last.pt
即可。
例如:
python train.py --weights runs/train/exp*/weights/last.pt