I am currently using Unity to run an app on Android for object tracking. When the app is opened, the object trackers are loaded. I am using 90 objects split into 9 object trackers. When the last object trackers are loaded, the peak memory consumption goes up to 2.2 GB. After a few seconds, the memory consumption goes down to 500 MB. If I activate the object trackers separately (1 object tracker every 5 seconds after the app is opened), the peak memory consumption becomes 0.95 GB which is still high. I would like to reduce this amount as much as possible to avoid apps crashing in low memory phones. I am almost certain that the Wikitude SDK is causing these memory spikes since the memory consumption goes up drastically after an object tracker is loaded (from 300 MB to 900 MB) and then back down to 400 MB.
I have attached an object tracker which spikes up to 0.88 GB when loaded alone. It consists of 10 objects which were all created from pictures except the firetruck sample, some of which have many pictures associated with them (50) while others only a few (10).
Right now, the code is very simple, I am simply activating the object trackers and that's it.
I have attached the statistics of Unity's memory profiler when an object tracker is loaded and there is a spike of 0.94 GB. As you see, the total untracked memory amounts to 0.76 GB which further increases the probability that the SDK is causing these spikes.
Unity version: 2021.2.7f1
Is there a way to reduce the memory consumption spikes by the Wikitude SDK when loading the object trackers?
I would recommend using an ML based layer to detect if an object is seen in the camera view. Therefore, either NatML or Unity's Barracuda are good options... To train the model itself, I guess Google's Teachable machine should be a simple solution. The exported Tensorflow lite model can be directly used with NatML (not sure about Barracuda).
Based on the classification of the ML layer, the Object Tracker should be created dynamically... The target collections should also be split up into separate target collections containing only one target to reduce the memory allocation on load.