PaddleSeg UnboundLocalError: local variable ‘images‘ referenced before assignment

问题描述:

在用PaddleSeg的恢复模型(已经训练完的模型)训练时会出现以下错误
PaddleSeg UnboundLocalError: local variable ‘images‘ referenced before assignment

原因分析:

在C:\Users\315\Desktop\code\PaddleSeg\paddleseg\core、train.py中第144行
PaddleSeg UnboundLocalError: local variable ‘images‘ referenced before assignment
由于已经训练完了,程序不会进入while循环中,而后面的images需要在while循环中赋值(292行)

PaddleSeg UnboundLocalError: local variable ‘images‘ referenced before assignment
所以程序会报局部变量未赋值被引用的错误

解决方案:

在if语句下添加以下代码
PaddleSeg UnboundLocalError: local variable ‘images‘ referenced before assignment
程序就可以顺利执行下去。

上一篇:unable to delete * (must be forced) - image is referenced in multiple repositories


下一篇:【python】错误:UnboundLocalError: local variable ‘XXX‘ referenced before assignment