Skip to content
/ DeWm Public

Automatically remove watermarks from illustrations using AI (Stable Diffusion).

License

Notifications You must be signed in to change notification settings

huzpsb/DeWm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DeWm

/djuːm/ DeWaterMark.
中文版

DEMO
The demo is using an impaired model with worse quality but works without sd.

Tired of images covered in watermarks? Look no further!
This tool uses AI (StableDiffusion) to automatically remove watermarks from illustrations.

Disclaimer: All sample images in this repository were generated by me.
Removing watermarks from images does not mean you automatically gain authorization to use those images.
More importantly, removing watermarks involves modifying the images, which is prohibited under many licenses. Please do not misuse the models provided in this repository!

Training Method: No comment.

Usage:

  1. Use dev.py to process the original image and generate a mask.
  2. In Stable Diffusion (SD), select inpainting mode and upload the mask.
    That's it!

Tips for Better Results (not absolute; experiment on your own):

  1. Choose a model with a similar art style; it can significantly improve the quality of the final result.
  2. Avoid using blurred masks. Set mask blur to at most 1–2. Adjust the mathematical morphology operations provided in the function to refine the mask as needed.
  3. When in doubt, over-select rather than under-select. At worst, you can manually erase areas incorrectly selected by the model, which is still easier than manually blacking out watermarks.
  4. For semi-transparent watermarks, set masked areas to use the original image. Otherwise, use the filled option.
  5. I recommend using Euler a sampler with 20 steps.
  6. Keep the CFG scale low. If you can get by with 2, don’t use 3. The goal is to avoid breaking the image. Otherwise, the style may look overly "AI-generated." Ignore this if you prefer the AI aesthetic.
  7. Set denoising strength to 0.2, with a maximum of 0.25. Going higher will likely break the image because this process uses a fine mask.
  8. In extreme cases, first perform a "Anti-Anti-AI" operation using DeTox.

Additional Uses:

The inpainting process can also remove residual edges left by the watermark.
Therefore, if you're planning to use ControlNet, you can first remove the watermark as described and then calculate edges from the watermark-free image.

TODO:

If feasible, create a universal style inpainting model independent of (or based on) Stable Diffusion.

Examples:

(Supports more types of transparent, image-based, and other watermarks; the following is for demonstration purposes.)

Original Image:

Generated Mask (you could manually erase false positives, but skipped here for demonstration):

Stable Diffusion Inpainting:

About

Automatically remove watermarks from illustrations using AI (Stable Diffusion).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages