google_ml_kit_flutter icon indicating copy to clipboard operation
google_ml_kit_flutter copied to clipboard

Face Detection is not working in Android with google_ml_kit: ^0.19.0 Dependency

Open santhoshAndroid opened this issue 1 year ago • 6 comments

Describe your issue. If applicable, add screenshots to help explain your problem.

This requirement addresses the issue where face detection is not functioning properly on Android when using the google_ml_kit: ^0.19.0 dependency. The solution aims to identify and resolve compatibility problems, bugs, or missing configurations that prevent the face detection feature from working as expected. The goal is to ensure seamless integration of Google ML Kit's face detection capabilities in Android applications, allowing for accurate and efficient face tracking and recognition.

Steps to reproduce.

Steps to Reproduce the Face Detection Issue in Android with google_ml_kit: ^0.19.0 Dependency

  1. Set Up the Project:

    • Create a new Flutter project or open an existing one.
    • Add the google_ml_kit: ^0.19.0 dependency in your pubspec.yaml file.
    • Run flutter pub get to install the dependency.
  2. Initialize Camera for Face Detection:

    • Implement the camera initialization using Flutter’s camera plugin or native camera integration.
    • Add necessary permissions (camera, storage) in AndroidManifest.xml:
      <uses-permission android:name="android.permission.CAMERA"/>
      
  3. Implement Face Detection Code:

    • Set up the face detection code using google_ml_kit. For instance, create a FaceDetector instance and start the camera preview.
  4. Build and Run the Application on an Android Device:

    • Build the app and run it on a physical Android device (not emulator).
    • Make sure you grant all permissions when prompted.
  5. Test Face Detection:

    • Open the app and ensure the camera is functioning.
    • Point the camera at a face to see if face detection works.
  6. Observe the Issue:

    • Notice that the camera feed displays, but no faces are detected in real-time.
    • The live camera preview fails to detect any faces, despite the face being visible and in clear lighting.
    • Face landmarks and liveness detection do not work or trigger any events.
  7. Verify Logs (Optional):

    • Check Android Studio logs for any relevant error messages or warnings related to the ML Kit's face detection, camera initialization, or missing dependencies.

This reproduces the face detection failure using google_ml_kit: ^0.19.0 on Android.

What is the expected result?

Expected Result:

  • When the camera is opened, the face detector should automatically start detecting faces in the camera feed.
  • The camera should detect and highlight faces in real-time, showing facial landmarks (such as eyes, nose, and mouth) and tracking movements.
  • If implemented, liveness detection should accurately detect whether the face in view is real and not a static image.

Actual Result:

  • The camera opens, but face detection does not trigger, and no faces are detected.
  • There is no visual indication of facial landmarks or liveness detection, even though the camera feed is visible.

Did you try our example app?

Yes

Is it reproducible in the example app?

Yes

Reproducible in which OS?

Android

Flutter/Dart Version?

[√] Flutter (Channel stable, 3.24.3, on Microsoft Windows [Version 10.0.22631.4317], locale en-US) • Flutter version 3.24.3 on channel stable at C:\src\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 2663184aa7 (5 weeks ago), 2024-09-11 16:27:48 -0500 • Engine revision 36335019a8 • Dart version 3.5.3 • DevTools version 2.37.3

Plugin Version?

dependencies: flutter: sdk: flutter cupertino_icons: ^1.0.8 image: ^4.2.0 file_picker: ^8.1.2 path_provider: ^2.1.4 camera: ^0.10.6 camera_android_camerax: ^0.6.10 google_ml_kit: ^0.19.0 google_mlkit_face_detection: ^0.12.0 fluttertoast: ^8.2.8 flutter_pdfview: ^1.3.3 image_picker: ^1.1.2 tflite_flutter: ^0.11.0

santhoshAndroid avatar Oct 19 '24 06:10 santhoshAndroid

The face is not detected in android device camera

santhoshAndroid avatar Oct 23 '24 12:10 santhoshAndroid

Has anyone faced this issue and solved it? If yes, can you explain how to solve it?

santhoshAndroid avatar Oct 23 '24 12:10 santhoshAndroid

@bensonarafat can you help me

santhoshAndroid avatar Oct 23 '24 12:10 santhoshAndroid

Do you try the example app ? @santhoshAndroid

bensonarafat avatar Oct 23 '24 12:10 bensonarafat

Yes, I tried, but the camera turns on, and no face is detected @bensonarafat

santhoshAndroid avatar Oct 23 '24 14:10 santhoshAndroid

If any configuration for android gradle files

santhoshAndroid avatar Oct 23 '24 14:10 santhoshAndroid

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Nov 23 '24 12:11 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Dec 08 '24 12:12 github-actions[bot]

What are the minimum requirements of android device in terms of camera, processor, chipset and OS version can anyone please share details

MasoomRazaa avatar Feb 11 '25 07:02 MasoomRazaa

It's the same thing for me as well. No face is being detected.

camera: ^0.10.5+5 flutter_vision: ^1.1.4 provider: ^6.1.1 http: ^1.1.0 path_provider: ^2.1.1 path: ^1.8.3 image: ^4.1.3 image_picker: ^1.1.2 permission_handler: ^12.0.0+1 google_mlkit_face_detection: ^0.13.1 google_ml_kit: ^0.20.0

and the repo can be found in the following link: https://github.com/ShaysFrame/open_rtms/tree/ml-kit-switch it doesn't detect any faces please someone take a look at the code and let me know if it's possible to fix this issue. : |

ShaysFrame avatar May 14 '25 01:05 ShaysFrame