algorithmic-efficiency icon indicating copy to clipboard operation
algorithmic-efficiency copied to clipboard

fix contrast() transform

Open EIFY opened this issue 1 year ago • 1 comments

See https://github.com/google-research/big_vision/issues/109, fix suggested by @yeqingli in https://github.com/tensorflow/models/pull/11219#pullrequestreview-2355525720.

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: https://github.com/mlcommons/algorithmic-efficiency/blob/86d2a0d23c9a3192f878406edc72547fcf0568ec/algorithmic_efficiency/workloads/imagenet_resnet/imagenet_pytorch/randaugment.py#L107-L108

So the JAX counterpart should be correct as well.

EIFY avatar Nov 28 '24 22:11 EIFY

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

github-actions[bot] avatar Nov 28 '24 22:11 github-actions[bot]