blueoil
blueoil copied to clipboard
The debug binary now show how much memory it will try to allocate on the heap
Currently there is no way of knowing how much memory a network model requires for activations on deployment.
Motivation and Context
It is possible to know the required memory from the Tensorflow model but will not match with the actual required amount of memory due to buffer reuse and quantization. This PR will make the debug binary (lm_xxx.elf
) to print a message that show how much memory will be allocated on the heap before calling Network::init()
. This allows you to have an idea of how much memory will be used and, debug possibly related memory issues.
Description
- Added a new method to
Network
class that returns the amount of memory in bytes. - Use this method from
mains/main.cpp
and print how many megabytes will be required by the model.
How has this been tested?
Tested with 2 of the provided examples:
- classification: lmnet_quantized_cifar10
- object detection: widerface_v5
Screenshots (if appropriate):
For object detection this will show:
This network will try to allocate 10.2753 MB on the heap
-------------------------------------------------------------
Comparison: Default network test succeeded!!!
-------------------------------------------------------------
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature / Optimization (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Checklist:
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.