Shilin-LU / VINE

"Robust Watermarking Using Generative Priors Against Image Editing: From Benchmarking to Advances" (Official Implementation)
MIT License
142 stars 18 forks source link

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

Open seasnakes opened 5 days ago

seasnakes commented 5 days ago

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

image

Shilin-LU commented 5 days ago

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 commented 4 days ago

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 commented 3 days ago

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 commented 3 days ago

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 commented 3 days ago

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 commented 3 days ago

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 commented 2 days ago

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 commented 2 days ago

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 commented 2 days ago

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 commented 2 days ago

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 commented 2 days ago

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 commented 2 days ago

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 commented 2 days ago

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 commented 1 day ago

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. We may also release the fine-tuning code once our work is accepted.