Skip to content

效果前后不一致 #112

Description

@wangwenqi567

使用代码如下:

from rapidocr import RapidOCR

from rapid_table import ModelType, RapidTable, RapidTableInput

ocr_engine = RapidOCR()

ROOT_URL = "models/"
model_path = {
    "encoder": f"{ROOT_URL}/unitable/encoder.pth",
    "decoder": f"{ROOT_URL}/unitable/decoder.pth",
    "vocab": f"{ROOT_URL}/unitable/vocab.json",
}

input_args = RapidTableInput(
     model_type=ModelType.UNITABLE,
     model_dir_or_path=model_path,
     engine_cfg={"use_cuda": True, "cuda_ep_cfg.gpu_id": 1},
)

table_engine = RapidTable(input_args)


@app.post("/uni_table")
def uni_table(
     image_data: ImageData,
) -> str:
    image_bytes = base64.b64decode(image_data.image)
    ori_ocr_res  = ocr_engine(image_bytes)
    ocr_results = [ori_ocr_res.boxes, ori_ocr_res.txts, ori_ocr_res.scores]
    table_results = table_engine(image_bytes , ocr_results)
    table_html_str, table_cell_bboxes = table_results.pred_html, table_results.cell_bboxes
    return table_html_str

def start_server(
        host='0.0.0.0', port=0000, reload=False, **kwargs
):
    import uvicorn

    uvicorn.run(app, host=host, port=port, reload=reload, **kwargs)

rapid-table 2.0.2
rapidocr 3.2.0
我遇到一个问题,即当我识别 A 图片时,效果是正常的,识别 B 图片时效果就会变差,
但是我重新启动服务,再识别 B 的表格时效果又是正常的,此时 A 图片效果又会变差,
就好像只有第一次识别是正常效果,后面效果就不对了,哪怕试验多次,依然是不对的。
想请教一下是什么原因,是做了什么缓存之类的影响了识别吗?
ps : 如果不是起模型服务的话,每次重新跑demo代码是不会出现效果不一致的情况

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions