LaMa
LaMa fills masked regions of an image.
- Tarefas
- restoration
- Instalação
pip install "libreyolo[onnx]"- Nível de suporte
- Somente inferência, desde a v1.6.0. Somente predição, validação e exportação. Os recursos de treinamento não se aplicam.
- Origem
- LaMa por Samsung Research, Apache-2.0. Artigo, código-fonte
- Licenças
- Código MIT, pesos Apache-2.0. Uso comercial
Install
pip install "libreyolo[onnx]"Predict
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
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
| Arquivo | Licença dos pesos |
|---|---|
| Restoration | |
| LibreLaMab-restore.pt | apache-2.0 |
Todos os arquivos acima existem hoje na organização LibreYOLO e são baixados no primeiro uso.
Licensing
Confira a licença no repositório do Hugging Face correspondente aos pesos que você baixar. Cada checkpoint na organização LibreYOLO tem uma licença, e ela nem sempre é a mesma em toda a família. Esse repositório é a fonte oficial. O resumo abaixo descreve o que se aplicava na última verificação desta página.
Esta é uma descrição das licenças envolvidas, não uma orientação jurídica. Se a resposta tiver importância comercial, leia as licenças e procure sua própria assessoria.
- Trabalho original
- LaMa, Samsung Research
- Licença original
- Apache-2.0
- Código-fonte original
- github.com/advimman/lama
- Código do LibreYOLO
- MIT
- Pesos
- Apache-2.0, republicado em huggingface.co/LibreYOLO
- Interpretação
- 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}
}Copiado do bloco de citação dos autores em raw.githubusercontent.com/advimman/lama/main/README.md.