WEKA Segmentation applying classifier on selected pixels

Hello,

In WEKA segmentation, when applying a classifier, it will work on the entire input image. Is there a way to apply the classifier on only a subset of the input image? For example, by supplying a mask or a set of ROIs to define the areas to be classified (or to be excluded in the classification). This will be very useful when we working on some pre-classified images and we want train and apply a model for a subset of the input image.

Thanks,

Qiao

Hi Qiao,

Do you have any clues on this? I have the same problem.

I want to exclude some fixed regions in my picture stack because they contain an artifact that disturbs the classification.

I was thinking of the following approaches, but they don’t give the desired result. Maybe my post triggers some answers from you or the community:-)

  1. I have freehand-drawn the regions that must be excluded and filled it with white (clear…invert…) before running the WEKA tool. In the classification settings I added a class “artifact”. I was hoping that the white color would force the classifier to assign the label “artifact” to all pixels in those regions, but it doesnt. The result is still dependant on the quality of the classification settings.

  2. Also masking out those regions after running the tool is not a solution, because the labels outside the artifact regions are sometimes also labeled as artifact.

It would in fact be helpful if there would be a training feature that assigned a certain class name (“artifact”) in 100% of the cases to the white pixels and never to any other pixels.

One other way could be that the classification would only be done on the pixels inside a non rectangular region, without being affected by proximity to it’s border.

Does anyone have a clue?

Hi Qiao,

I have been thinking about this.

Maybe it is an option to do classification normally but generate probability maps for the classes instead of the classified images. Then you could use a slightly modified script to generate the classification from those probabilities, see https://gist.github.com/iarganda/c7fc0a88b8d2737c9d3d. This script should also take into account a binary probability map for the regions that you want to exclude/include.

Fred

1 Like

Thanks @Fred_ckx. You had a few good points there. I was hoping to have either a mask to exclude some certain regions or to support adding a NOT of Class # option (similar to None of the Above in a multiple-choice question).

This is a brilliant idea and might work for us. Thanks for sharing @Fred_ckx

1 Like