L
L
Lsh2019-02-17 22:24:50
Python
Lsh, 2019-02-17 22:24:50

MXNet shows poor performance on the graphics card. Where can there be a bottleneck?

Hi all!
I'm trying to figure out face detection in images using neural networks.
I read somewhere on Habré that MTCNN is a good detector, it is accurate and fast.
I found two of his (her?) variants for the MXNet framework.
1: https://github.com/onnx/models/blob/master/models/...
2: https://github.com/edmBernard/mtcnn
It works and finds faces.
But: FPS is low (6 - 10) and the video card is loaded only by 10 - 15%, the video card memory is occupied by a maximum of a quarter. Those. there is some kind of bottleneck that prevents you from using the full power of the GPU. How to find it, where to dig, what could be the reason?
For testing, I have an extremely simple code (this is the code for the first option, for the second - similar), it seems to me that there is simply nothing to slow down here:

import time
import cv2
import mxnet as mx
import mtcnn_detector
ctx = mx.gpu()
detector = mtcnn_detector.MtcnnDetector("path_to_model", ctx=ctx)
image = cv2.imread("1920x1080.png")
frame_id = 0
time_deltas: = [1 for _ in range(10)]
while True:
    time1 = time.time()
    detector.detect_face(image)
    time2 = time.time()
    td = time2 - time1
    time_deltas[frame_id % 10] = td
    if frame_id % 10 == 0:
        fps = 1 / (sum(time_deltas) / len(time_deltas))
        print(fps)
    frame_id += 1

GPU: Two GTX 1050Ti, CPU: Xeon E5-2660 v2 @ 2.20GHz, RAM: 32GB
Python 3.6.7, mxnet-cu91mkl, Nvidia driver: 390.48
Ubuntu 18.04

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Arseny Kravchenko, 2019-02-18
@Arseny_Info

For better utilization, batch processing of data is needed.

A
asd111, 2019-02-18
@asd111

Register in ods.ai and ask the guys there. At the same time, you can check with them about the algorithm. There are just a lot of specialists on mxnet.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question