This is a 2026-11-13 measurement of where the hair-edge error in one background-removal pipeline actually comes from. The pipeline is the common one: shrink the photo to the model's input size, predict a mask, stretch the mask back to the original resolution. When hair comes out mushy, the tempting fix is to blame the last step and reach for a better upsampler. Coming from codec work, the more natural move is to split the distortion into its sources before touching any filter. Split that way, the error had two terms on a 0–255 alpha scale: about 54 from the model disagreeing with a stronger model, and about 1 from the resize round trip.
The model under test is the INT8 ISNet that the fast tier of ImgIng https://imging.ai/ loads in a desktop browser on an Apple silicon Mac. Its publicly loaded config gives a 1024×1024 input. The professional tier also takes 1024, and the highest tier, BiRefNet HR-Matting, takes 2048×2048. The same ISNet file was run locally with ONNX Runtime, and the highest tier's mask of a 2048×2048 portrait served as the reference. That reference is a model's output, not ground truth. The portrait was scaled to 768, 1024, 1440 and 1920 px per side to stand in for four "originals", and only the hair band was scored: pixels where the reference alpha sits between 0.02 and 0.98, grown by about 2 px. The number is the mean absolute alpha error inside that band.
Separating the two error terms
It takes one control path, which I'll call the ideal model. Take the reference mask, shrink it to 1024, then upsample it back to the original size. That path has no model disagreement in it at all, only resolution loss plus whatever upsampler you pick. Anything the real model scores above that line is the model's share.
The resolution round trip cost about one level
At 1440 px, a 1.41× upscale, the ideal model's band error was 1.51 with bilinear and 0.73 with bicubic. At 1920 px, 1.88×, it was 1.43 and 0.79. At 1024 it is zero by construction, and at 768, where the mask gets shrunk instead, 0.89. The share of band pixels off by more than 25 levels never went above 0.02%. On this image the round trip barely registers below 2×, and bicubic takes another 0.6 to 0.8 off bilinear at those two sizes.
The model term stayed near 54 at every size
The fast model against the reference scored 51.57 at 768, 55.32 at 1024, 53.85 at 1440 and 54.22 at 1920, with 51.5% to 53.6% of band pixels off by more than 25. A bigger original means a bigger stretch, so one might expect that number to climb with image size. It stayed within a four-level range. The direction of the error matters too. On thin, sparse strands (reference alpha between 0.05 and 0.6) the fast model's alpha summed to about 1.45 times the reference. It wasn't losing hair there. It was calling the strand zone more solid and keeping part of the background between strands.
A guided filter made the small term bigger
The obvious hypothesis was that a guided filter, with the original RGB as the guide, radius 2 × side / 1024 and eps 1e-4, would beat bilinear. On the fast model's mask it was slightly worse at every size: 53.38, 55.96, 54.75 and 55.01. On the ideal model it was clearly worse, 11.42 to 14.96 against roughly 1, because it softened edges the reference had kept sharp. A sweep then covered r over 1, 2, 4 and eps over 1e-6, 1e-4, 1e-2 at 1920. The best ideal-model setting, r=1 and eps=1e-2, still landed at 2.67, worse than bicubic's 0.79. With the fast model every setting fell between 54.07 and 55.01, while bilinear sat at 54.22. A filter applied over the whole mask only moves the small term, and in the wrong direction. Whether a filter restricted to the hair region, or a trimap-based refinement pass, would close part of the 54, is unknown. Neither was run here.
Where I would spend the effort next
Read as a budget, the order is simple. Model choice comes first, because the 54 lives there. A local refinement stage that only touches the hair band comes second; that is my inference from the numbers above, not something measured here. The upsampler comes last. Bicubic took 0.6 to 0.8 off bilinear here, so take it and move on. It is also worth keeping the ideal-model line in every evaluation report, so that the next proposal for a new upsampler arrives with its ceiling already printed: about 1.5 levels at up to 1.88× on this image.
The limits are real, though. Even the 2048 reference didn't separate single flyaway strands; every mask in this test treated them as one clump, so the band score measures the outer contour of the hair mass, not individual strands. The 54 is disagreement with a stronger model, not distance from truth, and a hand-pulled matte might move both terms. It is one portrait, one machine, one run each, nothing above 1920 px, and the professional tier never went into the table. Nobody can say yet how much of the 54 a better reference would take away.
Sample photo: "Windblown" by Kaci Baum, CC0, via Wikimedia Commons.
Top comments (0)