BlogEngineering

Free segmentation vs generative AI for product previews: what we learned building one

We set out to let a shopper upload a photo and see a product on it — a garment on themselves, wall film on their wall, a vinyl wrap on their car. We tested eight configurations across four families of approach before settling on one engine for all three.

Published
Reading time
5 minutes

Geometry in the browser

Upload a photoDrag four cornersFails on pale rooms

Segmentation in the browser

Download 30 MBUpload a photoFix the outline

Segmentation on a server

Upload a photoWait 8–95 secondsFix the outline

Softbox model

Upload a photoUnder half a minuteNothing to fix
What each approach asked of the shopper before they saw anything.

This is the whole account, including the simpler approaches we abandoned anyway.

Family one: do it with geometry, for free

The first version uses no machine learning. The shopper drags four corners to mark a flat surface. The product image is warped into that quadrilateral. The brightness of the original surface is sampled and multiplied back over the top, so the new material inherits the room’s existing shadows and highlights.

It is free per preview and instant. On a well-lit wall with some tonal variation, it is genuinely convincing.

Geometry in the browserThe pattern runs over the radiator

Softbox modelThe radiator stays in front of the wall

Geometry has no idea the radiator is not the wall.

It failed in two specific places.

Pale rooms. The light-borrowing depends on variation in the original surface. A bright white wall has almost none, so the result came out flat and pasted-on.

Objects the same colour as the wall. A white radiator on a white wall, a cream sofa against cream. The maths cannot tell them apart from the wall, so the pattern ran straight across them.

It also asks the shopper to do work. Four corners is four chances to leave.

Family two: Segment Anything

If the problem is that the software does not know where the surface ends, use a model that does. We ran Meta’s Segment Anything (SAM), first in the browser, then on a server.

SAM is good at the thing it is for. It traced arched doorways. It traced chair legs in front of a wall and held the pattern behind them. The outlines were not the problem.

In the browser, it meant roughly a 30 MB download before the shopper saw anything at all.

On a server, the download went away and became a wait: about 8 to 95 seconds per photo depending on the image.

Either way, it was wrong often enough that the interface needed a way for shoppers to tap and correct the mask.

The customer's photo

The customer's photo

Segment Anything and recolour: Film over the ornament

Segment Anything and recolour

Film over the ornament

Softbox model: Ornament left in front

Softbox model

Ornament left in front

A kitchen with a metal film on the cabinets. The mask took the ornament in front of them; the generated version kept it.

At that point the customer has stopped shopping and started doing quality control on your software.

Family three: segmentation plus recolour, for cars

For vehicle wraps, segmentation had an elegant trick available. Isolate the car, then change hue and gloss response inside the mask while leaving the original photograph’s light and shadow intact. Nothing is invented, so nothing can be hallucinated.

For gloss, satin and matte wraps this produced believable results cheaply.

The customer's photo

The customer's photo

Segmentation and recolour: Flat colour

Segmentation and recolour

Flat colour

Softbox model: Chrome that reflects the street

Softbox model

Chrome that reflects the street

Rose-gold chrome on the same car. A recolour cannot reflect anything; a generated wrap can.

It could not do chrome or colour shift. A chrome wrap is a mirror — its colour is the car park reflected in it. A colour-shift wrap is a different hue on the same panel depending on angle. Recolouring inside a mask produced flat paint and a single flat hue respectively. Those are the premium lines in most wrap catalogues, so the method worked on the cheap stock and failed on the profitable stock. The full account is in the car wrap visualizer post.

Family four: generative image models

We tested three: the model Softbox now runs, a larger general image model, and a dedicated virtual try-on model.

The dedicated try-on model, built specifically for clothing, lost on clothing. Asked to add a jacket to a shopper wearing a sweater, it replaced the sweater, and in one run changed the shopper’s trousers. Full comparison in AI try-on vs dedicated try-on models.

The Softbox model looked real on every product type we threw at it, including chrome and colour-shift wraps. It changed only the product and left the face, the rest of the outfit, the furniture and the car alone.

His photo

His photo

Dedicated try-on model: Trousers replaced

Dedicated try-on model

Trousers replaced

Softbox model: Only the shirt changed

Softbox model

Only the shirt changed

The test that decided it: what else changed.

The larger general model produced comparable quality, with small inventions of its own: a number plate one car did not have, a jacket worn open that the product shows buttoned. It was also the heavier of the two to run, which settled it.

Everything, in one table

Browser geometrySAM in browserSAM on serverSAM + recolourGenerative
Before the shopper sees anythingInstant~30 MB download8–95 seconds8–95 secondsUsually under half a minute
Shopper input requiredFour cornersTaps to fixTaps to fixTaps to fixUpload only
Pale, flat roomsFailsHandledHandledn/aHandled
Object matching wall colourFailsHandledHandledn/aHandled
Chrome / colour-shift wrapsNoNoNoFailsHandled
Layered clothingNoNoNoNoHandled
One engine for all product typesNoNoNoNoYes

What we actually learned

Free is not cheap if the customer pays in effort. The geometry version costs nothing per preview and asks the shopper for four corners and a tolerance for mistakes. That is a real price, charged to the person you are trying to sell to.

Good segmentation does not equal a good preview. SAM found the edges. Finding the edges was never the hard part — delivering a result fast enough, without a download, without corrections, was.

The decisive test was obedience, not realism. The question that separated the generative models was not “how photoreal is it” but “what else did it change”. A preview that quietly alters your customer’s trousers or wheels is making a false claim they can see.

Specialised does not beat general here. The clothing-specific model was the one that mishandled clothing.

What it takes to run shapes the product. A heavier model would have meant gating previews behind a login. We chose the lighter one and kept previews open to every visitor, with store-side spending controls instead of a paywall.

What we did not measure

No phone-speed benchmarks, no conversion lift, no return-rate change from our own data. We ran an engineering comparison on identical inputs, and that is all the above claims to be.

Questions people ask

Is Segment Anything a bad choice for ecommerce?

No. It is a strong model that did not fit this job. For offline work — batch background removal, cataloguing, anything without a customer waiting — the constraints that ruled it out here do not apply.

Could you combine the approaches?

We tried. Geometry for easy photos, generative for hard ones needs something to classify “hard”, and getting that wrong is worse than always using the slower path.

Why one engine for three product types?

Fewer moving parts, one integration, and the hardest cases in each category turned out to need the same capability.

Are the demo pages running the real thing?

The non-AI demos are the actual browser geometry and recolour implementations. The comparison pages show output from the models described.

Do you run anything in the shopper’s browser now?

No heavyweight model. The download requirement was one of the things that ruled that path out.