Skip to content

Commit

Permalink
added more results
Browse files Browse the repository at this point in the history
  • Loading branch information
braindotai committed Feb 23, 2021
1 parent cc93d11 commit 20c8edd
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 22 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ Below are the final outputs for some sample image editing examples:
<img src='outputs/image-editing/edit3.png' atl="Image Editing" style="floar: center; border-radius: 6px;">
</div>

<div align="center">
<img src='outputs/image-editing/edit4.png' atl="Image Editing" style="floar: center; border-radius: 6px;">
</div>

<div align="center">
<img src='outputs/image-editing/edit2.png' atl="Image Editing" style="floar: center; border-radius: 6px;">
</div>
Expand Down
60 changes: 38 additions & 22 deletions inference.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
import argparse
from api import remove_watermark
# import argparse
# from api import remove_watermark

parser = argparse.ArgumentParser(description = 'Removing Watermark')
parser.add_argument('--image-path', type = str, default = './data/watermark-unavailable/watermarked/watermarked0.png', help = 'Path to the "watermarked" image.')
parser.add_argument('--mask-path', type = str, default = './data/watermark-unavailable/masks/mask0.png', help = 'Path to the "watermark" image.')
parser.add_argument('--input-depth', type = int, default = 32, help = 'Max channel dimension of the noise input. Set it based on gpu/device memory you have available.')
parser.add_argument('--lr', type = float, default = 0.01, help = 'Learning rate.')
parser.add_argument('--training-steps', type = int, default = 3000, help = 'Number of training iterations.')
parser.add_argument('--show-step', type = int, default = 200, help = 'Interval for visualizing results.')
parser.add_argument('--reg-noise', type = float, default = 0.03, help = 'Hyper-parameter for regularized noise input.')
parser.add_argument('--max-dim', type = float, default = 512, help = 'Max dimension of the final output image')
# parser = argparse.ArgumentParser(description = 'Removing Watermark')
# parser.add_argument('--image-path', type = str, default = './data/watermark-unavailable/watermarked/watermarked0.png', help = 'Path to the "watermarked" image.')
# parser.add_argument('--mask-path', type = str, default = './data/watermark-unavailable/masks/mask0.png', help = 'Path to the "watermark" image.')
# parser.add_argument('--input-depth', type = int, default = 32, help = 'Max channel dimension of the noise input. Set it based on gpu/device memory you have available.')
# parser.add_argument('--lr', type = float, default = 0.01, help = 'Learning rate.')
# parser.add_argument('--training-steps', type = int, default = 3000, help = 'Number of training iterations.')
# parser.add_argument('--show-step', type = int, default = 200, help = 'Interval for visualizing results.')
# parser.add_argument('--reg-noise', type = float, default = 0.03, help = 'Hyper-parameter for regularized noise input.')
# parser.add_argument('--max-dim', type = float, default = 512, help = 'Max dimension of the final output image')

args = parser.parse_args()
# args = parser.parse_args()

remove_watermark(
image_path = args.image_path,
mask_path = args.mask_path,
max_dim = args.max_dim,
show_step = args.show_step,
reg_noise = args.reg_noise,
input_depth = args.input_depth,
lr = args.lr,
training_steps = args.training_steps,
)
# remove_watermark(
# image_path = args.image_path,
# mask_path = args.mask_path,
# max_dim = args.max_dim,
# show_step = args.show_step,
# reg_noise = args.reg_noise,
# input_depth = args.input_depth,
# lr = args.lr,
# training_steps = args.training_steps,
# )

import numpy as np
import cv2
import matplotlib.pyplot as plt
img = cv2.imread('./data/watermark-unavailable/watermarked/watermarked0.png')
mask = cv2.imread('./data/watermark-unavailable/masks/mask0.png', 0)
zeros = mask == 0
ones = mask == 1
mask[zeros] = 0
mask[ones] = 1
plt.imshow(mask, cmap = 'gray')
plt.show()
dst = cv2.inpaint(img, mask, 3, cv2.INPAINT_TELEA)
cv2.imshow('dst', dst)
cv2.waitKey(0)
cv2.destroyAllWindows()
Binary file added outputs/image-editing/edit4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 20c8edd

Please sign in to comment.