Skip to content

Problem with transfer of classification from stack to images #63

@christianrickert

Description

@christianrickert

Hello, there's something curious about the transfer of my classification model from a training stack to my experimental dataset:
The probability map for the stack looks fine, but the probability map for a single image from the same stack looks different - using the same model for classification.

@iarganda suggested in a response to another issue to train on either a stack or on a sequence of images (for multiple images).
I've trained on a stack with 30 images depicting nuclei - using fairly computationally expensive features.

Here's the probability map for the first image of the stack:

stack-probabilty

And here's the probability map for the same image extracted from the stack:

image-probabilty

The segmentation results for both images differ significantly, even though the same classification model has been used.

The macro below will create the probability maps for the training stack and then duplicate the first stack image and create the probability map with the same model for comparison: it takes roughly 25 min on my system with a peak memory usage of about 13.5 GB.

// load image stack
file = File.openDialog("Select example.tif");
title = File.getName(file);
folder = File.getParent(file);
classifier = folder + File.separator + "example.model";

wekaversion = "v3.2.34";
run("Bio-Formats Windowless Importer", "open=[file]");

// create probability map for stack of images
selectWindow(title);
run("Trainable Weka Segmentation");
selectWindow("Trainable Weka Segmentation " + wekaversion);
wait(5000);
call("trainableSegmentation.Weka_Segmentation.loadClassifier", classifier);
call("trainableSegmentation.Weka_Segmentation.getProbability");
selectWindow("Probability maps");
rename("Probability maps - training stack");
close("Trainable*");

// create probability map for image (from stack)
selectWindow(title);
run("Duplicate...", "title=image");
run("Trainable Weka Segmentation");
wait(5000);
selectWindow("Trainable Weka Segmentation " + wekaversion);
call("trainableSegmentation.Weka_Segmentation.loadClassifier", classifier);
call("trainableSegmentation.Weka_Segmentation.getProbability");
selectWindow("Probability maps");
rename("Probability maps - image from stack");
close("Trainable*");

The files required for reproduction of the issue can be downloaded here: example.zip (MD5: EA367E1226010A1E14B3A1570DA2DD5F)

As a consequence, I can't train on a larger dataset to improve the segmentation results.

Any idea what went wrong with my approach or what I could do to prevent this issue in the future?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions