CSBDeep / CSBDeep_fiji

BSD 2-Clause "Simplified" License
11 stars 4 forks source link

Initialisation of GenericNetwork fails if the cached network file doesn't exist anymore #16

Closed haesleinhuepf closed 5 years ago

haesleinhuepf commented 5 years ago

Hey guys,

I was just executing Run your own Model for the first time and everything went fine. However, when I ran the menu for the second time, I get the following error message, before the Dialog opens. Furthermore, a window opens with this text: image

Also restarting Fiji didn't help. Together with @maweigert and @uschmidt83 we discovered the root of the issue: After the first execution of my model, I renamed the model file on the hard drive. Would it be possible to reset the cache in case the file is no longer present at the former place?

Cheers, Robert

org.scijava.module.MethodCallException: Error executing method: mpicbg.csbd.commands.GenericNetwork#modelInitialized
    at org.scijava.module.MethodRef.execute(MethodRef.java:74)
    at org.scijava.module.AbstractModuleItem.initialize(AbstractModuleItem.java:202)
    at org.scijava.module.AbstractModule.initialize(AbstractModule.java:95)
    at org.scijava.module.process.InitPreprocessor.process(InitPreprocessor.java:62)
    at org.scijava.module.ModuleRunner.preProcess(ModuleRunner.java:105)
    at org.scijava.module.ModuleRunner.run(ModuleRunner.java:157)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
    at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:238)
    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.reflect.InvocationTargetException
    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.scijava.module.MethodRef.execute(MethodRef.java:70)
    ... 12 more
Caused by: java.lang.NullPointerException
    at org.scijava.io.http.HTTPLocation.<init>(HTTPLocation.java:101)
    at org.scijava.io.http.HTTPLocation.<init>(HTTPLocation.java:114)
    at mpicbg.csbd.util.IOHelper.loadFileOrURL(IOHelper.java:25)
    at mpicbg.csbd.network.DefaultNetwork.loadModel(DefaultNetwork.java:51)
    at mpicbg.csbd.network.task.DefaultModelLoader.loadNetwork(DefaultModelLoader.java:41)
    at mpicbg.csbd.network.task.DefaultModelLoader.run(DefaultModelLoader.java:21)
    at mpicbg.csbd.commands.CSBDeepCommand.prepareInputAndNetwork(CSBDeepCommand.java:288)
    at mpicbg.csbd.commands.GenericNetwork.prepareInputAndNetwork(GenericNetwork.java:200)
    at mpicbg.csbd.commands.GenericNetwork.modelInitialized(GenericNetwork.java:102)
    ... 17 more
frauzufall commented 5 years ago

Please check with the latest master I just uploaded, the code changed a bit and I cannot reproduce it on my machine so maybe it's already fixed.

haesleinhuepf commented 5 years ago

Hey @frauzufall ,

I just tried with the version on the recent master branch. This is what I do:

[INFO] imagej-tensorflow version: 1.0.1
[INFO] tensorflow version: 1.6.0
[INFO] The current library path is: LD_LIBRARY_PATH=null
[INFO] Couldn't load tensorflow GPU support.
[INFO] If the problem is CUDA related, make sure CUDA and cuDNN are in the LD_LIBRARY_PATH.
[INFO] Using CPU version from jar file.
modelInitialized
[ERROR] null
org.scijava.module.MethodCallException: Error executing method: mpicbg.csbd.commands.GenericNetwork#modelInitialized
    at org.scijava.module.MethodRef.execute(MethodRef.java:74)
    at org.scijava.module.AbstractModuleItem.initialize(AbstractModuleItem.java:202)
    at org.scijava.module.AbstractModule.initialize(AbstractModule.java:95)
    at org.scijava.module.process.InitPreprocessor.process(InitPreprocessor.java:62)
    at org.scijava.module.ModuleRunner.preProcess(ModuleRunner.java:105)
    at org.scijava.module.ModuleRunner.run(ModuleRunner.java:157)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
    at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:238)
    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.reflect.InvocationTargetException
    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.scijava.module.MethodRef.execute(MethodRef.java:70)
    ... 12 more
Caused by: java.lang.NullPointerException
    at org.scijava.io.http.HTTPLocation.<init>(HTTPLocation.java:101)
    at org.scijava.io.http.HTTPLocation.<init>(HTTPLocation.java:114)
    at mpicbg.csbd.util.IOHelper.loadFileOrURL(IOHelper.java:25)
    at mpicbg.csbd.network.DefaultNetwork.loadModel(DefaultNetwork.java:51)
    at mpicbg.csbd.network.task.DefaultModelLoader.loadNetwork(DefaultModelLoader.java:41)
    at mpicbg.csbd.network.task.DefaultModelLoader.run(DefaultModelLoader.java:21)
    at mpicbg.csbd.commands.CSBDeepCommand.prepareInputAndNetwork(CSBDeepCommand.java:288)
    at mpicbg.csbd.commands.GenericNetwork.prepareInputAndNetwork(GenericNetwork.java:200)
    at mpicbg.csbd.commands.GenericNetwork.modelInitialized(GenericNetwork.java:102)
    ... 17 more

My operating system is a recent Windows 10 64 bit.

I hope that helps!

Cheers, Robert

P.S.: It's not urgent, please don't work on this bug this week! ;-)

gdellaire commented 5 years ago

I am having similar issues. I was able to open the dialog for 'Run Your Own Network' once and when I loaded the tf_model.zip (the discs demo model actually) the software crashed. I re-entered Fiji and tried to start the dialogue again for running your own network - I get the same issue as above with the failure to execute: 'mpicbg.csbd.commands.GenericNetwork' - I had this on one installation of CSBDeep_fiji on Win10 but not on a second installation.

I checked what could be different and I found that I had included http://sites.imagej.net/CSBDeep-CUDA9/ in the update sites on the installation that does not crash using the tf_model.zip. This installation puts the following files in your Fiji installation folders: lib/linux64/libtensorflow_LICENSE lib/linux64/libtensorflow_framework.so lib/linux64/libtensorflow_jni.so

These "shouldn't" matter for a Win10 installation but ¯_(ツ)_/¯.

Pepperify commented 5 years ago

Hello,

I'm also experiencing the same issue. After the first installation I was able to excecute "Run your network" once. After that, I've got an identical error message every time.

I added http://sites.imagej.net/CSBDeep-CUDA9/ to the update list, but this did not solve the issue.

Does ImageJ write some files to the disk that might stay there even if I delete and "reinstall" the fiji.app folder? Is there anything more rigorous method to remove all the data of ImageJ from my system?

Thanks for the great work. Training worked really well for me and I'm really waiting for the moment when I can put it in use. I had some issues also running my network in Python, but I'll open a new issue for that one.

maweigert commented 5 years ago

Hi @Pepperify ,

yes, sometimes the preferences saved by Fiji come into the way of the plugin, and I do see the error you describe from time to time. Removing the respective preference entry does usually work for me, which you can do by creating a new python script (File->New->Script) and running the following commands (thx to @haesleinhuepf):

#@ImageJ ij 
from java.lang import String
ij.prefs().remove(String, "modelfile-anynetwork");

Hope that helps!

Pepperify commented 5 years ago

Thank you so much! This solved the issue!

Hi @Pepperify ,

yes, sometimes the preferences saved by Fiji come into the way of the plugin, and I do see the error you describe from time to time. Removing the respective preference entry does usually work for me, which you can do by creating a new python script (File->New->Script) and running the following commands (thx to @haesleinhuepf):

#@ImageJ ij 
from java.lang import String
ij.prefs().remove(String, "modelfile-anynetwork");

Hope that helps!

frauzufall commented 5 years ago

Hey all, as soon as I remember / can reset my update site password I will upload a new version where this should not happen and where you don't have to use this trick. Sorry for the inconvenience!