da4fb02764495b143551661a02f0da973982b1b2,calamari_ocr/ocr/trainer.py,CalamariTrainer,train,#CalamariTrainer#Any#,37

Before Change


        data.params().downscale_factor_ = model.compute_downscale_factor()
        model.classes = codec.size()

        if not data.val_reader:
            // A val reader is required, copy train dataset but in pred and eval mode
            data.val_reader = copy.copy(data.train_reader)
            data.val_reader.mode = DataSetMode.PRED_AND_EVAL

        data.train_reader.auto_repeat = True
        super(CalamariTrainer, self).train(callbacks=callbacks)

        if False:

After Change


        if len(train_pipeline) == 0:
            raise Exception("Training dataset is empty.")

        if data.params().val:
            val_pipeline = data.get_pipeline(PipelineMode.Evaluation, data.params().val)
            if len(val_pipeline) == 0:
                raise Exception("Validation dataset is empty. Provide valid validation data for early stopping.")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: Calamari-OCR/calamari
Commit Name: da4fb02764495b143551661a02f0da973982b1b2
Time: 2021-01-19
Author: wick.chr@gmail.com
File Name: calamari_ocr/ocr/trainer.py
Class Name: CalamariTrainer
Method Name: train


Project Name: Calamari-OCR/calamari
Commit Name: fb08a6d154a8aa5beabc18de4400476a928ed644
Time: 2021-01-19
Author: wick.chr@gmail.com
File Name: calamari_ocr/ocr/training/trainer.py
Class Name: CalamariTrainer
Method Name: train


Project Name: Calamari-OCR/calamari
Commit Name: 19462c9a66831742f2168b0ae6c2b217bc08854f
Time: 2021-01-19
Author: wick.chr@gmail.com
File Name: calamari_ocr/ocr/trainer.py
Class Name: CalamariTrainer
Method Name: train