PaddlePaddle/PaddleOCR · error · RuntimeError
Unknown augmenter arg: {}
Error message
Unknown augmenter arg: {} What it means
IAA (imgaug) augmenter construction in PaddleOCR maps each entry of the 'augmenter_args' list to an imgaug class via getattr(A, type). When the augmenter type string is not a recognized imgaug/Resize augmenter name, construction falls through and raises RuntimeError('Unknown augmenter arg: ' + str(args)).
Source
Thrown at ppocr/data/imaug/iaa_augment.py:130
# Process individual transformation specified as dictionary
augmenter_type = args["type"]
augmenter_args = args.get("args", {})
augmenter_args_mapped = self.map_arguments(augmenter_type, augmenter_args)
augmenter_type_mapped = self.imgaug_to_albu.get(
augmenter_type, augmenter_type
)
if augmenter_type_mapped == "Resize":
return ImgaugLikeResize(**augmenter_args_mapped)
else:
cls = getattr(A, augmenter_type_mapped)
return cls(
**{
k: self.to_tuple_if_list(v)
for k, v in augmenter_args_mapped.items()
}
)
else:
raise RuntimeError("Unknown augmenter arg: " + str(args))
# Map arguments to expected format for each augmenter type
def map_arguments(self, augmenter_type, augmenter_args):
augmenter_args = augmenter_args.copy() # Avoid modifying the original arguments
if augmenter_type == "Resize":
# Ensure size is a valid 2-element list or tuple
size = augmenter_args.get("size")
if size:
if not isinstance(size, (list, tuple)) or len(size) != 2:
raise ValueError(
f"'size' must be a list or tuple of two numbers, but got {size}"
)
min_scale, max_scale = size
return {
"scale_range": (min_scale, max_scale),
"interpolation": 1, # Linear interpolation
"p": 1.0,
}View on GitHub (pinned to 2661c7c0ef)
Solutions
- Check the exact spelling of the 'type' field against imgaug's augmenters module (python -c 'import imgaug.augmenters as A; print([n for n in dir(A) if n[0].isupper()])')
- Use the supported special-case name 'Resize' for resize operations
- Pin a compatible imgaug version (imgaug 0.4.0 is the usual requirement for PaddleOCR)
- Print the args dict in the error and compare it field-by-field with a known-good config such as configs/det/det_db_iaa.yml style pipelines
Example fix
# before (config)
augmenter_args:
- { type: Fliplr, args: { p: 0.5 } }
- { type: Resise, args: { size: [640, 640] } }
# after
augmenter_args:
- { type: Fliplr, args: { p: 0.5 } }
- { type: Resize, args: { size: [640, 640] } } Defensive patterns
Strategy: validation
Validate before calling
import imgaug.augmenters as A
valid = set(n for n in dir(A) if n[0].isupper()) | {'Resize'}
for entry in augmenter_args:
if entry['type'] not in valid:
raise SystemExit(f"Unknown augmenter type {entry['type']}; valid: {sorted(valid)[:20]}...") Try / catch
try:
aug = IaaAugment(augmenter_args=augmenter_args)
except (RuntimeError, AttributeError, ValueError) as e:
raise ValueError(f'Bad iaa augmenter_args {augmenter_args}: {e}') from e Prevention
- List available imgaug augmenters at env-setup time and store them with your config
- Pin imgaug==0.4.0 to keep the class set stable
- Add new augmenter types one at a time, running one dataloader batch to catch constructor errors
When it happens
Trigger: Using the iaa_augment.IaaAugment pipeline with an augmenter_args entry whose 'type' key is misspelled (e.g. 'Fliplr' vs 'Fliplr', 'Affine', 'Resize') or names a class that does not exist in the imgaug library version installed (A here is the imgaug augmenters module or its shim).
Common situations: Custom yml configs that add imgaug augmenters not covered by the mapping table; upgrading/downgrading imgaug so a class name disappears; a typo in the type field such as 'Resise' or 'MotionBlur' (imgaug has no such class).
Related errors
- 'size' must be a list or tuple of two numbers, but got {size
- Asset "${assetName}" references unknown model asset "${asset
- RecResizeImg.image_shape is required in rec inference.yml
- Unexpected recognition channels: ${String(channels)}
- OCR pipeline config text must decode to an object.
AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14).
Data as JSON: /api/errors/0b2c9f505915a568.
Report an issue: GitHub.