Home >Backend Development >Python Tutorial >From Stamped to Clean: Transforming Watermarked Images into Clear Visuals
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.
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 uses tensorflow=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/
%%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
Please give a star to Github Repository which is forked from zuruoke/watermark-removal
To configure TensorFlow=1.15, setup conda env inside colab
The above is the detailed content of From Stamped to Clean: Transforming Watermarked Images into Clear Visuals. For more information, please follow other related articles on the PHP Chinese website!