opendatalab/MinerU · error · Exception

not support limit type, image

Error message

not support limit type, image 

What it means

Raised in the DetResizeForTest image operator (pytorchocr data augmentation) when limit_type is not one of 'max', 'min', or 'resize_long'. This operator resizes detection inputs to constrain a side length, and the string comes from the detection config's DetResizeForTest.limit_type key.

Source

Thrown at mineru/model/utils/pytorchocr/data/imaug/operators.py:261

            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.
        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.
        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:
            ratio = float(self.max_side_limit) / max(resize_h, resize_w)
            resize_h = int(resize_h * ratio)
            resize_w = 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:
            print(img.shape, resize_w, resize_h)
            sys.exit(0)

View on GitHub (pinned to 4fe4bde114)

Solutions

  1. Set limit_type in the DetResize for-test operator config to 'max', 'min', or 'resize_long'.
  2. If you want plain resizing, many configs use limit_type: 'resize_long' with a limit_side_len value.
  3. Compare against the det config shipped with mineru for your model version.

Example fix

# before
DetResizeForTest(limit_type="long", limit_side_len=960)

# after
DetResizeForTest(limit_type="resize_long", limit_side_len=960)
Defensive patterns

Strategy: validation

Validate before calling

limit_type = ops_cfg.get("limit_type")
assert limit_type in {"max", "min", "resize_long"}, f"bad limit_type: {limit_type!r}"

Prevention

When it happens

Trigger: A detection YAML/JSON config with image_shape-operator settings where limit_type is misspelled or omitted-with-bad-default (e.g. 'none', '', 'long'). Constructing DetResizeForTest(...) directly with an invalid limit_type also triggers it at first __call__.

Common situations: Hand-edited det configs copied from newer PaddleOCR versions whose limit_type vocabulary differs; merging configs where the key got dropped; typo like 'Resize_long'.

Related errors


AI-assisted analysis of opendatalab/MinerU@4fe4bde114 (2026-08-14). Data as JSON: /api/errors/5864e296844089a7. Report an issue: GitHub.