Classifier stops working

I’ve been using Qupath for a while now to count pSTAT marker using a classifier on baby brain tissue and it was working perfect!
Suddenly my classifier stopped working, even the automatic cell detection with my parameters will give weird results (like on the background detecting cells…) and for some pics not even detect cells… I have taken the pics with the same parameters at the microscope.
Please Help!

Could you share an example of the before and after pictures?

If you attempt to re-run your previous analysis on the previous pictures, does it still work?

Have you changed versions of QuPath?

If your images are fluorescent (or brightfield even), was a bulb changed or any maintenance performed on the instrument? Performing a cleaning and background adjustment on one of our local whole slide scanners changed the background significantly, so even if users had chosen the same settings each time, after the cleaning, none of the same algorithms would likely have worked.

Hello Thank you for your reply!
So, no, the microscope was not touched by anyone, no bulbs or maintenance…
The classifier still works fine on the images if I go back…
On the first image you can see my cells have been classified…100% are pSTAT3
The second image is another subject, you can see the classifier works so different…
I checked the properties of the pics (bits) to make sure they are all the same, I don’t know what to do at this point I should only use one classifier for the same study right? If I create a new classifier it works on some pics and not on others as well…
Thanks for all your help!!!


It sounds like the issue is variance within your images. Either caused by the microscope, or caused by staining/fixation procedures, which can have major impacts on how brightly your sample stains. I can’t really tell from those images, but there is a good chance that the actual pixel values are very different between what you consider positive and negative in each picture.

If this is due to staining (new batch of antibody, new DAPI, etc), then you need a new classifier, simple as that. And a new negative control.

The other possibility is that the classifier is right, and what you see is wrong. To elaborate, QuPath adjusts the brightness and contrast when you open most images so that all channels are visible. Even if, when compared with another image in the same set, they should be completely black. So it is important to make sure the min and max for any given channel (Brightness and contrast settings) are the same before assuming the classifier is wrong.

The quickest way to figure out which of these is happening (or something else I haven’t thought of) is to check the detection measurements for the objects you are seeing. If the Mean Intensity for the channel of interest is significantly changed between a positive cell in one image and a positive cell in another image… the classifier is working correctly from it’s point of view. It just might not be doing what you want it to.

If you samples vary too much, you may need a more complicated classifier, trained over many more images.

Thank you so much, I will check all this for sure.
How do I train a classifier with multiple images? I tried to look for this before with no success,
Thank you again!

The More button in the classifier can be used for that. If you are training using annotations, select training areas in multiple images, and then rebuild from project. Or, I think if you are jumping from image to image, it should ask you if you want to retain the current objects in the training. This does NOT let you add in additional objects once you have trained a classifier. You cannot load a classifier and edit it, at that point it is locked.

Though if there is too much variance in the images, a simple machine learning classifier might not work, as you might need some form of regularization. That is currently outside the scope of QuPath (from what I understand), but might be on the horizon. Depending on who applies for the QuPath job, so spread the word.

*Actually, you might be able to try the Normalization options, which I suspect is batch normalization? But I haven’t really played with them much, I try to rely on keeping the image content consistent whenever possible.