"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > From Stamped to Clean: Transforming Watermarked Images into Clear Visuals

From Stamped to Clean: Transforming Watermarked Images into Clear Visuals

Published on 2024-08-22
Browse:911

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.


Steps to follow -

  1. Create a new Google Colab notebook. Change the runtime to T4 GPU to enhance computing power to run the inference pipeline.

  2. 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

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

Release Statement This article is reproduced at: https://dev.to/jivaniyash/from-stamped-to-clean-transforming-watermarked-images-into-clear-visuals-24fp?1 If there is any infringement, please contact [email protected] to delete it
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3