apache / mxnet

Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more
https://mxnet.apache.org
Apache License 2.0
20.78k stars 6.79k forks source link

How to reduce the memory when load the trained model? #8570

Open 315386775 opened 6 years ago

315386775 commented 6 years ago

Description

I used the VGG16 base network. The faster-rcnn occupy 2G memory in fact, but when loading model need around 6G memory. How to reduce the memory when load the trained model?

What have you tried to solve it?

edmBernard commented 6 years ago

Convolution operations take more place in memory for use than its weights on disk. If you want to reduce GPU memory usage you can reduce batch size and image size. In training step it more often the batch size. Or change your network to a smaller one like mobilenet.

315386775 commented 6 years ago

@edmBernard thank you. Now i use the image to test the model. The batch size is 1 and image size also can not reduce. When loaded the model the network occupy 2G memory. The memory when loading the model increase to 6 G only in 1 second.
https://github.com/dmlc/mxnet-memonger

szha commented 6 years ago

@apache/mxnet-committers: This issue has been inactive for the past 90 days. It has no label and needs triage.

For general "how-to" questions, our user forum (and Chinese version) is a good place to get help.

lanking520 commented 6 years ago

@sandeep-krishnamurthy please add Memory, Performance to this topic