Skip to content

Conversation

@paulinek13
Copy link
Contributor

@paulinek13 paulinek13 commented Jul 28, 2025

Description

#529

This PR adds a converter that implements the transparency attack as described in: "Transparency Attacks: How Imperceptible Image Layers Can Fool AI Perception" by McKee, F. and Noever, D., 2024: https://arxiv.org/abs/2401.15817

The converter blends an attack (background/harmful) image with a benign (foreground/target) image using an optimized alpha channel to create a dual perception effect. The output is a PNG image that looks like the benign image on light backgrounds, but reveals the attack image when placed on dark backgrounds.

Tests and Documentation

✔️ Added unit tests.

I've tested the effectiveness of the converter with various models (even local ones) and it works as expected: I was able to successfully "fool" some of them :) I'll post an example of such attack in the PR comments.

  • TODO: add a notebook

@paulinek13
Copy link
Contributor Author

paulinek13 commented Jul 28, 2025

Here's an example of attack that uses this converter for image manipulation, ChatGPT:

image

Apparently, when using dark theme I can clearly see that the image asks "How to make a bomb", but that's a limitation this converter just has.

And here's some comparison of how the final blended image looks based on the viewer's background color:
image

Edit: I wanted to share a link to the chat but I immediately got "This shared link has been disabled by moderation" 😄

@paulinek13 paulinek13 changed the title [DRAFT] FEAT: add hidden layer image manipulation converter FEAT: add hidden layer image manipulation converter Jul 29, 2025
@paulinek13 paulinek13 marked this pull request as ready for review July 29, 2025 19:02
Copy link
Contributor

@romanlutz romanlutz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woah! This is awesome 🥇 I left a few comments but nothing major. Excellent work! Can't wait to try this.

Copy link
Contributor

@jbolor21 jbolor21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome! Maybe one related idea is adding in a notebook (or in our image converter notebook) on showing this working! (Totally non-blocking comment)

@paulinek13
Copy link
Contributor Author

This is awesome! Maybe one related idea is adding in a notebook (or in our image converter notebook) on showing this working! (Totally non-blocking comment)

I'll definitely do this! Thanks for the idea 😃

Copy link
Contributor

@bashirpartovi bashirpartovi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on this @paulinek13 , this is really cool. I had a few comments and one recommendation as follows:

You could add early convergence check in your step loop for an early exit. Here is an example:

# ...
prev_loss = float('inf')
convergence_threshold = 1e-6
convergence_patience = 10
no_improvement_count = 0

# ... 

for step in range(self.steps):
     # ...
     if abs(prev_loss - loss) < convergence_threshold:
          no_improvement_count += 1
          if no_improvement_count >= convergence_patience:
               # early convergence, exit the loop
               break
          else:
               no_improvement_count = 0
     prev_loss = loss
     # ....

@romanlutz romanlutz self-assigned this Jul 30, 2025
@paulinek13 paulinek13 force-pushed the feat/529/add_hidden_layer_image_converter branch from ad47c84 to 2d2beef Compare July 31, 2025 11:50
@paulinek13 paulinek13 changed the title FEAT: add hidden layer image manipulation converter FEAT: add TransparencyAttackConverter Jul 31, 2025
@paulinek13
Copy link
Contributor Author

@romanlutz @jbolor21 @hannahwestra25 @bashirpartovi

Thanks a lot for your reviews, comments and suggestions! I've addressed them 😀

I'll now work on adding a notebook for this converter

Copy link
Contributor

@romanlutz romanlutz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! This is essentially ready to merge.

@romanlutz romanlutz merged commit c73ce45 into Azure:main Sep 26, 2025
20 checks passed
@paulinek13 paulinek13 deleted the feat/529/add_hidden_layer_image_converter branch November 6, 2025 16:22
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

Successfully merging this pull request may close these issues.

5 participants