LaMa

LaMa fills masked regions of an image.

Tasks
restoration
Install
pip install "libreyolo[onnx]"
Support tier
Inference only, since v1.6.0. Predict, validate and export only. Training features do not apply.
Upstream
LaMa by Samsung Research, Apache-2.0. Paper, source
Licenses
Code MIT, weights Apache-2.0. Commercial use

Install

bash
pip install "libreyolo[onnx]"

Predict

Python
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreLaMab-restore.pt", device="cpu")import numpy as npfrom PIL import Image image = Image.open(SAMPLE_IMAGE).convert("RGB")mask = np.zeros((image.height, image.width), dtype=np.uint8)mask[image.height//3:2*image.height//3, image.width//3:2*image.width//3] = 255result = model(image, mask=mask)result.restored.save("inpainted.png")

Pass mask= for single-image inference: nonzero pixels mark the region to fill. The checkpoint embeds an ONNX graph and requires ONNX Runtime 1.18 or later. Training and export are not supported.

Validate

Python
from libreyolo import LibreYOLO model = LibreYOLO("LibreLaMab-restore.pt", device="cpu")# Restore dataset YAML with paired inputs/targets folders plus a mask_dir keymetrics = model.val(data="path/to/your/restore.yaml", workers=0)print(metrics)

Use the dataset format for this task. Validation explains the dataset requirements and returned metrics.

Checkpoints

FileWeights license
Restoration
LibreLaMab-restore.ptapache-2.0

Every file above exists in the LibreYOLO org today and downloads on first use.

Licensing

Check the license on the Hugging Face repository of the specific weights you download. Every checkpoint in the LibreYOLO org carries one, and they are not always the same across a family. That repository is the authoritative source; the summary below describes what applied when this page was last verified.

This is a description of the licenses involved, not legal advice. If the answer matters commercially, read the licenses yourself and take your own counsel.

Original work
LaMa, Samsung Research
Upstream license
Apache-2.0
LibreYOLO code
MIT
Weights
Apache-2.0, republished at huggingface.co/LibreYOLO
Interpretation
The mirrored ONNX artifact carries the OpenCV publisher's Apache-2.0 declaration.

Citation

@article{suvorov2021resolution,
  title={Resolution-robust Large Mask Inpainting with Fourier Convolutions},
  author={Suvorov, Roman and Logacheva, Elizaveta and Mashikhin, Anton and Remizova, Anastasia and Ashukha, Arsenii and Silvestrov, Aleksei and Kong, Naejin and Goka, Harshith and Park, Kiwoong and Lempitsky, Victor},
  journal={arXiv preprint arXiv:2109.07161},
  year={2021}
}

Copied from the authors' citation block at raw.githubusercontent.com/advimman/lama/main/README.md.

Verified against LibreYOLO v1.6.0. Support tables, checkpoints and benchmark numbers on this page are generated from the released library and the published weights, not written by hand.

LaMa architecture

Select a variant or family overview, then select a block for details. Open the full diagram to zoom or download SVG and PNG.