使用use_gpu=True比use_gpu=False慢
Created by: nihuizhidao
欢迎您反馈PaddleHub使用问题,非常感谢您对PaddleHub的贡献! 在留下您的问题时,辛苦您同步提供如下信息:
- 版本、环境信息 1)PaddleHub和PaddlePaddle版本:paddlehub 1.7.1,paddlepaddle-gpu 1.8.1.post107 2)系统环境:CentOS7, python 3.7.6, GPU: RTX 2080
测试pyramidbox_lite_server_mask模型的face_detection API时发现使用use_gpu=True比use_gpu=False慢:以下为单张图片使用face_detection时time.perf_count()的耗时:
use_gpu=True
time cost: 4.844235592056066 time cost: 1.454470616299659 time cost: 1.3260896857827902 time cost: 1.425043759867549 time cost: 1.4381717252545059 time cost: 1.3000757340341806 time cost: 1.3987517324276268 time cost: 1.4077853970229626 time cost: 1.2869801730848849 done, time cost: 15.88195555889979
use_gpu=False
time cost: 2.0452515189535916 time cost: 1.7653371165506542 time cost: 1.388544927816838 time cost: 1.5212951567955315 time cost: 1.4754767650738358 time cost: 1.4352801940403879 time cost: 1.3712380463257432 time cost: 1.4844537246972322 time cost: 1.3216509399935603 done, time cost: 13.819137034006417
使用的模型及版本号:
!hub install pyramidbox_lite_server_mask==1.0.0 !hub install pyramidbox_lite_server==1.1.0
请问这是为什么呢,如何能够更加快速地推理?