【问题标题】:Inference time of tiny-yolo-v3 on GPUtiny-yolo-v3 在 GPU 上的推理时间
【发布时间】:2020-09-17 00:34:30
【问题描述】:

我正在使用 GPU 运行时在 google collab 上推断 tiny-yolo-v3。 使用的 GPU 是 Tesla P100-PCIE-16GB。

运行暗网推理命令后,显示的预测时间为 0.91 秒。

我可以从代码中看到,这个时间戳是网络在 GPU 上的处理时间,不包括图像的预处理和后处理。 我创建了包含相同结果的单元格。

现在,我对此有点困惑。我知道这些 GPU 非常昂贵并且性能很好。但是 0.91 秒的推理时间占 0.9 帧/秒的性能,这并不重要。

谁能告诉我我在这里做错了什么? 还是GPU的实际性能?

我知道推理时间取决于很多参数,例如网络大小等,但 GPU 在 tiny-yolo-v3 等网络中处理数据的速度有多快?

from tensorflow.python.client import device_lib
device_lib.list_local_devices()

[name: "/device:CPU:0"
 device_type: "CPU"
 memory_limit: 268435456
 locality {
 }
 incarnation: 4007284112891679343, name: "/device:XLA_CPU:0"
 device_type: "XLA_CPU"
 memory_limit: 17179869184
 locality {
 }
 incarnation: 16862634677760767602
 physical_device_desc: "device: XLA_CPU device", name: "/device:XLA_GPU:0"
 device_type: "XLA_GPU"
 memory_limit: 17179869184
 locality {
 }
 incarnation: 10729193134179919719
 physical_device_desc: "device: XLA_GPU device", name: "/device:GPU:0"
 device_type: "GPU"
 memory_limit: 15701463552
 locality {
   bus_id: 1
   links {
   }
 }
 incarnation: 8937778522862983933
 physical_device_desc: "device: 0, name: Tesla P100-PCIE-16GB, pci bus id: 0000:00:04.0, compute capability: 6.0"]

import tensorflow as tf
tf.test.gpu_device_name()

/device:GPU:0'

!./darknet detector test cfg/coco.data cfg/yolov3-tiny.cfg /yolov3-tiny.weights data/dog.jpg

layer     filters    size              input                output
    0 conv     16  3 x 3 / 1   416 x 416 x   3   ->   416 x 416 x  16  0.150 BFLOPs
    1 max          2 x 2 / 2   416 x 416 x  16   ->   208 x 208 x  16
    2 conv     32  3 x 3 / 1   208 x 208 x  16   ->   208 x 208 x  32  0.399 BFLOPs
    3 max          2 x 2 / 2   208 x 208 x  32   ->   104 x 104 x  32
    4 conv     64  3 x 3 / 1   104 x 104 x  32   ->   104 x 104 x  64  0.399 BFLOPs
    5 max          2 x 2 / 2   104 x 104 x  64   ->    52 x  52 x  64
    6 conv    128  3 x 3 / 1    52 x  52 x  64   ->    52 x  52 x 128  0.399 BFLOPs
    7 max          2 x 2 / 2    52 x  52 x 128   ->    26 x  26 x 128
    8 conv    256  3 x 3 / 1    26 x  26 x 128   ->    26 x  26 x 256  0.399 BFLOPs
    9 max          2 x 2 / 2    26 x  26 x 256   ->    13 x  13 x 256
   10 conv    512  3 x 3 / 1    13 x  13 x 256   ->    13 x  13 x 512  0.399 BFLOPs
   11 max          2 x 2 / 1    13 x  13 x 512   ->    13 x  13 x 512
   12 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024  1.595 BFLOPs
   13 conv    256  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 256  0.089 BFLOPs
   14 conv    512  3 x 3 / 1    13 x  13 x 256   ->    13 x  13 x 512  0.399 BFLOPs
   15 conv    255  1 x 1 / 1    13 x  13 x 512   ->    13 x  13 x 255  0.044 BFLOPs
   16 yolo
   17 route  13
   18 conv    128  1 x 1 / 1    13 x  13 x 256   ->    13 x  13 x 128  0.011 BFLOPs
   19 upsample            2x    13 x  13 x 128   ->    26 x  26 x 128
   20 route  19 8
   21 conv    256  3 x 3 / 1    26 x  26 x 384   ->    26 x  26 x 256  1.196 BFLOPs
   22 conv    255  1 x 1 / 1    26 x  26 x 256   ->    26 x  26 x 255  0.088 BFLOPs
   23 yolo
Loading weights from /content/gdrive/My Drive/Darknet/yolov3-tiny.weights...Done!
data/dog.jpg: Predicted in 0.917487 seconds.
dog: 57%
car: 52%
truck: 56%
car: 62%
bicycle: 59%

【问题讨论】:

    标签: tensorflow deep-learning gpu yolo darknet


    【解决方案1】:

    您必须在启用 GPU 的情况下制作暗网,才能使用 GPU 执行推理,而您目前获得推理的时间是因为推理当前是由 CPU 完成的,而不是 GPU。 我遇到了这个问题,在我自己的笔记本电脑上,我得到了 1.2 秒的推理时间。在我启用 CUDA 并启用了 GPU 的项目后,我在 Nvidia Geforce GTX 960 上获得了大约 0.2 秒的推理时间。 为了使用 GPU 制作暗网,打开 Makefile,将 GPU=0 行更改为 GPU=1。然后再次制作项目。如果你在 colab 上运行代码,我假设你会得到 0.05 秒的推理时间。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-08
      • 2018-12-10
      相关资源
      最近更新 更多