{"record":{"id":"a876d765b5ec031d","repo":"PaddlePaddle/PaddleOCR","slug":"interpolation-types-only-nearest-linear-cubic-a","errorCode":null,"errorMessage":"Interpolation types only nearest, linear, cubic, area are supported!","messagePattern":"Interpolation types only nearest, linear, cubic, area are supported!","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"ppocr/data/imaug/abinet_aug.py","lineNumber":52,"sourceCode":"\ndef sample_uniform(low, high, size=None):\n    return np.random.uniform(low, high, size=size)\n\n\ndef get_interpolation(type=\"random\"):\n    if type == \"random\":\n        choice = [cv2.INTER_NEAREST, cv2.INTER_LINEAR, cv2.INTER_CUBIC, cv2.INTER_AREA]\n        interpolation = choice[random.randint(0, len(choice) - 1)]\n    elif type == \"nearest\":\n        interpolation = cv2.INTER_NEAREST\n    elif type == \"linear\":\n        interpolation = cv2.INTER_LINEAR\n    elif type == \"cubic\":\n        interpolation = cv2.INTER_CUBIC\n    elif type == \"area\":\n        interpolation = cv2.INTER_AREA\n    else:\n        raise TypeError(\n            \"Interpolation types only nearest, linear, cubic, area are supported!\"\n        )\n    return interpolation\n\n\nclass CVRandomRotation(object):\n    def __init__(self, degrees=15):\n        assert isinstance(degrees, numbers.Number), \"degree should be a single number.\"\n        assert degrees >= 0, \"degree must be positive.\"\n        self.degrees = degrees\n\n    @staticmethod\n    def get_params(degrees):\n        return sample_sym(degrees)\n\n    def __call__(self, img):\n        angle = self.get_params(self.degrees)\n        src_h, src_w = img.shape[:2]","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/ppocr/data/imaug/abinet_aug.py#L34-L70","documentation":"get_interpolation in ppocr/data/imaug/abinet_aug.py maps a style string to an OpenCV interpolation flag; 'random' picks one of the four flags, and anything other than random/nearest/linear/cubic/area raises TypeError. This is ABINet training-data augmentation config validation, so the error means an invalid 'interpolation' entry in the transform config.","triggerScenarios":"An augmentation pipeline config (or CVGeometry/CVColorJitter-style transform constructed with interpolation='bilinear', 'lanczos', or 'RANDOM') reaching get_interpolation; only exact lowercase strings are accepted.","commonSituations":"Copying augmentation YAML from other repos (Albumentations/torchvision names like 'bilinear'); training ABINet rec models with hand-edited config files; case mismatches.","solutions":["Set interpolation to one of: 'random', 'nearest', 'linear', 'cubic', 'area' in the transform config.","Note 'bilinear' is NOT accepted — the OpenCV name here is 'linear'.","Check the YAML/JSON config actually loaded (print the resolved transform args) to catch overrides."],"exampleFix":"# config.yml / transform args\n# before\n- CVGeometry:\n    interpolation: bilinear\n# after\n- CVGeometry:\n    interpolation: linear","handlingStrategy":"validation","validationCode":"VALID_INTERP = {'random', 'nearest', 'linear', 'cubic', 'area'}\n\ndef valid_interpolation(s) -> bool:\n    return isinstance(s, str) and s.lower() in VALID_INTERP","typeGuard":"def is_interpolation_style(v) -> bool:\n    return isinstance(v, str) and v in {'random','nearest','linear','cubic','area'}","tryCatchPattern":null,"preventionTips":["Map external names to this module's names ('bilinear' -> 'linear', 'lanczos4' -> 'cubic'|None)","Validate augmentation YAML against the accepted set before training starts","Remember values are case-sensitive lowercase strings"],"tags":["data-augmentation","abinet","opencv","config","typeerror"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}