Search in sources :

Example 6 with SplitFeature

use of com.joliciel.jochre.boundaries.features.SplitFeature 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

SplitFeature (com.joliciel.jochre.boundaries.features.SplitFeature)6 JochreSession (com.joliciel.jochre.JochreSession)3 SplitFeatureParser (com.joliciel.jochre.boundaries.features.SplitFeatureParser)3 JochreImage (com.joliciel.jochre.graphics.JochreImage)3 Shape (com.joliciel.jochre.graphics.Shape)3 ClassificationModel (com.joliciel.talismane.machineLearning.ClassificationModel)3 Decision (com.joliciel.talismane.machineLearning.Decision)3 DecisionMaker (com.joliciel.talismane.machineLearning.DecisionMaker)3 Config (com.typesafe.config.Config)3 BufferedImage (java.awt.image.BufferedImage)3 RecursiveShapeSplitter (com.joliciel.jochre.boundaries.RecursiveShapeSplitter)2 ShapeSplitter (com.joliciel.jochre.boundaries.ShapeSplitter)2 SplitCandidateFinder (com.joliciel.jochre.boundaries.SplitCandidateFinder)2 TrainingCorpusShapeSplitter (com.joliciel.jochre.boundaries.TrainingCorpusShapeSplitter)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 TreeSet (java.util.TreeSet)2 Test (org.junit.Test)2 BeamSearchImageAnalyser (com.joliciel.jochre.analyser.BeamSearchImageAnalyser)1 ErrorLogger (com.joliciel.jochre.analyser.ErrorLogger)1