问题描述
这是我的第一篇文章,如果我不太清楚,请见谅。我一直在互联网上搜索并阅读 API 无济于事,但没有找到解决方案(这应该是显而易见的)。
从weka wiki示例中,我一直在尝试为多类(超过2类)分类器编写宏:
segmentator = new WekaSegmentation();
import hr.irb.fastRandomForest.FastRandomForest;
// create random forest classifier
rf = new FastRandomForest();
// set number of trees in the forest
rf.setNumTrees( 100 );
// set number of features per tree (0 for automatic selection)
rf.setNumFeatures(0 );
// set random seed
rf.setSeed( (new java.util.Random()).nextInt() );
// set classifier
segmentator.setClassifier( rf );
// Add training image
imageOri = IJ.openImage( fileori );
imageLabel = IJ.openImage( filelabel );
segmentator.addLabeledData( imageOri,imageLabel,{});
// Train classifier
segmentator.trainClassifier();
其中 fileori 是原始 2D 灰度缩放图像的路径。 filelabel是.tif标签文件的路径,0、1、2、3的像素值分别对应不同的类。
当我运行脚本时,它总是只识别 0 类和 1 类。具有 2 和 3 值的像素被忽略。
使用像素值为 1、2、3、4 的标签无济于事。仅考虑第 0 类(在本例中为 0 个样本)和第 1 类。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)