Stardist2D quits QuPath

I have a problem when I run Stardist2d (tensorflow) in QuPath. It closes Qupath immediately after running. Any idea how to solve this? I’m using MacOS

Does an error message of any kind appear?
Also, did you built it using tensorflow or tensorflow-gpu? I expect that on a Mac the gpu version will not work (while the default CPU version works for me).

I didn’t get any error message. It just quits. I traced where the error occurs, and I found the issue was triggered in stardist.detectObjects(CurrentImageData, pathObjects).

I built qupath for tensorflow-cpu

Since it works fine for me on a Mac, I don’t really know how to begin to help resolve this. If you can provide a lot more information then I might spot something useful e.g.

  • when/how exactly you built QuPath
    • which branch you used (or did you just download it recently from GitHub without switching branch)
    • which Java version
    • what command line call (./gradlew ...)
  • what script you ran when the crash occurs (including which StarDist model, and the path to the model)
  • which version of macOS
  • if you’re using an Intel or new Silicon Mac
  • how much RAM you have

Usually when QuPath crashes like that on a Mac, I’d expect to see an error displayed by the operating system containing a long and obscure stack trace – which can be very useful. Similar information is seen in a hs_err file, e.g. see https://github.com/qupath/qupath/issues/484

I built the QuPath two days ago following the instructions in QuPath documentation https://qupath.readthedocs.io/en/latest/docs/advanced/stardist.html

  • I recently downloaded it from Github without switching branches (main QuPath https://github.com/qupath/qupath). Should I use master instead?

  • Java is 14.0.2

  • I used this command./gradlew clean build createPackage -Ptensorflow-cpu=true

  • script I ran is shown below, Stardist model is he_heavy_augment

import static qupath.lib.gui.scripting.QPEx.*
import qupath.lib.gui.tools.MeasurementExporter
import qupath.lib.objects.PathCellObject
import qupath.lib.objects.PathDetectionObject
import qupath.tensorflow.stardist.StarDist2D


//  User enter these information for every project.
//*************************************************
// Specify the model directory (you will need to change this!)
def pathModel = '/Volumes/Seagate_Backup_Plus_Drive/PostDoc/QuPath/he_heavy_augment'  
def PixelWidth_new = 1.000;
def PixelHeight_new = 1.000;
def x_left = 100;
def y_left = 100;
def w_ROI =  150;
def h_ROI = 150;
//*************************************************


def project = getProject()
def entry = getProjectEntry()
def imageData = entry.readImageData()
def CurrentImageData = getCurrentImageData()
def hierarchy = imageData.getHierarchy()
def annotations = hierarchy.getAnnotationObjects()




if(pixelWidth == Double.NaN){
    setPixelSizeMicrons(PixelWidth_new, PixelHeight_new);
 
}



setImageType('BRIGHTFIELD_H_E');
setColorDeconvolutionStains('{"Name" : "H&E default", "Stain 1" : "Hematoxylin", "Values 1" : "0.65111 0.70119 0.29049 ", "Stain 2" : "Eosin", "Values 2" : "0.2159 0.8012 0.5581 ", "Background" : " 255 255 255 "}');


def stardist = StarDist2D.builder(pathModel)
      .threshold(0.5)              // Prediction threshold
      .normalizePercentiles(1, 99) // Percentile normalization
      .pixelSize(0.5)              // Resolution for detection
      .build()
println "Success";
// Run detection for the selected objects
//def imageData = getCurrentImageData()
def pathObjects = getSelectedObjects()
if (pathObjects.isEmpty()) {
    Dialogs.showErrorMessage("StarDist", "Please select a parent object!")
    return
}
stardist.detectObjects(CurrentImageData, pathObjects)   // crashes here and qupath quits
  • Mac OS X El Capitan version 10.11.6

  • Processor Intel Core i5

  • RAM is 8GB

Here is the error I got after the QuPath quits

Process:               QuPath-0.2.3 [7647]
Path:                  /Users/USER/Documents/*/QuPath-0.2.3.app/Contents/MacOS/QuPath-0.2.3
Identifier:            QuPath
Version:               0.2.3 (100)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           QuPath-0.2.3 [7647]


Date/Time:             2020-12-04 13:23:51.829 +0300
OS Version:            Mac OS X 10.11.6 (15G22010)

Anonymous UUID:        A741C1D7-31B9-B7C7-2526-9F1D30076A59

Sleep/Wake UUID:       102B9241-D308-4291-B222-BFC7BF233024

Time Awake Since Boot: 55000 seconds
Time Since Wake:       2400 seconds

System Integrity Protection: enabled

Crashed Thread:        51  Java: richscripteditor-1

Exception Type:        EXC_BREAKPOINT (SIGTRAP)
Exception Codes:       0x0000000000000002, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
/Users/saeedalahmari/.javacpp/cache/tensorflow-1.15.2-1.5.3-macosx-x86_64.jar/org/bytedeco/tensorflow/macosx-x86_64/libtensorflow_cc.so.1

Dyld Error Message:
  Symbol not found: _clock_gettime
  Referenced from: /Users/USER/*/libtensorflow_cc.so.1 (which was built for Mac OS X 10.13)
  Expected in: /usr/lib/libSystem.B.dylib

Thanks, it looks like the issue is that TensorFlow isn’t working on OS X 10.11.6.

From the error report, it seems it requires a _clock_gettime method that wasn’t available until 10.12.

Here is a related StackOverflow discussion: https://stackoverflow.com/questions/55229836/failed-to-load-the-native-tensorflow-runtime-symbol-not-found-clock-gettime

3 Likes

Thanks @petebankhead ,this was helpful to solve the issue

2 Likes