-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Could not apply Classifier!" while running example "apply classifier to all images in folder" script on TWS 3.3.2 as well as 3.2.34 #78
Comments
This may happen when you change enabled features after you load your classifier. diff --git a/src/test/java/trainableSegmentation/BasicTest.java b/src/test/java/trainableSegmentation/BasicTest.java
index 5ad8639..bc0ca82 100644
--- a/src/test/java/trainableSegmentation/BasicTest.java
+++ b/src/test/java/trainableSegmentation/BasicTest.java
@@ -47,6 +47,16 @@ public class BasicTest
{
assertTrue("Misclassified training sample", pix[i] == pixTrue[i]);
}
+
+ // TODO: avoid testing the file system
+ boolean[] ff = segmentator.getEnabledFeatures();
+ segmentator.saveClassifier("test1.classifier");
+ segmentator = new WekaSegmentation();
+ segmentator.loadClassifier("test1.classifier"); // <- load
+ ff[0] = false; // <- turn off gaussian blur
+ segmentator.setEnabledFeatures(ff);
+ result = segmentator.applyClassifier(image);
+ assertTrue("Failed to apply trained classifier", null != result);
}
@Test
This perfectly matches your output. This might be related to #74 as I saw the stack trace from this issue while trying to incorrectly fix 74. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi everyone,
while trying to apply a previously trained model to a number of files in a folder using the standard script provided here https://imagej.net/plugins/tws/scripting#example-apply-classifier-to-all-images-in-folder I get the follow error in a pop up window: "Could not apply Classifier!"
The script window gives me the following output:
while the Fiji console gives me this:
I am running Fiji/ImageJ2 Version 2.9.0/1.53t Build: a33148d777 and have tried this with both the inbuilt Trainable_Segmentation-3.3.2 as well as Trainable_Segmentation-3.2.34.
I also tried using an older Fiji Version (ImageJ 2.1.0 Build 5f23140693) with inbuilt Trainable_Segmentation-3.2.34. Same error. Script log output shows:
while Fiji console shows:
I am running Mac OS 13.2.1
Any ideas what the problem might be? Thanks very much for any help!
The text was updated successfully, but these errors were encountered: