diff --git a/app/src/main/java/com/quillstudios/pokegoalshelper/ml/YOLOInferenceEngine.kt b/app/src/main/java/com/quillstudios/pokegoalshelper/ml/YOLOInferenceEngine.kt index 60b6eca..ab54ca4 100644 --- a/app/src/main/java/com/quillstudios/pokegoalshelper/ml/YOLOInferenceEngine.kt +++ b/app/src/main/java/com/quillstudios/pokegoalshelper/ml/YOLOInferenceEngine.kt @@ -37,12 +37,9 @@ class YOLOInferenceEngine( { private const val TAG = "YOLOInferenceEngine" private const val MODEL_FILE = "best.onnx" - private const val INPUT_SIZE = 640 private const val CONFIDENCE_THRESHOLD = 0.55f private const val NMS_THRESHOLD = 0.3f private const val NUM_CHANNELS = 3 - private const val NUM_DETECTIONS = 300 - private const val NUM_CLASSES = 95 // Enhanced accuracy settings for ONNX (fixed input size) private const val ENABLE_TTA = true // Test-time augmentation @@ -114,11 +111,11 @@ class YOLOInferenceEngine( private var ortEnvironment: OrtEnvironment? = null private var isInitialized = false - // Dynamic model metadata (extracted at runtime) - private var modelInputSize: Int = INPUT_SIZE // fallback to constant - private var modelNumDetections: Int = NUM_DETECTIONS // fallback to constant - private var modelNumClasses: Int = NUM_CLASSES // fallback to constant - private var modelOutputFeatures: Int = NMS_OUTPUT_FEATURES_PER_DETECTION // fallback to constant + // Dynamic model metadata (extracted at runtime from ONNX model) + private var modelInputSize: Int = 640 // Default fallback + private var modelNumDetections: Int = 300 // Default fallback + private var modelNumClasses: Int = 96 // Default fallback (based on dataset.yaml) + private var modelOutputFeatures: Int = NMS_OUTPUT_FEATURES_PER_DETECTION // Default fallback // Shared thread pool for preprocessing operations (prevents creating new pools per detection) private val preprocessingExecutor = Executors.newFixedThreadPool(config.threadPoolSize)