Answer the question
In order to leave comments, you need to log in
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
Answer the question
In order to leave comments, you need to log in
For better utilization, batch processing of data is needed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question