Browse Source

refactor: remove benchmarking debug code from CRITICAL-003

- Remove BENCHMARKING_MODE flag and detectionTimes list
- Remove printBenchmarkStats() and resetBenchmarkStats() functions
- Remove detailed benchmark logging from detection method
- Keep only essential timing log for normal operation
- Clean production code after performance testing complete

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
critical-003-parallel-processing
Quildra 5 months ago
parent
commit
611a1e4504
  1. 35
      app/src/main/java/com/quillstudios/pokegoalshelper/YOLOOnnxDetector.kt

35
app/src/main/java/com/quillstudios/pokegoalshelper/YOLOOnnxDetector.kt

@ -39,9 +39,6 @@ class YOLOOnnxDetector(private val context: Context) {
var DEBUG_CLASS_FILTER: String? = null // Set to class name to show only that class
var SHOW_ALL_CONFIDENCES = false // Show all detections with their confidences
// Benchmarking for CRITICAL-003
var BENCHMARKING_MODE = true // Enable detailed performance logging
private val detectionTimes = mutableListOf<Long>()
fun setCoordinateMode(mode: String) {
COORD_TRANSFORM_MODE = mode
@ -55,25 +52,6 @@ class YOLOOnnxDetector(private val context: Context) {
Log.i(TAG, "📊 Show all confidences: $SHOW_ALL_CONFIDENCES")
}
fun printBenchmarkStats() {
if (detectionTimes.isNotEmpty()) {
val avg = detectionTimes.average()
val min = detectionTimes.minOrNull() ?: 0L
val max = detectionTimes.maxOrNull() ?: 0L
val count = detectionTimes.size
Log.i(TAG, "📈 BENCHMARK STATS (${if (ENABLE_MULTI_PREPROCESSING) "MULTI" else "SINGLE"}-PROCESSING):")
Log.i(TAG, " Count: $count detections")
Log.i(TAG, " Average: ${String.format("%.1f", avg)}ms")
Log.i(TAG, " Min: ${min}ms")
Log.i(TAG, " Max: ${max}ms")
Log.i(TAG, " Total: ${detectionTimes.sum()}ms")
}
}
fun resetBenchmarkStats() {
detectionTimes.clear()
Log.i(TAG, "📊 Benchmark stats reset")
}
// Preprocessing enhancement techniques
private const val ENABLE_CONTRAST_ENHANCEMENT = true
@ -395,19 +373,6 @@ class YOLOOnnxDetector(private val context: Context) {
val finalDetections = mergeAndFilterDetections(allDetections, inputMat.cols(), inputMat.rows())
val totalTime = System.currentTimeMillis() - startTime
// Record benchmark data
if (BENCHMARKING_MODE) {
detectionTimes.add(totalTime)
val preprocessingType = if (ENABLE_MULTI_PREPROCESSING) "MULTI" else "SINGLE"
Log.i(TAG, "📊 BENCHMARK: $preprocessingType-processing took ${totalTime}ms (${detectionTimes.size} samples)")
// Print stats every 10 detections
if (detectionTimes.size % 10 == 0) {
printBenchmarkStats()
}
}
Log.i(TAG, "✅ Enhanced ONNX detection complete: ${finalDetections.size} objects in ${totalTime}ms")
return finalDetections

Loading…
Cancel
Save