This is my first post so sorry if I am not so clear. I have been searching on the internet and read about API to no avails but found no solution (which should be obvious).
I have been trying to write a macro for multiclass (more than 2 class) classifier:
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();
where the fileori is path to original 2D-grey scaled image.
filelabel is the path to the .tif label file, with pixel values from 0, 1, 2, 3 corresponding to different classes.
When I run the script, it always recognizes only class 0 and class 1. Pixels with 2 and 3 value are ignored.
Using a label with pixel values from 1, 2, 3, 4 does not help. Only class 0 (in this case with 0 sample) and class 1 are taken into account.
What I need to do for more-than-2-class classification?
Thank you,