Issues with the new "Train object classifier" in M12

In the latest M12 when trying the new “Train object classifier”, the Save button does not seem to do anything. When I looked in the classifier folder of the project, there isn’t any classifier files there.

Additionally, I tried the new feature to “Load training” after creating training annotations across several slides but it does not appear to update the classification with “Live update” on the current field of view. Perhaps I am not using it as intended?

Could these be bugs?

Can you specify in more detail exactly what steps you tried, and if you see any relevant text under View → Show log?

You need to make sure you save the annotations you make on other images in your project, and select them after pressing Load project. The number of loaded images should then appear in the button.

Screenshot 2020-05-20 at 13.54.56

Saving should work in the same way as for a thresholder/pixel classifier.
After typing a name and pressing the Save button, the classifier name should change to italics to indicate that it has been saved.

1 Like

Specifically, what I did was a bit convoluted…

I initiated this project I am working on in M9 while waiting for M12 to be released. I did this to script the pixel classifier (unrelated here). As I progressed to starting cell classification using the object classifier, I created training annotations over cell detections on several slides and saving these annotations on the slides (save project).

Mid way through this, M12 got released and I launched the project in M12. Everything seemed fine. The changelog for M12 suggested that the new “Train object classifier” seems to be scriptable and can load training from multiple images, so I wanted to try it out.

With all the training annotations already present in the project from M9, I opened the “Train object classifier” function, kept the default settings, used the “Load training” button, selected all my images and clicked Apply. I now see this:

I then click “Live update” but I do not see any change in classification for cell detections. The log showed this warning:

WARN: No measurements - cannot update classifier

Hoping to be able to save and load the combined training, I typed in my classifier name to save “Nuclei classifier 2” and clicked “Save”. The log showed this warning:

WARN: Invalid classifier name Nuclei classifier 2 replaced with Nuclei classifier 2
WARN: No measurements - cannot update classifier

Is one of your images open at the time you choose ‘live update’?

I’ve tried it and it works for me… I also don’t see anything really wrong with what you did - but I’d suggest trying a new minimal project from scratch to see if you can get it working under more conventional conditions first :slight_smile:

Yes, one of my images is open at the time I chose “Load training” and “Live update”. Should I reload it?

Also it’s strange that “Nuclei classifier 2” is considered an invalid classifier name.

I think I will stick with the old Detection classifier for this project as I have already made some progress. I will play around with the new Object classifier in a new project in the future.

Thanks for the hard work Pete!

1 Like

Well, that overly-enthusiastic warning is just a bug :slight_smile: Missed a ! in the code, fixed it now…

For the ‘Features’ option, do you have All measurements selected? It looks that way in your screenshot, but if not it would explain the error (unless you have also specifically selected other measurements).

Also, I assume that the annotations you are using for training are unlocked, otherwise you’d need to change that setting.

Yes, All measurements is selected.

All my training annotations are indeed unlocked. My tissue annotations (to limit analysis to tissue sections and not glass) are locked. I also changed the tissue class name to null in case it would impact classification.

1 Like

Thank, ok so I could replicate it! :smiley:

For me it happens if any of my ‘other’ training images are lacking measurements (which can also mean they are lacking detections entirely).

The reason: when selecting ‘All measurements’, QuPath is now trying to get ‘all measurements that are common to all the training objects’… so that if you have extra measurements for some objects but not others, these won’t be included.

The trouble is that it tries this too enthusiastically, and so if it finds images with no measurements it decides that there are no measurements common to all the training objects. Which isn’t necessarily true. In any case, it’s too strict a rule.

I can fix this issue - I hope it might be the one you’re experiencing…?

The workaround is to make sure that when you add extra images for training, these must all have detections and annotations on them.


This actually might be the case. I just added all five images when loading the training, one or two of which does not have any cell detections at all.

1 Like