Skip to content

性能貌似有问题 #2

@Times125

Description

@Times125

在本地macbook的m4芯片上跑一张图耗时3秒左右,放到阿里云服务器上系统是ubuntu22,使用nvidia t4 gpu+40核心+155G存储的规格,跑一张图片要18秒。
用的测试代码如下:


import time
from anyocr.pipeline import anyocr,anyocrConfig

config = anyocrConfig(
    det_model_path = "anyocr/models/anyocr_det_ch_v4_lite.onnx",
    rec_model_path = "anyocr/models/anyocr_rec_v4_server.onnx",
    cls_model_path = "anyocr/models/anyocr_cls_v4.onnx",
    rec_keys_path = "anyocr/models/anyocr_keys_v4.txt",
    cls_use_cuda=True, 
    rec_use_cuda=True, 
    det_use_cuda=True
)
config = config.model_dump()
model = anyocr(config)
avg_time = 0
for i in range(10):
    start_time = time.time()
    result,e = model.raw_completions('xx.png',use_cls=True,use_det=True)
    # print(result)
    # text = "".join([item[1] for item in result])
    # print(text)
    avg_time += time.time() - start_time
    print(f"cost time : {time.time() - start_time} s")

print(f'avg time : {avg_time/10}s')

测试结果:

cost time : 18.152334690093994 s
cost time : 18.196022748947144 s
cost time : 18.263890027999878 s
cost time : 18.26397180557251 s
cost time : 18.30384087562561 s
cost time : 18.36418128013611 s
cost time : 18.338853359222412 s
cost time : 18.376988649368286 s
cost time : 18.327746152877808 s
cost time : 18.14015555381775 s
avg time : 18.27279703617096s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions