Skip to content

Restructured to allow 'import page_segmentation'

Restructured the project to make it importable as module.

bash programs are unchanged but comprised the python code to one module so that imports like the following are possible e.g.:

from page_segmentation import train uses the functionality of the page-segmentation-train command as python function:

def train(output:str,
    train:str=[],
    test:str=[],
    eval:str=[],
    split_file:str=None,
    prediction_dir:str=None,
    l_rate:float=1e-3,
    l_rate_drop_factor:float=0.1,
    n_classes:int=4,
    target_line_height:int=6,
    load:str=None,
    n_iter:int=500,
    early_stopping_test_interval:int=100,
    early_stopping_max_keep:int=10,
    early_stopping_max_l_rate_drops:int=3,
    early_stopping_on_accuracy=False,
    display:int=100):

Likewise with from page_segmentation import predict uses the functionality of the page-segmentation-predict.

Installing the project previously installed it as scripts.* and lib.* this means that it easily clashed with other modules doing the same. It could be argued that lib.trainer and lib.predictor should be made to top level classes/scripts instead of scripts.train.train and scripts.predict.predict

Added subprogramms in bash e.g.:

page-segmentation train

[Caution: code should be reviewed before merging]

Edited by Ghost User

Merge request reports

Loading