ashpy
ashpy copied to clipboard
[FEATURE] - Add a flag for correct scaling of logged TensorBoard images
System information
- AshPy version (you are using): 0.4.0
- Are you willing to contribute it (Yes/No): Yes
Describe the feature and the current behavior/state TensorBoard images should be logged in the [0, 1] range when float. Currently, we do not provide any type of automatic handling of this scaling, so if you are training on [-1, 1] and using our callbacks, images will be logged without scaling.
Will this change the current API? How?
Small change to ashpy.utils.log() and all the callbacks using it, they will now accept a new boolean argument auto_tb_scaling controlling this behavior.
Who will benefit with this feature? Anyone using the default logging facilities.
Any Other info
Do you think that a boolean flag is enough?
If the input is float tensorboard wants the range [0,1] so we need to scale the image if the range is [-1, 1] or if the range is [0, 255] (Are there people using the range [0, 255] and float dtype?).
In this case we can accept an enum describing the input range.
Yeah, an Enum is probably better.
I guess we should go with this approach:
- If the image
dtypeistf.uin8, then we expect values on [0-255] (follow the tensorflow convention) - If the image
dytpeistf.float*then the image should be in the range [0.1] (tensorflow convention). We can support only the most common scenario that's an image with values squashed in [-1,1]. Thus a boolean for this case is enough IMHO - Else raise error
Initial implementation in #56
See https://github.com/zurutech/ashpy/pull/56/commits/18f9e41d7bc639b1db868e1fcbaa302bfa2616ec#diff-b3393cc30d90b7f5a9c26ecc968ef758R44