修改检测参数,降低置信度,提高检测的延时

This commit is contained in:
xsl
2025-12-06 11:59:00 +08:00
parent db80a5dbbd
commit da2c97e412
2 changed files with 32 additions and 28 deletions
@@ -67,6 +67,9 @@ class FaceLandmarkerHelper(
} }
} }
minFaceDetectionConfidence = 0.1f;
minFaceTrackingConfidence = 0.1f;
minFacePresenceConfidence = 0.1f;
try { try {
val baseOptions = baseOptionBuilder.build() val baseOptions = baseOptionBuilder.build()
// Create an option builder with base options and specific // Create an option builder with base options and specific
@@ -238,32 +241,33 @@ class FaceLandmarkerHelper(
val frameId = result.timestampMs() val frameId = result.timestampMs()
if( result.faceLandmarks().size > 0 ) { if( result.faceLandmarks().size > 0 ) {
// 计算各种延时 // 计算各种延时
val timings = frameTimings[frameId] // val timings = frameTimings[frameId]
if (timings != null) { // if (timings != null) {
val totalLatency = resultTime - timings.captureTime // val totalLatency = resultTime - timings.captureTime
val preprocessLatency = timings.preprocessEndTime - timings.preprocessStartTime // val preprocessLatency = timings.preprocessEndTime - timings.preprocessStartTime
val detectionLatency = resultTime - timings.detectionStartTime // val detectionLatency = resultTime - timings.detectionStartTime
val captureToDetectionLatency = timings.detectionStartTime - timings.captureTime // val captureToDetectionLatency = timings.detectionStartTime - timings.captureTime
//
Log.i("TimeLatency", // Log.i("TimeLatency",
"总延时: ${totalLatency}ms | " + // "总延时: ${totalLatency}ms | " +
"预处理: ${preprocessLatency}ms | " + // "预处理: ${preprocessLatency}ms | " +
"检测: ${detectionLatency}ms | " + // "检测: ${detectionLatency}ms | " +
"捕获到检测: ${captureToDetectionLatency}ms | " + // "捕获到检测: ${captureToDetectionLatency}ms | " +
"FPS: ${String.format("%.1f", currentFps)}" // "FPS: ${String.format("%.1f", currentFps)}"
) // )
//
val finishTimeMs = SystemClock.uptimeMillis() // val finishTimeMs = SystemClock.uptimeMillis()
val inferenceTime = finishTimeMs - result.timestampMs() // val inferenceTime = finishTimeMs - result.timestampMs()
faceLandmarkerHelperListener?.onResults( // faceLandmarkerHelperListener?.onResults(
ResultBundle( // ResultBundle(
result, // result,
inferenceTime, // 主要是检测时间 // inferenceTime, // 主要是检测时间
input.height, // input.height,
input.width, // input.width,
) // )
) // )
} else { // } else
//{
val finishTimeMs = SystemClock.uptimeMillis() val finishTimeMs = SystemClock.uptimeMillis()
val inferenceTime = finishTimeMs - result.timestampMs() val inferenceTime = finishTimeMs - result.timestampMs()
Log.i("TimeLatency", Log.i("TimeLatency",
@@ -277,7 +281,7 @@ class FaceLandmarkerHelper(
input.width input.width
) )
) )
} //}
} }
else { else {
faceLandmarkerHelperListener?.onEmpty() faceLandmarkerHelperListener?.onEmpty()
+1 -1
View File
@@ -102,7 +102,7 @@ private:
VkPipelineLayout m_pipelineLayout = VK_NULL_HANDLE; VkPipelineLayout m_pipelineLayout = VK_NULL_HANDLE;
VkDescriptorSetLayout m_descriptorSetLayout = VK_NULL_HANDLE; VkDescriptorSetLayout m_descriptorSetLayout = VK_NULL_HANDLE;
vector<VkDescriptorSet> m_descriptor_sets; vector<VkDescriptorSet> m_descriptor_sets;
const uint32_t kMaxTexture = 30; const uint32_t kMaxTexture = 60;
vector<Texture> m_texs; vector<Texture> m_texs;
vector<Texture> m_texs_next; vector<Texture> m_texs_next;
vector<Texture> m_texs_ex; vector<Texture> m_texs_ex;