LaMa for ONNX Runtime
Big LaMa, the large-mask inpainting model, as an ONNX graph, as used by the Erase tool of
Gumka on Linux. It fills a masked area with what fits
the picture around it. Its Fourier convolutions see the whole crop at once, so it handles large
areas and repeating structure (brickwork, fences, foliage).
| File |
Input |
Output |
lama_fp32.onnx (208 MB) |
image float32 [1, 3, 512, 512], RGB from 0 to 1; mask float32 [1, 1, 512, 512], 1 fills |
output float32 [1, 3, 512, 512], RGB from 0 to 255 |
- The size is fixed (only the batch axis is open). Gumka crops the picture around the mask,
with context on every side, scales the crop to 512 × 512, and blends the fill back into the
full-resolution picture.
- The output is already joined to the input outside the mask, and what is under the mask on
input is ignored.
- Opset 17. Gumka runs it on ONNX Runtime's CPU provider: about 1.6 s per erase on a Ryzen 7
8845HS.
- The Core ML version, for macOS, is
gumka/lama-coreml.
Source and license
- Model: LaMa, "Resolution-robust Large Mask Inpainting with Fourier Convolutions", Roman
Suvorov et al., 2021, https://arxiv.org/abs/2109.07161,
https://github.com/advimman/lama (Apache-2.0).
- ONNX export: Carve, published at Carve/LaMa-ONNX
(Apache-2.0). It replaces the Fourier unit with one that exports
(Carve-Photos/lama); Carve reports the same results
as the original.
- This repository holds
lama_fp32.onnx of Carve/LaMa-ONNX at revision c3c0c9e46893,
unchanged; Gumka's models.toml
pins its size and SHA-256. License: Apache-2.0, see LICENSE.