I am trying to build a tool from WEKA software using the J48 classifier for automatic satellite image classification to build landuse land cover maps.

How do I input the satellite image in WEKA after converting it into ASCII format?


WEKA is relatively easy to use. First, convert your training data into ARFF format. For example, if your satellite data consists of three band values, (b1,b2,b3), and a land cover label, lc, then your ARFF format might be:

@RELATION Example @ATTRIBUTE b1 NUMERIC @ATTRIBUTE b2 NUMERIC @ATTRIBUTE b3 NUMERIC @ATTRIBUTE lc CLASS {vegetation, water, bare_soils} @DATA 0.2,0.3,0.1,vegetation ...

Inside code, assuming you use Java, it's as simple as:

    ArffReader arff = new ArffReader(new BufferedReader(new FileReader(INPUT_DATA_ARFF)));

    Instances trainSet = arff.getData();
    trainSet.setClassIndex(trainSet.numAttributes() - 1);

    Classifier decisionTree = new J48();
    decisionTree .buildClassifier(trainSet);

    // evaluation

    // let newUnseenExample be an unlabeled feature vector 

This snippet should help you get started. The art is in choosing the right model and the right representation of your data, of course.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.