Search in sources :

Example 1 with SplitEvaluator

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

the class Jochre method doCommandEvaluateSplits.

/**
 * Evaluate the letter splitting model on its own.
 *
 * @param criteria
 *          the criteria used to select the evaluation corpus
 */
public void doCommandEvaluateSplits(CorpusSelectionCriteria criteria) throws IOException {
    ClassificationModel splitModel = jochreSession.getSplitModel();
    if (splitModel == null)
        throw new IllegalArgumentException("Missing parameter: jochre.image-analyser.split-model");
    List<String> splitFeatureDescriptors = splitModel.getFeatureDescriptors();
    SplitFeatureParser splitFeatureParser = new SplitFeatureParser();
    Set<SplitFeature<?>> splitFeatures = splitFeatureParser.getSplitFeatureSet(splitFeatureDescriptors);
    SplitCandidateFinder splitCandidateFinder = new SplitCandidateFinder(jochreSession);
    splitCandidateFinder.setMinDistanceBetweenSplits(5);
    ShapeSplitter shapeSplitter = new RecursiveShapeSplitter(splitCandidateFinder, splitFeatures, splitModel.getDecisionMaker(), jochreSession);
    JochreCorpusShapeReader shapeReader = new JochreCorpusShapeReader(jochreSession);
    shapeReader.setSelectionCriteria(criteria);
    SplitEvaluator splitEvaluator = new SplitEvaluator(jochreSession);
    FScoreCalculator<String> fScoreCalculator = splitEvaluator.evaluate(shapeReader, shapeSplitter);
    LOG.debug("" + fScoreCalculator.getTotalFScore());
}
Also used : RecursiveShapeSplitter(com.joliciel.jochre.boundaries.RecursiveShapeSplitter) SplitFeatureParser(com.joliciel.jochre.boundaries.features.SplitFeatureParser) SplitFeature(com.joliciel.jochre.boundaries.features.SplitFeature) JochreCorpusShapeReader(com.joliciel.jochre.graphics.JochreCorpusShapeReader) SplitEvaluator(com.joliciel.jochre.boundaries.SplitEvaluator) RecursiveShapeSplitter(com.joliciel.jochre.boundaries.RecursiveShapeSplitter) TrainingCorpusShapeSplitter(com.joliciel.jochre.boundaries.TrainingCorpusShapeSplitter) ShapeSplitter(com.joliciel.jochre.boundaries.ShapeSplitter) SplitCandidateFinder(com.joliciel.jochre.boundaries.SplitCandidateFinder) ClassificationModel(com.joliciel.talismane.machineLearning.ClassificationModel)

Aggregations

RecursiveShapeSplitter (com.joliciel.jochre.boundaries.RecursiveShapeSplitter)1 ShapeSplitter (com.joliciel.jochre.boundaries.ShapeSplitter)1 SplitCandidateFinder (com.joliciel.jochre.boundaries.SplitCandidateFinder)1 SplitEvaluator (com.joliciel.jochre.boundaries.SplitEvaluator)1 TrainingCorpusShapeSplitter (com.joliciel.jochre.boundaries.TrainingCorpusShapeSplitter)1 SplitFeature (com.joliciel.jochre.boundaries.features.SplitFeature)1 SplitFeatureParser (com.joliciel.jochre.boundaries.features.SplitFeatureParser)1 JochreCorpusShapeReader (com.joliciel.jochre.graphics.JochreCorpusShapeReader)1 ClassificationModel (com.joliciel.talismane.machineLearning.ClassificationModel)1