keras-cv icon indicating copy to clipboard operation
keras-cv copied to clipboard

RandAugment.get_standard_policy should propagate value range to RandomBrightness and RandomContrasts

Open martin-gorner opened this issue 3 years ago • 8 comments

When using RandomBrightness and RandomContrasts from RandAugment.get_standard_policy() with value_range=(0,1), two issues arise:

  • RandomContrast computes output values correctly but does not clip them to the (0,1) range
  • RandomBrightness computes incorrect output values that a massively out of range, and does not clip them either

This issue canot be fixed until TF 2.10

Please note that this issues does not affect RandAugment(value_range=(0,1)) which rescales internally to range (0,255) before applying all augmentations. RandAugment(value_range=(0,1)) works correctly.

Repro Colab: https://colab.research.google.com/drive/1dig1GRPRW_7MwKV-Z0z_2tAVqnFjJ6PH?usp=sharing

martin-gorner avatar May 11 '22 20:05 martin-gorner

This issue canot be fixed until TF 2.10

I think that for RandomBrightness the value_range arg is already available with TF 2.9rc2 right?

For RandomContrasts instead it is still not available also in master.

bhack avatar May 11 '22 21:05 bhack

This issue canot be fixed until TF 2.10

I think that for RandomBrightness the value_range arg is already available with TF 2.9rc2 right?

For RandomContrasts instead it is still not available also in master.

I think it came after the branch cut. Tested it today in a local runtime.

LukeWood avatar May 12 '22 00:05 LukeWood

I think it came after the branch cut. Tested it today in a local runtime.

If you click you can see that I'am on the rc2 tag.

bhack avatar May 12 '22 00:05 bhack

I think it came after the branch cut. Tested it today in a local runtime.

If you click you can see that I'am on the rc2 tag.

Weird, I just have installed the wrong version. Good to know, with 2.9 we can fix 1/2 the issue. We will do so before KerasCV 0.2.0

LukeWood avatar May 12 '22 01:05 LukeWood

Great! This will fix the problem with RandomBrightness which outputs the wrong values. The lack of clipping is slightly less important because it is smaller in magnitude.

martin-gorner avatar May 12 '22 02:05 martin-gorner

https://github.com/keras-team/keras-cv/pull/429

bhack avatar May 12 '22 10:05 bhack

Thanks for reporting the issue! We have consolidated the development of KerasCV into the new KerasHub package, which supports image, text, and multi-modal models. Please read the announcement. KerasHub will support all the core functionality of KerasCV.

KerasHub can be installed with !pip install -U keras-hub. Documentation and guides are available at keras.io/keras_hub.

With our focus shifted to KerasHub, we are not planning any further development or releases in KerasCV. If you encounter a KerasCV feature that is missing from KerasHub, or would like to propose an addition to the library, please file an issue with KerasHub.

sachinprasadhs avatar May 07 '25 22:05 sachinprasadhs

This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.

github-actions[bot] avatar Jun 23 '25 02:06 github-actions[bot]

This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.

github-actions[bot] avatar Jul 07 '25 02:07 github-actions[bot]