Deep learning fast.ai ImageDataBunch中的序号类

Deep learning fast.ai ImageDataBunch中的序号类,deep-learning,pytorch,image-recognition,fast-ai,Deep Learning,Pytorch,Image Recognition,Fast Ai,我有顺序分类标签,我想在一个应用程序中使用 在我的数据框中,我指定如下内容: from pandas.api.types import CategoricalDtype cat_type = CategoricalDtype(categories=['L', 'M', 'H'], ordered=True) label_df["adj_gr"] = label_df["adj_gr"].astype(cat_type) #Series shows as: Categories (3, obj

我有顺序分类标签,我想在一个应用程序中使用

在我的数据框中,我指定如下内容:

from pandas.api.types import CategoricalDtype
cat_type = CategoricalDtype(categories=['L', 'M', 'H'], ordered=True)
label_df["adj_gr"] = label_df["adj_gr"].astype(cat_type)


#Series shows as: Categories (3, object): [L < M < H]
对于神经网络,顺序是否与ML模型一样重要

令人沮丧的是,当我有几个类别时,我
plot\u composition\u matrix()


设置:
python==3.7,pytorch==1.4,fastai==1.0.60

可能
data.classes
只是返回一个无序的类列表,但数据本身仍然保持有序。你试过查看
数据
看它是否仍然有意义吗?我没有,你知道怎么做吗?
data
的数据类型是一个ImageDataBunch。我已经有一段时间没有使用Fastai了,但是请尝试
data[0]
data[1]
。databunch实际上只是一种对训练、验证和测试集进行分组的方法。
data.classes
可能只是返回一个无序的类列表,但数据本身仍然保持有序。你试过查看
数据
看它是否仍然有意义吗?我没有,你知道怎么做吗?
data
的数据类型是一个ImageDataBunch。我已经有一段时间没有使用Fastai了,但是请尝试
data[0]
data[1]
。databunch实际上只是一种将培训、验证和测试集分组的方法
data = ImageDataBunch.from_df("", df=label_df, fn_col="path", label_col="adj_gr", valid_pct=0.2,
        ds_tfms=tfms, size=224, num_workers=4, padding_mode='border').normalize(imagenet_stats)
data.classes
OUT: [H, L, M]