This content originally appeared on DEV Community and was authored by Yash Jivani
Have you wondered how you can remove watermarks from images using Python? It's very simple! You should know Python and have a basic knowledge of computer vision models like CNN & TensorFlow DL framework to follow architectures if you are interested!! Please make sure that you read the copyright laws of the images you want to remove watermarks before you run the code.
Steps to follow -
Create a new Google Colab notebook. Change the runtime to T4 GPU to enhance computing power to run the inference pipeline.
Install Conda packages, create and activate the Conda environment
Since Google Colab uses the latest Tensorflow & Python versions and this project usestensorflow=1.15.0
which is supported by Python 3.6, install miniconda inside the Colab environment
# set pythonpath
%env PYTHONPATH = # /env/python
# Set up miniconda and set the path '/usr/local'
!wget https://repo.anaconda.com/miniconda/Miniconda3-py38_4.12.0-Linux-x86_64.sh
!chmod +x Miniconda3-py38_4.12.0-Linux-x86_64.sh
!./Miniconda3-py38_4.12.0-Linux-x86_64.sh -b -f -p /usr/local
import sys
sys.path.append('/usr/local/lib/python3.8/site-packages')
# create a new conda environment using Python 3.3
!conda create -n myenv python=3.6
3.Install Packages inside Env.
%%shell
eval "$(conda shell.bash hook)"
conda activate myenv
conda install -y tensorflow==1.15 pillow opencv matplotlib pyyaml
conda install -y tensorflow-gpu
pip install --upgrade pip
pip install git+https://github.com/JiahuiYu/neuralgym
4.Clone Repo
!git clone https://github.com/zuruoke/watermark-removal
5.Download Model Files from drive and paste them into the /watermark-removal/model
directory.
6.Execute Python code to remove the watermark from your istock image. If you have Alamy, Shutterstock, or your custom watermarked images, please add mask.png
inside utils/<watermark-type>/<image-type>
.
%%shell
eval "$(conda shell.bash hook)"
conda activate myenv
cd watermark-removal
python main.py --image path-to-input-image --output path-to-output-image --checkpoint_dir model/ --watermark_type istock
Reference
Please give a star to Github Repository which is forked from zuruoke/watermark-removal
To configure TensorFlow=1.15, setup conda env inside colab
This content originally appeared on DEV Community and was authored by Yash Jivani
Yash Jivani | Sciencx (2024-08-16T14:31:01+00:00) From Stamped to Clean: Transforming Watermarked Images into Clear Visuals. Retrieved from https://www.scien.cx/2024/08/16/from-stamped-to-clean-transforming-watermarked-images-into-clear-visuals/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.