python - How to make random gamma correction with tensorflow? -
how make random gamma correction tensorflow?
i trying this:
a, b = tf.unstack(tf.random_uniform([2], dtype=tf.float32)) r = tf.image.adjust_gamma(image, gamma=a, gain=b)
but i've got error result:
file "/venv/local/lib/python3.5/site-packages/tensorflow/python/ops/image_ops_impl.py", line 999, in adjust_gamma if gamma < 0: file "/venv/local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 564, in __bool__ raise typeerror("using `tf.tensor` python `bool` not allowed. " typeerror: using `tf.tensor` python `bool` not allowed. use `if t not none:` instead of `if t:` test if tensor defined, , use tensorflow ops such tf.cond execute subgraphs conditioned on value of tensor.
here gamma
, gain
not tensor
, normal python scalar
gamma = np.random.uniform(low=0, high=3, size=[1,]) gain = np.random.uniform(low=0, high=1, size=[1,]) r = tf.image.adjust_gamma(image, gamma=gamma[0], gain=gain[0])
Comments
Post a Comment