Skip to content

Conversation

@dxoigmn
Copy link
Contributor

@dxoigmn dxoigmn commented Mar 28, 2023

What does this PR do?

The current Projector is not batch/tuple aware, which is necessary for attacks on datasets where input images have different shapes (e.g., COCO). This PR makes it so.

Type of change

Please check all relevant options.

  • Improvement (non-breaking)
  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Testing

Please describe the tests that you ran to verify your changes. Consider listing any relevant details of your test configuration.

  • make test

Before submitting

  • The title is self-explanatory and the description concisely explains the PR
  • My PR does only one thing, instead of bundling different changes together
  • I list all the breaking changes introduced by this pull request
  • I have commented my code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have run pre-commit hooks with pre-commit run -a command without errors

Did you have fun?

Make sure you had fun coding 🙃

@dxoigmn dxoigmn marked this pull request as ready for review March 28, 2023 20:29
@dxoigmn dxoigmn requested a review from mzweilin March 28, 2023 20:29
@mzweilin
Copy link
Contributor

Do you have a plan for modality-aware?

@dxoigmn
Copy link
Contributor Author

dxoigmn commented Mar 28, 2023

Nope.

"""Apply a list of perturbation modifier."""

def __init__(self, projectors: List[Projector]):
def __init__(self, projectors: list[Projector]):
Copy link
Contributor

@mzweilin mzweilin Mar 29, 2023

Choose a reason for hiding this comment

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

Do you think it's better to make it a dictionary so that it's more easily configurable in Hydra? Like that in Enforcer:

def __init__(self, constraints: dict[str, Constraint] | None = None) -> None:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that should live in another PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My read of the Projectors class is that they need a wholesale redesign because there's a lot of mixing of functionality instead of focusing on composition.

@dxoigmn dxoigmn requested a review from mzweilin March 29, 2023 18:13
@mzweilin
Copy link
Contributor

I have made a shared modality-batch-aware mechanism in #115 for Initializer, Projector and Composer.

@dxoigmn
Copy link
Contributor Author

dxoigmn commented Apr 1, 2023

I have made a shared modality-batch-aware mechanism in #115 for Initializer, Projector and Composer.

Okay. Is the idea that this PR should be updated to use that? I also saw there was an opportunity to DRY the logic but wanted to wait until after we get everything merged. I'll try to read through what you wrote though.

@dxoigmn
Copy link
Contributor Author

dxoigmn commented Apr 3, 2023

@mzweilin: I think it's better to merge this now than wait for the generic dispatch to be done since it updates the tests to conform to the existing interface.

Copy link
Contributor

@mzweilin mzweilin left a comment

Choose a reason for hiding this comment

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

LGTM

@dxoigmn dxoigmn merged commit dbc6f65 into main Apr 6, 2023
@dxoigmn dxoigmn deleted the make_projector_batch_aware branch April 6, 2023 14:41
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.

2 participants