PaddlePaddle / PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
https://paddlepaddle.github.io/PaddleOCR/
Apache License 2.0
44.47k stars 7.84k forks source link

2.3M图片,每次识别必定内存溢出 #13911

Closed blandDrift closed 1 month ago

blandDrift commented 1 month ago

🔎 Search before asking

🐛 Bug (问题描述)

1

此图片每次OCR识别,必定内存溢出


C++ Traceback (most recent call last):


paddle::AnalysisPredictor::ZeroCopyRun() paddle::framework::NaiveExecutor::Run() paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, phi::Place const&) paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, phi::Place const&) const paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, phi::Place const&, paddle::framework::RuntimeContext) const void phi::HardSwishKernel<float, phi::GPUContext>(phi::GPUContext const&, phi::DenseTensor const&, phi::DenseTensor) void phi::ActivationGPUImpl<float, phi::GPUContext, phi::funcs::CudaHardSwishFunctor >(phi::GPUContext const&, phi::DenseTensor const&, phi::DenseTensor, phi::funcs::CudaHardSwishFunctor const&) float phi::DeviceContext::Alloc(phi::TensorBase, unsigned long, bool) const phi::DeviceContext::Impl::Alloc(phi::TensorBase, phi::Place const&, phi::DataType, unsigned long, bool, bool) const phi::DenseTensor::AllocateFrom(phi::Allocator, phi::DataType, unsigned long, bool) paddle::memory::allocation::Allocator::Allocate(unsigned long) paddle::memory::allocation::StatAllocator::AllocateImpl(unsigned long) paddle::memory::allocation::Allocator::Allocate(unsigned long) paddle::memory::allocation::Allocator::Allocate(unsigned long) paddle::memory::allocation::Allocator::Allocate(unsigned long) paddle::memory::allocation::Allocator::Allocate(unsigned long) paddle::memory::allocation::CUDAAllocator::AllocateImpl(unsigned long) std::string phi::enforce::GetCompleteTraceBackString(std::string&&, char const, int) phi::enforce::GetCurrentTraceBackStringabi:cxx11 ---------------------- Error Message Summary: ---------------------- ResourceExhaustedError: Out of memory error on GPU 0. Cannot allocate 2.089966GB memory on GPU 0, 7.469543GB memory has been allocated and available memory is only 362.875000MB. Please check whether there is any other process using GPU 0.

  1. If yes, please stop them, or start PaddlePaddle on another GPU.
  2. If no, please decrease the batch size of your model. (at ../paddle/fluid/memory/allocation/cuda_allocator.cc:86)

🏃‍♂️ Environment (运行环境)

Red Hat Enterprise Linux 8.10 python3.8.13 paddlepaddle-gpu 2.6.1.post117 nvidia A10 8G

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

基于rapidocr_paddle的封装 import cv2

from rapidocr_paddle import RapidOCR

engine = RapidOCR(det_use_cuda=True, cls_use_cuda=True, rec_use_cuda=True) image_path = "tests/1.png" result, elapse_list = engine(image_path)

SWHL commented 1 month ago

和 RapidOCR issue #226重复