8b5a8bedaeb5e8bc35878d7ae39430a5c285c9ec,calamari_ocr/ocr/datasets/abbyy_dataset/dataset.py,AbbyyDataSet,_load_sample,#AbbyyDataSet#Any#Any#,68

Before Change


                    })

    def _load_sample(self, sample, text_only):
        image_path = sample["image_path"]
        line = sample["line"]
        text = None
        img = None
        if self.mode == DataSetMode.EVAL or self.mode == DataSetMode.TRAIN:
            text = sample["format"].text

        if text_only:
            return img, text

        if self.mode == DataSetMode.TRAIN or self.mode == DataSetMode.PREDICT:
            img = np.array(Image.open(image_path))

            ly, lx = img.shape

            // Cut the Image
            img = img[line.rect.top: -ly + line.rect.bottom, line.rect.left: -lx + line.rect.right]

            // add padding as required from normal files
            img = np.pad(img, ((3, 3), (0, 0)), mode="constant", constant_values=img.max())

            Binarize Image
            if self.binary:
                img = img > 0.9

After Change


            for l, line in enumerate(page.getLines()):
                for f, fo in enumerate(line.formats):
                    text = None
                    cut_img = None
                    if self.mode == DataSetMode.EVAL or self.mode == DataSetMode.TRAIN:
                        text = fo.text
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: Calamari-OCR/calamari
Commit Name: 8b5a8bedaeb5e8bc35878d7ae39430a5c285c9ec
Time: 2019-04-08
Author: wick.chr.info@gmail.com
File Name: calamari_ocr/ocr/datasets/abbyy_dataset/dataset.py
Class Name: AbbyyDataSet
Method Name: _load_sample


Project Name: apache/incubator-tvm
Commit Name: a3b1397363ea86172fdfc2d631c2be03c01e042f
Time: 2020-04-23
Author: zhaowu@apache.org
File Name: python/tvm/relay/frontend/tflite.py
Class Name: OperatorConverter
Method Name: convert_conv


Project Name: apache/incubator-tvm
Commit Name: a3b1397363ea86172fdfc2d631c2be03c01e042f
Time: 2020-04-23
Author: zhaowu@apache.org
File Name: python/tvm/relay/frontend/coreml.py
Class Name:
Method Name: _ConvolutionLayerParams