My own situation is that there are too many pictures displayed in the code, which leads to longer and longer training time for each iteration/epoch. or something like that.
Solution:
close plt.close()
the picture in time
fig = plt.figure(0) # 新图0
plt.savefig( ) # 保存
plt.close(0) # 关闭图0
plt.close('all') #关闭所有图
Time-consuming screenshot of the training process:
After using plt.close('all')