Skip to content

v5识别模型当batch=1的时候,测试的图片很长,等比缩放之后,总是导致显存不够,能否限制图片宽度,然后再去缩放?而不是直接resize #15848

Open
@cqray1990

Description

@cqray1990

🔎 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 (问题描述)

class OCRReisizeNormImg:
"""for ocr image resize and normalization"""

def __init__(self, rec_image_shape=[3, 48, 320], input_shape=None):
    super().__init__()
    self.rec_image_shape = rec_image_shape
    self.input_shape = input_shape
    self.max_imgW = 3200

      paddlex的处理直接resize   ,参数直接写死3200
       def resize_norm_img(self, img, max_wh_ratio):
              """resize and normalize the img"""
              imgC, imgH, imgW = self.rec_image_shape
              assert imgC == img.shape[2]
              imgW = int((imgH * max_wh_ratio))
              if imgW > self.max_imgW:
                  resized_image = cv2.resize(img, (self.max_imgW, imgH))
                  resized_w = self.max_imgW
                  imgW = self.max_imgW

paddleocr,没有找到相关处理代码,都是在一个batch里面找最大的宽度然后统一缩放

🏃‍♂️ Environment (运行环境)

paddleocr3.0

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

识别模型当batch=1的时候,测试的图片很长,等比缩放之后,总是导致显存不够,能否限制图片宽度,然后再去缩放?而不是直接resize

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions