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

SSD MobileNet内存占用过大 #71

Open
wait1988 opened this issue Apr 26, 2018 · 10 comments
Open

SSD MobileNet内存占用过大 #71

wait1988 opened this issue Apr 26, 2018 · 10 comments

Comments

@wait1988
Copy link

在CPU上运行SSD MobileNet内存占用900多M,而用Opencv的DNN模块来运行,内存200多M,差别为什么这么大呢

@luoyetx
Copy link
Owner

luoyetx commented Apr 27, 2018

你是怎么监测到 900 M 的内存占用的,下面的图是我在 Debug 模式下跑 SSD exmaple 画出来的

figure_1

mem.log

@wait1988
Copy link
Author

VS2015的诊断工具,视频大小640*480,mini-caffe内存占用和CPU利用率如下图:
vs
同样的输入和网络模型,OpenCV DNN模块的内存占用和CPU利用率如下图:
vs1

@wait1988
Copy link
Author

刚在Linux上面运行SSD的例子,结果显示成功之后,回车推出,就崩溃了
[15:50:40] /home/deep_learning/mini-caffe/src/syncedmem.cpp:286: [CPU] Free 2.75 M
[15:50:40] /home/deep_learning/mini-caffe/src/syncedmem.cpp:286: [CPU] Free 4 M
[15:50:40] /home/deep_learning/mini-caffe/src/syncedmem.cpp:286: [CPU] Free 4.5 M
[15:50:40] /home/deep_learning/mini-caffe/src/syncedmem.cpp:286: [CPU] Free 5.49 M
[15:50:40] /home/deep_learning/mini-caffe/src/syncedmem.cpp:286: [CPU] Free 6.35 M
[15:50:40] /home/deep_learning/mini-caffe/src/syncedmem.cpp:286: [CPU] Free 24.7 M
*** Error in `./ssd': free(): invalid pointer: 0x0000000000b9af80 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f2c994c57e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7f2c994ce37a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f2c994d253c]
/usr/local/lib/libprotobuf.so.9(_ZN6google8protobuf8internal28DestroyDefaultRepeatedFieldsEv+0x1f)[0x7f2c99194b5f]
/usr/local/lib/libprotobuf.so.9(_ZN6google8protobuf23ShutdownProtobufLibraryEv+0x8b)[0x7f2c99193f4b]
/usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3(+0x233b9)[0x7f2c8d4b13b9]
/lib64/ld-linux-x86-64.so.2(+0x10de7)[0x7f2c9b3b2de7]
/lib/x86_64-linux-gnu/libc.so.6(+0x39ff8)[0x7f2c99487ff8]

@luoyetx
Copy link
Owner

luoyetx commented Apr 28, 2018

@wait1988 Linux 崩溃似乎是 protobuf 的问题?

@luoyetx
Copy link
Owner

luoyetx commented Apr 28, 2018

我本地 debug 模式下跑的 ssd example

tim 20180429001859

@wait1988
Copy link
Author

wait1988 commented May 2, 2018

@luoyetx 看日志像是protobuf的问题,我现在的版本是2.5,有推荐的版本么

@luoyetx
Copy link
Owner

luoyetx commented May 2, 2018

3.4 版本,内存占用还是有问题吗?

@fanxingzju
Copy link

@luoyetx 您好,我阅读了mini-caffe的内存管理策略(issue: #70 #31 #29 以及具体的实现syncedmem.cpp 和 syscedmem.hpp),您的工作给了我非常大的启发,非常感谢!!

我准备测试 mini-caffe 加载不同模型做推理过程中的内存使用情况,想请教下您,您回答里面的那些内存占用曲线是怎么绘制的啊?

我注意到mini-caffe在RequestCPU和ReturnCPU过程中打印了内存申请和释放情况([CPU] Request / [CPU] Return / [CPU] Free ..),是根据日志文件里面的打印信息另外写一个脚本去绘制内存占用曲线么? 还是借助某种内存分析工具? 方便介绍一下吗?

@fanxingzju
Copy link

我找到这个脚本了 https://github.com/luoyetx/mini-caffe/blob/master/tools/parse_mem.py

python parse_mem.py "./mem.log" 就可以绘制出来内存使用曲线了

这个功能对于开发者来说非常有用,建议可以在介绍profile的时候,一并介绍下这个工具~~

再次感谢!!

@HappyKerry
Copy link

@luoyetx protobuf必须用3.4版本吗?Ubuntu 16.04 protobuf我用的3.6、2.6内存占用都有问题,不知什么原因

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

4 participants