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

fix contrast() transform #821

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

fix contrast() transform #821

wants to merge 1 commit into from

Conversation

EIFY
Copy link

@EIFY EIFY commented Nov 28, 2024

See google-research/big_vision#109, fix suggested by @yeqingli in tensorflow/models#11219 (review).

In short, the original implementation of the contrast() transform which is copied 4-5+ times is broken:
What is meant to be the mean RGB value ends up being (h*w) / 256, which is always 196 for 224x224 crop.
This bug is often left unfixed, but here we are comparing the JAX vs. PyTorch implementations and the latter has the correct contrast transform:

elif op_name == 'Contrast':
img = F.adjust_contrast(img, magnitude)

So the JAX counterpart should be correct as well.

@EIFY EIFY requested a review from a team as a code owner November 28, 2024 22:33
Copy link

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

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.

1 participant