Steps:
- Take original image;
- Detect words rectangles in image (with CRAFT-pytorch image);
- Create words mask;
- Delete text with Automated objects removal inpainter
- Create more accurasy mask. For example create mask from words symbols, not from word rectangles (Create and train autoencoder by symbols);
- Play with function create_craft_args - change args.text_threshold, args.low_text, args.link_threshold - it's can give better result;
- Autotune edge-connect models;
- Try another pretrained edge-connect models (psv/celeba/places2);
- Try change
args.model
value inload_object_remover_config
; - ...
- Open console;
- Run command
git clone https://github.com/pnzr00t/remove-text-from-image
(current repository URL); - Run command
cd ./remove-text-from-image/
(cloned folder); - Run command
bash ./install_project.sh
(Downloading libs, and models); - Run command
pip install -r ./requirements.txt
; - Run main.py script, you can chage original image URL in
function test_remover_func():
. Output image will save in local folder./results_images
.
- Open console;
- Run command
git clone https://github.com/pnzr00t/remove-text-from-image
(current repository URL); - Run command
cd ./remove-text-from-image/
(cloned folder); - Run command
bash ./install_project.sh
(Downloading libs, and models); - Run command
pip install -r ./requirements.txt
; - Run command
pip install -r ./requirements-fast-api.txt
(modules for FastAPI service); - Run command for start up FastAPI service
uvicorn app:app
; - Remove text from image by HTTP request
http://127.0.0.1:8000/image_remover/?url=https://img-9gag-fun.9cache.com/photo/axMNd31_460s.jpg
(IP and port will print in console when you start up service step 7. url= -- URL to original image).
- Open console;
- Run command
git clone https://github.com/pnzr00t/remove-text-from-image
(current repository URL); - Run command
cd ./remove-text-from-image/
(cloned folder); - Run command
bash ./install_project.sh
(Downloading libs, and models); - Run command
pip install -r ./requirements.txt
; - Run command
pip install -r ./requirements-fast-api.txt
(modules for FastAPI service); - Run command for start up FastAPI service
gunicorn -w 1 -k uvicorn.workers.UvicornWorker app:app --timeout 600 --max-requests 5
; - Remove text from image by HTTP request
http://127.0.0.1:8000/image_remover/?url=https://img-9gag-fun.9cache.com/photo/axMNd31_460s.jpg
(IP and port will print in console when you start up service step 7. url= -- URL to original image).
Note: FastAPI with unicorn "eat" a lot of memory and have memory leak, thats why you can use gunicorn service, witch will restart and clean memory every --max-requests COUNT_REQUEST
- Go https://colab.research.google.com/ ;
- File->Open notebook->Git Hub;
- Copy and paste URL for current repository;
- Chose colab file;
- Run all cells;
- Copy and paste original image URL in special cell with "input_image_url" parameter.
Celeba/Places/PSV(Paris Street View)
This script use a lot of memory, so i recommended restart you service or use gunicorn version (Install gunicorn service and run)
Use gunicorn version and set properly --max-requests COUNT
COUNT parameter (according of you RAM capacity)
Yes, but you need torch lib with GPU, script automatically detecting you GPU device and run on them. (Additional info: At this time it must be NVIDIA GPU with cuda drivers and >= 4GB RAM)
Create as part of dlschool.org project.
Deep Learning School -- organization supported by PSAMI MIPT and Lab of Innovation (MIPT).
- CRAFT text detecting;
- Automated objects removal inpainter;
- Generative Image Inpainting with Adversarial Edge Learning as part of Automated objects removal inpainter
Licensed under a Creative Commons Attribution-NonCommercial 4.0 International.
Except where otherwise noted, this content is published under a CC BY-NC license, which means that you can copy, remix, transform and build upon the content as long as you do not use the material for commercial purposes and give appropriate credit and provide a link to the license.