在MacOS上进行极慢的推理,以获得更快的推理速度\u rcnn\u resnet50\u fgvc\u 2018\u 07\u 19

2024-05-17 15:12:49 发布

您现在位置:Python中文网/ 问答频道 /正文

在我合理的新MBP上,使用iNat模型(2854个类)对每张图像进行推断需要6分钟以上。其他模型速度快得多,但对我来说没用,因为我想装箱(并识别)昆虫

352.11440205574036
{'num_detections': 5, 'detection_boxes': array([[0.161314  , 0.07663244, 0.8760584 , 0.8353734 ],
       [0.21500829, 0.15136112, 0.8591431 , 0.77994514],
       [0.2097887 , 0.15024516, 0.798306  , 0.7945756 ],
       [0.22616749, 0.14413752, 0.8274681 , 0.78175414],
       [0.23031202, 0.1721791 , 0.8461484 , 0.7838437 ]], dtype=float32), 'detection_scores': array([0.49970442, 0.07632057, 0.07298005, 0.06298006, 0.03536102],
      dtype=float32), 'detection_classes': array([  2, 248,   9, 155, 198], dtype=uint8)}
         29469691 function calls (29323558 primitive calls) in 471.230 seconds

   Ordered by: cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   2740/1    0.044    0.000  471.234  471.234 {built-in method builtins.exec}
        1    0.319    0.319  471.227  471.227 detect_insect.py:1(<module>)
        1    0.004    0.004  355.473  355.473 detect_insect.py:72(run_inference_for_single_image)
        1    0.001    0.001  352.112  352.112 session.py:846(run)
        1    0.002    0.002  352.111  352.111 session.py:1091(_run)
        1    0.000    0.000  352.096  352.096 session.py:1318(_do_run)
        1    0.000    0.000  352.096  352.096 session.py:1363(_do_call)
        1    0.001    0.001  352.096  352.096 session.py:1346(_run_fn)
        1    0.002    0.002  347.445  347.445 session.py:1439(_call_tf_sessionrun)
        1  347.443  347.443  347.443  347.443 {built-in method _pywrap_tensorflow_internal.TF_SessionRun_wrapper}
        1    0.441    0.441   56.288   56.288 request.py:1775(retrieve)
    85287    0.176    0.000   52.912    0.001 tempfile.py:479(func_wrapper)
    85287    0.589    0.000   52.735    0.001 client.py:436(read)
    85286    0.328    0.000   51.999    0.001 client.py:468(readinto)
    85286    0.487    0.000   51.645    0.001 {method 'readinto' of '_io.BufferedReader' objects}
   159149    0.374    0.000   51.280    0.000 socket.py:575(readinto)
   159149   50.610    0.000   50.610    0.000 {method 'recv_into' of '_socket.socket' objects}
       25    0.000    0.000   35.959    1.438 deprecation.py:473(new_func)
        1    0.000    0.000   35.956   35.956 importer.py:347(import_graph_def)
        1    0.001    0.001   35.956   35.956 importer.py:415(_import_graph_def_internal)
        1    0.489    0.489   19.450   19.450 importer.py:237(_ProcessNewOps)
        1    0.290    0.290   13.701   13.701 ops.py:3542(_add_new_tf_operations)
        1    0.106    0.106   11.004   11.004 ops.py:3560(<listcomp>)
        1   10.931   10.931   10.931   10.931 {built-in method _pywrap_tensorflow_internal.TF_GraphImportGraphDefWithResults}

Any advice?


Tags: runinpy模型sessionsocketarraymethod