Giter VIP home page Giter VIP logo

whitelok / watermark-remover Goto Github PK

View Code? Open in Web Editor NEW
295.0 25.0 115.0 1.49 MB

Remove watermark automatically(Just can use for fixed position watermark till now). 自动水印消除算法的实现(目前只支持固定水印位置)。

ai deep-reinforcement-learning computer-vision cv maching-learning watermark-image watermark-remover python machine-learning machine-learning-algorithms deep-learning

watermark-remover's Introduction

Watermark Remover Automatically

IMPORTANT !!!

THANKS FOR SOMEONE SUGGESTION, THIS REPO WILL NOT PROVIDE ANY CODE ANY MORE

WHAT HAD YOU DONE WITH MY CODE IS NO RELATIONSHIP WITH ME


Tips

Please run with Python 3.6.5

Result

Result with demo images

Result with pratical images

Docker runtime [Recommendation]

  • docker pull whitelok/watermark-remover:v1.0

Install

  1. cd watermark-remover; pip3 install -r requirements.txt
  2. Install opencv Python3 binding.(If you need, I can share one to you)

Usage

Demo

  1. bash train.sh for training the watermark and alpha saving in result folder and remove watermark from original image.

Tips

  • Training tips
  1. if the watermark free result is not good enough, you can change --iters (refer to train.sh)
  2. if the training process is too long to wait, you can change --watermark_threshold (refer to train.sh)
  3. if you get tk_inter error, you can change --save_result (refer to train.sh)

Customer

  1. Put all watermarked images into one folder
  2. python3 main_solver.pyc --path [watermarked images folder]

Progress and Implemented function

watermark-remover's People

Contributors

karlluo-tencent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

watermark-remover's Issues

only for watermark with a same size?

Hello, this algorithm seems to only can remove the watermark of common photo with a same size with the watermark mask ?How about the watermark with different size?
Can you give some advises?

source code

Can you send a copy of the source code to me? Thanks.

manifest unknown when running docker pull

When I run

docker pull whitelok/watermark-remover

I get the following error:

Using default tag: latest
Error response from daemon: manifest for whitelok/watermark-remover:latest not found: manifest unknown: manifest unknown

OpenCV docker compilation error

OpenCV compilation gives two errors when building the docker and build stops.

[ 73%] Building CXX object modules/video/CMakeFiles/opencv_video.dir/src/bgfg_KNN.cpp.o
/root/opencv_contrib/modules/rapid/src/rapid.cpp: In function ‘float cv::rapid::rapid(cv::InputArray, int, int, cv::InputArray, cv::InputArray, cv::InputArray, cv::InputOutputArray, cv::InputOutputArray)’:
/root/opencv_contrib/modules/rapid/src/rapid.cpp:344:75: error: ‘solvePnPRefineLM’ was not declared in this scope
solvePnPRefineLM(pts3d, correspondencies, K, cv::noArray(), rvec, tvec);
^
Scanning dependencies of target opencv_rgbd
[ 73%] Building CXX object modules/rgbd/CMakeFiles/opencv_rgbd.dir/src/depth_cleaner.cpp.o
modules/rapid/CMakeFiles/opencv_rapid.dir/build.make:62: recipe for target 'modules/rapid/CMakeFiles/opencv_rapid.dir/src/rapid.cpp.o' failed
make[2]: *** [modules/rapid/CMakeFiles/opencv_rapid.dir/src/rapid.cpp.o] Error 1
make[1]: *** [modules/rapid/CMakeFiles/opencv_rapid.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

RuntimeError: Bad magic number in .pyc file (Docker)

Hey,

I am trying to get this working locally using your docker image, but I think there is a version missmatch. Can I grab the main.py file?

➜  Sites docker pull whitelok/watermark-remover:v1.0
v1.0: Pulling from whitelok/watermark-remover
Digest: sha256:7c046162194c9195b760c4ba125d1c47631759d04eebaab9242a59804a30ae2b
Status: Image is up to date for whitelok/watermark-remover:v1.0
docker.io/whitelok/watermark-remover:v1.0
➜  Sites docker run whitelok/watermark-remover:v1.0 bash ./train.sh
RuntimeError: Bad magic number in .pyc file

With git pull:

➜  Sites  docker run whitelok/watermark-remover:v1.0 bash -c 'git pull origin master && bash ./train.sh'
From https://github.com/whitelok/watermark-remover
 * branch            master     -> FETCH_HEAD
   46df224..219ec2b  master     -> origin/master
Updating 46df224..219ec2b
Fast-forward
 .gitignore                                    |   0
 .gitmodules                                   |   0
 .resource/practical-result.png                | Bin 0 -> 1209205 bytes
 .resource/progress.png                        | Bin
 .resource/result.png                          | Bin
 README.md                                     |  12 ++++-
 autowatermarkremoval/__init__.pyc             | Bin 121 -> 121 bytes
 autowatermarkremoval/closed_form_matting.pyc  | Bin 2051 -> 2051 bytes
 autowatermarkremoval/estimatewatermark.pyc    | Bin 5312 -> 5312 bytes
 autowatermarkremoval/preprocess.pyc           | Bin 1047 -> 1047 bytes
 autowatermarkremoval/reconstructwatermark.pyc | Bin 9561 -> 9561 bytes
 autowatermarkremoval/remover.pyc              | Bin 4605 -> 4605 bytes
 autowatermarkremoval/solver.pyc               | Bin 13996 -> 17369 bytes
 autowatermarkremoval/utils.pyc                | Bin 7658 -> 7811 bytes
 demo/fotolia_137840668.jpg                    | Bin
 demo/fotolia_168667147.jpg                    | Bin
 demo/fotolia_168667186.jpg                    | Bin
 demo/fotolia_168667261.jpg                    | Bin
 demo/fotolia_168667468.jpg                    | Bin
 demo/fotolia_168667490.jpg                    | Bin
 demo/fotolia_168668046.jpg                    | Bin
 demo/fotolia_168668148.jpg                    | Bin
 demo/fotolia_168668150.jpg                    | Bin
 demo/fotolia_168668190.jpg                    | Bin
 demo/fotolia_75353029.jpg                     | Bin
 main.pyc                                      | Bin 2354 -> 2559 bytes
 python-version.txt                            |   1 +
 remove.sh                                     |   0
 requirements.txt                              |  67 +++---------------------
 result/C_3.npy                                | Bin
 result/Ik_11_59_116_3.npy                     | Bin
 result/W_59_116_3.npy                         | Bin
 result/Wk_11_59_116_3.npy                     | Bin
 result/Wm_59_116_3.npy                        | Bin
 result/Wm_gradx_500_500_3.npy                 | Bin
 result/Wm_gradx_cropped_59_116_3.npy          | Bin
 result/Wm_grady_500_500_3.npy                 | Bin
 result/Wm_grady_cropped_59_116_3.npy          | Bin
 result/alph_59_116_3.npy                      | Bin
 result/alph_est_59_116.npy                    | Bin
 result/alpha1_59_116_3.npy                    | Bin
 result/cropped_images_J_11_59_116_3.npy       | Bin
 result/est_Ik_59_116_3.npy                    | Bin
 result/images_11_500_500_3.npy                | Bin
 result/result_0.jpg                           | Bin
 result/result_1.jpg                           | Bin
 result/result_10.jpg                          | Bin
 result/result_2.jpg                           | Bin
 result/result_3.jpg                           | Bin
 result/result_4.jpg                           | Bin
 result/result_5.jpg                           | Bin
 result/result_6.jpg                           | Bin
 result/result_7.jpg                           | Bin
 result/result_8.jpg                           | Bin
 result/result_9.jpg                           | Bin
 result/watermark_59_116_3.npy                 | Bin
 train.sh                                      |   0
 watermark-dockerfile                          |  70 ++++++++++++++++++++++++++
 58 files changed, 90 insertions(+), 60 deletions(-)
 mode change 100644 => 100755 .gitignore
 mode change 100644 => 100755 .gitmodules
 create mode 100755 .resource/practical-result.png
 mode change 100644 => 100755 .resource/progress.png
 mode change 100644 => 100755 .resource/result.png
 mode change 100644 => 100755 README.md
 mode change 100644 => 100755 demo/fotolia_137840668.jpg
 mode change 100644 => 100755 demo/fotolia_168667147.jpg
 mode change 100644 => 100755 demo/fotolia_168667186.jpg
 mode change 100644 => 100755 demo/fotolia_168667261.jpg
 mode change 100644 => 100755 demo/fotolia_168667468.jpg
 mode change 100644 => 100755 demo/fotolia_168667490.jpg
 mode change 100644 => 100755 demo/fotolia_168668046.jpg
 mode change 100644 => 100755 demo/fotolia_168668148.jpg
 mode change 100644 => 100755 demo/fotolia_168668150.jpg
 mode change 100644 => 100755 demo/fotolia_168668190.jpg
 mode change 100644 => 100755 demo/fotolia_75353029.jpg
 create mode 100755 python-version.txt
 mode change 100644 => 100755 remove.sh
 mode change 100644 => 100755 requirements.txt
 mode change 100644 => 100755 result/C_3.npy
 mode change 100644 => 100755 result/Ik_11_59_116_3.npy
 mode change 100644 => 100755 result/W_59_116_3.npy
 mode change 100644 => 100755 result/Wk_11_59_116_3.npy
 mode change 100644 => 100755 result/Wm_59_116_3.npy
 mode change 100644 => 100755 result/Wm_gradx_500_500_3.npy
 mode change 100644 => 100755 result/Wm_gradx_cropped_59_116_3.npy
 mode change 100644 => 100755 result/Wm_grady_500_500_3.npy
 mode change 100644 => 100755 result/Wm_grady_cropped_59_116_3.npy
 mode change 100644 => 100755 result/alph_59_116_3.npy
 mode change 100644 => 100755 result/alph_est_59_116.npy
 mode change 100644 => 100755 result/alpha1_59_116_3.npy
 mode change 100644 => 100755 result/cropped_images_J_11_59_116_3.npy
 mode change 100644 => 100755 result/est_Ik_59_116_3.npy
 mode change 100644 => 100755 result/images_11_500_500_3.npy
 mode change 100644 => 100755 result/result_0.jpg
 mode change 100644 => 100755 result/result_1.jpg
 mode change 100644 => 100755 result/result_10.jpg
 mode change 100644 => 100755 result/result_2.jpg
 mode change 100644 => 100755 result/result_3.jpg
 mode change 100644 => 100755 result/result_4.jpg
 mode change 100644 => 100755 result/result_5.jpg
 mode change 100644 => 100755 result/result_6.jpg
 mode change 100644 => 100755 result/result_7.jpg
 mode change 100644 => 100755 result/result_8.jpg
 mode change 100644 => 100755 result/result_9.jpg
 mode change 100644 => 100755 result/watermark_59_116_3.npy
 mode change 100644 => 100755 train.sh
 create mode 100755 watermark-dockerfile
RuntimeError: Bad magic number in .pyc file

求教一个问题

你好,我最近刚在学习这篇文章,有些地方没有看懂,求教~
比如Eq.5,应该是解释为什么随着K增大,梯度的中位数会收敛于水印部分。但是这部分的公式推导不是很清楚,▽是计算梯度的意思,E[] 是什么意思?exception吗? 但是等式第二步不清楚是怎么转化的,文章里面只是说乘法导数。可以指导一下吗?多谢!

Error ravel_multi_index

ValueError: operands could not be broadcast together with shapes (6,59) (6,119) (6,3)

I'm not certain why I'm getting this error, I've run both the docker repo and raw code on my machine. Do you have any advice?

Get caught in loop with train.sh

When I run ./train.sh I get a figure 1 with 7 different method results (TM_CCOEFF, ...etc) When I close that window I get a python debug prompt (Pdb) and if I type continue it asks me to select a method result.

Then I get a new figure with the watermark, then it blacks out and I get a warning "invalid value encountered in true_divide.

> /Users/me/Workspace/Sandbox/watermark-remover/autowatermarkremoval/solver.py(241)_detect_watermark()
(Pdb) continue
Please select a method result
1. cv2.TM_CCOEFF
2. cv2.TM_CCOEFF_NORMED
3. cv2.TM_CCORR
4. cv2.TM_CCORR_NORMED
5. cv2.TM_SQDIFF
6. cv2.TM_SQDIFF_NORMED
7. CANNY_2D_FILTER
:1
2019-10-11 15:14:06 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:14:06 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:14:06 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:14:18 dlw.flightwave.aero autowatermarkremoval.utils[92544] DEBUG get_cropped_image min_x=120, min_y=302, max_x=395, max_y=407
Traceback (most recent call last):
  File "./autowatermarkremoval/solver.py", line 414, in solve
ValueError: could not broadcast input array from shape (275,105,3) into shape (105,275,3)
/Users/me/Workspace/Sandbox/watermark-remover/.direnv/python-3.6.5/lib/python3.6/site-packages/matplotlib/figure.py:98: MatplotlibDeprecationWarning:
Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  "Adding an axes using the same arguments as a previous axes "
/Users/me/Workspace/Sandbox/watermark-remover/autowatermarkremoval/utils.py:87: RuntimeWarning: invalid value encountered in true_divide
2019-10-11 15:14:18 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:14:30 me.me.com autowatermarkremoval.solver[92544] DEBUG cv2.TM_CCOEFF (100, 288) (375, 393)
2019-10-11 15:14:30 me.me.com autowatermarkremoval.solver[92544] DEBUG cv2.TM_CCOEFF_NORMED (100, 288) (375, 393)
2019-10-11 15:14:30 me.me.com autowatermarkremoval.solver[92544] DEBUG cv2.TM_CCORR (425, 395) (700, 500)
2019-10-11 15:14:30 me.me.com autowatermarkremoval.solver[92544] DEBUG cv2.TM_CCORR_NORMED (425, 43) (700, 148)
2019-10-11 15:14:30 me.me.com autowatermarkremoval.solver[92544] DEBUG cv2.TM_SQDIFF (110, 309) (385, 414)
2019-10-11 15:14:30 me.me.com autowatermarkremoval.solver[92544] DEBUG cv2.TM_SQDIFF_NORMED (0, 0) (275, 105)
2019-10-11 15:14:30 me.me.com autowatermarkremoval.solver[92544] DEBUG CANNY_2D_FILTER (154, 314) (429, 419)
2019-10-11 15:14:30 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:14:30 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:14:30 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:14:30 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:14:30 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:14:30 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:14:30 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
> /Users/me/Workspace/Sandbox/watermark-remover/autowatermarkremoval/solver.py(241)_detect_watermark()
(Pdb) continue
Please select a method result
1. cv2.TM_CCOEFF
2. cv2.TM_CCOEFF_NORMED
3. cv2.TM_CCORR
4. cv2.TM_CCORR_NORMED
5. cv2.TM_SQDIFF
6. cv2.TM_SQDIFF_NORMED
7. CANNY_2D_FILTER
:5
2019-10-11 15:20:26 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:20:26 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:20:26 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:20:38 me.me.com autowatermarkremoval.utils[92544] DEBUG get_cropped_image min_x=0, min_y=0, max_x=275, max_y=105
Traceback (most recent call last):
  File "./autowatermarkremoval/solver.py", line 414, in solve
ValueError: could not broadcast input array from shape (275,105,3) into shape (105,275,3)
2019-10-11 15:20:38 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:20:50 me.me.com autowatermarkremoval.solver[92544] DEBUG cv2.TM_CCOEFF (315, 281) (590, 386)
2019-10-11 15:20:50 me.me.com autowatermarkremoval.solver[92544] DEBUG cv2.TM_CCOEFF_NORMED (109, 302) (384, 407)
2019-10-11 15:20:50 me.me.com autowatermarkremoval.solver[92544] DEBUG cv2.TM_CCORR (425, 0) (700, 105)
2019-10-11 15:20:50 me.me.com autowatermarkremoval.solver[92544] DEBUG cv2.TM_CCORR_NORMED (179, 0) (454, 105)
2019-10-11 15:20:50 me.me.com autowatermarkremoval.solver[92544] DEBUG cv2.TM_SQDIFF (120, 325) (395, 430)
2019-10-11 15:20:50 me.me.com autowatermarkremoval.solver[92544] DEBUG cv2.TM_SQDIFF_NORMED (0, 0) (275, 105)
2019-10-11 15:20:50 me.me.com autowatermarkremoval.solver[92544] DEBUG CANNY_2D_FILTER (154, 314) (429, 419)
2019-10-11 15:20:50 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:20:51 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:20:51 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:20:51 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:20:51 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:20:51 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
2019-10-11 15:20:51 me.me.com matplotlib.axes._base[92544] DEBUG update_title_pos
>

"Can't use on your computer, sorry"

Any chance you can provide a little more information on requirements where this error is coming from? I'm guessing we need a discrete Nvidia gpu or something?

Error for full-size watermark

Thanks for providing the python3.7 binaries.
Ran into a bug when running it on my own test data:

2019-01-17 18:52:32 186590ce2455.ant.amazon.com autowatermarkremoval.solver[720] DEBUG saving image tmp/step_1_Wm_gradx.jpg
2019-01-17 18:52:32 186590ce2455.ant.amazon.com autowatermarkremoval.solver[720] DEBUG saving image tmp/step_1_Wm_grady.jpg
2019-01-17 18:52:32 186590ce2455.ant.amazon.com autowatermarkremoval.solver[720] DEBUG saving image tmp/step_2_Wm_gradx_cropped.jpg
2019-01-17 18:52:32 186590ce2455.ant.amazon.com autowatermarkremoval.solver[720] DEBUG saving image tmp/step_2_Wm_gradx_cropped.jpg
Traceback (most recent call last):
  File "./main.py", line 23, in <module>
  File "./autowatermarkremoval/solver.py", line 356, in solve
  File "./autowatermarkremoval/solver.py", line 313, in solve
  File "./autowatermarkremoval/solver.py", line 209, in _possion_reconstruct
cv2.error: OpenCV(3.4.2) /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/filter.cpp:288: error: (-215:Assertion failed) wholeSize.width > 0 && wholeSize.height > 0 in function 'proceed'

The issue seems to be that the watermark in my test set is an actual overlay of the whole picture, so the files step_2_Wm_gradx_cropped.jpg and step_2_Wm_grady_cropped.jpg are basically empty (if I understand the algorithm correctly).

Happy to send you a sample set of the data if you are interested.

Can not load watermark image

!python ./main.pyc --mode remove --watermark_path ./result/W_59_116_3.npy --alpha_path ./result/alph_59_116_3.npy --image_path ./demo/fotolia_168667147.jpg

Traceback (most recent call last):
  File "./main.py", line 78, in <module>
  File "./autowatermarkremoval/remover.py", line 152, in remove
  File "./autowatermarkremoval/remover.py", line 31, in __init__
AssertionError: Can not load watermark image from result/W_59_116_3.npy

I only used commands from the documentation

error when saving image

Hi,

I met an error when I train the model, what ever using your demo images or my own images, the trainning seems run well, but after 3 iterations, it throwed exceptions when saving image tmp\WK.jpg, the error as below:

Unhandled exception at 0x00007FFB14FFD830 (cv2.cp37-win_amd64.pyd) in python.exe: 0xC0000094: Integer division by zero.

Could you please help me out here?

Here are the full logs:

(wm) d:\watermark-py372>python main.pyc --path demo
2020-04-14 11:25:17 my-machine-name autowatermarkremoval.utils[5496] DEBUG imread from file d:\watermark-py372\demo\fotolia_137840668.jpg
2020-04-14 11:25:17 my-machine-name autowatermarkremoval.utils[5496] DEBUG imread from file d:\watermark-py372\demo\fotolia_168667147.jpg
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG imread from file d:\watermark-py372\demo\fotolia_168667186.jpg
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG imread from file d:\watermark-py372\demo\fotolia_168667261.jpg
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG imread from file d:\watermark-py372\demo\fotolia_168667468.jpg
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG imread from file d:\watermark-py372\demo\fotolia_168667490.jpg
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG imread from file d:\watermark-py372\demo\fotolia_168668046.jpg
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG imread from file d:\watermark-py372\demo\fotolia_168668148.jpg
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG imread from file d:\watermark-py372\demo\fotolia_168668150.jpg
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG imread from file d:\watermark-py372\demo\fotolia_168668190.jpg
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG imread from file d:\watermark-py372\demo\fotolia_75353029.jpg
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.solver[5496] INFO start estimate watermark(same position)
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.solver[5496] INFO Computing gradients
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.solver[5496] INFO Computing median gradients.
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.solver[5496] DEBUG saving image tmp\step_1_Wm_gradx.jpg
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.solver[5496] DEBUG saving image tmp\step_1_Wm_grady.jpg
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.solver[5496] DEBUG saving image tmp\step_2_Wm_gradx_cropped.jpg
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.solver[5496] DEBUG saving image tmp\step_2_Wm_gradx_cropped.jpg
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.solver[5496] INFO possion reconstruct finished.
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.solver[5496] DEBUG saving image tmp\step_3_watermark_possion_reconstruct.jpg
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.solver[5496] DEBUG saving image tmp\step_4_watermark_possion_reconstruct_remove_min.jpg
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG get_cropped_image min_x=78, min_y=189, max_x=279, max_y=309
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG get_cropped_image min_x=78, min_y=189, max_x=279, max_y=309
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG get_cropped_image min_x=78, min_y=189, max_x=279, max_y=309
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG get_cropped_image min_x=78, min_y=189, max_x=279, max_y=309
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG get_cropped_image min_x=78, min_y=189, max_x=279, max_y=309
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG get_cropped_image min_x=78, min_y=189, max_x=279, max_y=309
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG get_cropped_image min_x=205, min_y=84, max_x=406, max_y=204
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG get_cropped_image min_x=78, min_y=189, max_x=279, max_y=309
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG get_cropped_image min_x=78, min_y=189, max_x=279, max_y=309
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG get_cropped_image min_x=186, min_y=28, max_x=387, max_y=148
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.utils[5496] DEBUG get_cropped_image min_x=78, min_y=189, max_x=279, max_y=309
2020-04-14 11:25:18 my-machine-name autowatermarkremoval.solver[5496] INFO Estimating normalized alpha using 11 images.
0.36277774944338675
0.3418032657098949
0.35440235262726777

Iteration: 0
Step 1
2020-04-14 11:27:56 my-machine-name matplotlib.font_manager[5496] DEBUG findfont: Matching :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=10.0 to DejaVu Sans ('D:\git\my\python\OpenCv-Python-Tutorials\venv\lib\site-packages\matplotlib\mpl-data\fonts\ttf\DejaVuSans.ttf') with score of 0.050000
0
C:\Users\kke\Miniconda3\lib\site-packages\matplotlib\cbook\deprecation.py:107: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance. In a future version, a new instance will always be created and returned. Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
warnings.warn(message, mplDeprecation, stacklevel=1)
1
2
3
4
5
6
7
8
9
10
Step 2
Step 3

Iteration: 1
Step 1
0
1
2
3
4
5
6
7
8
9
10
Step 2
Step 3

Iteration: 2
Step 1
0
1
2
3
4
5
6
7
8
9
10
Step 2
Step 3

Iteration: 3
Step 1
0
1
2
3
4
5
6
7
8
9
10
Step 2
Step 3
2020-04-14 12:32:43 my-machine-name autowatermarkremoval.solver[5496] DEBUG saving image tmp\Wk.jpg

Thank you!

cv2.error: OpenCV(3.4.2)

2019-06-11 11:54:52 mp-hr autowatermarkremoval.solver[16582] INFO Computing gradients
2019-06-11 11:55:17 mp-hr autowatermarkremoval.solver[16582] INFO Computing median gradients.
2019-06-11 12:03:51 mp-hr autowatermarkremoval.utils[16582] DEBUG saving obj result/Wm_gradx_1689_3000_3
2019-06-11 12:03:53 mp-hr autowatermarkremoval.utils[16582] DEBUG saving obj result/Wm_grady_1689_3000_3
2019-06-11 12:03:55 mp-hr autowatermarkremoval.solver[16582] DEBUG The position of watermark gardient is in (-2, 1624, -3, 3002)
2019-06-11 12:03:55 mp-hr autowatermarkremoval.utils[16582] DEBUG saving obj result/Wm_gradx_cropped_0_3_3
2019-06-11 12:03:55 mp-hr autowatermarkremoval.utils[16582] DEBUG saving obj result/Wm_grady_cropped_0_3_3
Traceback (most recent call last):
  File "./main.py", line 64, in <module>
  File "./autowatermarkremoval/solver.py", line 539, in solve
  File "./autowatermarkremoval/solver.py", line 425, in solve
  File "./autowatermarkremoval/solver.py", line 301, in _possion_reconstruct
cv2.error: OpenCV(3.4.2) /opt/concourse/worker/volumes/live/9523d527-1b9e-48e0-7ed0-a36adde286f0/volume/opencv-suite_1535558719691/work/modules/imgproc/src/filter.cpp:288: error: (-215:Assertion failed) wholeSize.width > 0 && wholeSize.height > 0 in function 'proceed'

The above is debug info.

My sample dataset has email you.

Problem with the imports in "./autowatermarkremoval/solver.py"

I am trying to run the solver.pyc code to remove some watermarks from my own folder with watermarked pictures. I'm using this command:

python3 ./autowatermarkremoval/solver.pyc --path ../input_pictures/

Nevertheless, this does not work. I am getting the following error:

ImportError: cannot import name 'utils'

I have opened the compiled code of solver.pyc with 'uncompyle6' to see the source code, and I see that there are many relative imports that are done. I made some modifications to these imports but I couldn't manage to make it work. Any ideas why this is failing?

Additionally, I would be really grateful if you could make a little bit more detailed 'readme'.

problem with remove.sh

I run remove.sh as follows, but it failed, I don’t know where the problem is.

python3 main.pyc --mode remove --watermark_path result/W_59_116_3.npy --alpha_path result/alpha1_59_116_3.npy --image_path demo/fotolia_168667147.jpg

请教一个问题

泊松重构图像您是怎么做的呢
how to do the possion reconstruct using gradient of watermark image?

seems the remove is broken

image
the W_201_120_3 is not what I generated from the picture , but still need this file.... pretty strange

Keep getting _tkinter module error

I have installed the requirements and python3-tk.
Not sure but why when running bash demo.sh I get the follower error.

Traceback (most recent call last): File "./main_solver.py", line 5, in <module> File "./autowatermarkremoval/solver.py", line 9, in <module> File "/home/user/venv3/lib/python3.6/site-packages/matplotlib/pyplot.py", line 115, in <module> _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup() File "/home/user/venv3/lib/python3.6/site-packages/matplotlib/backends/__init__.py", line 62, in pylab_setup [backend_name], 0) File "/home/user/venv3/lib/python3.6/site-packages/matplotlib/backends/backend_tkagg.py", line 4, in <module> from . import tkagg # Paint image to Tk photo blitter extension. File "/home/user/venv3/lib/python3.6/site-packages/matplotlib/backends/tkagg.py", line 5, in <module> from six.moves import tkinter as Tk File "/usr/lib/python3/dist-packages/six.py", line 92, in __get__ result = self._resolve() File "/usr/lib/python3/dist-packages/six.py", line 115, in _resolve return _import_module(self.mod) File "/usr/lib/python3/dist-packages/six.py", line 82, in _import_module __import__(name) File "/usr/lib/python3.6/tkinter/__init__.py", line 36, in <module> import _tkinter # If this fails your Python may not be configured for Tk ModuleNotFoundError: No module named '_tkinter'

removal result

fotolia_152586
fotolia_539921
fotolia_592458
fotolia_688089
fotolia_781992

The watermark removal is not very clean, and there are traces on the border. Can you give me some advice? thank you

segfault

autowatermarkremoval.reconstructwatermark[6751] DEBUG start...
Can't expand MemType 0: jcol 2203950
Segmentation fault (core dumped)

what info is required to debug?

Cannot build the docker image from master

When I try I get the following error:

[ 77%] Built target opencv_ccalib CMakeFiles/Makefile2:6925: recipe for target 'modules/rgbd/CMakeFiles/opencv_rgbd.dir/all' failed make[1]: *** [modules/rgbd/CMakeFiles/opencv_rgbd.dir/all] Error 2 Makefile:160: recipe for target 'all' failed make: *** [all] Error 2 The command '/bin/sh -c mkdir -p ~/opencv/build && cd ~/opencv/build && cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_IPP=OFF -D WITH_CUDA=OFF -D WITH_OPENCL=OFF -D BUILD_TESTS=OFF -D PYTHON_DEFAULT_EXECUTABLE=$(which python3) -D BUILD_PERF_TESTS=OFF -D OPENCV_ENABLE_NONFREE=ON -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules .. && make -j"$(nproc)" install && ln -s /usr/local/include/opencv4/opencv2 /usr/local/include/opencv2' returned a non-zero code: 2

bad magic number error

Hi Whitelok, can you provide more information about the environment? I tried to use your image whitelok/watermark-remover:v1.0 but there is bad magic number error when you want to run python3 main_solver.pyc --path

Thank you.

Files in order

Hello!

I'm trying to get this to work for videos instead of just static images.
I've got it mostly working, except it randomizes the filenames when reading the original folder, and the output filenames do not match the input filenames, so I have no convenient ways to keep the video frames in the right order.
Can the code be edited to fix this? Anyone has an idea how I could get the order to be enforced?

Cheers!

Watermark detect algo is not stable

Trained with Adobe stock photos from the original paper, but got the message:

For the watermark detect algo is not stable, please input the final position you want to remove like: x,y (w, h is the watermark shape) or enter to skip it.

Pressing enter triggers an error:

ValueError: could not broadcast input array from shape (765,869,3) into shape (948,765,3)

Could you please help fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.