{"record":{"id":"a869e18d602c7487","repo":"PaddlePaddle/PaddleOCR","slug":"not-support-limit-type-image","errorCode":null,"errorMessage":"not support limit type, image ","messagePattern":"not support limit type, image ","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"ppocr/data/imaug/operators.py","lineNumber":301,"sourceCode":"            if max(h, w) > limit_side_len:\n                if h > w:\n                    ratio = float(limit_side_len) / h\n                else:\n                    ratio = float(limit_side_len) / w\n            else:\n                ratio = 1.0\n        elif self.limit_type == \"min\":\n            if min(h, w) < limit_side_len:\n                if h < w:\n                    ratio = float(limit_side_len) / h\n                else:\n                    ratio = float(limit_side_len) / w\n            else:\n                ratio = 1.0\n        elif self.limit_type == \"resize_long\":\n            ratio = float(limit_side_len) / max(h, w)\n        else:\n            raise Exception(\"not support limit type, image \")\n        resize_h = int(h * ratio)\n        resize_w = int(w * ratio)\n        if max(resize_h, resize_w) > self.max_side_limit:\n            print(\n                f\"Resized image size ({resize_h}x{resize_w}) exceeds max_side_limit of {self.max_side_limit}. \"\n                f\"Resizing to fit within limit.\"\n            )\n            ratio = float(self.max_side_limit) / max(resize_h, resize_w)\n            resize_h, resize_w = int(resize_h * ratio), int(resize_w * ratio)\n\n        resize_h = max(int(round(resize_h / 32) * 32), 32)\n        resize_w = max(int(round(resize_w / 32) * 32), 32)\n\n        try:\n            if int(resize_w) <= 0 or int(resize_h) <= 0:\n                return None, (None, None)\n            img = cv2.resize(img, (int(resize_w), int(resize_h)))\n        except:","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/ppocr/data/imaug/operators.py#L283-L319","documentation":"This is the image-side resize logic used by detection preprocessing (DetResizeForImage style). After handling limit_type 'max', 'min', and 'resize_long', any other limit_type string falls into the else branch and raises 'not support limit type, image'.","triggerScenarios":"Setting limit_type in a detection config's DetResizeForImage (or equivalent) transform to an unsupported value such as 'min_long', 'long', 'none', or leaving a typo like 'reszie_long'.","commonSituations":"Merging configs from different PaddleOCR versions or other repos where limit_type vocabulary differs; attempting to disable the limit with limit_type: null/none (not supported here).","solutions":["Use one of the three supported values: limit_type: max, limit_type: min, or limit_type: resize_long","To approximate 'no limit', use limit_type: max with a very large limit_side_len (capped later by max_side_limit)","Double-check spelling against a shipped config such as configs/det/det_db_ch.yml style pipelines","Check that YAML did not fold the value into another key through bad indentation"],"exampleFix":"# before\nDetResizeForImage:\n  limit_type: min_long\n  limit_side_len: 736\n# after\nDetResizeForImage:\n  limit_type: min\n  limit_side_len: 736","handlingStrategy":"validation","validationCode":"allowed = {'max', 'min', 'resize_long'}\nlt = op_cfg.get('limit_type')\nif lt not in allowed:\n    raise SystemExit(f'limit_type must be one of {sorted(allowed)}, got {lt!r}')","typeGuard":"def is_valid_limit_type(v: str) -> bool:\n    return v in {'max', 'min', 'resize_long'}","tryCatchPattern":"try:\n    op = DetResizeForImage(**op_cfg)\nexcept Exception as e:\n    if 'not support limit type' in str(e):\n        raise ValueError(f\"limit_type must be max|min|resize_long, got {op_cfg.get('limit_type')}\") from e\n    raise","preventionTips":["Copy limit_type values verbatim from shipped configs","Diff custom ymls against the official baseline config when upgrading PaddleOCR","Remember there is no 'none' option; use max with a large limit_side_len"],"tags":["config","detection","resize","preprocessing"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}