Thursday, 15 October 2020

React native firebase ml kit face detector works on android but not iOS

I am trying to implement rnfirebase mlKit vision but it only works on android, not iOS. I am taking a picture with react-native-camera and using data.uri to pass it to ml-vision. I am running react native version 0.63.3. I have followed the installation steps here and here I have tried everything I can find online but there isn't much.

my code is as follows but all I get in my console.log(faces = , faces) is an empty array so the forEach loop doesn't run

 const faces = await vision().faceDetectorProcessImage(data.uri);
      console.log('faces = ', faces);

      faces.forEach(face => {
        console.log('Head rotation on Y axis: ', face.headEulerAngleY);
        console.log('Head rotation on Z axis: ', face.headEulerAngleZ);

        console.log('Left eye open probability: ', face.leftEyeOpenProbability);
        console.log('Right eye open probability: ', face.rightEyeOpenProbability);
        console.log('Smiling probability: ', face.smilingProbability);

        face.faceContours.forEach(contour => {
          if (contour.type === VisionFaceContourType.FACE) {
            console.log('Face outline points: ', contour.points);
          }
        });
      });

my package.json

"dependencies": {
    "@material-ui/icons": "^4.9.1",
    "@react-native-community/async-storage": "^1.12.0",
    "@react-native-community/cameraroll": "^1.8.1",
    "@react-native-community/image-editor": "^2.3.0",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/netinfo": "^5.9.7",
    "@react-native-community/picker": "^1.6.6",
    "@react-native-firebase/analytics": "^7.6.7",
    "@react-native-firebase/app": "^8.4.5",
    "@react-native-firebase/database": "^7.5.11",
    "@react-native-firebase/messaging": "^7.9.0",
    "@react-native-firebase/ml-vision": "^7.4.8",

my pod file

$FirebaseSDKVersion = '6.29.0'
$RNFirebaseAsStaticFramework = true

platform :ios, '10.0'

target 'idSxanner' do

config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])


  pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'

  target 'idSxannerTests' do
    inherit! :complete
    # Pods for testing
  end


  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
  end
end

target 'idSxanner-tvOS' do
  # Pods for idSxanner-tvOS

  target 'idSxanner-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end


from React native firebase ml kit face detector works on android but not iOS

No comments:

Post a Comment