Using the easy (tears) eraser function model Lama with pip package
Eraser function is so easy that it makes you cry
Eraser function is common in image processing apps.
The feature that allows you to erase unnecessary parts of an image can be used with just a few lines of code. 3150.
Colab demo using the eraser function
How to use
install
pip install simple-lama-inpainting
execution
Prepare the image and a mask image (grayscale) in which the parts you want to erase are painted white and execute.
In the example of the image above, we will erase the necklace, so
1. Image ↓
2. Mask image ↓
It becomes.
from simple_lama_inpainting import SimpleLama
from PIL import Image
simple_lama = SimpleLama()img_path = "image.jpg"
mask_path = "mask.png"image = Image.open(img_path)
mask = Image.open(mask_path).convert('L')result = simple_lama(image, mask)
result.save("inpainted.png")
Isn’t it so easy?
🐣
🐣
I’m a freelance engineer.
Work consultation
Please feel free to contact us with a brief development description.
rockyshikoku@gmail.com
I am creating applications using machine learning and AR technology.
I send machine learning / AR related information.