label=[0,0,1,1,2,2]
n_class=3
onehot_label = np.array([[1 if i ==<
python一句话实现将普通标签转换成onehot标签: np.array([[1 if i == l else 0 for i in range(n_class)] for l in label])
最新推荐文章于 2022-11-03 12:00:07 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)
label=[0,0,1,1,2,2]
n_class=3
onehot_label = np.array([[1 if i ==<