Browse Source

Add debug logging for shiny icon detection investigation

- Add DEBUG_SHINY_DETECTION flag to track shiny_icon (class 50) processing
- Lower confidence threshold from 0.45f to 0.25f temporarily for debugging
- Add detailed logging for shiny icon candidates with confidence and coordinates
- Will help identify if shiny icons are being detected but filtered out

🤖 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
512f267be6
  1. 15
      app/src/main/java/com/quillstudios/pokegoalshelper/YOLOOnnxDetector.kt

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

@ -21,7 +21,7 @@ class YOLOOnnxDetector(private val context: Context) {
private const val TAG = "YOLOOnnxDetector"
private const val MODEL_FILE = "best.onnx"
private const val INPUT_SIZE = 640
private const val CONFIDENCE_THRESHOLD = 0.45f // Lowered to match .pt model detection levels
private const val CONFIDENCE_THRESHOLD = 0.25f // Temporarily lowered for shiny icon debugging
private const val NMS_THRESHOLD = 0.3f // More aggressive merging of overlapping boxes
private const val NUM_CHANNELS = 3
private const val NUM_DETECTIONS = 8400 // YOLOv8 default
@ -39,6 +39,9 @@ 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
// Special debug mode for shiny icon investigation
var DEBUG_SHINY_DETECTION = true // Enable detailed shiny icon debugging
fun setCoordinateMode(mode: String) {
COORD_TRANSFORM_MODE = mode
Log.i(TAG, "🔧 Coordinate transform mode changed to: $mode")
@ -774,6 +777,11 @@ class YOLOOnnxDetector(private val context: Context) {
Log.d(TAG, "🔍 [DEBUG] Class: $className (ID: $classId), Confidence: %.3f, Original: %.3f".format(mappedConfidence, confidence))
}
// Special debug logging for shiny icon (class 50)
if (DEBUG_SHINY_DETECTION && (classId == 50 || className == "shiny_icon") && mappedConfidence > 0.05f) {
Log.w(TAG, "✨ [SHINY DEBUG] Found shiny_icon candidate! ClassID: $classId, Confidence: %.4f (mapped: %.4f), Coords: [%.1f,%.1f,%.1f,%.1f]".format(confidence, mappedConfidence, x1, y1, x2, y2))
}
// Apply class filtering if set
val passesClassFilter = DEBUG_CLASS_FILTER == null || DEBUG_CLASS_FILTER == className
@ -1106,6 +1114,11 @@ class YOLOOnnxDetector(private val context: Context) {
Log.d(TAG, "🔍 [DEBUG] Class: $className (ID: $classId), Confidence: %.3f, Original: %.3f".format(mappedConfidence, confidence))
}
// Special debug logging for shiny icon (class 50)
if (DEBUG_SHINY_DETECTION && (classId == 50 || className == "shiny_icon") && mappedConfidence > 0.05f) {
Log.w(TAG, "✨ [SHINY DEBUG] Found shiny_icon candidate! ClassID: $classId, Confidence: %.4f (mapped: %.4f), Coords: [%.1f,%.1f,%.1f,%.1f]".format(confidence, mappedConfidence, x1, y1, x2, y2))
}
// Apply class filtering if set
val passesClassFilter = DEBUG_CLASS_FILTER == null || DEBUG_CLASS_FILTER == className

Loading…
Cancel
Save