zuruoke/watermark-removal

repository·master·Indexed 26 days ago

https://github.com/zuruoke/watermark-removal

An open source project using machine learning-based image inpainting, inspired by Contextual Attention and Gated Convolution, to remove watermarks from images. It provides a CLI and Docker support for processing images using pre-trained TensorFlow model checkpoints.

Tokens
726
Snippets
2
Records
4
Agent score
40%

What's inside watermark-removal

  1. Setup Watermark-Removal in Google Colab

    master

    Note: The Google Colab method is currently marked as broken in the repository. If attempting to use it, follow these steps:

    1. Clone the repository: !git clone https://github.com/zuruoke/watermark-removal
    2. Change directory to the repo.
    3. Downgrade TensorFlow to version 1.15.0: !pip install tensorflow==1.15.0
    4. Install the neuralgym toolkit: !pip install git+https://github.com/JiahuiYu/neuralgym
    5. Download the model directory and place it in model/. Ensure checkpoint.txt is renamed to checkpoint.
    6. Run the removal using main.py.
    !python main.py --image path-to-input-image --output path-to-output-image --checkpoint_dir model/ --watermark_type istock
  2. Run Watermark-Removal using Docker

    master

    You can run the watermark removal process inside a Docker container. This requires building the image from the repository and providing the pre-trained model directory via a volume mount.

    1. Clone the repository.
    2. Build the Docker image: docker build -t watermark-removal .
    3. Download the model directory from this link.
    4. Run the container by mounting the model, input, and output directories.
    docker run --rm -v '<path_to_model_dir>:/repo/model' -v '<path_to_input_dir>:/input' -v '<path_to_output_dir>:/output' watermark-removal --checkpoint_dir /repo/model --image '/input/<input_image_file>' --output '/output/<output_image_file>' --watermark_type istock
  3. CLI Arguments for watermark-removal

    master

    When running the tool (either via Docker or directly via main.py), use the following arguments:

    • --checkpoint_dir: Path to the directory containing the model checkpoints.
    • --image: Path to the input image file containing the watermark.
    • --output: Path where the processed image should be saved.
    • --watermark_type: The type of watermark to remove (e.g., istock).
  4. Run watermark removal via CLI

    master

    The main.py script provides a command-line interface to remove watermarks from images using a pre-trained inpainting model. It requires an input image, an output path, the type of watermark to target, and the directory containing the TensorFlow model checkpoints.

    Arguments:

    • --image: The filename of the image to be processed (string).
    • --output: The path where the processed image will be saved (string, default: output.png).
    • --watermark_type: The specific type of watermark to remove (string, default: istock).
    • --checkpoint_dir: The directory containing the TensorFlow checkpoints (string, default: model/).