Use the AI tool Lama Cleaner to remove watermarks, characters, backgrounds and other content in pictures with one click

foreword

prerequisite

related introduction

  • Python is a cross-platform computer programming language. It is a high-level scripting language that combines interpretability, compilation, interactivity and object-oriented. Originally designed for writing automation scripts (shell), as the version is continuously updated and new language features are added, it is more and more used for the development of independent and large-scale projects.
  • PyTorch is a deep learning framework, which encapsulates many network and deep learning related tools for us to call, instead of writing them one by one. It is divided into CPU and GPU versions, and other frameworks include TensorFlow, Caffe, etc. PyTorch is launched by Facebook Artificial Intelligence Research Institute (FAIR) based on Torch. It is a Python-based sustainable computing package that provides two advanced features: 1. Tensor computing with powerful GPU acceleration (such as NumPy); 2. , Automatic differentiation mechanism when constructing deep neural network.
  • Lama Cleaner is a completely free and open source image removal and repair tool with no resolution limit: Lama Cleaner has a variety of built-in AI model construction, and the functions are quite complete. It can be used to quickly remove various watermarks, items, characters, fonts, and other content in images.

Lama Cleaner

Environmental requirements

  • torch>=1.9.0
  • opencv-python
  • flask==2.2.3
  • flask-socketio
  • simple-websocket
  • flask_cors
  • flaskwebgui==0.3.5
  • pydantic
  • rich
  • window
  • yacs
  • diffusers==0.16.1
  • transformers==4.27.4
  • built
  • piexif==1.1.3
  • safetensors
  • omegaconf
  • controlnet-aux==0.0.3

Install Lama Cleaner

  • Before installing pip, you need to install the Python environment
pip install lama-cleaner
或者
pip install lama-cleaner -i https://pypi.tuna.tsinghua.edu.cn/simple # 使用国内镜像源,下载速度更快。

insert image description here
insert image description here

Start Lama Cleaner

Start in CPU mode

lama-cleaner --model=lama --device=cpu --port=8080 

GPU mode start

## 本机浏览
lama-cleaner --model=lama --device=cuda --port=8080 --model-dir E:\mytest\lama_cleaner\weight
## 局域网内浏览
lama-cleaner --model=lama --device=cuda --port=8080 --model-dir E:\mytest\lama_cleaner\weight --host 0.0.0.0 

insert image description here

insert image description here

Use Lama Cleaner

  • Open the URL in your browser:http://IP地址:8080
    insert image description here
    insert image description here

Test Results

NO.1 Detection frame

  1. Open to the original picture
    insert image description here
  2. Press and hold the mouse to remove the content in the picture (yellow track)
    insert image description here
  3. renderings
    insert image description here

NO.2 water mark

  1. Open to the original picture
    insert image description here
  2. Press and hold the mouse to remove the content in the picture (yellow track)
    insert image description here
  3. renderings
    insert image description here

NO.3 Canton Tower

  1. Open to the original picture
    insert image description here

  2. Press and hold the mouse to remove the content in the picture (yellow track)
    insert image description here

  3. renderings
    insert image description here

NO.4 character background

  1. Open to the original picture
    insert image description here

  2. Press and hold the mouse to remove the content in the picture (yellow track)
    insert image description here

  3. renderings
    insert image description here

reference

[1] https://github.com/Sanster/lama-cleaner.git

Guess you like

Origin blog.csdn.net/FriendshipTang/article/details/132193945