Thirty Frames on the Trail

Deep Learning in the Real WorldMedium+20 XP+20

Thirty Frames on the Trail

A hiking app names plants live through the phone camera. Trails often have no signal, so the model has to run on the phone. The team wants the largest model the phone can handle, since within this family bigger has meant more accurate.

Time. The camera delivers 303030 frames per second. Every frame passes through three stages, one after another:

stagetime per frame
preparing the image4.54.54.5 ms
running the modeldepends on the model
drawing the label on screen1.51.51.5 ms

A frame that is not finished before the next one arrives makes the overlay stutter. The team accepts at most 1 late frame in 100.

On this phone, a test model with 202020 million parameters (8-bit weights) was timed over thousands of frames:

measurementmodel time
half of all frames finish within888 ms
99 frames in 100 finish within121212 ms

Model time grows in proportion to the number of parameters, for both measurements.

Memory. The phone shuts down any app that uses more than 250250250 MB. The rest of the app (interface, camera buffers) already takes 150150150 MB. While it runs, the model needs 404040 MB of working memory whatever its size, plus its weights, stored at 8 bits each. Take 111 MB =106= 10^6=106 bytes.

What is the largest model, in millions of parameters, that meets both requirements? Round to 1 decimal place.

Hints

Solve it to unlock the solution

Once you get it right, the reasoning behind the answer shows up here.