PaddlePaddle / PaddlePaddle/FastDeploy

RK3588 OCR 内存泄露

Open
#2,609 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.7k
Forks
756
Avg merge
19h 28m
Merged PRs (30d)
4

Description

在对生成的demo文件进行压力测试的时候,出现内存泄露问题.
infer.cc修改后的代码:

int processImages() {

  fastdeploy::RuntimeOption option;
  fastdeploy::ModelFormat format;
  int flag = std::atoi("1");

  if (flag == 0) {
    option.UseCpu();
    format = fastdeploy::ONNX;
  } else if (flag == 1) {
    option.UseRKNPU2();
    format = fastdeploy::RKNN;
  }

  std::string det_model_dir = "./yh/det4_shape_rk3588_unquantized.rknn";
  std::string cls_model_dir = "./yh/cls2_shape_rk3588_unquantized.rknn";
  std::string rec_model_dir = "./yh/rec4_shape_rk3588_unquantized.rknn";
  std::string rec_label_file = "./yh/ppocr_keys_v1.txt";
  std::string test_image = "./1.jpg";
  InitAndInfer(det_model_dir, cls_model_dir, rec_model_dir, rec_label_file,
               test_image, option, format);
  return 0;
}

测试test.cpp:

#include <iostream>
#include <vector>
#include <string>
#include "infer_demo.h" // 包含静态库的头文件

int main() {
    while(1) {
        processImages();
    }

    return 0;
}

头文件:infer_demo.h

#ifndef INFER_DEMO_H
#define INFER_DEMO_H

int processImages();

#endif // INFER_DEMO_H

Image

Image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with processImages in infer.cc, the declaration in infer_demo.h, and the stress loop in test.cpp. Run the RK3588 OCR demo under repeated calls to InitAndInfer and inspect memory behavior around that entry point. Done means the repeated test no longer shows memory growth, with the reproduction and expected behavior documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-vision, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.