ba193bcaea3f8f2b447bad1194adce5acb8b4e3d,calamari_ocr/ocr/data_processing/final_preparation.py,FinalPreparation,_apply_single,#FinalPreparation#Any#,15

Before Change



    def _apply_single(self, data):
        if self.normalize:
            data = data * 1.0 / np.amax(data)

        if self.invert:
            data = np.amax(data) - data

After Change



    def _apply_single(self, data):
        if self.normalize:
            amax = np.amax(data)
            if amax > 0:
                data = data * 1.0 / amax

        if self.invert:
            data = np.amax(data) - data

        if self.transpose:
            data = data.T

        if self.pad > 0:
            if self.transpose:
                w = data.shape[1]
                data = np.vstack([np.full((self.pad, w), self.pad_value), data, np.full((self.pad, w), self.pad_value)])
            else:
                w = data.shape[0]
                data = np.hstack([np.full((w, self.pad), self.pad_value), data, np.full((w, self.pad), self.pad_value)])

        if self.as_uint8:
            data = (data * 255).astype(np.uint8)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: Calamari-OCR/calamari
Commit Name: ba193bcaea3f8f2b447bad1194adce5acb8b4e3d
Time: 2018-06-14
Author: wick.chr.info@gmail.com
File Name: calamari_ocr/ocr/data_processing/final_preparation.py
Class Name: FinalPreparation
Method Name: _apply_single


Project Name: mne-tools/mne-python
Commit Name: 544989c7ff9922e04bddad72c1b13156ce344ace
Time: 2019-02-15
Author: alexandre.gramfort@m4x.org
File Name: mne/rank.py
Class Name:
Method Name: _estimate_rank_from_s


Project Name: apache/incubator-mxnet
Commit Name: 95f5cc60904a2d88d4861fff0f6dbad15f8cdbe3
Time: 2020-10-06
Author: zhaoqizhu96@gmail.com
File Name: tests/nightly/test_np_large_array.py
Class Name:
Method Name: test_amax


Project Name: lcswillems/torch-rl
Commit Name: f583090eceb985cf4a65299620e1fb6aa4217fbb
Time: 2018-08-29
Author: lcswillems@gmail.com
File Name: utils/general.py
Class Name:
Method Name: synthesize