PaddlePaddle/PaddleOCR · error · Exception

not found infer list {}

Error message

not found infer list {}

What it means

Exception from get_image_file_list (ppocr/utils/utility.py) when an infer_list file path is supplied but does not exist on disk. The list file is expected to be a text file with one image path (optionally tab-separated from a label) per line, resolved relative to img_file.

Source

Thrown at ppocr/utils/utility.py:70

    if mode == "train_eval":
        check_params = check_params + [
            "train_batch_size_per_card",
            "test_batch_size_per_card",
        ]
    elif mode == "test":
        check_params = check_params + ["test_batch_size_per_card"]
    return check_params


def _check_image_file(path):
    img_end = {"jpg", "bmp", "png", "jpeg", "rgb", "tif", "tiff", "gif", "pdf"}
    return any([path.lower().endswith(e) for e in img_end])


def get_image_file_list(img_file, infer_list=None):
    imgs_lists = []
    if infer_list and not os.path.exists(infer_list):
        raise Exception("not found infer list {}".format(infer_list))
    if infer_list:
        with open(infer_list, "r") as f:
            lines = f.readlines()
        for line in lines:
            image_path = line.strip().split("\t")[0]
            image_path = os.path.join(img_file, image_path)
            imgs_lists.append(image_path)
    else:
        if img_file is None or not os.path.exists(img_file):
            raise Exception("not found any img file in {}".format(img_file))

        img_end = {"jpg", "bmp", "png", "jpeg", "rgb", "tif", "tiff", "gif", "pdf"}
        if os.path.isfile(img_file) and _check_image_file(img_file):
            imgs_lists.append(img_file)
        elif os.path.isdir(img_file):
            for single_file in os.listdir(img_file):
                file_path = os.path.join(img_file, single_file)
                if os.path.isfile(file_path) and _check_image_file(file_path):

View on GitHub (pinned to 2661c7c0ef)

Solutions

  1. Verify the list file exists at the exact path passed (ls it) and fix the path or download/generate the list.
  2. Use an absolute path for infer_list to avoid working-directory sensitivity.
  3. Confirm each line's first tab-separated field names an image that exists under img_file.

Example fix

# before
get_image_file_list('imgs', infer_list='eval_list.txt')  # file missing in cwd

# after
get_image_file_list('imgs', infer_list='/data/eval/eval_list.txt')
Defensive patterns

Strategy: validation

Validate before calling

import os

def valid_infer_list(p) -> bool:
    return p is None or (os.path.isfile(p) and os.path.getsize(p) > 0)

assert valid_infer_list(infer_list), f"infer list missing or empty: {infer_list}"

Prevention

When it happens

Trigger: Calling prediction/evaluation entry points with image_dir plus an infer_list (e.g. rec_gt_test.txt style list) whose path is typo'd, absolute-mismatched, or not downloaded yet.

Common situations: Benchmarking on ICDAR/ReCTS/LaTeX lists that must be fetched separately; running tools from a different working directory with a relative infer_list path; config eval lists pointing at an unmounted dataset volume.

Related errors


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