Does Increased Parameter Size Always Mean Greater Memory Size for Inferences? Densenet vs Resnet

computer visionmachine learning

I was using DenseNet, a type of CNN, and while it does not use many parameters, I have heard that it is not very memory efficient. However, the question I had was if I just download the weights and use it for another application (an example is a smartphone) and run inferences, would only the parameter size be taken into account for how much memory it uses?

Simplified:
Resnet 10 million parameter –> training
Densenet 1 million parameter –> training Densenet uses less parameters than resnet but more memory

Resnet weights deployed onto phone
Densenet weights deployed onto phone
Will densenet use less memory for inferences on phone than resnet?

Best Answer

Parameter count isn't the only thing you need to track for measuring memory usage. You also need to store the data as it goes through the network, which could be require a lot of storage, depending on what you're doing. Consider a large number of small filters applied to a large image. The memory consumption of the filters in total is small, but storing lots of filtered versions of a large input image will consume a lot of memory.