Skip to content

Memory leak when using PaddleOCR 3.0.1/3.0.0 with argument device=cpu #15631

Closed
PaddlePaddle/PaddleX
#4148
@timminator

Description

@timminator

🔎 Search before asking

  • I have searched the PaddleOCR Docs and found no similar bug report.
  • I have searched the PaddleOCR Issues and found no similar bug report.
  • I have searched the PaddleOCR Discussions and found no similar bug report.

🐛 Bug (问题描述)

PaddleOCR 3.0.1/3.0.0 has a memory leak when used with the argument command line argument --device cpu or in a python script when used with device="cpu". RAM usage increases steadily in this case and does never decrease again. This is especially bad on a folder with a lot of images. On a test folder with around 2000 images I saw a ram usage of about 9 GB!

Image

🏃‍♂️ Environment (运行环境)

  • OS: Windows 11
  • PaddleOCR 3.0.1
  • PaddlePaddle 3.0.0 (CPU version)
  • 16GB RAM
  • Installed via pip in a venv with Python 3.11

🌰 Minimal Reproducible Example (最小可复现问题的Demo)

Example in python:

from paddleocr import PaddleOCR

ocr = PaddleOCR(
    use_doc_orientation_classify=False, 
    use_doc_unwarping=False, 
    use_textline_orientation=False,
    device="cpu") # Argument that causes the issue

result = ocr.predict(r"Path\to\folder\with\a\lot\of\images")
for res in result:
    res.print()
    res.save_to_img("output")
    res.save_to_json("output")

Example from the command line:

paddleocr ocr -i "Path\to\folder\with\a\lot\of\images" --lang ch --use_doc_orientation_classify False --use_doc_unwarping False --use_textline_orientation false --device cpu

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions