Bad Annotation in Pixel Classifier

Hi,

I am using QuPathv0.2.0-m9 and I am trying to train the pixel classifier on a H&E image to determine the difference between tumour and stroma cells.

Once I have done this and try to run a live prediction I get a message that comes up saying bad allocation. This then results in no classifier being made and I can’t continue my analysis further.

Has anyone come across this before and can anyone tell me how to fix this? Any help would be hugely appreciated!

Thanks,

Sarah

1 Like

Hi Sarah,

Could you provide the log (copy/paste) with the full error stack trace (or the full error message) please? It will help us understand more precisely what has gone wrong! Thank you.

1 Like

Hey!

I have attached a couple of screen shots with the complete error message. If there’s anything else I can share to help figure it out please let me know!

Sarah!


QuPath_BadAnnotation_2|690x447

Sorry, here is just a complete copy/paste of the log message too.

INFO: Loaded extension ImageJ extension (38 ms)
INFO: Loaded extension JPen extension (18 ms)
INFO: Loaded extension OpenCV extensions (6 ms)
INFO: Loaded extension Rich script editor extension (262 ms)
INFO: OpenSlide version 3.4.1
INFO: Selected style: null
INFO: Performing update check…
WARN: No changelog found - will not check for updates
INFO: Starting QuPath with parameters:
INFO: Project set to Project: Tumour_Roundness-project
WARN: Temp memoization directory created at C:\Users\slaing\AppData\Local\Temp\qupath-memo-17036072778363717370
WARN: If you want to avoid this warning, either disable Bio-Formats memoization in the preferences or specify a directory to use
INFO: Image data set to ImageData: Not set, MDAL71.2j_2.scn - Series 1
ERROR: Estimate stain vectors: No brightfield, RGB image selected!
INFO: Requesting region for stain vector editing:
INFO: 1 region detected (processing time: 0.28 seconds)
INFO: Processing complete in 0.28 seconds
INFO: Completed!
INFO:
qupath.imagej.detect.tissue.SimpleTissueDetection2 {“threshold”: 200, “requestedPixelSizeMicrons”: 20.0, “minAreaMicrons”: 10000.0, “maxHoleAreaMicrons”: 1000000.0, “darkBackground”: false, “smoothImage”: true, “medianCleanup”: true, “dilateBoundaries”: false, “smoothCoordinates”: true, “excludeOnBoundary”: false, “singleAnnotation”: true}
WARN: Annotations for at least two classes are required to train a classifier
WARN: Annotations for at least two classes are required to train a classifier
INFO: Training data: 57673 x 12, Target data: 57673 x 1
ERROR: QuPath exception: bad allocation
at org.bytedeco.opencv.opencv_ml.StatModel.train(Native Method)
at qupath.opencv.ml.OpenCVClassifiers$AbstractOpenCVClassifierML.trainWithLock(OpenCVClassifiers.java:420)
at qupath.opencv.ml.OpenCVClassifiers$RTreesClassifier.trainWithLock(OpenCVClassifiers.java:698)
at qupath.opencv.ml.OpenCVClassifiers$AbstractOpenCVClassifierML.train(OpenCVClassifiers.java:402)
at qupath.opencv.ml.OpenCVClassifiers$RTreesClassifier.train(OpenCVClassifiers.java:738)
at qupath.lib.gui.ml.PixelClassifierPane.doClassification(PixelClassifierPane.java:974)
at qupath.lib.gui.ml.PixelClassifierPane.updateClassifier(PixelClassifierPane.java:815)
at qupath.lib.gui.ml.PixelClassifierPane.lambda$initialize$11(PixelClassifierPane.java:318)
at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:360)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
at javafx.beans.property.BooleanPropertyBase.fireValueChangedEvent(BooleanPropertyBase.java:104)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:111)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145)
at com.sun.javafx.binding.BidirectionalBinding$BidirectionalBooleanBinding.changed(BidirectionalBinding.java:264)
at com.sun.javafx.binding.BidirectionalBinding$BidirectionalBooleanBinding.changed(BidirectionalBinding.java:227)
at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:181)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
at javafx.beans.property.BooleanPropertyBase.fireValueChangedEvent(BooleanPropertyBase.java:104)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:111)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145)
at javafx.scene.control.ToggleButton.setSelected(ToggleButton.java:150)
at javafx.scene.control.ToggleButton.fire(ToggleButton.java:256)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:206)
at com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274)
at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3862)
at javafx.scene.Scene.processMouseEvent(Scene.java:1849)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2590)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:409)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:299)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:447)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:412)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:446)
at com.sun.glass.ui.View.handleMouseEvent(View.java:556)
at com.sun.glass.ui.View.notifyMouse(View.java:942)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Unknown Source)

1 Like

@slaing a similar error has been reported a few times, but it seems to be rare and I’ve never been able to reproduce it. It would be great if you could answer the following questions:

  • Does it happen immediately every time you try to train a classifier in QuPath, or just sometimes?
  • Does it happen if you change the classifier to ‘Artificial Neural Network’ rather than ‘Random trees’?
  • Does it happen if you train an object classifier, not just a pixel classifier?
  • If you’re able to use a different computer, does it happen there?
  • What is the maximum memory available to QuPath? This is the value under Help → Show setup options.
  • Can you say anything more about what kind of computer you have? e.g. running Windows / macOS, how much RAM, old/new, what kind of processor (e.g. i3, i5, i7, AMD)?

My guess is that there is a problem running on certain hardware, but I’m not sure if this is the case… or, if it is, what exactly is incompatible.

Thanks Pete.

It happens every time I try to train a classifier now. It didn’t use to but now it is, I don’t know what has changed that it is happening every time now.

I know it doesn’t happen on different computers as one of my colleagues tried on their computer and it was working fine. I have a new PC (got late last year), running Windows, using an i7 processor and the maximum memory available to QuPath is 8GB. I have attached a screen shot that has the information about the PC.

I have just tried using the artificial neural network rather than random trees and it has worked! I will go ahead using this method for now but wanted to give you all the information that I have so that you might be able to figure out if it’s an issue with my PC or if something else is going on.

Thanks for your help, I really appreciate it!

Sarah

1 Like

Thanks Sarah, this information is really useful. It dispels most of my guesses about what the problem could be, so remains a mystery for now, but it helps to have this to refer to when the issue resurfaces. I’m glad you also share the experience that it’s ok on other computers and the ANN works.

If it helps, my impression is that the ANN pixel classifier often gives better results than Random Trees anyway (although I haven’t tried to assess this)…

Is that within the same project? Or if you start another small project and make a couple of annotations for training, does it also happen?

I have tried both within the same project and started another project that only has one image in it and thee same thing happens with both.

I also tried uninstalling QuPath and then re-installing and the same thing still happened.

1 Like