Why & How Spyne Switched to AWS SageMaker to Train AI for Automated Image Editing System

Spyne Tech
4 min readJul 20, 2022

--

Blessed be the souls that built Amazon SageMaker — it has made our lives surprisingly easy. It took a lot of time for Spyne’s AI application to become a success, and it involved a lot of sweat and tears (no blood, thankfully). Now, we have trained our system to recognize the object in a selected image — a car, for example — and differentiate it from the background and noise.

After that our AI automatically replaces the background in the image with a new one, chosen by the end user from a preset collection or a custom one. The system also adds finishing touches, like an appropriate window tint, replacing the registration plates with a custom logo, etc. We’ve got plenty of other goodies as well, which we shall share later!

Training an AI model is a hard nut to crack. Thanks to AWS SageMaker, it’s now a cakewalk for Spyne.

Amazon AWS SageMaker Studio
Amazon AWS SageMaker Studio (source: AWS)

To reach this point, we had to train our AI system heavily and rigorously. Millions of images were fed in, and the system had to learn what a “car” is, clean the background and transform them into high-quality studio-like images. We used to do things by hand back in the day; teams sat around in circles, sometimes with marshmallows, manually setting up instances- selecting the types of instances to be created, selecting the target OS, installing training libraries, etc. We utilized EC2 on-demand instances back then, mainly out of necessity.

The roadblock

Once the training of our AI model began, it ran uninterrupted until it was complete, which often happened at odd hours. However, as we used on-demand instances, our Virtual Machines (VMs) would keep running until the next business day when someone would arrive at the office and turn it off.

While the output was desirable, the bill was not! Running VMs, even when idle, costs a lot of money.

Our first solution and the challenges that followed

Unhappy with the hefty bills we were paying, we briefly decided to switch over to spot instancing for our AI model. However, there were major problems with that.

Every time another AWS client popped up asking for heavier computing power on-demand, our EC2 instances would go low priority, sometimes even stopping midway. We had to manually prompt our model training to resume or restart, which was a gigantic pain in everyone’s noses.

We lost precious time, and our deadlines were forced to be pushed back.

And then we found a solution!

One fine day, we decided to give SageMaker a try. The documentation was readily available on the AWS website online, so it wasn’t too hard to understand how to get it running. We got one team member to run trials, and guess what, we struggled a lot initially! Well, baby steps…

Thankfully, we were able to run a successful trial one-and-a-half business days later. Following that, we held a KT session, wherein the rest of the team was brought up to speed on the whats, whens, and whys of SageMaker. We managed to easily streamline the process, further helping us save time.

Amazon SageMaker is a managed service. This means that it handles the training jobs automatically, setting up and scaling as it sees fit. Now, we’re able to use spot instances for our training, which has slashed our bills to a third! The platform also checks and resumes training of our AI model whenever instances are available.

AWS Amazon SageMaker project workflow
AWS Amazon SageMaker project workflow

We don’t even have to distribute the VM instances between our team members — SageMaker does it for us. Also, it logs the following automatically — source code, hyper-parameters, runs, datasets, model checkpoints, and output weights — for future reference and deployment.

People following Spyne’s progress would know that we are adding an eCommerce section as well, which will be followed by a few other product categories. Our AI system needs to be way more sophisticated now, so as to successfully cover different products from various industries. Training the Artificial Intelligence model for this was extremely intense, as the scope of operations is way larger compared to automobiles.

Thankfully, SageMaker helped us dash through the process, and will do so for our future projects too.

--

--

Spyne Tech

Here, we spill what’s brewing in the fields of #artificialintellegence, #marketing and #automotive, including how it relates to you