Background Removal

Case Study: Approaches Tried in RemoveBG

Overview

The goal was to improve background removal quality, especially in cases where fine details like hair strands, small gaps between subjects, and green spill around edges were causing poor results.

We explored multiple approaches to get cleaner masks and better color correction, but each approach came with its own limitations. Below is a summary of what we tried, what happened, and why those approaches did not fully work.

Approaches Tried

  1. Training the InSPyReNet Model for Better Masks

We first tried training the InSPyReNet model with the expectation that it would generate more accurate masks.

  • What happened: The masks were still not detailed enough, especially around hair and the small gaps between subjects.
  • Why it failed: The model was not able to capture fine boundary details accurately, which made it unsuitable for cases where edge precision was important.
  • How it was addressed: We moved away from relying on InSPyReNet and evaluated stronger background removal models for better base mask quality.
  1. Edge-Based Approach to Detect the Subject Boundary and Remove Green Around It

We researched an approach where we detect the subject edges and specifically remove green pixels around those areas.

  • What happened: While this removed some green spill, it also started changing green clothing into blue around the edges.
  • Why it failed: The method was too aggressive near subject boundaries and could not reliably distinguish between actual green spill and genuine green-colored objects like clothes.
  • How it was addressed: We stopped using edge-based correction as a standalone method and limited it to controlled refinement inside post-processing.
  1. Looking into Segmentation Models for Better Hair Handling

Since hair was one of the main problem areas, we started exploring segmentation models that could isolate hair more accurately. As part of this, we also tried Rembg models to generate masks.

  • What happened: The masks produced by Rembg were still not accurate enough for detailed hair segmentation.
  • Why it failed: The output lacked the quality needed for precise processing around hair, so it did not solve the main issue.
  • How it was addressed: We continued evaluating better mask-generation approaches and later shifted to BiRefNet for stronger foreground extraction.
  1. Research on MediaPipe, Combined with Gaussian Blur

We then explored MediaPipe to check whether it could provide better segmentation. Since MediaPipe alone was not giving strong results, we also researched adding Gaussian blur into the pipeline.

  • Why it failed: MediaPipe by itself was not producing sufficiently accurate segmentation, and Gaussian blur only softened transitions rather than solving the actual masking and despill problem.
  • How it was addressed: MediaPipe was retained as a supporting component in the pipeline, while Gaussian blur was used only for smoothing and not as the core fix.
  1. Removing Blue Tones Introduced After Green Removal

During the pipeline improvements, we noticed that after green removal, blue tones were appearing in hair and clothing. To address this, we added logic to remove unwanted blue tones from these areas.

  • What happened: This helped in some cases, but it also started affecting the original color of hair and clothing.
  • Why it failed: The correction step was removing not only the unwanted blue spill but also valid color information, which caused visible color distortion.
  • How it was addressed: We added a more controlled blue-spill removal step after green despill as part of post-processing.
  1. Misclassification of Green Caps as Hair in MediaPipe

Another issue we faced was that green caps were being classified as hair by MediaPipe.

  • What happened: Because of this misclassification, the caps also went through the same color correction process as hair and started turning blue.
  • Why it failed: The segmentation was not fine-grained enough to clearly separate hair from accessories like caps, which caused incorrect color processing.
  • How it was addressed: We reduced dependency on MediaPipe for primary segmentation and used it only as an additional support layer in the pipeline.
  1. Research on SCHP (Self-Correction for Human Parsing)

To solve the cap-vs-hair problem, we explored SCHP, a human parsing model that provides separate masks for different regions such as hair, caps, and hats.

  • What happened: SCHP did help by giving separate masks for caps and hats.
  • Why it failed: Even with better region separation, the despill step was still not accurate enough. The color correction across hair and cap regions was still incorrect, so the final output was not reliable.
  • How it was addressed: We used the learnings from SCHP for understanding region-level separation, but did not adopt it as the final solution.
  1. BiRefNet for Background Removal

We explored BiRefNet to improve foreground-background separation and overall mask quality.

  • What happened: BiRefNet gave better background removal results compared to the previously tested approaches.
  • Why earlier methods failed in comparison: Earlier models did not provide a strong enough base mask for reliable post-processing and edge refinement.
  • How it was addressed: BiRefNet was adopted as the primary background removal model in the current pipeline.

Current Approach Being Used

At present, we are using a combination of :

1

  • BiRefNet for background removal
2

  • MediaPipe segmentation support
3

  • Custom post processingCustom post processing
4

  • Gaussian Blur
5

  • Blue spill removal after green despill

Why we chose this approach

This combination gave the most practical and improved results among all the approaches tested. BiRefNet provides a better base mask, while MediaPipe and custom post-processing help refine the output further. Gaussian blur smooths harsh transitions, and blue-spill removal helps correct color shifts introduced after green despill.

What this approach helps with

  • Provides better foreground-background separation

  • Improves edge refinement around the subject

  • Smooths transitions for a cleaner visual result

  • Reduces unwanted blue tones after green despill

  • Performs better overall than any single-model or single-step approach

Main Learnings

  • Fine hair details and small gaps between subjects are still one of the hardest parts of background removal.

  • Mask quality has a direct impact on the success of despill and edge correction.

  • Edge-based green removal can easily damage original subject colors, especially for green clothing.

  • MediaPipe helped in some areas, but its segmentation was not reliable enough for accessories like caps.

  • Better region separation alone is not enough unless color correction is also accurate.

  • A combined pipeline works better than relying on a single model or correction step.

Conclusion

We tried multiple approaches across masking, segmentation, edge detection, human parsing, and color correction to improve RemoveBG results. While each approach solved part of the problem, none of them alone provided a complete and reliable solution.

The main reasons earlier approaches failed were:

  • Inaccurate masks around hair and fine edges

  • Incorrect distinction between green spill and real subject colors

  • Segmentation errors between hair and accessories

  • Color despill affecting the actual appearance of hair, clothing, and caps

Currently, the most practical solution is a combined pipeline using BiRefNet + MediaPipe + custom post-processing + Gaussian blur + blue spill removal after green despill, and this is the approach we are currently using.

Ready to take the next step?

Latest Case Studies

LOCAL SEO July 9, 2026

Local SEO and Google Business Profile Optimization for a Multi-Location NYC Swim School

Continue Reading
DIGITAL MARKETING July 25, 2026

SEO, Content, and AI Visibility for a 35-Year Commercial Holiday Décor Industry Leader

Continue Reading