Browse Source

Add raw model output debugging for shiny icon investigation

- Log raw output statistics including max values and non-zero counts
- Specifically check shiny icon class region (class 50) in raw model output
- Will reveal if model produces shiny predictions before post-processing
- Helps identify if issue is in model weights vs post-processing

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

Co-Authored-By: Claude <noreply@anthropic.com>
feature/debug-shiny-pokeball-detection
Quildra 5 months ago
parent
commit
f1b1b3439e
  1. 16
      app/src/main/java/com/quillstudios/pokegoalshelper/YOLOOnnxDetector.kt

16
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<Array<FloatArray>>
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)

Loading…
Cancel
Save