1

I've done the classification of images in imageJ, using the Trainable Weka Segmentation plugin, and have gotten an arff file. The purpose is to recognize whether a specific object is in the image or not so I have two classes; the object and the not-object.

How do I in Java use this file to classify a new image, see if the object is in the image? Is it even possible to do?

John Slaine
  • 188
  • 2
  • 15
  • An arff file is a file with feature data, you need to serialize your trained model, then you can use it from Java or from the CLI. – Josep Valls Apr 19 '17 at 07:35

2 Answers2

2

Like @Josep Valls menioned the .arff File is just your feature Data (what your classifying algorithm uses as training/test data).

Here you have a topic about using weka in Java: import weka.jar file

Here is an additional tutorial: https://weka.wikispaces.com/Use+WEKA+in+your+Java+code

After that you have 2 options:

1: Serialize your model and import it into your java code: https://weka.wikispaces.com/Serialization as @Josep Valls mentioned

2: loading only the .arff file and retrain your model with the (i guess allready optimized) parameters you used before.

Community
  • 1
  • 1
Florian H
  • 3,052
  • 2
  • 14
  • 25
0

The Trainable Weka Segmentation plugin allows you to save your classifying algorithm as Weka, into a .model file. Just click on "Save classifier" instead of "Save data". Later you can apply that model to new images by clicking on "Apply classifier".

iarganda
  • 121
  • 1
  • 6