Commit 07738afc authored by 马乐's avatar 马乐

1.修复人脸重新初始化失败

parent 00e0b732
...@@ -309,13 +309,19 @@ class MainActivity : AppCompatActivity(),TextToSpeech.OnInitListener,VideoCallba ...@@ -309,13 +309,19 @@ class MainActivity : AppCompatActivity(),TextToSpeech.OnInitListener,VideoCallba
} }
} else { } else {
LogUtils.eTag("fr", "人脸算法初始化失败") LogUtils.eTag("fr", "人脸算法初始化失败")
engine?.unInit()
frCameraDevice?.stopPreview()
frCameraDevice?.let { smartPlatformManager.closeCameraDevice(it)}
} }
} catch (e: CancellationException) { } catch (e: CancellationException) {
LogUtils.eTag("fr","人脸识别error:${e.message}") LogUtils.eTag("fr","人脸识别error:${e.message}")
coroutineContext[FrCoroutineContext]?.engine?.unInit()
frCameraDevice?.stopPreview() frCameraDevice?.stopPreview()
frCameraDevice?.stopRecord(RecordSource.GENERAL_CAMERA)
frCameraDevice?.let { smartPlatformManager.closeCameraDevice(it)} frCameraDevice?.let { smartPlatformManager.closeCameraDevice(it)}
} catch (e: Exception) { } catch (e: Exception) {
coroutineContext[FrCoroutineContext]?.engine?.unInit()
frCameraDevice?.stopPreview()
frCameraDevice?.let { smartPlatformManager.closeCameraDevice(it)}
e.printStackTrace() e.printStackTrace()
} }
} }
......
...@@ -51,6 +51,8 @@ class FrCoroutineContext(val engine: ArcVisDriveEngine): AbstractCoroutineContex ...@@ -51,6 +51,8 @@ class FrCoroutineContext(val engine: ArcVisDriveEngine): AbstractCoroutineContex
class FrCoroutineScope(context: CoroutineContext) : Closeable, CoroutineScope { class FrCoroutineScope(context: CoroutineContext) : Closeable, CoroutineScope {
override val coroutineContext: CoroutineContext = context + frJob override val coroutineContext: CoroutineContext = context + frJob
override fun close() { override fun close() {
LogUtils.eTag("fr","FrCoroutineScope auto close")
LogUtils.file("FrCoroutineScope auto close")
coroutineContext[FrCoroutineContext]?.engine?.unInit() coroutineContext[FrCoroutineContext]?.engine?.unInit()
coroutineContext.cancel() coroutineContext.cancel()
} }
...@@ -111,7 +113,7 @@ fun ArcVisDriveEngine.compareFeatureWithScore(liveExtractResult:ArcFRExtractResu ...@@ -111,7 +113,7 @@ fun ArcVisDriveEngine.compareFeatureWithScore(liveExtractResult:ArcFRExtractResu
frSimilarity frSimilarity
) )
LogUtils.d("frSimilarity:${frSimilarity.score},compareFeature result:${result}") LogUtils.d("frSimilarity:${frSimilarity.score},compareFeature result:${result}")
result == ArcErrorInfo.ARC_ERROR_OK && frSimilarity.score > 75 result == ArcErrorInfo.ARC_ERROR_OK && frSimilarity.score * 100 >= 75
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment