Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在批量predict时显存上涨,最后OOM问题的解决思路 #1

Open
simplew2011 opened this issue Jul 8, 2020 · 1 comment
Open

Comments

@simplew2011
Copy link

原因:keras.backend.get_value函数会添加新的节点到tf的图中;在每次循环图片预测时导致了tf的图越来越大,内存泄露。
参照:
https://blog.csdn.net/mingshili/article/details/81941677
修改predict.py里的CTC解码部分,可解决。
每次重置session会打印tensorflow信息,比较难看,通过在predict.py开头添加下面关闭控制台输出的tensorflow信息:
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'

@simplew2011
Copy link
Author

原因:keras.backend.get_value函数会添加新的节点到tf的图中;在每次循环图片预测时导致了tf的图越来越大,内存泄露。
参照:
https://blog.csdn.net/mingshili/article/details/81941677
修改predict.py里的CTC解码部分,可解决。
每次重置session会打印tensorflow信息,比较难看,通过在predict.py开头添加下面关闭控制台输出的tensorflow信息:
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'

二次更新,前面方法视乎还是有问题,找到下面最终方法解决:
https://github.com/YCG09/chinese_ocr/blob/master/densenet/model.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant