Replies: 4 comments
-
det_limit_side_len=20000设置的太大了,显存不够 |
Beta Was this translation helpful? Give feedback.
-
长图可以试试main分支下的slice操作 PaddleOCR/doc/doc_ch/quickstart.md Lines 256 to 294 in 6954da7 |
Beta Was this translation helpful? Give feedback.
-
请问这是啥问题。。 |
Beta Was this translation helpful? Give feedback.
-
我又试了一下没啥问题呀 pip install git+https://github.com/PaddlePaddle/PaddleOCR.git from paddleocr import PaddleOCR
from PIL import Image, ImageDraw, ImageFont
# 初始化OCR引擎
ocr = PaddleOCR(use_angle_cls=True, lang="en")
img_path = "./very_large_image.jpg"
slice = {'horizontal_stride': 300, 'vertical_stride': 500, 'merge_x_thres': 50, 'merge_y_thres': 35}
results = ocr.ocr(img_path, cls=True, slice=slice)
# 加载图像
image = Image.open(img_path).convert("RGB")
draw = ImageDraw.Draw(image)
font = ImageFont.truetype("../PaddleOCR/doc/fonts/simfang.ttf", size=20) # 根据需要调整大小
# 处理并绘制结果
for res in results:
for line in res:
box = [tuple(point) for point in line[0]]
# 找出边界框
box = [(min(point[0] for point in box), min(point[1] for point in box)),
(max(point[0] for point in box), max(point[1] for point in box))]
txt = line[1][0]
draw.rectangle(box, outline="red", width=2) # 绘制矩形
draw.text((box[0][0], box[0][1] - 25), txt, fill="blue", font=font) # 在矩形上方绘制文本
# 保存结果
image.save("result.jpg") |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
问题描述 / Problem Description
paddleocr 做长图的ocr识别,det_limit_side_len=20000,10G 显存,Out of memory error on
运行环境 / Runtime Environment
NVIDIA-SMI 470.57.02 Driver Version: 470.57.02 CUDA Version: 11.8 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA A10 On | 00000000:00:09.0 Off | 0 |
| 0% 52C P0 64W / 150W | 10262MiB / 10332MiB | 1% Default |
| | | N/A |
复现代码 / Reproduction Code
完整报错 / Complete Error Message
7 phi::DnnWorkspaceHandle::RunFunc(std::function<void (void*)> const&, unsigned long)
8 phi::DnnWorkspaceHandle::ReallocWorkspace(unsigned long)
9 paddle::memory::allocation::Allocator::Allocate(unsigned long)
10 paddle::memory::allocation::StatAllocator::AllocateImpl(unsigned long)
11 paddle::memory::allocation::Allocator::Allocate(unsigned long)
12 paddle::memory::allocation::Allocator::Allocate(unsigned long)
13 paddle::memory::allocation::Allocator::Allocate(unsigned long)
14 paddle::memory::allocation::Allocator::Allocate(unsigned long)
15 paddle::memory::allocation::CUDAAllocator::AllocateImpl(unsigned long)
16 std::string phi::enforce::GetCompleteTraceBackString<std::string >(std::string&&, char const*, int)
17 phi::enforce::GetCurrentTraceBackStringabi:cxx11
Error Message Summary:
ResourceExhaustedError:
Out of memory error on GPU 0. Cannot allocate 128.000000MB memory on GPU 0, 10.021484GB memory has been allocated and available memory is only 70.000000MB.
Please check whether there is any other process using GPU 0.
(at /paddle/paddle/fluid/memory/allocation/cuda_allocator.cc:86)
可能解决方案 / Possible solutions
附件 / Appendix
Beta Was this translation helpful? Give feedback.
All reactions