Product leadership.
AI & enterprise software.

All writing

Automatically Removing Image Backgrounds

Photo by Source Image

In a world full of digital content, it matters to have good-quality images that fit your audience. We can usually find images online to use as the starting point for creating content.

But it still takes work to bring those images together. Removing backgrounds, resizing, clipping, and other edits all take time. That can be a challenge if you don’t have much design experience or time to spare.

Take removing an image background, for example. Doing it manually usually means tracing the outline of the main subject in an image editor. That can take a while, especially when the subject is complicated.

In this second article in my #reviewproductAI series, I’ll look at a product I’ve actually been thinking about prototyping myself for some time: using AI to remove the background from an image.

Product Check

Photo by removal.ai Website

Several companies offer similar services, including removal.ai, removebg, slazzer, and fotor. I’ll use removal.ai as an example here, since I came across it before its competitors.

Looking at its website, the product seems to target a few different groups: designers, developers, marketers, and anyone else who needs to remove an image background.

The idea is to help people quickly and easily prepare the subject of an image for further editing. Broadly, the market appears to split into B2C for individuals and B2B for companies that need to process images in larger volumes.

The product is offered as Software as a Service (SaaS), with access through a desktop app and an API. Its subscription model is based on the processing quota a user selects.

People can use the desktop app directly or use the API to process larger amounts of data. From what I’ve seen, the tools are fairly easy to understand.

For the API, there’s documentation with examples in Python, PHP, C#, JavaScript, and Node.js. There’s also a simple demo where you can upload an image and see the result with its background removed.

AI Perspective

Photo by Deep Machine Learning AI

Let’s look at the product from an AI perspective. From what I can tell, image segmentation appears to be the main method behind the image processing.

Segmentation means marking the areas of an image that belong to a particular object. The image is divided into regions with similar attributes at the pixel level.

For example, if the target is a bicycle, the system marks the pixels belonging to the bicycle. It can then remove the non-bicycle areas as background, leaving an image of the bicycle with an empty background.

Photo by Image segmentation results of DeepLabV3 on sample images

There are many ways to perform image segmentation. Older approaches include thresholding, K-means clustering, histogram-based segmentation, and edge detection. More recent approaches include CNNs, ensemble learning, and others.

To explore research in this area, take a look at the Papers with Code page. It lists methods you can study and try. If you’re lucky, there’s a code repository you can reproduce the results with too.

Experiment

Now let’s try a small experiment comparing removal.ai with an open-source implementation to see how their image segmentation results differ. I used DeepLabV3-ResNet101 with PyTorch on my laptop, which has a GTX 1060ti GPU.

I tested three images. One thing to keep in mind: I fed the images directly into the DeepLabV3-ResNet101 code using the default parameters, and I didn’t make any edits to the results from removal.ai.

Photo by Complex, NBA, The Salt Lake Tribune

In the images above, DeepLabV3-ResNet101 leaves behind some objects that should have been removed as background. That could happen here because the model is being used as a research implementation in a limited test setup.

The results from removal.ai do a better job of separating the main subject from the background. Still, in the second row, part of a person gets cut off. In the third row, a leg that should be treated as background remains in the image.

The product has a feature to handle these cases: users can check and adjust which areas should be kept or removed. There is a paid limitation, though. Editing at full resolution requires payment; otherwise, it’s available only at preview resolution.

Photo by removal.ai

A Few Closing Thoughts

These examples show how a product prepared for commercial use can better address what users need. Of course, comparing it with a public research implementation isn’t exactly an apples-to-apples comparison.

The product is more robust in deciding which objects to keep and which areas to treat as background. It also gives users a way to correct mistakes, which helps them get the image quality they’re looking for.

It also gets me thinking about all the public AI repositories out there that could become part of a commercial product. Plenty of challenges would come with that, including training data, user expectations, and the high computing costs that AI startups have to deal with.

The solution addresses a clear user problem: getting good-quality results without spending too much time processing images. Having both a direct application and an API gives people different ways to get their work done.

Indra Nugraha

A product leader connecting engineering, customer needs, and business priorities across AI and enterprise software.

More about me

Continue reading

Why Product Managers Should Have a Blog

With 2021 just getting started, plenty of people are making New Year’s resolutions. I’m also hoping to achieve a few specific things this year. But rather th...