VIMAGE - Accelerate, Simplify, Deploy
Dev story of building a scalable GPU-backed solution on google cloud platform
VIMAGE is an award-winning photo-editing software, with over 10 million total downloads on google play. It is primarily built by a group of just 5 people (as of March 6, 2023). An overview of the app’s capabilities is shown in this promotional video:
The results look nice and, if you have a keen eye for the ML tech, you will have noticed that the core of the project’s success rests on decomposing the image into fore- and background parts, to allow for seamless modification of both parts.
Details and requirements
The core of the project consists of the following three parts:
- Handling image I/O in a way that respects the end-user privacy
- Creating an accurate depth map of the input RGB image.
- Deciding which pixels fall within the background and which within the foreground
In addition, there were other, purely business-driven restrictions in place:
- Prioritize cost saving
- Ensure the app can scale up smoothly
- Optimize code, reduce end-user lag
- Everything should be hosted on google cloud platform
Live showcase
Depth estimation
Background removal
Below you can see the background removal tool in action. It is free to use:
Implementation
The most pressing constraint of this project was the GPU-requirements of the core layer of the project. This, coupled with the scalability requirements (i.e. a fully managed GPU provider platform) narrowed down our choice of compute providers significantly. At this stage we had just 3 options:
- Set up a manual lightweight server that allocates and de-allocates GPU-powered VMs from
google cloud compute
service. - Investigate the
google cloud run anthos
service (which, reportedly provides serverless GPUs) - Investigate whether
Google Cloud Vertex AI
could be used for our requirements.
To avoid costly research phase, we consulted with a certified google cloud architect and with their insight, decided to go with Vertex AI
service. The rough outline of the project was specified during a packed 1 hour-long meeting:
- Use
Vertex AI Endpoint
to access the cheapest GPU VM (T4 GPU instance backed with N2-family CPU). - Leverage the scalability of
Vertex AI Endpoints
. VAIE is scalable by default, but is constrained to have at least 1 instance always running. Usually, this means a monthly bill of around $300, and for personal, ultra-low-use projects, this kind of bill is a big no-no. However, given our customer’s access to a large amount of budget, this price was of no concern.
However, VAIE also comes with a few drawbacks. Namely: