如何在使用tensorflow lite Android API进行首次正确图像检测后停止分类



我指的是谷歌的tensorflow lite图像检测示例https://github.com/tensorflow/examples/tree/master/lite/examples/object_detection/android/app/src/main/java/org/tensorflow/lite/examples/detection

相机打开时的回调:onImageAvailable((调用processImage((,后者调用具有检测到的对象及其置信度的窗格。如果camer保持打开状态,它将继续对对象进行分类。有没有一种方法可以在第一次成功检测到图像后停止分类?我所能想到的就是在检测到第一个图像后按下后退按钮,或者停止相机预览。还有其他建议吗?如果tensorflow lite中有一些方法,比如stop Classification((,它可能会起的作用

正如您所看到的,每当捕获新图像时,它都会运行分类。

如果只想捕获单个图像,最好使用captureSession.capture((,而不是captureSession.setReatingRequest((https://github.com/tensorflow/examples/blob/master/lite/examples/object_detection/android/app/src/main/java/org/tensorflow/lite/examples/detection/CameraConnectionFragment.java

请参阅CameraCaptureSession API文档。https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession

最新更新