我需要平衡一些图像数据集,如何使用SMOTE变体或 imblearn SMOTE 方法处理图像?我不知道怎么做,因为它们似乎只使用数字数据集。
如何使用可用的包在图像数据上运行 SMOTE?
数据挖掘
美国有线电视新闻网
阶级失衡
打击
2022-03-10 16:35:58
2个回答
这可能会有所帮助 - https://github.com/tgsmith61591/smrt。合成少数重建技术使用变分自动编码器。
我们的图像数据通常采用 (8000,128,64,3) 格式,如果我们直接传递给 SMOTE,那么它会抛出错误,因为它被设计为输入 (n_examples, n_feature)。
我们需要重塑我们的形象:
dataForSmote = x.reshape(8000, 128 * 64 * 3)
然后,
smote = SMOTE(sampling_strategy = 0.8)
x_smote, y_smote = smote.fit_resample(dataForSmote , y)
X_smote = x_smote.reshape(10800, 128, 64, 3)
在这里,我假设 6K 为多数集,2K 为少数集,如果我们计算 6K 的 80%,我们得到 4.8K,即 2.8K 新合成示例添加的总数变为 8+2.8 = 10.8K
使用X_smote和y_smote进行培训。
其它你可能感兴趣的问题