Skip to content

GPU 推理耗时太长 #117

Description

@MMVAT

作者您好,我在a100gpu上,按照您给出的代码推理和您同一张60kb的图片,但是发现推理时间和使用cpu差不多,都是4.多秒,并且观察到gpu上是有相应的计算和显存波动的,请问这是为什么

from rapidocr import RapidOCR
import time

from rapid_table import ModelType, RapidTable, RapidTableInput

ocr_engine = RapidOCR()

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

img_path = "/home/admin001/YY/RapidTable-main/demo_train/table.jpg"

start_time = time.time()
ori_ocr_res = ocr_engine(img_path)
ocr_results = [ori_ocr_res.boxes, ori_ocr_res.txts, ori_ocr_res.scores]
print(f"all time{start_time - time.time()}")

results = table_engine(img_path, ocr_results=ocr_results)
results.vis(save_dir="outputs", save_name="vis10")

Metadata

Metadata

Assignees

No one assigned

    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