fiji / Trainable_Segmentation

Fiji library to perform image segmentation based on the Weka learning schemes
https://imagej.net/Trainable_Weka_Segmentation
GNU General Public License v3.0
112 stars 61 forks source link

Error while adjusting data! #71

Open CellKai opened 2 years ago

CellKai commented 2 years ago

Since a few days applying a Weka model in a script fails with the error "Error while adjusting data!". I am using Weka v3.3.2

You can reproduce the issue using the minimal example described on image.sc: https://forum.image.sc/t/applying-weka-model-in-a-script-fails-in-recent-version/54822

IJ.log windows output:

Field of view: max sigma = 16.0, min sigma = 0.0 Membrane thickness: 1, patch size: 19 Read class name: class 1 Read class name: class 2 Error while adjusting data! Classifying blobs.gif using 4 tiles... Processing slices of blobs-crop-0-0 in 1 thread(s)... Starting thread 0 processing 1 slices, starting with 1 Creating features for slice 1... Filtering feature stack by selected attributes... Classifying slice 1 in 8 thread(s)...

Console printout: Started Untitled.ijm.py at Mon Mar 07 11:23:39 CET 2022 Traceback (most recent call last): File "Untitled.ijm.py", line 31, in File "Untitled.ijm.py", line 26, in apply_weka_model at trainableSegmentation.WekaSegmentation.applyClassifier(WekaSegmentation.java:5692) at trainableSegmentation.WekaSegmentation.applyClassifier(WekaSegmentation.java:6695) at trainableSegmentation.WekaSegmentation.applyClassifier(WekaSegmentation.java:6595) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) java.lang.NullPointerException: java.lang.NullPointerException

at org.python.core.Py.JavaError(Py.java:547)
at org.python.core.Py.JavaError(Py.java:538)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:192)
at org.python.core.PyObject.__call__(PyObject.java:422)
at org.python.core.PyMethod.__call__(PyMethod.java:187)
at org.python.pycode._pyx0.apply_weka_model$1(Untitled.ijm.py:28)
at org.python.pycode._pyx0.call_function(Untitled.ijm.py)
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyBaseCode.call(PyBaseCode.java:168)
at org.python.core.PyFunction.__call__(PyFunction.java:437)
at org.python.pycode._pyx0.f$0(Untitled.ijm.py:32)
at org.python.pycode._pyx0.call_function(Untitled.ijm.py)
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1687)
at org.python.core.__builtin__.eval(__builtin__.java:497)
at org.python.core.__builtin__.eval(__builtin__.java:501)
at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:255)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:57)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:31)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
at org.scijava.script.ScriptModule.run(ScriptModule.java:157)
at org.scijava.module.ModuleRunner.run(ModuleRunner.java:163)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:124)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:63)
at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:225)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Caused by: java.lang.NullPointerException at trainableSegmentation.WekaSegmentation.applyClassifier(WekaSegmentation.java:5692) at trainableSegmentation.WekaSegmentation.applyClassifier(WekaSegmentation.java:6695) at trainableSegmentation.WekaSegmentation.applyClassifier(WekaSegmentation.java:6595) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:190) ... 27 more

CellKai commented 2 years ago

not sure what caused the issue, but it seems to be fixed using Trainable_Segmentation-3.2.34.jar.

CellKai commented 2 years ago

not sure what caused the issue, but it seems to be fixed using Trainable_Segmentation-3.2.34.jar.

CellKai commented 2 years ago

apologies for re-opening this issue, but I just noticed that I observed this issue in the latest version v3.3.2 and could confirm that it was not present using the older version v3.2.34. So I think this is in fact a current issue thats reproducible and ongoing.

tumblejunky commented 2 years ago

I just want to state that I am having the same issue with scripting segmentation and is fixed with older distributions. Thanks for keeping an active distribution.

phisanti commented 2 years ago

I have to say I noticed the same bug with the weka-dev-3.9.4.jar or Trainable_Segmentation-3.3.2.ar version. Any solution would be welcomed.

iarganda commented 2 years ago

Thank you all for reporting! I'll work on it as soon as I can!

MyelineR commented 3 months ago

Hello, I realize this thread is quite old but unfortunately I have run into the same problem and wonder if anyone has found a work around since the issue was first posted. I'm very new to Fiji and code, so I don't really have the capacity to figure out what is going on by myself.

The current version is Trainable_Segmentation-3.3.4.jar

After training my classifier, I tried to use, it and the tiling script, to segment two 11 000 x 14 000p test images (using 11 tiles in x and 14 tiles in y, 0 tiles in z).

The Fiji log shows : Field of view: max sigma = 16.0, min sigma = 0.0 Membrane thickness: 2, patch size: 19 Read class name: Vessels Read class name: Background Error while adjusting data! Classifying Image 1 (3930 VCAM)-1.tif using 154 tiles... Processing slices of Image1(3930VCAM)-1-crop-0-0 in 1 thread(s)... Starting thread 0 processing 1 slices, starting with 1 Creating features for slice 1... Filtering feature stack by selected attributes... Classifying slice 1 in 16 thread(s)...

I then get a message from Fiji saying : image

Console says this : image

Any ideas would be greatly appreciated. Thank you in advance,

Myeline