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

Can the model process images larger than 512x512 dimensions? #2

Open
seasnakes opened this issue Nov 8, 2024 · 14 comments
Open

Can the model process images larger than 512x512 dimensions? #2

seasnakes opened this issue Nov 8, 2024 · 14 comments

Comments

@seasnakes
Copy link

When using a 2160x2160 test image, the following error occurs.

image

@Shilin-LU
Copy link
Owner

Hi, thanks for your interest. The code has been updated to support images of any resolution. Please pull the latest version and give it another try.

@seasnakes
Copy link
Author

Hi, thanks for your interest. The code has been updated to support images of any resolution. Please pull the latest version and give it another try.

Thank you for your help. We are now able to successfully handle images of various resolutions. I am truly grateful for the remarkable work your team has done and made available to the public. Wishing you all the best in getting your work accepted at a top conference soon.

@seasnakes
Copy link
Author

seasnakes commented Nov 10, 2024

One more question, I was wondering if the Vine model is capable of handling non-square images. Currently, the code crops non-square images into square ones. Could you advise on how we might add watermarks to images of other dimensions without cropping them?

Thank you for your assistance!

@Shilin-LU
Copy link
Owner

One more question, I was wondering if the Vine model is capable of handling non-square images. Currently, the code crops non-square images into square ones. Could you advise on how we might add watermarks to images of other dimensions without cropping them?

Thank you for your assistance!

You could try resizing the image to a square size first, then apply the watermark, and afterward resize it back to its original dimensions. This approach might reduce detection accuracy to some extent, potentially depending on the aspect ratio.

@seasnakes
Copy link
Author

One more question, I was wondering if the Vine model is capable of handling non-square images. Currently, the code crops non-square images into square ones. Could you advise on how we might add watermarks to images of other dimensions without cropping them?
Thank you for your assistance!

You could try resizing the image to a square size first, then apply the watermark, and afterward resize it back to its original dimensions. This approach might reduce detection accuracy to some extent, potentially depending on the aspect ratio.

Are you proposing that for cases like long images, we crop out a square section from the center, add a watermark to that part, and then restore the cropped areas on the sides of the original image? In other words, we would only need to use the central portion of the image for watermarking? 🤔

@Shilin-LU
Copy link
Owner

Yes, the solution you mentioned is also a good approach. Here’s a summary of the two options:

  1. Crop a square section from the center of the image, apply the watermark to this section, and then restore the cropped areas on the sides of the original image. (detection accuracy of this solution would be better)

  2. Resize the entire image to a square format, apply the watermark, and then resize it back to its original dimensions.

@seasnakes
Copy link
Author

seasnakes commented Nov 11, 2024

Yes, the solution you mentioned is also a good approach. Here’s a summary of the two options:

  1. Crop a square section from the center of the image, apply the watermark to this section, and then restore the cropped areas on the sides of the original image. (detection accuracy of this solution would be better)
  2. Resize the entire image to a square format, apply the watermark, and then resize it back to its original dimensions.

the degradation in image quality caused by the watermark is mainly noticeable at the edges. When adding the watermark to the cropped image and then pasting the watermarked image back onto the corresponding area of the original image, you'll clearly notice alternating bright and dark zones at the edges. Replacing these blurred edges with the original image’s portions results in a significant decrease in accuracy during decoding.
No matter if it's the first or second method, the issue of alternating bright and dark zones at the edges persists. Is there a solution that can mitigate this effect while still maintaining robustness?

@Shilin-LU
Copy link
Owner

Yes, you’re right. I believe the second method may result in fewer artifacts. There is always a tradeoff between robustness and image quality. Although our approach outperforms others in terms of PSNR, LPIPS, and FID, some artifacts remain. Further reducing artifacts could be a valuable focus for future research.

@seasnakes
Copy link
Author

seasnakes commented Nov 11, 2024

Yes, you’re right. I believe the second method may result in fewer artifacts. There is always a tradeoff between robustness and image quality. Although our approach outperforms others in terms of PSNR, LPIPS, and FID, some artifacts remain. Further reducing artifacts could be a valuable focus for future research.

I understand. Are there any available methods to minimize the impact on edge image quality? In my testing, the current impact on edge image quality is still quite noticeable.

@Shilin-LU
Copy link
Owner

I believe this issue arises during the training stage, it would be challenging to address it effectively in the inference stage.

(one potential solution in the training stage could be to add a loss term that emphasizes the MSE loss at the edges. However, this approach may unintentionally shift artifacts toward the center of the image, which is also undesirable. This area definitely has room for further improvement).

If high robustness against image editing is not essential for your application, you might consider using VINE-B, which may produce similar artifacts but could offer some improvement, or explore other methods that achieve higher PSNR.

@seasnakes seasnakes reopened this Nov 12, 2024
@seasnakes
Copy link
Author

seasnakes commented Nov 12, 2024

I believe this issue arises during the training stage, it would be challenging to address it effectively in the inference stage.

(one potential solution in the training stage could be to add a loss term that emphasizes the MSE loss at the edges. However, this approach may unintentionally shift artifacts toward the center of the image, which is also undesirable. This area definitely has room for further improvement).

If high robustness against image editing is not essential for your application, you might consider using VINE-B, which may produce similar artifacts but could offer some improvement, or explore other methods that achieve higher PSNR.

Thank you for sharing your insights. By the way, does VINE resist cropping attacks? The paper doesn't seem to mention relevant content on this aspect, and in my tests, the embedded watermark couldn't be accurately distinguished after cropping.

@Shilin-LU
Copy link
Owner

Shilin-LU commented Nov 12, 2024

The main goal of our work is to develop a watermarking model robust to image editing, so we do not include all traditional degradations during training. However, if needed for practical applications, users can fine-tune the model with these traditional degradations. Most of these degradations are differentiable and easier to integrate into the training process compared to handling image edit.

@seasnakes
Copy link
Author

The main goal of our work is to develop a watermarking model robust to image editing, so we do not include all traditional degradations during training. However, if needed for practical applications, users can fine-tune the model with these traditional degradations. Most of these degradations are differentiable and easier to integrate into the training process compared to handling image edit.

20241112-135146

I got it. I mentioned “cropping” because if we strengthen the anti-cropping ability on the performance of the current model, we can actually use it to replace the edges of the watermarked image with the corresponding part of the original image, which can solve the problem of the poor quality of the current edges, I don't know if this is feasible. Can you give some more suggestions about how to fine-tune the model with these traditional degradations .

@Shilin-LU
Copy link
Owner

Shilin-LU commented Nov 12, 2024

20241112-135146

I got it. I mentioned “cropping” because if we strengthen the anti-cropping ability on the performance of the current model, we can actually use it to replace the edges of the watermarked image with the corresponding part of the original image, which can solve the problem of the poor quality of the current edges, I don't know if this is feasible. Can you give some more suggestions about how to fine-tune the model with these traditional degradations .

Understood. However, after fine-tuning with cropping degradation, artifacts may shift toward the center of the image. For more details on fine-tuning, you can refer to the loss functions outlined in the paper and incorporate the desired degradation in the noise layers.

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

2 participants