yolov7中断训练后继续训练

发布时间:2024年01月13日

1、训练指令

(1)添加resume参数,参数值改为true

(2)weights参数,参数值改为中断前上次训练权重

中断后继续训练命令:

python.exe train.py --weights runs/train/exp9/weights/last.pt --resume True

2、报错:

TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
?1. Downgrade the protobuf package to 3.20.x or lower.
?2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

处理:

看报错提示是protobuf这个库版本不对,protobuf需要3.20.x或以下版本,我查了下我自己的版本是4.15.2。版本不对,那就卸载原来的protobuf,再安装一个符号要求的版本

pip uninstall protoc

安装

pip install protobuf==3.19.0

?3、安装protobuf3.19.0后,又报错:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
onnx 1.15.0 requires protobuf>=3.20.2, but you have protobuf 3.19.0 which is incompatible.
tensorflow-gpu 2.7.0rc0 requires numpy~=1.19.2, but you have numpy 1.22.4 which is incompatible.
Successfully installed protobuf-3.19.0

看报错提示还是版本不匹配,我安装了protobuf 3.19.0版本,但是需要3.20.2以上的版本

那就改成3.20.2版本。

卸载原来的protobuf

pip uninstall protobuf

安装protobuf3.20.2

pip install protobuf==3.20.2

4、protobuf版本问题搞定后,再次运行训练命令

python.exe train.py --weights runs/train/exp9/weights/last.pt --resume True

ok,接着之前中断的训练继续训练了

文章来源:https://blog.csdn.net/qq_40342287/article/details/135576056
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。