Loading classifier classifies cells differently than when training classifier

I’m experiencing an issue with loading my classifier where the cells are being classified differently than they were during training (i.e. cells classified as stroma during training are classified as nectrotic when classifier is loaded). I am working with QuPath v0.2.0-m2 on multistain IF TMAs. Has anyone else experienced this issue and/or have any solutions or explanations?

Could you give a few more details as to which type of classifier you are using (I figure trained through the Create detection classifier menu, but want to be sure as there are plenty of options), whether the changes are consistent (is every stroma converted to necrotic, or just some seemingly at random?), and how you are running the classifier (are you calling the file in a script, or using the GUI to load it)?

The classifier is being made through the Create detection classifier menu. The classifications are mostly similar, but some cell classifications are being changed all around (only some stroma is being converted to necrosis). The classifier is being called using a script however I experience the same issue when it is loaded using the Load Classifier menu.

I haven’t seen this before. Some questions:

  • Is all this happening on a single image, or has the classifier been trained on more than one image?
  • Is the dialog from ‘Create detection classifier’ still open (e.g. with ‘Auto update’) when the script is run?
  • Was the classifier trained, saved and reloaded using the exact same version of QuPath?
  • Does the problem persist if you restart QuPath after training and before running the script/loading the classifier?
  • Are you certain that all the same features have been calculated before the classifier is applied?

Regarding the last point: if your script also includes cell detection and you add intensity/smoothed features (for example), these features must be created in the same way before applying a saved classifier. Otherwise the corresponding values will be missing and the classification result will be different.

I’ve discovered the cause of the problem I was facing.

I was building the classifier on a separate project than the one I was loading the classifier on to. I usually do this so that I can go back and retrain the classifier if needed. The classifier was indeed saving and loading properly, however when I compared the training project to the work project all images that were trained earlier were still classifying the cells based on a premature version of the classifier due to the fact that when you switch between images the classifier doesn’t update right away.

Thanks for your help anyways everyone.

2 Likes

Thank you for clarifying!