def __init__()

in source/infer-ocr/src/main.py [0:0]


    def __init__(self):
        modelName = 'det_' + os.environ['MODEL_NAME'] + '.onnx'
        self.weights_path = '/mnt/lambda/' + modelName

        self.det_algorithm = 'DB'
        self.use_zero_copy_run = False

        pre_process_list = [{
            'DetResizeForTest': {
                'limit_side_len': 960,
                'limit_type': 'max'
            }
        }, {
            'NormalizeImage': {
                'std': [0.229, 0.224, 0.225],
                'mean': [0.485, 0.456, 0.406],
                'scale': '1./255.',
                'order': 'hwc'
            }
        }, {
            'ToCHWImage': None
        }, {
            'KeepKeys': {
                'keep_keys': ['image', 'shape']
            }
        }]

        postprocess_params = {}
        postprocess_params['name'] = 'DBPostProcess'
        postprocess_params["thresh"] = 0.3
        postprocess_params["box_thresh"] = 0.3
        postprocess_params["max_candidates"] = 1000
        postprocess_params["unclip_ratio"] = 1.6
        postprocess_params["use_dilation"] = True
        self.preprocess_op = create_operators(pre_process_list)
        self.postprocess_op = build_post_process(postprocess_params)
        self.ort_session = onnxruntime.InferenceSession(self.weights_path)