我正在使用 tensorflow 开发对象检测器,但遇到了一些问题。 我正在训练一个部署在 android example application 上的模型(应用于 TFDetect Activity )具有 120 张图像、20k 步和 ssd_mobilenet_v2。我在 Windows 10 上使用 Android Studio。 我可以成功地训练它并且工作正常,但是检测之间的时间过长,比如 4 到 5 秒:
09-26 12:24:56.904 7986-7986/org.tensorflow.demo I/tensorflow: DetectorActivity: Preparing image 192 for detection in bg thread.
09-26 12:24:56.999 7986-8002/org.tensorflow.demo I/tensorflow: DetectorActivity: Running detection on image 192
09-26 12:25:00.439 7986-8002/org.tensorflow.demo I/tensorflow: MultiBoxTracker: Processing 0 results from 192
09-26 12:25:00.508 7986-7986/org.tensorflow.demo I/tensorflow: DetectorActivity: Preparing image 225 for detection in bg thread.
09-26 12:25:00.595 7986-8002/org.tensorflow.demo I/tensorflow: DetectorActivity: Running detection on image 225
09-26 12:25:04.059 7986-8002/org.tensorflow.demo I/tensorflow: MultiBoxTracker: Processing 0 results from 225
09-26 12:25:04.060 7986-7986/org.tensorflow.demo I/tensorflow: DetectorActivity: Preparing image 258 for detection in bg thread.
09-26 12:25:04.154 7986-8002/org.tensorflow.demo I/tensorflow: DetectorActivity: Running detection on image 258
09-26 12:25:07.559 7986-8002/org.tensorflow.demo I/tensorflow: MultiBoxTracker: Processing 0 results from 258
当我在较新的手机上运行它时。时间减少到 2 或 3 秒。此外,当我开始使用 MobileNet 模型时,它得到 好一些。我正在寻找优化方法或可以减少该时间的方法。
哪些因素会影响检测速度? (更多图片?更多训练步骤?)以及我可以使用哪些优化方法?
最佳答案
有多种方法可以减少检测时间。例如,您可以尝试向神经网络提供较小的图像(像素越少计算量越少)或在灰度中进行训练和分类。 (更少的颜色 == 更少的数据 == 更少的计算)。
关于android - 如何优化 tensorflow 对象检测器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52523294/