【发布时间】:2020-02-09 07:03:28
【问题描述】:
在keras documentation 中,提到了"categorical": 2D numpy array of one-hot encoded labels. Supports multi-label output.,但在我的情况下,它不支持。
train_generator_1 = train_data_gen.flow_from_dataframe(annotation,
directory="data",
target_size=(img_shape,img_shape),
x_col="Left",
y_col=['N','D','G','C','A','H','M','O'],
class_mode='categorical',
shuffle=False,
batch_size=batch_size,
seed=7)
附上标签图片。
我得到的错误是TypeError: If class_mode="categorical", y_col="['N', 'D', 'G', 'C', 'A', 'H', 'M', 'O']" column values must be type string, list or tuple.
【问题讨论】:
-
检查 y_col 是否包含任何 nan 值或参考此链接以匹配您的数据类型github.com/keras-team/keras-preprocessing/blob/…
-
不,它们不包含缺失值