diff --git a/app/src/main/java/com/quillstudios/pokegoalshelper/YOLOOnnxDetector.kt b/app/src/main/java/com/quillstudios/pokegoalshelper/YOLOOnnxDetector.kt index be01899..e6c2de1 100644 --- a/app/src/main/java/com/quillstudios/pokegoalshelper/YOLOOnnxDetector.kt +++ b/app/src/main/java/com/quillstudios/pokegoalshelper/YOLOOnnxDetector.kt @@ -405,6 +405,22 @@ class YOLOOnnxDetector(private val context: Context) { val outputTensor = result.get(0).value as Array> val flatOutput = outputTensor[0].flatMap { it.asIterable() }.toFloatArray() + // Debug: Log raw output statistics when looking for shiny icons + if (DEBUG_SHINY_DETECTION) { + val maxVal = flatOutput.maxOrNull() ?: 0f + val nonZeroCount = flatOutput.count { it > 0.01f } + Log.w(TAG, "🔬 [RAW OUTPUT] Method: $method, FlatOutput size: ${flatOutput.size}, Max value: %.4f, Non-zero (>0.01): $nonZeroCount".format(maxVal)) + + // Check for any values in the shiny icon class region (class 50 * 8400 detections) + val shinyClassStart = 50 * NUM_DETECTIONS + 4 * NUM_DETECTIONS // After x,y,w,h for all detections + if (shinyClassStart < flatOutput.size) { + val shinyClassValues = flatOutput.sliceArray(shinyClassStart until kotlin.math.min(shinyClassStart + NUM_DETECTIONS, flatOutput.size)) + val maxShinyConf = shinyClassValues.maxOrNull() ?: 0f + val shinyAboveThreshold = shinyClassValues.count { it > 0.1f } + Log.w(TAG, "🔬 [SHINY RAW] Max shiny confidence: %.4f, Count >0.1: $shinyAboveThreshold".format(maxShinyConf)) + } + } + // Post-process results with method-specific coordinate transformation val detections = postprocessWithMethod(flatOutput, inputMat.cols(), inputMat.rows(), INPUT_SIZE, method)