Error in Training Step Using Trainable Weka Segmentation for TEM Image

Hi,

I am new to Imagej and am looking to analyze ~ 20 .tif TEM images to quantify mitochondria morphology (length, area, number of mitochondria per image).

From what I’ve read, the TWS plugin is appropriate for the type of analysis I’m wanting to carry out but I keep running into issues during the training step.

Any assistance would be greatly appreciated!

These are the errors:

Log:
Warning: at least one dimension of the image is larger than 1024 pixels.
Feature stack creation and classifier training might take some time depending on your computer.

Creating feature stack…
Updating features of slice number 1…
Error when updating feature stack.
Feature stack was not updated.
The traning did not finish.

Console:
[INFO] Reading available sites from https://imagej.net/
WARNING: core mtj jar files are not available as resources to this classloader (sun.misc.Launcher$AppClassLoader@764c12b6)
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
java.util.concurrent.FutureTask.report(FutureTask.java:122)
java.util.concurrent.FutureTask.get(FutureTask.java:192)
trainableSegmentation.FeatureStack.updateFeaturesMT(FeatureStack.java:3047)
trainableSegmentation.FeatureStack.updateFeaturesMT(FeatureStack.java:2780)
trainableSegmentation.FeatureStackArray.updateFeaturesMT(FeatureStackArray.java:190)
trainableSegmentation.WekaSegmentation.trainClassifier(WekaSegmentation.java:5271)
trainableSegmentation.Weka_Segmentation$4.run(Weka_Segmentation.java:1496)

at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at trainableSegmentation.FeatureStack.updateFeaturesMT(FeatureStack.java:3047)
at trainableSegmentation.FeatureStack.updateFeaturesMT(FeatureStack.java:2780)
at trainableSegmentation.FeatureStackArray.updateFeaturesMT(FeatureStackArray.java:190)
at trainableSegmentation.WekaSegmentation.trainClassifier(WekaSegmentation.java:5271)
at trainableSegmentation.Weka_Segmentation$4.run(Weka_Segmentation.java:1496)

Caused by: java.lang.OutOfMemoryError: Java heap space
at ij.process.FloatProcessor.(FloatProcessor.java:38)
at trainableSegmentation.FeatureStack.calculateHessianOnChannel(FeatureStack.java:978)
at trainableSegmentation.FeatureStack.calculateHessian(FeatureStack.java:943)
at trainableSegmentation.FeatureStack.access$2(FeatureStack.java:938)
at trainableSegmentation.FeatureStack$10.call(FeatureStack.java:932)
at trainableSegmentation.FeatureStack$10.call(FeatureStack.java:1)
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)

NGLY1_Cell10_image10_19kx.tif (8.7 MB)

Hi @kkwolfe and welcome to the forum!

This means that you are running out of memory.
Fiji has a certain amount of RAM memory that it is allowed to use which may be less than what your computer can provide. Have you already increased that value? If not, click on this menu:
Edit > Options > Memory & Threads. A dialog like this should appear:
image
Set the “Maximum Memory” to a higher value - for example 80% of your RAM memory.

If that doesn’t solve your issue I’d suggest to have a look at Ilastik. It’s a great standalone tool for image segmentation + intuitive to use. The algorithm method itself (Random Forest) is very similar to Trainable Weka. I have the feeling (but didn’t dig very deep) that it can handle large images better because it does computations lazily.

1 Like

Hi Thank you I will give it a go!