AI-Powered Watermark Batch Remover using Florence-2 and LaMA Models
WatermarkRemover-AI
is a Python-based application that utilizes state-of-the-art AI models—Florence-2 from Microsoft for detecting watermarks and LaMA (Large Masked Autoregressive) for inpainting—to effectively remove watermarks from images. The application provides a user-friendly interface built with PyQt6, allowing for easy batch processing and previewing of original, cleaned, and difference images. It's effective tool for large datasets processing for AI image models learning and training.
- Batch Image Processing: Select a directory of images and process them all at once.
- Advanced Watermark Detection: Utilizes Florence-2's open vocabulary detection to identify watermark regions accurately.
- High-Quality Inpainting: Employs the LaMA model for seamless inpainting, ensuring high-quality results.
- Customizable Settings: Configure overwrite behavior
- Florence-2, a model from Microsoft, is used for detecting watermarks in images. It leverages open vocabulary detection to identify regions that may contain watermarks.
- Detected regions are filtered to ensure that only areas covering less than 10% of the image are processed, avoiding false positives.
- The LaMA (Large Masked Autoregressive) model is employed for inpainting the detected watermark regions. It provides high-quality, context-aware inpainting, making the watermark removal seamless.
- The application uses different strategies (resize, crop) to handle images of various sizes, ensuring the best possible results.
- The application features a PyQt6-based graphical user interface (GUI) that is intuitive and user-friendly. It allows users to select input/output directories, configure settings, and view the results in real-time.
- Python 3.8+ (3.11 recommended)
- CUDA (for GPU acceleration)
-
Clone the Repository:
git clone https://github.com/yourusername/WatermarkRemover-AI.git cd WatermarkRemover-AI
-
Install Dependencies:
pip install -r requirements.txt pip install transformers>=4.44.0
-
Run the Application:
Command-line
python remwm.py source_directory output_directory
GUI:
python remwmgui.py
- Use the "Input Directory" button to choose the directory containing the images you want to process.
- Use the "Output Directory" button to choose where the processed images will be saved.
- If output file exists: Choose whether to skip or overwrite existing processed images.
- Click "Start Processing" to begin processing all images in the input directory.
- The progress bar will update as images are processed.
You may want to change the object detection prompt from text_input = 'logo'
to 'watermark' or 'text' depending on your use case.
Contributions are welcome! If you'd like to contribute, please fork this repository, create a feature branch, and submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.