较小的位图不会增加人脸检测器移动视觉的速度 [英] Face Detector Mobile Vision speed not increased with smaller Bitmap

查看:106
本文介绍了较小的位图不会增加人脸检测器移动视觉的速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

摘要: 我们的应用程序依赖于面部标志物的高检测速度(=睁眼或闭眼).因此,我开发了一种算法,该算法从上一帧开始获取人脸的位置,并从下一帧开始裁剪图像.这可以完美工作,并且人脸检测器只需要处理四分之一的图像.

Summary: Our app depends on a high detection speed of facial landmarks (= like eyes open or closed). Thus I developed an algorythm that takes the position of the face from the last frame and crops the image from the next frame. This works perfectly and the Face Detector only has to process a quarter of the image.

但是它不会提高检测速度.有人知道为什么吗?

But it does not increase the detection speed. Does anybody know why?

编辑:我的算法正在做的就是根据来自最后一张图像的信息来裁剪图像.但是它不执行ImageRecognition本身.我们正在使用 Google的移动视觉.

All that my algorythm is doing is croping the image based on the information from the last image. But it does not perform the ImageRecognition itself. We are using Mobile Vision from Google.

重要的代码段:

此片段在将位图传递到人脸检测器之前执行.它采用前一帧的脸部位置,并且仅通过图像的这一部分:

This snippped is executed before passing the bitmap to the Face Detector. It takes the face position from the previous frame and only passes this part of the image:

Bitmap bitmapReturn = Bitmap.createBitmap(bitmap, topLeftX, topLeftY, width, height);

此片段在人脸检测器处理完帧后执行.它为下一帧提供了图像的位置:

This snippet is executed after the frame is processed by the Face Detector. It porviedes the location of the image for the next frame:

        float spotY = getSpotY(face);
        float spotX = getRatioX(face);
        int moveX = (int) (((float)bitMapScanWidth / 2) - spotX) ;
        int moveY = (int) (((float)bitMapScanHeight / 2) - spotY);
        moveValues(moveX, moveY);

还有一些其他代码片段,可确保图像值topLeftXtopLeftY不会达到位图大小以外的值,而另一些代码片段可确保人脸在图像上的大小相同.

There are some further code snippets that make sure the image values topLeftX and topLeftY don't reach values beyond the bitmap size and others that make sure the face has the same size on the image.

但是如前所述.算法工作正常,但不再导致速度提高.我不知道为什么,因为它可以大大减少所需的计算时间.谁能解释我为什么不是这种情况?我需要调整一些东西吗?还是有另一种方法可以提高算法速度?

But as said before. The algorythm works fine, but doesn't lead to anymore speed. I can't figure out why, because it should massively reduce the required computation time. Can anybody explain me why this is not the case? Do I have to adjust something? Or is there another way, to increase speed in my algorythm?

请注意,当我比较两个版本(使用裁剪图像的算法和不裁剪图像的算法)之间的速度时,两个版本实际上都是通过所需的功能来计算的,以裁剪图像.唯一的区别是,其中一个实际上使用这些值来裁剪图像,而另一个仅在背景中计算了它们.这意味着,我的算法所需的计算并不是速度提高缺失的原因.

Note that when I compared the speed between the two versions (With the algorythm that crops the image and without it) both versions actually calculated through the required functions to crop the image. The only difference was that one of them actually used the values to crop the image and the other one just calculated them in the background. This means, that the computation required for my algorythm was not the reason for the missing speed improvement.

推荐答案

如果要构建自己的面部识别算法,则可以尝试更改实际算法并使用适合移动设备的体系结构.例如MobilNetSSD等,您也可以尝试更改算法的编译方式并将其部署到移动设备上,因为这两种技术都可以提高性能,而不仅仅是简单的裁剪功能可以做到. 此外,如果您在共享所使用的实际算法时没有任何问题,我会尽力查看为什么裁剪不适用于您的特定情况.

If you are building your own algorithm for facial recognition, you can try to change the actual algorithm and use an architecture that is suitable for mobile devices. like MobilNetSSD or such, also you can try and change how you compile your algorithm and deploy it on mobile because both those techniques can boost the performance beyond what a simple cropping function can do. further, if you don't have any problem sharing the actual algorithm you are using I will do my best to see why cropping doesn't work for your specific case.

这篇关于较小的位图不会增加人脸检测器移动视觉的速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆