Issue Loading Object Classifier Correctly

Encountering the following issue in m11 after going through the following process:

  1. Create a training project, containing 100 IF images.

  2. Run the following script to detect cells and compute features:

//Set image type

//Clear annotations and detections

//Create a full image annotation 

//Select annotations 

//Run cell detection
runPlugin('qupath.imagej.detect.cells.WatershedCellDetection', '{"detectionImage": "DAPI", "requestedPixelSizeMicrons": 0.5,  "backgroundRadiusMicrons": 8.0,  "medianRadiusMicrons": 0.0,  "sigmaMicrons": 1.5,  "minAreaMicrons": 10.0,  "maxAreaMicrons": 400.0,  "threshold": 1.0,  "watershedPostProcess": true,  "cellExpansionMicrons": 2.5,  "includeNuclei": true,  "smoothBoundaries": true,  "makeMeasurements": true}');

//Calculate intensity features 
runPlugin('qupath.lib.algorithms.IntensityFeaturesPlugin', '{"pixelSizeMicrons": 2.0,  "region": "Square tiles",  "tileSizeMicrons": 25.0,  "channel1": false,  "channel2": false,  "channel3": false,  "channel4": true,  "channel5": false,  "doMean": true,  "doStdDev": true,  "doMinMax": true,  "doHaralick": true,  "haralickMin": 5.0,  "haralickMax": 80.0,  "haralickDistance": 1,  "haralickBins": 32}');

//Calculate smoothed features
runPlugin('qupath.lib.plugins.objects.SmoothFeaturesPlugin', '{"fwhmMicrons": 25.0,  "smoothWithinClasses": false,  "useLegacyNames": false}');
  1. Go to Classify --> Object Classification --> Train object classifier. Select Object filter: all, Classifier type: Random Trees, Features: Selected (and select some), Classes: all, Training; all annotations, and hit live update.

  2. Use the live update to guide me and make annotations throughout the project as the classifier improves.

  3. Save the classifier.

The issue arises when I try to load that classifier on the same images (either in the same project or reuploaded to a different one, using Classify --> Object Classifier --> Load Object Classifier). The classifications aren’t the same as when I was training the classifier, but shouldn’t it be if the same annotations are there…or if the classifier is based on those annotations?

I’ve made sure all of the steps / feature calculations are the same beforehand…and if this was the issue I doubt I’d see this problem in the project in which the classifier was trained too.

Any help appreciated, thanks!


I just wanted to quickly point out that this is not how the Object classifier currently works. It will only be based on the annotations in your current image, not all images in the project. I believe this is under development, but currently if you want to train across a project you should make use of Create combined training image from regions of various images, or use the old Create detection classifier. If you use the older classifier (which has the option to rebuild from project or carry training objects over from image to image), you may want to go back to M10 (or build updated versions of M12!), as M11 has an issue with loading the old version of the detection classifiers after you save them.

You can quickly test this for yourself by using completely different classes in two different images.

Also, thanks for giving such a clear description of your problem!

1 Like

This helps a lot, I had no idea this was the case. The old classifier seems to be working - thanks so much Mike!

1 Like

Note that the recent update to M12 should have fixed many of the classifier issues.

1 Like