Search in sources :

Example 1 with MergeEvaluator

use of com.joliciel.jochre.boundaries.MergeEvaluator in project jochre by urieli.

the class Jochre method doCommandEvaluateMerge.

/**
 * Evaluate the letter merging model on its own.
 *
 * @param criteria
 *          for selecting the portion of the corpus to evaluate
 */
public void doCommandEvaluateMerge(CorpusSelectionCriteria criteria) throws IOException {
    ClassificationModel mergeModel = jochreSession.getMergeModel();
    if (mergeModel == null)
        throw new IllegalArgumentException("Missing parameter: jochre.image-analyser.merge-model");
    List<String> mergeFeatureDescriptors = mergeModel.getFeatureDescriptors();
    MergeFeatureParser mergeFeatureParser = new MergeFeatureParser();
    Set<MergeFeature<?>> mergeFeatures = mergeFeatureParser.getMergeFeatureSet(mergeFeatureDescriptors);
    JochreCorpusGroupReader groupReader = new JochreCorpusGroupReader(jochreSession);
    groupReader.setSelectionCriteria(criteria);
    ShapeMerger merger = new ShapeMerger(mergeFeatures, mergeModel.getDecisionMaker());
    MergeEvaluator evaluator = new MergeEvaluator(jochreSession);
    FScoreCalculator<String> fScoreCalculator = evaluator.evaluate(groupReader, merger);
    LOG.debug("" + fScoreCalculator.getTotalFScore());
}
Also used : MergeFeatureParser(com.joliciel.jochre.boundaries.features.MergeFeatureParser) MergeEvaluator(com.joliciel.jochre.boundaries.MergeEvaluator) MergeFeature(com.joliciel.jochre.boundaries.features.MergeFeature) TrainingCorpusShapeMerger(com.joliciel.jochre.boundaries.TrainingCorpusShapeMerger) ShapeMerger(com.joliciel.jochre.boundaries.ShapeMerger) ClassificationModel(com.joliciel.talismane.machineLearning.ClassificationModel) JochreCorpusGroupReader(com.joliciel.jochre.graphics.JochreCorpusGroupReader)

Aggregations

MergeEvaluator (com.joliciel.jochre.boundaries.MergeEvaluator)1 ShapeMerger (com.joliciel.jochre.boundaries.ShapeMerger)1 TrainingCorpusShapeMerger (com.joliciel.jochre.boundaries.TrainingCorpusShapeMerger)1 MergeFeature (com.joliciel.jochre.boundaries.features.MergeFeature)1 MergeFeatureParser (com.joliciel.jochre.boundaries.features.MergeFeatureParser)1 JochreCorpusGroupReader (com.joliciel.jochre.graphics.JochreCorpusGroupReader)1 ClassificationModel (com.joliciel.talismane.machineLearning.ClassificationModel)1