fiji / microscope-image-quality

TensorFlow-based classifier for microscope image focus quality.
https://imagej.net/Microscope_Focus_Quality
Apache License 2.0
17 stars 2 forks source link

Memory issues #6

Closed SGrasshopper closed 5 years ago

SGrasshopper commented 5 years ago

Hi,

I am using this plug-in in a script in FIJI. I am looping through a time series with four Z slices to find the most in-focus Z plane to generate an in-focus time-lapse final single Z slice stack. On both my MacOS mojave computer and my umbuntu computer the plug-in runs out of memory and crashes FIJI silently. It does not appear to ever release the memory it is using. I can stop the script, close all windows, run garbage collection and the JVM never releases the memory back to the system. Any help with this would be greatly appreciated.

Best, Scott

samueljyang commented 5 years ago

As a temporary fix, have you tried the "Increasing ImageJ/Fiji’s memory" described here: https://docs.openmicroscopy.org/bio-formats/5.7.1/users/imagej/managing-memory.html

How large are these images?

SGrasshopper commented 5 years ago

Hi,

The problem is independent of memory available in imageJ. If i track memory use in imageJ everything appears normal, as memory is used and released as images are opened and closed as expected and if i increase or decrease the imagej’s memory the behavior does not change. However system memory for the JVM continues to increase and is never released until i quit imageJ and restart. Even if all image windows are closed in ImageJ the system memory use does not go back down. Are there any data you would like me to gather and send to help with this issue? Image size also does not seem to matter my big images are 2048X2048 and small are 682X682.

Scott

On May 9, 2019, at 8:34 AM, samueljyang notifications@github.com wrote:

As a temporary fix, have you tried the "Increasing ImageJ/Fiji’s memory" described here: https://docs.openmicroscopy.org/bio-formats/5.7.1/users/imagej/managing-memory.html https://docs.openmicroscopy.org/bio-formats/5.7.1/users/imagej/managing-memory.html How large are these images?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fiji/microscope-image-quality/issues/6#issuecomment-490954264, or mute the thread https://github.com/notifications/unsubscribe-auth/ABR6N5C5K76W7V2Q34SPZCTPUQ77PANCNFSM4HL3TCFA.

HedgehogCode commented 5 years ago

I think the issue is that the Graph and Session of the model are not closed. This can be done by closing the whole SavedModelBundel which is created here.

I won't have time to try it myself soon. I would be glad if someone could try if this fixes the issue.

ctrueden commented 5 years ago

Just a quick note that I am planning to investigate (and hopefully fix) this as soon as I can. Unfortunately, I have a lot on my plate and cannot give a time estimate. But it is high on my priority list. In the meantime, if anyone else wants to try their hand, don't let me stop you!

ctrueden commented 5 years ago

Hopefully fixed with #7, thanks to @HedgehogCode. I will test, cut a release and upload it to the TensorFlow update site within the next couple of weeks. But in the meantime, if you want to test it yourself, you can download the SNAPSHOT build, drop it into your Fiji's jars folder (deleting any other microscope-image-quality*.jar files), and see how it goes.

SGrasshopper commented 5 years ago

The snapshot build works perfectly for me now.

ctrueden commented 5 years ago

Wonderful, thanks for following up, @SGrasshopper.

ctrueden commented 5 years ago

I have released microscope-image-quality version 1.0.0 including this fix. The bump to 1.0.0 reflects that this component is pretty much finished and stable, with no further active development planned.

I also updated the TensorFlow used by ImageJ to version 1.12.

All of these updates have been uploaded to the TensorFlow update site, and are now available via ImageJ's Help › Update... mechanism.

:beers: