Watermark-Removal-Pytorch
Watermark-Removal-Pytorch copied to clipboard
Loss of resolution
Hello,
Thank you for implementing this great pipeline! I successfully ran it but I saw the resolution of output is much lower than the original input. The loss of resolution also happended to those unmasked areas without the watermark. I set the output dimention the same as the input dimention. Is that a way to improve the resolution and avoid changing the quality of unmasked regions?
Thanks, Shujun
Can you send some screenshots? Quality reduction should be unnoticeable for the regions where there is no watermark.
Actually, I think the reason of low resolution is default of --max-dix arg. It's 512 pixels.
I ran into a bug:
!python inference.py --max-dim=1024
TypeError: 'float' object cannot be interpreted as an integer
Actually, I think the reason of low resolution is default of --max-dix arg. It's 512 pixels.
I ran into a bug:
!python inference.py --max-dim=1024
TypeError: 'float' object cannot be interpreted as an integer
you do not need the equal sign. Replace it with a space
you do not need the equal sign. Replace it with a space
Nope. Still same error:
!python inference.py --image-path='foo.jpg' --mask-path='bar.jpg' --max-dim 720 --training-steps 20000
Traceback (most recent call last): File "/content/Watermark-Removal-Pytorch/inference.py", line 16, in <module> remove_watermark( File "/content/Watermark-Removal-Pytorch/api.py", line 27, in remove_watermark image_np, mask_np = preprocess_images(image_path, mask_path, max_dim) File "/content/Watermark-Removal-Pytorch/helper.py", line 60, in preprocess_images image_pil, mask_pil = max_dimension_resize(image_pil, mask_pil, max_dim) File "/content/Watermark-Removal-Pytorch/helper.py", line 54, in max_dimension_resize return image_pil.resize((w, h)), mask_pil.resize((w, h)) File "/usr/local/lib/python3.10/dist-packages/PIL/Image.py", line 2192, in resize return self._new(self.im.resize(size, resample, box)) TypeError: 'float' object cannot be interpreted as an integer
I also get this error
Yes, me too. You can fix this editing inference.py and changing the type of the parameter.
parser.add_argument('--max-dim', type = float, default = 512, help = 'Max dimension of the final output image')
change the bold part to type=int.
Regards
@friki67 that's the correct fix, could you make the pull request?
@friki67 that's the correct fix, could you make the pull request?
Sorry, I don't know how to do it :(
It seems that setting it to a value higher than 512 makes the whole thing impractical. ETA is showing up to be 20 hours for a single image with a max_dim of 1024 on an RTX 2080. That's unfortunate because the low resolution images that it outputs with the default max_dim of 512 is impractical as well.