You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we try to pass unbatched single rgb image to RandomGrayscale it fails.
Code to reproduce
import keras
from keras import layers
import matplotlib.pyplot as plt
import numpy as np
img=np.random.uniform(size=(224,224,3))
# plt.imshow(img)
# plt.show()
out=layers.RandomGrayscale(1)(np.array(img))
# plt.imshow(out)
# plt.show()
I get the following error
/usr/local/bin/python3 /Users/hellorahul/PyCharmMiscProject/script.py
Traceback (most recent call last):
File "/Users/hellorahul/PyCharmMiscProject/script.py", line 8, in <module>
out=layers.RandomGrayscale(1)(np.array(img))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/layers/preprocessing/tf_data_layer.py", line 49, in __call__
return super().__call__(inputs, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/utils/traceback_utils.py", line 122, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/keras/src/backend/tensorflow/numpy.py", line 2616, in squeeze
raise ValueError(
ValueError: Exception encountered when calling RandomGrayscale.call().
Cannot squeeze axis=0, because the dimension is not 1.
Arguments received by RandomGrayscale.call():
• data=tf.Tensor(shape=(224, 224, 3), dtype=float32)
• training=True
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
When we try to pass unbatched single rgb image to RandomGrayscale it fails.
Code to reproduce
I get the following error
The text was updated successfully, but these errors were encountered: