Applying a trained classifier model with custom-made features using Advanced Weka Segmaentation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Applying a trained classifier model with custom-made features using Advanced Weka Segmaentation

Dionysios Lefkaditis
Hello everyone,

I have successfully trained a weka classifier that includes custom-made features. I have now made a simple script that applies this classifier model to testing images. It all runs smoothly without any problems. However, I am puzzled on how the custom-made features are computed so that the classifier is applied on an unseen test image, while I can understand that the code of the predefined (default) features of "Advanced Weka Segmaentation" plugin is known. Are they really properly computed or not? Are they contained in the binary file of the classifier model? It just seems too easy and simple to me, so I am suspicious :p

thank you in advance,
Dionysios


My simplistic script follows:

import ij.*;
import ij.process.*;
import trainableSegmentation.*;
import hr.irb.fastRandomForest.*;

// testing input image (it could be a stack or a single 2D image)
image = IJ.openImage("/home/dionysis/fermi/media/data/Terumo/Images/SPLIT/train/reject/KNIIC_BC_Cam1_Pit2_Image1018.bmp");
IJ.run(image, "32-bit", "");

// create Weka segmentator
seg = new WekaSegmentation(image);

 
// Load Classifier
seg.loadClassifier("/home/dionysis/fermi/media/data/Terumo/Images/SPLIT/6class.model");
IJ.log("Classifier loaded");
 

// Apply trained classifier to test image and get probabilities
prob = seg.applyClassifier(image, 0, true );
IJ.log("Classifier applied");
 
// Display results
prob.setTitle( "Probability maps of test image" );
IJ.log("Showing results");
prob.show();

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html