To start Lama Cleaner without any plugins, issue the command:
$ lama-cleaner --model=lama --device=cpu --port=8080
Point your web browser at
http://127.0.0.1:8080. You’ll see something like this (we’re using the light theme).
Either click into the box to upload an image, or drag and drop an image. Select the area to inpaint, and see the results. By default, Lama Cleaner runs inpainting after drawing a stroke, but it’s also possible to use a manual mode from Settings (that’s the cog icon in the top right hand corner). Settings also lets you download masks, choose the model, and define the crop masking area.
With the default lama model, we’ll drag an image into the web browser.
Brush the area of the image you wish to remove. Here, we have brushed out the young woman on the scooter.
There’s no functionality within the web interface to activate the plugins. Instead, they must be explicitly activated from the command-line. For example, to run Lama Cleaner with the Rembg, RealESRGAN, and GFPGAN plugins, issue the command:
$ lama-cleaner --model=lama --device=cpu --port=8080 --enable-remove-bg --enable-realesrgan --realesrgan-model RealESRGAN_x4plus --realesrgan-device cuda --enable-gfpgan --gfpgan-device cuda
There are keyboard shortcuts and a choice of theme (dark or light).
It’s also possible to run Lama Cleaner as a desktop application by appending the flag (
$ lama-cleaner --model=lama --device=cpu --port=8080 --enable-remove-bg --enable-realesrgan --realesrgan-model RealESRGAN_x4plus --realesrgan-device cuda --enable-gfpgan --gfpgan-device cuda --gui
Lama Cleaner gets our seal of approval. It’s really simple to install and use. You’ll be up and running in just a few minutes.
The interface is implemented well. We can set the brush size, there’s undo and redo functionality, together with the option to download the image results.
The results are impressive with the lama model. The image to the right shows all the models that are available (accessed from Settings). There are lots of nice touches such as its file manager, and painting by example using exemplar-based image editing.
There are three different ways to run the inpainting model on an image. By default, the crop strategy is used which crops the masking area from the original image. This offers good speed and uses little VRAM. For higher quality you can use the resize or original strategy at the expense of using more VRAM and slower results.
The plugins make it easy to upscale images (2x and 4x are available), apply face correction, and remove backgrounds although it’s a shame there’s no control over the strength applied when using GFPGAN face correction.
For other useful open source apps that use machine learning/deep learning, we’ve compiled this roundup.