From a07683d41766c702502549e361641598bfa85214 Mon Sep 17 00:00:00 2001 From: THEBUSTED Date: Tue, 16 Jul 2024 23:50:15 +0700 Subject: [PATCH] Update CameraFragment.kt (#420) the fix was to update the onItemSelectedListener for spinnerModel. Instead of setting objectDetectorHelper.currentDelegate, we now directly set objectDetectorHelper.currentModel = p2. This ensures that when a new model is selected, the objectDetectorHelper actually uses the correct model for predictions, resolving the issue where results weren't updating. --- .../examples/objectdetection/fragments/CameraFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/object_detection/android/app/src/main/java/com/google/mediapipe/examples/objectdetection/fragments/CameraFragment.kt b/examples/object_detection/android/app/src/main/java/com/google/mediapipe/examples/objectdetection/fragments/CameraFragment.kt index c59b181b..33c073d2 100644 --- a/examples/object_detection/android/app/src/main/java/com/google/mediapipe/examples/objectdetection/fragments/CameraFragment.kt +++ b/examples/object_detection/android/app/src/main/java/com/google/mediapipe/examples/objectdetection/fragments/CameraFragment.kt @@ -232,7 +232,7 @@ class CameraFragment : Fragment(), ObjectDetectorHelper.DetectorListener { p3: Long ) { try { - objectDetectorHelper.currentDelegate = p2 + objectDetectorHelper.currentModel = p2 updateControlsUi() } catch(e: UninitializedPropertyAccessException) { Log.e(TAG, "ObjectDetectorHelper has not been initialized yet.")