Skip to content

Question about training classifier #49

@CarmenSC

Description

@CarmenSC

Hi,

Some context:
I am new using Fiji and WEKA. I am trying to spot some structures in my plants to count them automatically. It worked really well with the first photograph, so I save the model.

I load the model and apply it to a second picture, and it worked but less efficiently. That's why I decided to keep training the model. I tried to do it and I got an error message in WEKA.

The traning did not finish.
Training input:
# of pixels selected as Sporophytes: 2856
# of pixels selected as Background: 18911
# of pixels selected as Sporophytes_Closed: 5517
Creating training data took: 10334ms
Training classifier...
FastRandomForest of 200 trees, each constructed while considering 2 random features.
Out of bag error: 0.48%
 
 
Finished training in 240647ms
Classifying whole image using 4 thread(s)...
Error while classifying whole image! 
Finished segmentation of whole image.

My question is:

Can I train the model using different images?

I also added a third category (label) when I did the training the second time. Dunno if that's part of the problem too.

The warning message is below:

WARNING: core mtj jar files are not available as resources to this classloader (sun.misc.Launcher$AppClassLoader@764c12b6)
java.lang.ArrayIndexOutOfBoundsException: 2
	hr.irb.fastRandomForest.FastRfBagging.distributionForInstance(FastRfBagging.java:647)
	hr.irb.fastRandomForest.FastRandomForest.distributionForInstance(FastRandomForest.java:646)
	weka.classifiers.AbstractClassifier.classifyInstance(AbstractClassifier.java:173)
	trainableSegmentation.WekaSegmentation$8.call(WekaSegmentation.java:7025)
	trainableSegmentation.WekaSegmentation$8.call(WekaSegmentation.java:1)
	java.util.concurrent.FutureTask.run(FutureTask.java:266)
	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	java.lang.Thread.run(Thread.java:745)

	at hr.irb.fastRandomForest.FastRfBagging.distributionForInstance(FastRfBagging.java:647)
	at hr.irb.fastRandomForest.FastRandomForest.distributionForInstance(FastRandomForest.java:646)
	at weka.classifiers.AbstractClassifier.classifyInstance(AbstractClassifier.java:173)
	at trainableSegmentation.WekaSegmentation$8.call(WekaSegmentation.java:7025)
	at trainableSegmentation.WekaSegmentation$8.call(WekaSegmentation.java:1)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
java.lang.ArrayIndexOutOfBoundsException: 2
	hr.irb.fastRandomForest.FastRfBagging.distributionForInstance(FastRfBagging.java:647)
	hr.irb.fastRandomForest.FastRandomForest.distributionForInstance(FastRandomForest.java:646)
	weka.classifiers.AbstractClassifier.classifyInstance(AbstractClassifier.java:173)
	trainableSegmentation.WekaSegmentation$8.call(WekaSegmentation.java:7025)
	trainableSegmentation.WekaSegmentation$8.call(WekaSegmentation.java:1)
	java.util.concurrent.FutureTask.run(FutureTask.java:266)
	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	java.lang.Thread.run(Thread.java:745)

	at hr.irb.fastRandomForest.FastRfBagging.distributionForInstance(FastRfBagging.java:647)
	at hr.irb.fastRandomForest.FastRandomForest.distributionForInstance(FastRandomForest.java:646)
	at weka.classifiers.AbstractClassifier.classifyInstance(AbstractClassifier.java:173)
	at trainableSegmentation.WekaSegmentation$8.call(WekaSegmentation.java:7025)
	at trainableSegmentation.WekaSegmentation$8.call(WekaSegmentation.java:1)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
java.lang.ArrayIndexOutOfBoundsException: 2
	hr.irb.fastRandomForest.FastRfBagging.distributionForInstance(FastRfBagging.java:647)
	hr.irb.fastRandomForest.FastRandomForest.distributionForInstance(FastRandomForest.java:646)
	weka.classifiers.AbstractClassifier.classifyInstance(AbstractClassifier.java:173)
	trainableSegmentation.WekaSegmentation$8.call(WekaSegmentation.java:7025)
	trainableSegmentation.WekaSegmentation$8.call(WekaSegmentation.java:1)
	java.util.concurrent.FutureTask.run(FutureTask.java:266)
	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	java.lang.Thread.run(Thread.java:745)

	at hr.irb.fastRandomForest.FastRfBagging.distributionForInstance(FastRfBagging.java:647)
	at hr.irb.fastRandomForest.FastRandomForest.distributionForInstance(FastRandomForest.java:646)
	at weka.classifiers.AbstractClassifier.classifyInstance(AbstractClassifier.java:173)
	at trainableSegmentation.WekaSegmentation$8.call(WekaSegmentation.java:7025)
	at trainableSegmentation.WekaSegmentation$8.call(WekaSegmentation.java:1)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
java.lang.ArrayIndexOutOfBoundsException: 2
	hr.irb.fastRandomForest.FastRfBagging.distributionForInstance(FastRfBagging.java:647)
	hr.irb.fastRandomForest.FastRandomForest.distributionForInstance(FastRandomForest.java:646)
	weka.classifiers.AbstractClassifier.classifyInstance(AbstractClassifier.java:173)
	trainableSegmentation.WekaSegmentation$8.call(WekaSegmentation.java:7025)
	trainableSegmentation.WekaSegmentation$8.call(WekaSegmentation.java:1)
	java.util.concurrent.FutureTask.run(FutureTask.java:266)
	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	java.lang.Thread.run(Thread.java:745)

	at hr.irb.fastRandomForest.FastRfBagging.distributionForInstance(FastRfBagging.java:647)
	at hr.irb.fastRandomForest.FastRandomForest.distributionForInstance(FastRandomForest.java:646)
	at weka.classifiers.AbstractClassifier.classifyInstance(AbstractClassifier.java:173)
	at trainableSegmentation.WekaSegmentation$8.call(WekaSegmentation.java:7025)
	at trainableSegmentation.WekaSegmentation$8.call(WekaSegmentation.java:1)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
java.lang.NullPointerException
	trainableSegmentation.WekaSegmentation.applyClassifier(WekaSegmentation.java:6921)
	trainableSegmentation.WekaSegmentation.applyClassifier(WekaSegmentation.java:6361)
	trainableSegmentation.WekaSegmentation.applyClassifier(WekaSegmentation.java:6288)
	trainableSegmentation.Weka_Segmentation$4.run(Weka_Segmentation.java:1470)

	at trainableSegmentation.WekaSegmentation.applyClassifier(WekaSegmentation.java:6921)
	at trainableSegmentation.WekaSegmentation.applyClassifier(WekaSegmentation.java:6361)
	at trainableSegmentation.WekaSegmentation.applyClassifier(WekaSegmentation.java:6288)
	at trainableSegmentation.Weka_Segmentation$4.run(Weka_Segmentation.java:1470)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions