Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loss of resolution #17

Open
oushujun opened this issue Apr 14, 2023 · 9 comments
Open

Loss of resolution #17

oushujun opened this issue Apr 14, 2023 · 9 comments

Comments

@oushujun
Copy link

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

@braindotai
Copy link
Owner

braindotai commented Jun 7, 2023

Can you send some screenshots? Quality reduction should be unnoticeable for the regions where there is no watermark.

@flymans
Copy link

flymans commented Jul 30, 2023

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

@edwin-yan
Copy link
Contributor

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

@flymans
Copy link

flymans commented Dec 5, 2023

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

@REPTILEHAUS
Copy link

I also get this error

@mmol67
Copy link

mmol67 commented Mar 7, 2024

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

@braindotai
Copy link
Owner

@friki67 that's the correct fix, could you make the pull request?

@mmol67
Copy link

mmol67 commented Mar 11, 2024

@friki67 that's the correct fix, could you make the pull request?

Sorry, I don't know how to do it :(

@arg274
Copy link

arg274 commented Mar 15, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants