PaddlePaddle/PaddleOCR · error · Exception

not support limit type, image

Error message

not support limit type, image 

What it means

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'.

Source

Thrown at ppocr/data/imaug/operators.py:301

            if max(h, w) > limit_side_len:
                if h > w:
                    ratio = float(limit_side_len) / h
                else:
                    ratio = float(limit_side_len) / w
            else:
                ratio = 1.0
        elif self.limit_type == "min":
            if min(h, w) < limit_side_len:
                if h < w:
                    ratio = float(limit_side_len) / h
                else:
                    ratio = float(limit_side_len) / w
            else:
                ratio = 1.0
        elif self.limit_type == "resize_long":
            ratio = float(limit_side_len) / max(h, w)
        else:
            raise Exception("not support limit type, image ")
        resize_h = int(h * ratio)
        resize_w = int(w * ratio)
        if max(resize_h, resize_w) > self.max_side_limit:
            print(
                f"Resized image size ({resize_h}x{resize_w}) exceeds max_side_limit of {self.max_side_limit}. "
                f"Resizing to fit within limit."
            )
            ratio = float(self.max_side_limit) / max(resize_h, resize_w)
            resize_h, resize_w = int(resize_h * ratio), int(resize_w * ratio)

        resize_h = max(int(round(resize_h / 32) * 32), 32)
        resize_w = max(int(round(resize_w / 32) * 32), 32)

        try:
            if int(resize_w) <= 0 or int(resize_h) <= 0:
                return None, (None, None)
            img = cv2.resize(img, (int(resize_w), int(resize_h)))
        except:

View on GitHub (pinned to 2661c7c0ef)

Solutions

  1. Use one of the three supported values: limit_type: max, limit_type: min, or limit_type: resize_long
  2. To approximate 'no limit', use limit_type: max with a very large limit_side_len (capped later by max_side_limit)
  3. Double-check spelling against a shipped config such as configs/det/det_db_ch.yml style pipelines
  4. Check that YAML did not fold the value into another key through bad indentation

Example fix

# before
DetResizeForImage:
  limit_type: min_long
  limit_side_len: 736
# after
DetResizeForImage:
  limit_type: min
  limit_side_len: 736
Defensive patterns

Strategy: validation

Validate before calling

allowed = {'max', 'min', 'resize_long'}
lt = op_cfg.get('limit_type')
if lt not in allowed:
    raise SystemExit(f'limit_type must be one of {sorted(allowed)}, got {lt!r}')

Type guard

def is_valid_limit_type(v: str) -> bool:
    return v in {'max', 'min', 'resize_long'}

Try / catch

try:
    op = DetResizeForImage(**op_cfg)
except Exception as e:
    if 'not support limit type' in str(e):
        raise ValueError(f"limit_type must be max|min|resize_long, got {op_cfg.get('limit_type')}") from e
    raise

Prevention

When it happens

Trigger: 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'.

Common situations: 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).

Related errors


AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14). Data as JSON: /api/errors/a869e18d602c7487. Report an issue: GitHub.