Weka - accuracy of segmentation between different images

Post is related to accuracy of Weka tool to segment images by using classifier trained (and working fine) on one image and using it on another image (where in this case it doesn’t segment well at all)

I am using Weka segmentation to segment stained cell lines.

I trained classifier with multiple features on signal vs background pixels. It works fine on the training image but once applied to another image > it doesn’t work fine.

see images below… red arrows shows bad/missed segmentation… image with blue arrows is the good one working fine.


When I do opposite, using the 2nd image for training > its classifier works fine on it but segment very bad on 1st image.

Q1- how can I solve/enhance this issue ?

Q2- Another question, Segmenting each image with its own trained classifier (will take time) works better but will lead to Non-comparable results…right ???
as I believe they should be segmented with same algorithm/features to avoid variability in segmentation

Q3- Re-training first the classifier with its data on different images and updating it to have better segmentation then using it again to classify all the training-used images, would it work better ? would it do over segmentation ?

Sorry for long topic and many questions.

Thanks in advance for help :slight_smile:

the behavior you observe has to be expected. You are training your classifier with only one image and maybe you give too much details in the training data you provide. So what you get is overfitting, i.e. the classifier kind of learns the training data by heart and does not generalize to other input data.

What you can do:

  • divide your data into training and test data
  • train the classifier with multiple images, do not do a full segmentation of your objects when providing the training data, just examples of the different situations, like background, inside objects, border of objects, …
  • Run the classifier on your reserved test data. Does it work on the data it has not been trained on, i.e. does it generalize? If yes, use it, if not go back to training

Feel free to have a look at are workshop materials about machine learning at github.

Best regards,