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 using the image_dataset_from_dataframe() function, which calls the image_dataset_from_paths_and_labels() function, given a dataframe whose label column contains string categorical labels (e.g. ['apple', 'orange', 'kiwi']), using the "categorical" label_mode, the following error results:
UFuncTypeError: ufunc 'maximum' did not contain a loop with signature matching types (dtype('<U25'), dtype('<U25')) -> None
where np.max(labels) is being called, but labels contains strings.
Maybe doing a separate case for string 'categorical' labels, with e.g. num_classes = np.unique(labels).shape[0] would solve this?
P.S. It also looks like you have an assertion that would not allow multi_class as a label type (line 491):
if label_mode not in {'int', 'categorical', 'multi_label', 'binary', None}:
but parts of the code (line 542 if label_mode in ('multi_class', 'multi_label'):) seem to allow for it.
(If you like, I could make this a separate issue for tracking.)
The text was updated successfully, but these errors were encountered:
When using the
image_dataset_from_dataframe()
function, which calls theimage_dataset_from_paths_and_labels()
function, given a dataframe whose label column contains string categorical labels (e.g. ['apple', 'orange', 'kiwi']), using the "categorical"label_mode
, the following error results:UFuncTypeError: ufunc 'maximum' did not contain a loop with signature matching types (dtype('<U25'), dtype('<U25')) -> None
This traces back to:
where
np.max(labels)
is being called, butlabels
contains strings.Maybe doing a separate case for string 'categorical' labels, with e.g.
num_classes = np.unique(labels).shape[0]
would solve this?P.S. It also looks like you have an assertion that would not allow
multi_class
as a label type (line 491):but parts of the code (line 542
if label_mode in ('multi_class', 'multi_label'):
) seem to allow for it.(If you like, I could make this a separate issue for tracking.)
The text was updated successfully, but these errors were encountered: