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
106 stars 60 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!