Пример #1
0
 def __init__(self, **kw):
     """Initialize a line recognizer that works from character models.
     The character shape model is given at initialization and needs to conform to
     the IModel interface.  The segmenter needs to support ISegmentLine.
     The best parameter determines how many of the top outputs from the classifier
     are used in the construction of the lattice.  The maxcost parameter is
     the maximum cost that will be assigned to a transiation in the lattice.
     The reject_cost is a cost above which a character won't get added to the lattice
     at all.  The minheight_letter threshold is the minimum height of a
     component (expressed as fraction of the medium segment height) in
     order to be added as a letter to the lattice."""
     self.cmodel = None
     self.debug = 0
     self.minsegs = 3
     self.maxspacecost = 20.0
     self.whitespace = "space.model"
     self.segmenter = ocrolseg.DpSegmenter()
     self.nbest = 5
     self.maxcost = 15.0
     self.reject_cost = self.maxcost
     self.min_height = 0.5
     self.rho_scale = 1.0
     self.maxdist = 10
     self.maxrange = 5
     self.use_ligatures = 1
     self.add_rho = 0
     self.verbose = 0
     self.debug_cls = []
     self.allow_any = 0  # allow non-unicode characters
     common.set_params(self, kw)
     if type(self.whitespace) == str:
         self.whitespace = common.load_component(
             common.ocropus_find_file(self.whitespace))
     self.grouper = grouper.Grouper()
Пример #2
0
 def __init__(self, **kw):
     self.w1 = None
     self.verbose = 0
     self.etas = [(0.1, 100000)] * 30
     ocrolib.set_params(self, kw, warn=0)
     self.eta = 0.1
     self.error_rate = 0
     self.training_log = []
Пример #3
0
 def __init__(self, **kw):
     self.w1 = None
     self.verbose = 0
     self.etas = [(0.1, 100000)] * 30
     ocrolib.set_params(self, kw, warn=0)
     self.eta = 0.1
     self.error_rate = 0
     self.training_log = []
Пример #4
0
 def __init__(self, **kw):
     self.nbest = 5
     self.minp = 1e-3
     self.classifier = self.makeClassifier()
     self.extractor = self.makeExtractor()
     kw = common.set_params(self, kw)
     kw = common.set_params(self.classifier, kw)
     self.rows = None
     self.nrows = 0
     self.classes = []
     self.c2i = {}
     self.i2c = []
     self.geo = None
Пример #5
0
 def __init__(self, **kw):
     # fairly conservative default settings that result
     # in reasonably good performance for many problems
     self.verbose = 0
     self.initial_nhidden = [20, 40, 60, 80, 120, 160]
     self.initial_eta = (0.1, 0.5)
     self.initial_epochs = 5
     self.initial_ntrain = 1000000
     self.log_eta_var = 0.2
     self.log_nh_var = 0.2
     self.min_round = 100000
     self.max_round = 10000000
     self.epochs_per_round = 5
     self.max_rounds = 48
     self.max_pool = 3
     ocrolib.set_params(self, kw, warn=0)
     self.kw = kw
Пример #6
0
 def __init__(self, **kw):
     # fairly conservative default settings that result
     # in reasonably good performance for many problems
     self.verbose = 0
     self.initial_nhidden = [20, 40, 60, 80, 120, 160]
     self.initial_eta = (0.1, 0.5)
     self.initial_epochs = 5
     self.initial_ntrain = 1000000
     self.log_eta_var = 0.2
     self.log_nh_var = 0.2
     self.min_round = 100000
     self.max_round = 10000000
     self.epochs_per_round = 5
     self.max_rounds = 48
     self.max_pool = 3
     ocrolib.set_params(self, kw, warn=0)
     self.kw = kw
Пример #7
0
 def __init__(self, **kw):
     UW3Aligner.__init__(self)
     self.combine = more_segmentation_errors
     kw = common.set_params(self, kw)
Пример #8
0
if platform.system().lower() == 'linux':
    parent_dir = current_dir.rsplit(
        '/', 1
    )[0]  # split current dir on last '/', which gives the parent dir in Ubuntu
elif platform.system().lower() == 'windows':
    parent_dir = current_dir.rsplit(
        '\\', 1
    )[0]  # split current dir on last '/', which gives the parent dir in Windows

sys.path.append(parent_dir)

from common import methods, labels, colors, set_params, plot_gray_areas, SMALL_SQUARE, wrap_angle, get_secondly_averages
import math

set_params()

methods = methods + ['RLintegral']
labels = labels + ['RLI']
colors[3] = 'orange'


def plot_zeros(ax, data):
    ax.plot(t, [0] * len(data),
            '-',
            linewidth=0.5,
            color='grey',
            alpha=0.5,
            label=None)

Пример #9
0
 def set(self, **kw):
     kw = common.set_params(self, kw)
     kw = common.set_params(self.classifier, kw)
     assert kw == {}, "extra parameters to %s: %s" % (self, kw)
Пример #10
0
 def __init__(self, **kw):
     self.r = 32
     self.normalize = None
     common.set_params(self, kw)