Inpaints masked regions of an image using LaMa with Fourier convolutions. Takes an input image plus a mask image and returns the completed image, generalizing to resolutions up to ~2k.
# LaMa Resolution-robust Large Mask Inpainting with Fourier Convolutions ## Overview LaMa (Large Mask Inpainting) is a state-of-the-art image completion model designed to handle complex, large-scale structural inpainting tasks. Unlike traditional diffusion-based models that may struggle with global image coherence, LaMa utilizes fast Fourier convolutions to capture long-range dependencies across the entire image. This allows the model to "understand" the global structure of a scene, enabling it to fill in missing or masked regions with high-fidelity textures and logical geometric patterns that seamlessly blend with the surrounding pixels. This model is particularly effective for high-resolution imagery, generalizing well to resolutions up to 2k. By leveraging Fourier-based architectures, LaMa achieves a superior balance between computational efficiency and visual quality. It is the ideal tool for creative professionals who need to remove unwanted objects, fix artifacts, or reconstruct missing parts of an image without sacrificing the integrity of the original composition. ## Use Cases * **Object Removal:** Effortlessly erase unwanted photobombers, stray objects, or distracting elements from high-quality product photography. * **Text and Logo Cleanup:** Remove watermarks, text overlays, or branding from stock imagery to repurpose assets for different regional campaigns. * **Asset Restoration:** Repair damaged or corrupted image files by masking out artifacts and allowing the AI to reconstruct the missing visual data. * **Creative Composition:** Expand or modify existing ad visuals by masking out specific areas and generating new, contextually relevant background elements. * **E-commerce Optimization:** Clean up product shots by removing background clutter, ensuring the focus remains entirely on the item being sold. ## Parameters To utilize this model, you must provide both the source image and a corresponding mask image. The mask acts as a binary guide, highlighting the exact pixels that require inpainting. Refer to the Input Parameters section for specific file format requirements and default behaviors. ## Tips for Best Results * **Precision Masking:** Use a precise brush tool to create your mask. While LaMa is robust, cleaner edges on your mask will result in a more seamless transition between the original image and the inpainted area. * **Resolution Matters:** While the model supports up to 2k resolution, ensure your input image is high-quality. Upscaling a low-resolution image before inpainting can lead to blurry results. * **Contextual Consistency:** If you are removing a large object, ensure the surrounding area in the mask provides enough context for the model to infer the background structure. * **Iterative Refinement:** For complex scenes, you may achieve better results by performing multiple smaller inpainting passes rather than one massive mask. * **Post-Processing:** If the inpainted area appears slightly too smooth compared to the original, consider adding a subtle film grain or noise layer in post-production to match the texture of the source image. ## About LaMa is a powerful open-source inpainting solution based on the research paper "Resolution-robust Large Mask Inpainting with Fourier Convolutions" (arXiv:2109.07161). Developed by the team at Advimman, this model represents a significant leap in computer vision, specifically in the domain of image restoration and generative completion. By utilizing Fourier convolutions, it provides a unique approach to structural coherence that remains a staple in modern AI creative workflows.
Model input reference derived from preset schema.
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| mask | image | Yes | null | Mask image |
| image | image | Yes | null | Input image |