Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about keras.utils.to_categorical(y, num_classes=self.n_classes) #3

Open
hktxt opened this issue Nov 14, 2018 · 0 comments
Open

about keras.utils.to_categorical(y, num_classes=self.n_classes) #3

hktxt opened this issue Nov 14, 2018 · 0 comments

Comments

@hktxt
Copy link

hktxt commented Nov 14, 2018

I have n_classes = 1251, but it come up with error:


RemoteTraceback Traceback (most recent call last)
RemoteTraceback:
"""
Traceback (most recent call last):
File "/data/hktxt/anaconda3/envs/tensorflow/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/data/hktxt/anaconda3/envs/tensorflow/lib/python3.6/site-packages/keras/utils/data_utils.py", line 401, in get_index
return _SHARED_SEQUENCES[uid][i]
File "", line 28, in getitem
X, y = self.__data_generation(list_IDs_temp)
File "", line 55, in __data_generation
return X, keras.utils.to_categorical(y, num_classes=self.n_classes)
File "/data/hktxt/anaconda3/envs/tensorflow/lib/python3.6/site-packages/keras/utils/np_utils.py", line 34, in to_categorical
categorical[np.arange(n), y] = 1
IndexError: index 1251 is out of bounds for axis 1 with size 1251

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant