Code Monkey home page Code Monkey logo

mrousavy / react-native-fast-tflite Goto Github PK

View Code? Open in Web Editor NEW
532.0 8.0 17.0 140.22 MB

๐Ÿ”ฅ High-performance TensorFlow Lite library for React Native with GPU acceleration

Home Page: https://mrousavy.com

License: MIT License

CMake 0.47% C++ 16.99% Java 2.86% JavaScript 1.75% Ruby 1.21% Swift 0.02% C 70.15% Objective-C 1.04% Objective-C++ 0.90% TypeScript 3.99% Shell 0.62%
ai arraybuffer camera detection facial-recognition fast ml native object-detection react

react-native-fast-tflite's Introduction

Fast TFLite

A high-performance TensorFlow Lite library for React Native.

  • ๐Ÿ”ฅ Powered by JSI
  • ๐Ÿ’จ Zero-copy ArrayBuffers
  • ๐Ÿ”ง Uses the low-level C/C++ TensorFlow Lite core API for direct memory access
  • ๐Ÿ”„ Supports swapping out TensorFlow Models at runtime
  • ๐Ÿ–ฅ๏ธ Supports GPU-accelerated delegates (CoreML/Metal/OpenGL)
  • ๐Ÿ“ธ Easy VisionCamera integration

Installation

  1. Add the npm package
    yarn add react-native-fast-tflite
  2. In metro.config.js, add tflite as a supported asset extension:
    module.exports = {
        // ...
        resolver: {
            assetExts: ['tflite', // ...
            // ...
    This allows you to drop .tflite files into your app and swap them out at runtime without having to rebuild anything! ๐Ÿ”ฅ
  3. (Optional) If you want to enable the GPU Delegate, see "Using GPU Delegates" down below.
  4. Run your app (yarn android / npx pod-install && yarn ios)

Usage

  1. Find a TensorFlow Lite (.tflite) model you want to use. There's thousands of public models on tfhub.dev.
  2. Drag your TensorFlow Lite model into your React Native app's asset folder (e.g. src/assets/my-model.tflite)
  3. Load the Model:
    // Option A: Standalone Function
    const model = await loadTensorflowModel(require('assets/my-model.tflite'))
    
    // Option B: Hook in a Function Component
    const plugin = useTensorflowModel(require('assets/my-model.tflite'))
  4. Call the Model:
    const inputData = ...
    const outputData = await model.run(inputData)
    console.log(outputData)

Loading Models

Models can be loaded either from the React Native bundle using a require(..) statement, or any kind of URI/URL (http://.. or file://..):

// Asset from React Native Bundle
loadTensorflowModel(require('assets/my-model.tflite'))
// File on the local filesystem
loadTensorflowModel('file:///var/mobile/.../my-model.tflite')
// Remote URL
loadTensorflowModel('https://tfhub.dev/google/lite-model/object_detection_v1.tflite')

Loading a Model is asynchronous since Buffers need to be allocated. Make sure to check for any potential errors when loading a Model.

Input and Output data

TensorFlow uses tensors as input and output formats. Since TensorFlow Lite is optimized to run on fixed array sized byte buffers, you are responsible for interpreting the raw data yourself.

To inspect the input and output tensors on your TensorFlow Lite model, open it in Netron.

For example, the object_detection_mobile_object_localizer_v1_1_default_1.tflite model I found on tfhub.dev has 1 input tensor and 4 output tensors:

Screenshot of netron.app inspecting the model

In the description on tfhub.dev we can find the description of all tensors:

Screenshot of tfhub.dev inspecting the model

From that we now know that we need a 192 x 192 input image with 3 bytes per pixel (meaning RGB).

Usage (VisionCamera)

If you were to use this model with a VisionCamera Frame Processor, you would need to convert the Frame to a 192 x 192 x 3 byte array. To do the conversion, use vision-camera-resize-plugin:

const objectDetection = useTensorflowModel(require('object_detection.tflite'))
const model = objectDetection.state === "loaded" ? objectDetection.model : undefined

const { resize } = useResizePlugin()

const frameProcessor = useFrameProcessor((frame) => {
    'worklet'
    if (model == null) return

    // 1. Resize 4k Frame to 192x192x3 using vision-camera-resize-plugin
    const resized = resize(frame, {
        scale: {
          width: 192,
          height: 192,
        },
        pixelFormat: 'rgb',
        dataType: 'uint8',
    })

    // 2. Run model with given input buffer synchronously
    const outputs = model.runSync([resized])

    // 3. Interpret outputs accordingly
    const detection_boxes = outputs[0]
    const detection_classes = outputs[1]
    const detection_scores = outputs[2]
    const num_detections = outputs[3]
    console.log(`Detected ${num_detections[0]} objects!`)

    for (let i = 0; i < detection_boxes.length; i += 4) {
        const confidence = detection_scores[i / 4]
        if (confidence > 0.7) {
            // 4. Draw a red box around the detected object!
            const left = detection_boxes[i]
            const top = detection_boxes[i + 1]
            const right = detection_boxes[i + 2]
            const bottom = detection_boxes[i + 3]
            const rect = SkRect.Make(left, top, right, bottom)
            canvas.drawRect(rect, SkColors.Red)
        }
    }
}, [model])

return (
    <Camera frameProcessor={frameProcessor} {...otherProps} />
)

Using GPU Delegates

GPU Delegates offer faster, GPU accelerated computation. There's multiple different GPU delegates which you can enable:

CoreML (iOS)

To enable the CoreML Delegate, you must configure react-native-fast-tflite to include it in the build.

Expo

For Expo, just use the config plugin in your expo config (app.json, app.config.json or app.config.js):

{
  "name": "my app",
  "plugins": [
    [
      "react-native-fast-tflite",
      {
        "enableCoreMLDelegate": true
      }
    ]
  ]
}
Bare React Native

If you are on bare React Native, you need to include the CoreML/Metal code in your project:

  1. Set $EnableCoreMLDelegate to true in your Podfile:
    $EnableCoreMLDelegate=true
    
    # rest of your podfile...
  2. Open your iOS project in Xcode and add the CoreML framework to your project: Xcode > xcodeproj > General > Frameworks, Libraries and Embedded Content > CoreML
  3. Re-install Pods and build your app:
    cd ios && pod install && cd ..
    yarn ios
  4. Use the CoreML Delegate:
    const model = await loadTensorflowModel(require('assets/my-model.tflite'), 'core-ml')

Note

Since some operations aren't supported on the CoreML delegate, make sure your Model is able to use the CoreML GPU delegate.

Community Discord

Join the Margelo Community Discord to chat about react-native-fast-tflite or other Margelo libraries.

Adopting at scale

This library helped you? Consider sponsoring!

This library is provided as is, I work on it in my free time.

If you're integrating react-native-fast-tflite in a production app, consider funding this project and contact me to receive premium enterprise support, help with issues, prioritize bugfixes, request features, help at integrating react-native-fast-tflite and/or VisionCamera Frame Processors, and more.

Contributing

  1. Clone the repo
  2. Make sure you have installed Xcode CLI tools such as gcc, cmake and python/python3. See the TensorFlow documentation on what you need exactly.
  3. Run yarn bootstrap and select y (yes) on all iOS and Android related questions.
  4. Open the Example app and start developing
    • iOS: example/ios/TfliteExample.xcworkspace
    • Android: example/android

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

react-native-fast-tflite's People

Contributors

17amir17 avatar dependabot[bot] avatar jaroslawkrol avatar mfkrause avatar mrousavy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-fast-tflite's Issues

Use TensorFlowLiteC from source (`tensorflow/`) on Android as well

Today, we build TensorFlowLiteC from source to use it in iOS:

# Assumes the user ran ./configure in tensorflow/ already
cd tensorflow
bazel build --config=ios_fat -c opt --cxxopt=--std=c++17 //tensorflow/lite/ios:TensorFlowLiteC_framework
bazel build --config=ios_fat -c opt --cxxopt=--std=c++17 //tensorflow/lite/ios:TensorFlowLiteCCoreML_framework
cd ..
cp -f -r tensorflow/bazel-bin/tensorflow/lite/ios/ ios/
unzip -o ios/TensorFlowLiteC_framework.zip -d ios
rm ios/TensorFlowLiteC_framework.zip
unzip -o ios/TensorFlowLiteCCoreML_framework.zip -d ios
rm ios/TensorFlowLiteCCoreML_framework.zip

The source code is added to this repo as a git submodule (tensorflow/), and when shipping the library to npm I prebuild a TensorFlowLiteC binary (including the TensorFlowLiteCCoreML delegate), add the headers, then ship it.

On Android however, we use the org.tensorflow:tensorflow-lite library from Gradle:

// Tensorflow Lite .aar (includes C API via prefabs)
implementation "org.tensorflow:tensorflow-lite:2.12.0"
extractHeaders("org.tensorflow:tensorflow-lite:2.12.0")
extractSO("org.tensorflow:tensorflow-lite:2.12.0")

This ships the Java files as well as introducing some other unnecessary files for the bundle. Also, it is outdated and not in sync with the iOS version, some fixes, features or improvements may only be available on iOS, but not on Android due to us using the published package from Maven. (Currently we use v2.2.0, which is outdated by more than two versions)

Instead, we should aim to also use TensorFlowLiteC (any potentially also an Android GPU delegate?) from source by also building it in the tensorflow/ submodule, just like how we do it on iOS, then add the headers and link the library in the android/CMakeLists.txt config.

This would align the versions perfectly and we don't need to fetch a prebuild version from Maven.

This PR was an attempt at doing so: #33 ...but I couldn't manage to get Bazel to build the Android version.

We need to make sure this ships the correct binaries (x86, x86_64, arm, and arm64 - or just x86_fat and arm_fat).


Added Bonus: Maybe we can even do the whole building in the CI with dependabot, so everytime the submodule changes (a commit lands on main in tensorflow/) it opens a PR, prebuilds the libraries, moves them into ios and android, and I only need to merge that to get the changes. No need to build it on my mac. Makes it even more safe

Support for Expo Go?

ERROR Error: The package 'react-native-fast-tflite' doesn't seem to be linked. Make sure:

  • You have run 'pod install'
  • You rebuilt the app after installing the package
  • You are not using Expo Go
    , js engine: hermes

Can you please add support for Expo react native?

How can I use this with expo?

Hey guys, I am using expo and I'm having some trouble following this step which only works for vanilla react native:
image

Build Errors in iOS

Description

I encountered two errors while attempting to build for iOS with both new and old architectures, each resulting in different issues. When using the new architecture, I encountered the following error:

node_modules/react-native-fast-tflite/ios/Tflite.h:3:9 'RNTfliteSpec.h' file not found

Screenshot

Switching back to the old architecture triggered an another error, which appears to be the same as this issue. While a workaround involves adding arm64 to excluded architectures and using Xcode in Rosetta mode, it's not an ideal solution in my opinion.

Building for iOS Simulator, but linking in object file built for iOS, file 'node_modules/react-native-fast-tflite/ios/TensorFlowLiteC.framework/TensorFlowLiteC' for architecture arm64

Steps to reproduce

  1. Use the repro provided below.
  2. Run a build with yarn react-native run-ios (you can toggle the RCT_NEW_ARCH_ENABLED flag in Podfile to switch architectures and observe both errors).

Repro link

https://github.com/ahmetbicer/fast-tflite-repro

React Native version

0.73.1

Problem with using GPU Delegates

I enabled the GPU Delegates in app.json, and I have $EnableCoreMLDelegate=true in my Podfile, yet when I try to load the example model in the README (using the exact same code), I get the following error:
ERROR Failed to load Tensorflow Model 14! [Error: Failed to create TFLite interpreter from model "http://192.168.1.79:8081/assets/assets/models/efficientdet.tflite?platform=ios&hash=8c27d0eef1a3447e68f5704859bdc418"!]

Note that I do not get this error when I don't use 'core-ml' in loadTensorflowModel.

I'm using iPhone 7 Plus with iOS 14.4.2.

Require statement not part of import statement.eslint@typescript-eslint/no-var-requires

I tried:

  • import my_tflite_model from "../../../assets/MyDetection.tflite";
    • ERROR: Cannot find module '../../../assets/MyDetection.tflite' or its corresponding type declarations.
  • import my_tflite_model = require("../../../assets/MyDetection.tflite");
    • ERROR: Cannot find module '../../../assets/MyDetection.tflite' or its corresponding type declarations.
  • const my_tflite_model = require("../../../assets/MyDetection.tflite");
  • const my_tflite_model = useTensorflowModel(require("../../../assets/MyDetection.tflite"));
  • const my_tflite_model = loadTensorflowModel(require("../../../assets/MyDetection.tflite"));

Before that, I did:

  1. yarn add react-native-fast-tflite
  2. Add tflite to module.exports. resolver. assetExts in metro.config.js.
  3. Add MyDetection.tflite to the ../../../assets folder.

Em,
How can I use this library? (I just want to create a function that can run my model.)

App Crashing on Release Build [Android]

Issue

When building the app in release mode the app crashes on start but works on debug build.

Findings

I am able to build the app in release mode when I disable dex guard. I have tried to remove the package from pro guard but nothing is working

// proguard_rules.pro
-keepclasseswithmembers class com.tflite.** {*;}
-keepclasseswithmembers class com.mrousavy.camera.** { *; }
-keepclasseswithmembers class com.worklets.** { *; }

//dexguard version and config
dexguard {
    version = '9.3.7'
    license = './lib/Dexguard/dexguard-license.txt'
    configurations {
        release {
            defaultConfiguration 'dexguard-release.pro'
            configuration 'dexguard-project.pro'
        }
    }
}
image (1)

TypeError: Cannot read property 'runSync' of undefined

I setup everything, also I use face detection, its work perfectly.
But this package not worked. I get this error TypeError: Cannot read property 'runSync' of undefined . I try to implement this code:

 
const model = useTensorflowModel(require('object_detection.tflite'))

const frameProcessor = useFrameProcessor((frame) => {
    'worklet'
    if (model.state !== "loaded") return

    const data = frame.toArrayBuffer()
    // do RGB conversion if the Frame is not already in RGB Format
    const outputs = model.model.runSync([data])

    const detection_boxes = outputs[0]
    const detection_classes = outputs[1]
    const detection_scores = outputs[2]
    const num_detections = outputs[3]
    console.log(`Detected ${num_detections[0]} objects!`)

    for (let i = 0; i < detection_boxes.length; i += 4) {
        const confidence = detection_scores[i / 4]
        if (confidence > 0.7) {
            // Draw a red box around the object!
            const left = detection_boxes[i]
            const top = detection_boxes[i + 1]
            const right = detection_boxes[i + 2]
            const bottom = detection_boxes[i + 3]
            const rect = SkRect.Make(left, top, right, bottom)
            frame.drawRect(rect, SkColors.Red)
        }
    }
}, [model])

return (
    <Camera frameProcessor={frameProcessor} {...otherProps} />
) 

can you help me?

Error loading model

Hy, i use plugin but i'm error in app

error =>
'Failed to load Tensorflow Model 1!', [TypeError: right operand of 'in' is not an object]

=> Platform
real device IOS 17 iphone 14 pro

v. "react-native-fast-tflite": "^0.3.0",
"react-native-vision-camera": "^3.3.1",

how to use with local img

I am working with img labling project and need guidance on processing local images from the file system. How can I convert these local image files into tensors to pass them as inputs to the functions? and im using expo and it seems like @tensorflow/tfjs-react-native doesnt work with the currunt version of expo

Not able to build for ios simulator arm64

Showing Recent Errors Only
Building for 'iOS-simulator', but linking in object file (/Users/vemarav/Developer/example/node_modules/react-native-fast-tflite/ios/TensorFlowLiteC.framework/TensorFlowLiteC) built for 'iOS'

Object Detection on Camera

my question is where the label map ? and can we make app that request to camera for object detection ?

How to convert image into 4d tensor typed Array

Hey @mrousavy ,

I have been working with a model which expects input in the following format.

  • Inputs:
  • float32 serving_default_input_1:0[1,768,768,3]

I have used the frame processor from react-native-vision-camera

   const frameProcessor = useFrameProcessor(
    frame => {
      'worklet';
      runAtTargetFps(1, () => {
        'worklet';
        if (actualModel == null) {
          // model is still loading...
          return;
        }
        const resized = resize(frame, {
          size: {
            width: 768,
            height: 768,
          },
          pixelFormat: 'rgb-uint8',
        });
        const result = actualModel.runSync([new Uint8Array(resized)]);
        console.log('result--->', result);
      });
    },
    [actualModel],
  );

My model is running and giving the same output for every frame. Can you help with that ?

Failed to load Tensorflow Model 1! [TypeError: right operand of 'in' is not an object]

Problem Description:
When attempting to load a TensorFlow 1 model, an error occurs with the message "Failed to load Tensorflow Model 1! [TypeError: right operand of 'in' is not an object]".

Expected Behavior:
Expected the TensorFlow 1 model to load successfully without any errors.

Reproduction Steps:

Run the application/script where an attempt to load the TensorFlow 1 model is made.
Observe the error message "Failed to load Tensorflow Model 1! [TypeError: right operand of 'in' is not an object]".
Actual Behavior:
Instead of successfully loading the model, an error occurs with the message "Failed to load Tensorflow Model 1! [TypeError: right operand of 'in' is not an object]".

Additional Information:

Device: iPhone 14 Pro Max
CoreML: disabled
Model: from your demo (model_movenet_singlepose_lightning_tflite_int8_4)

  "dependencies": {
    "@shopify/react-native-skia": "^0.1.202",
    "react": "18.2.0",
    "react-native": "0.72.4",
    "react-native-fast-tflite": "^0.3.0",
    "react-native-vision-camera": "^3.0.0-rc.8",
    "react-native-worklets-core": "^0.2.0"
  },

Failed to load Tensorflow Model IllegalArgumentException: Expected URL scheme 'http' or 'https' but no colon was found

I have a deployment very soon and I found out my frame processing isn't working in my release versions but it does work in my debug versions.

I checked the catlog of my app and I saw Failed to load Tensorflow Model IllegalArgumentException: Expected URL scheme 'http' or 'https' but no colon was found, I need to fix this ASAP, can you suggest a solution or even just a patch I could work with? Would very appreciate any help with this

2024-02-13 19:53:22.365 31683-31762 FrameProce...inRegistry com.x                    I  Looking up Frame Processor Plugin "scanOCR"...
2024-02-13 19:53:22.365 31683-31762 FrameProce...inRegistry com.x                    I  Frame Processor Plugin "scanOCR" found! Initializing...
2024-02-13 19:53:22.370 31683-31762 ReactNativeJS           com.x                    I  Loading Tensorflow Lite Model 19
2024-02-13 19:53:22.370 31683-31762 ReactNativeJS           com.x                    I  Resolved Model path: app_assets_documentdetection
2024-02-13 19:53:22.374 31683-31762 ReactNativeJS           com.x                    E  'Failed to load Tensorflow Model 19!', [Error: java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but no colon was found]
2024-02-13 19:53:22.381 31683-31683 PreviewView             com.x                    I  Creating PreviewView...
2024-02-13 19:53:22.382 31683-31683 PreviewView             com.x                    I  PreviewView is 0x0, rendering 1920x1080 content. Resizing to: 0x0 (COVER)
2024-02-13 19:53:22.383 31683-31683 CameraView              com.x                    I  Updating CameraSession...
2024-02-13 19:53:22.384 31683-31759 CameraSession           com.x                    I  configure { ... }: Waiting for lock...
2024-02-13 19:53:22.385 31683-31759 CameraSession           com.x                    I  configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=true, outputsChanged=true, sidePropsChanged=true, isActiveChanged=true)
2024-02-13 19:53:22.385 31683-31759 CameraSession           com.x                    I  Configuring inputs for CameraSession...
2024-02-13 19:53:22.385 31683-31759 Persistent...ureSession com.x                    D  --> setInput(0)
2024-02-13 19:53:22.385 31683-31759 CameraSession           com.x                    I  Destroying previous outputs...
2024-02-13 19:53:22.386 31683-31683 PreviewView             com.x                    I  Setting PreviewView ResizeMode to COVER...
2024-02-13 19:53:22.389 31683-31759 CameraSession           com.x                    I  Creating outputs for Camera #0...
2024-02-13 19:53:22.392 31683-31763 unknown:ReactNative     com.x                    E  console.error: Failed to load Tensorflow Model 19! Error: java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but no colon was found, js engine: hermes, stack:
                                                                                                    _construct@1:189687
                                                                                                    Wrapper@1:189333
                                                                                                    _callSuper@1:187344
                                                                                                    SyntheticError@1:188814
                                                                                                    reactConsoleErrorHandler@1:188479
                                                                                                    ?anon_0_@1:2159260
                                                                                                    asyncGeneratorStep@1:543122
                                                                                                    _throw@1:543424
                                                                                                    tryCallOne@53:15
                                                                                                    anonymous@139:26
                                                                                                    anonymous@1:206378
                                                                                                    _callTimer@1:205329
                                                                                                    _callReactNativeMicrotasksPass@1:205473
                                                                                                    callReactNativeMicrotasks@1:207457
                                                                                                    __callReactNativeMicrotasks@1:93414
                                                                                                    anonymous@1:92498
                                                                                                    __guard@1:93252
                                                                                                    flushedQueue@1:92409

Mediapipe Solutions with the frame processor

Hi, I know react-native-fast-tflite can process any tflite model, but it looks like MediaPipe's pose estimation allows you to download models that is ".task" file (the underlying model are apparently tflite models) https://developers.google.com/mediapipe/solutions/vision/pose_landmarker

To work around this, I was looking into integrating the example Mediapipe android code into creating a frame processor plugin (followed steps from the react-native-camera-vision docs , but this doesn't seems as straightforward. (for one, I am not sure how to convert Frame into ImageProxy object, 2. I am mostly familiar with RN side of things)

Any help is appreciated.

Problem with loading tflite model on Android in release version

Hi, there is an issues with the library on Android in the release version.

First:
Function loadTensorflowModel in TensorflowLite.ts use

const asset = Image.resolveAssetSource(source)
uri = asset.uri

In Dev mode, assets are served from the server, so the URI will be: "http://localhost:8081/assets/src/assets/mymodel.flite?platform=android&hash=...." so it works,
but in release mode on Android, asset.uri will be: src_assets_mymodel

Second:
The function fetchByteDataFromUrl in lib/android in TfliteModule.java uses the HTTP request method, which throws an error because it expects the URL scheme to be "http" or "https."

 
  public static byte[] fetchByteDataFromUrl(String url) {
    OkHttpClient client = new OkHttpClient();

    Request request = new Request.Builder().url(url).build();

    try (Response response = client.newCall(request).execute()) {
      if (response.isSuccessful() && response.body() != null) {
        return response.body().bytes();
      } else {
        throw new RuntimeException("Response was not successful!");
      }
    } catch (Exception e) {
      Log.e(NAME, "Failed to fetch URL " + url + "!", e);
      return null;
    }
  }
Screenshot 2024-01-23 at 13 28 42

On iOS, everything works fine

Error: The package 'react-native-fast-tflite' doesn't seem to be linked.

Hello,

I 've modify this example https://github.com/tensorflow/tfjs-examples/tree/master/react-native/image-classification/expo
in order to use a .tflite model following your instructions.
When I run de project i get the following error:
Error: The package 'react-native-fast-tflite' doesn't seem to be linked. Make sure:

  • You rebuilt the app after installing the package
  • You are not using Expo Go

at node_modules\expo\build\environment\react-native-logs.fx.js:27:4 in error
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:95:4 in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:141:19 in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:24:6 in handleError
at node_modules@react-native\polyfills\error-guard.js:49:36 in ErrorUtils.reportFatalError
at node_modules\metro-runtime\src\polyfills\require.js:203:6 in guardedLoadModule
at http://192.168.1.17:19000/index.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:297699:3 in global code

Invariant Violation: "main" has not been registered. This can happen if:

  • Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
  • A module failed to load due to an error and AppRegistry.registerComponent wasn't called.
    at node_modules\expo\build\environment\react-native-logs.fx.js:27:4 in error
    at node_modules\react-native\Libraries\Core\ExceptionsManager.js:95:4 in reportException
    at node_modules\react-native\Libraries\Core\ExceptionsManager.js:141:19 in handleException
    at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:24:6 in handleError
    at node_modules@react-native\polyfills\error-guard.js:49:36 in ErrorUtils.reportFatalError
    at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:370:8 in __guard
    at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:113:4 in callFunctionReturnFlushedQueue

โ€บ Opening on Android...
โ€บ Opening exp://192.168.1.17:19000 on 22041216G
โ€บ Press ? โ”‚ show all commands
โ€บ Opening on Android...
โ€บ Opening exp://192.168.1.17:19000 on 22041216G
โ€บ Press ? โ”‚ show all commands
Android Bundling complete 74ms
Android Running app on 22041216G

Invariant Violation: "main" has not been registered. This can happen if:

  • Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
  • A module failed to load due to an error and AppRegistry.registerComponent wasn't called.
    at node_modules\expo\build\environment\react-native-logs.fx.js:27:4 in error
    at node_modules\react-native\Libraries\Core\ExceptionsManager.js:95:4 in reportException
    at node_modules\react-native\Libraries\Core\ExceptionsManager.js:141:19 in handleException
    at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:24:6 in handleError
    at node_modules@react-native\polyfills\error-guard.js:49:36 in ErrorUtils.reportFatalError
    at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:370:8 in __guard
    at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:113:4 in callFunctionReturnFlushedQueue

Error: The package 'react-native-fast-tflite' doesn't seem to be linked. Make sure:

  • You rebuilt the app after installing the package
  • You are not using Expo Go

at node_modules\expo\build\environment\react-native-logs.fx.js:27:4 in error
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:95:4 in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:141:19 in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:24:6 in handleError
at node_modules@react-native\polyfills\error-guard.js:49:36 in ErrorUtils.reportFatalError
at node_modules\metro-runtime\src\polyfills\require.js:203:6 in guardedLoadModule
at http://192.168.1.17:19000/index.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:297699:3 in global code

Can you please help on this issue?
Regards.

Example App is Crashing When running in Release Mode [Android]

steps

  1. go to example/android/app/build.gradle
  2. go to line 56 and change enableProguardInReleaseBuilds to true

crash

2024-03-19 17:19:48.426 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollContainerViewManager
2024-03-19 17:19:48.427 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.progressbar.ReactProgressBarViewManager
2024-03-19 17:19:48.427 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.progressbar.b
2024-03-19 17:19:48.427 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.scroll.ReactScrollViewManager
2024-03-19 17:19:48.428 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager
2024-03-19 17:19:48.428 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager$b
2024-03-19 17:19:48.428 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager
2024-03-19 17:19:48.429 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager
2024-03-19 17:19:48.429 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class x3.a
2024-03-19 17:19:48.429 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.image.ReactImageManager
2024-03-19 17:19:48.429 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.modal.ReactModalHostManager
2024-03-19 17:19:48.429 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.modal.b
2024-03-19 17:19:48.430 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.text.ReactRawTextManager
2024-03-19 17:19:48.430 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.text.k
2024-03-19 17:19:48.430 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputManager
2024-03-19 17:19:48.431 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.textinput.d0
2024-03-19 17:19:48.431 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.text.ReactTextViewManager
2024-03-19 17:19:48.431 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.text.r
2024-03-19 17:19:48.432 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.view.ReactViewManager
2024-03-19 17:19:48.432 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager
2024-03-19 17:19:48.432 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.text.a0
2024-03-19 17:19:48.432 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.facebook.react.views.unimplementedview.ReactUnimplementedViewManager
2024-03-19 17:19:48.432 23925-23950 unknown:Vi...rtyUpdater com.tfliteexample                    W  Could not find generated setter for class com.mrousavy.camera.CameraViewManager
2024-03-19 17:19:48.443 23925-23945 OpenGLRenderer          com.tfliteexample                    W  Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2024-03-19 17:19:48.443 23925-23945 OpenGLRenderer          com.tfliteexample                    W  Failed to initialize 101010-2 format, error = EGL_SUCCESS
2024-03-19 17:19:48.449 23925-23945 Gralloc4                com.tfliteexample                    I  mapper 4.x is not supported
2024-03-19 17:19:48.451 23925-23950 ReactNativeJS           com.tfliteexample                    I  Running "TfliteExample
2024-03-19 17:19:48.454 23925-23950 ReactNativeJS           com.tfliteexample                    I  Loading react-native-worklets-core...
2024-03-19 17:19:48.454 23925-23945 OpenGLRenderer          com.tfliteexample                    E  Unable to match the desired swap behavior.
2024-03-19 17:19:48.458 23925-23950 ReactNativeJS           com.tfliteexample                    I  Worklets loaded successfully
2024-03-19 17:19:48.465 23925-23950 VisionCameraProxy       com.tfliteexample                    I  Initializing VisionCameraProxy...
2024-03-19 17:19:48.465 23925-23950 VisionCameraProxy       com.tfliteexample                    I  Creating Worklet Context...
2024-03-19 17:19:48.468 23925-23950 VisionCameraProxy       com.tfliteexample                    I  Worklet Context created!
2024-03-19 17:19:48.469 23925-23950 Compatibil...geReporter com.tfliteexample                    D  Compat change id reported: 250678880; UID 10185; state: ENABLED
2024-03-19 17:19:48.535 23925-23950 Compatibil...geReporter com.tfliteexample                    D  Compat change id reported: 206033068; UID 10185; state: ENABLED
2024-03-19 17:19:48.548 23925-23950 ReactNativeJS           com.tfliteexample                    I  Installing bindings...
2024-03-19 17:19:48.549 23925-23950 Tflite                  com.tfliteexample                    I  Loading C++ library...
2024-03-19 17:19:48.549 23925-23950 Tflite                  com.tfliteexample                    I  Installing JSI Bindings for VisionCamera Tflite plugin...
2024-03-19 17:19:48.550 23925-23950 Tflite                  com.tfliteexample                    I  Successfully installed JSI Bindings!
2024-03-19 17:19:48.550 23925-23950 ReactNativeJS           com.tfliteexample                    I  Successfully installed!
2024-03-19 17:19:48.550 23925-23950 FrameProce...inRegistry com.tfliteexample                    I  Looking up Frame Processor Plugin "resize"...
2024-03-19 17:19:48.550 23925-23950 FrameProce...inRegistry com.tfliteexample                    I  Frame Processor Plugin "resize" found! Initializing...
2024-03-19 17:19:48.550 23925-23950 ReactNativeJS           com.tfliteexample                    I  Model: loading (false)
2024-03-19 17:19:48.553 23925-23950 ReactNativeJS           com.tfliteexample                    I  Loading Tensorflow Lite Model 1
2024-03-19 17:19:48.554 23925-23950 ReactNativeJS           com.tfliteexample                    I  Resolved Model path: assets_efficientdet
2024-03-19 17:19:48.554 23925-23968 Tflite                  com.tfliteexample                    I  Loading byte data from URL: assets_efficientdet...
2024-03-19 17:19:48.554 23925-23968 Tflite                  com.tfliteexample                    I  Parsing resourceId...
2024-03-19 17:19:48.554 23925-23968 Tflite                  com.tfliteexample                    I  Parsed resourceId: 2131558400
2024-03-19 17:19:48.560 23925-23925 PreviewView             com.tfliteexample                    I  Creating PreviewView...
2024-03-19 17:19:48.561 23925-23925 PreviewView             com.tfliteexample                    I  PreviewView is 0x0, rendering 1080x1920 content. Resizing to: 0x0 (COVER)
2024-03-19 17:19:48.562 23925-23925 CameraView              com.tfliteexample                    I  Updating CameraSession...
2024-03-19 17:19:48.563 23925-23963 CameraSession           com.tfliteexample                    I  configure { ... }: Waiting for lock...
2024-03-19 17:19:48.563 23925-23963 CameraSession           com.tfliteexample                    I  configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=true, outputsChanged=true, sidePropsChanged=true, isActiveChanged=true)
2024-03-19 17:19:48.564 23925-23963 CameraSession           com.tfliteexample                    I  Need to rebuild CameraDevice and CameraCaptureSession...
2024-03-19 17:19:48.564 23925-23963 CameraSession           com.tfliteexample                    I  CameraDevice and CameraCaptureSession is torn down but Camera is not active, skipping update...
2024-03-19 17:19:48.564 23925-23963 CameraSession           com.tfliteexample                    I  Successfully updated CameraSession Configuration! isActive: false
2024-03-19 17:19:48.564 23925-23963 CameraView              com.tfliteexample                    I  invokeOnInitialized()
2024-03-19 17:19:48.567 23925-23925 CameraView              com.tfliteexample                    I  Updating CameraSession...
2024-03-19 17:19:48.567 23925-23963 CameraSession           com.tfliteexample                    I  configure { ... }: Waiting for lock...
2024-03-19 17:19:48.567 23925-23963 CameraSession           com.tfliteexample                    I  configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=true, outputsChanged=true, sidePropsChanged=true, isActiveChanged=true)
2024-03-19 17:19:48.567 23925-23963 CameraSession           com.tfliteexample                    I  Need to rebuild CameraDevice and CameraCaptureSession...
2024-03-19 17:19:48.567 23925-23963 CameraSession           com.tfliteexample                    I  Need to rebuild CameraDevice and CameraCaptureSession...
2024-03-19 17:19:48.567 23925-23963 CameraSession           com.tfliteexample                    I  Configuring Camera #10...
2024-03-19 17:19:48.568 23925-23963 CameraManager           com.tfliteexample                    I  Camera #10: Opening...
2024-03-19 17:19:48.568 23925-23925 PreviewView             com.tfliteexample                    I  PreviewView is 1440x2891, rendering 1080x1920 content. Resizing to: 1626x2891 (COVER)
2024-03-19 17:19:48.570 23925-23925 CameraSession           com.tfliteexample                    I  PreviewView Surface created! Surface(name=null)/@0x29c2de0
2024-03-19 17:19:48.570 23925-23925 CameraSession           com.tfliteexample                    I  Setting Preview Output...
2024-03-19 17:19:48.570 23925-23925 CameraSession           com.tfliteexample                    I  PreviewView Surface updated! Surface(name=null)/@0x29c2de0 1626 x 2891
2024-03-19 17:19:48.577 23925-23951 CameraDevices           com.tfliteexample                    I  Camera #10 is now unavailable.
2024-03-19 17:19:48.578 23925-23963 CameraSession           com.tfliteexample                    I  configure { ... }: Waiting for lock...
2024-03-19 17:19:48.578 23925-23963 CameraManager           com.tfliteexample                    I  Camera #10: Opened!
2024-03-19 17:19:48.579 23925-23963 CameraSession           com.tfliteexample                    I  Successfully configured Camera #10!
2024-03-19 17:19:48.579 23925-23963 CameraSession           com.tfliteexample                    I  Destroying previous outputs...
2024-03-19 17:19:48.580 23925-23963 CameraSession           com.tfliteexample                    I  Creating outputs for Camera #10...
2024-03-19 17:19:48.580 23925-23963 CameraSession           com.tfliteexample                    I  Adding 1280x960 Video Output in YUV_420_888...
2024-03-19 17:19:48.580 23925-23963 VideoPipeline           com.tfliteexample                    I  Initializing 1280 x 960 Video Pipeline (format: YUV)
2024-03-19 17:19:48.580 23925-23963 VideoPipeline           com.tfliteexample                    I  Using ImageReader round-trip (format: #35)
2024-03-19 17:19:48.581 23925-23963 VideoPipeline           com.tfliteexample                    I  Using API 29 for GPU ImageReader...
2024-03-19 17:19:48.581 23925-23968 tflite                  com.tfliteexample                    I  Initialized TensorFlow Lite runtime.
2024-03-19 17:19:48.581 23925-23963 Compatibil...geReporter com.tfliteexample                    D  Compat change id reported: 236825255; UID 10185; state: ENABLED
2024-03-19 17:19:48.582 23925-23963 CreateCaptureSession    com.tfliteexample                    I  Camera #10: Creating Capture Session #1... (Hardware Level: 0 | Outputs: [VIDEO (1280x960 in YUV)])
2024-03-19 17:19:48.582 23925-23963 CreateCaptureSession    com.tfliteexample                    I  Using new API (>=28)
2024-03-19 17:19:48.582 23925-23950 ReactNativeJS           com.tfliteexample                    I  Model: loading (false)
2024-03-19 17:19:48.803 23925-23950 ReactNativeJS           com.tfliteexample                    E  Error: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/mrousavy/camera/frameprocessor/FrameProcessor;.<init>(Lcom/facebook/jni/HybridData;)V", js engine: hermes
2024-03-19 17:19:48.804 23925-23950 ReactNativeJS           com.tfliteexample                    I  Model: loaded (true)
2024-03-19 17:19:48.812 23925-23950 ReactNativeJS           com.tfliteexample                    I  Model loaded! Shape:
                                                                                                    TFLite Model (default):
                                                                                                    - Inputs: 
                                                                                                      - uint8 serving_default_images:0[1,320,320,3]
                                                                                                    - Outputs: 
                                                                                                      - float32 StatefulPartitionedCall:3[1,25,4]
                                                                                                      - float32 StatefulPartitionedCall:2[1,25]
                                                                                                      - float32 StatefulPartitionedCall:1[1,25]
                                                                                                      - float32 StatefulPartitionedCall:0[1]]
2024-03-19 17:19:48.812 23925-23950 ReactNativeJS           com.tfliteexample                    E  Error: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/mrousavy/camera/frameprocessor/FrameProcessor;.<init>(Lcom/facebook/jni/HybridData;)V"
                                                                                                    
                                                                                                    This error is located at:
                                                                                                        in Camera
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in App
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in RCTView
                                                                                                        in Unknown
                                                                                                        in AppContainer, js engine: hermes
2024-03-19 17:19:48.813 23925-23950 ReactNativeJS           com.tfliteexample                    E  'Failed to load Tensorflow Model 1!', { [Error: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/mrousavy/camera/frameprocessor/FrameProcessor;.<init>(Lcom/facebook/jni/HybridData;)V"]
                                                                                                      componentStack: '\n    in Camera\n    in RCTView\n    in Unknown\n    in App\n    in RCTView\n    in Unknown\n    in RCTView\n    in Unknown\n    in AppContainer',
                                                                                                      isComponentError: true }
2024-03-19 17:19:48.840 23925-23951 AndroidRuntime          com.tfliteexample                    E  FATAL EXCEPTION: mqt_native_modules
                                                                                                    Process: com.tfliteexample, PID: 23925
                                                                                                    com.facebook.react.common.JavascriptException: Error: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/mrousavy/camera/frameprocessor/FrameProcessor;.<init>(Lcom/facebook/jni/HybridData;)V", js engine: hermes, stack:
                                                                                                    setFrameProcessor@1:602717
                                                                                                    onViewReady@1:602821
                                                                                                    invokeGuardedCallbackImpl@1:284974
                                                                                                    invokeGuardedCallback@1:285031
                                                                                                    invokeGuardedCallbackAndCatchFirstError@1:285063
                                                                                                    executeDispatch@1:285192
                                                                                                    executeDispatchesAndReleaseTopLevel@1:289361
                                                                                                    forEachAccumulated@1:286650
                                                                                                    anonymous@1:289724
                                                                                                    batchedUpdatesImpl@1:348771
                                                                                                    batchedUpdates@1:289279
                                                                                                    _receiveRootNodeIDEvent@1:289562
                                                                                                    receiveEvent@1:343266
                                                                                                    __callFunction@1:41328
                                                                                                    anonymous@1:39633
                                                                                                    __guard@1:40589
                                                                                                    callFunctionReturnFlushedQueue@1:39591
                                                                                                    
                                                                                                    	at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(Unknown Source:75)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.facebook.react.bridge.JavaMethodWrapper.invoke(Unknown Source:142)
                                                                                                    	at com.facebook.react.bridge.JavaModuleWrapper.invoke(Unknown Source:21)
                                                                                                    	at com.facebook.jni.NativeRunnable.run(Native Method)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:958)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                    	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(Unknown Source:0)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:205)
                                                                                                    	at android.os.Looper.loop(Looper.java:294)
                                                                                                    	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(Unknown Source:37)
                                                                                                    	at java.lang.Thread.run(Thread.java:1012)
2024-03-19 17:19:48.845 23925-23963 CreateCaptureSession    com.tfliteexample                    I  Camera #10: Successfully created CameraCaptureSession #1!
2024-03-19 17:19:48.845 23925-23963 CameraSession           com.tfliteexample                    I  Successfully configured Session with 1 outputs for Camera #10!
2024-03-19 17:19:48.845 23925-23963 CameraSession           com.tfliteexample                    I  Updating Video Outputs...
2024-03-19 17:19:48.845 23925-23963 VideoPipeline           com.tfliteexample                    I  Removing FrameProcessor Output...
2024-03-19 17:19:48.845 23925-23963 VideoPipeline           com.tfliteexample                    I  Removing RecordingSession Output...
2024-03-19 17:19:48.847 23925-23963 CameraView              com.tfliteexample                    I  invokeOnStarted()
2024-03-19 17:19:48.847 23925-23963 CameraSession           com.tfliteexample                    I  Successfully updated CameraSession Configuration! isActive: true
2024-03-19 17:19:48.847 23925-23963 CameraView              com.tfliteexample                    I  invokeOnInitialized()
2024-03-19 17:19:48.848 23925-23963 CameraSession           com.tfliteexample                    I  configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=false, outputsChanged=true, sidePropsChanged=true, isActiveChanged=false)
2024-03-19 17:19:48.848 23925-23963 CameraSession           com.tfliteexample                    I  Destroying previous outputs...
2024-03-19 17:19:48.848 23925-23963 SurfaceOutput           com.tfliteexample                    I  Closing 1280x960 Video Pipeline..
2024-03-19 17:19:48.849 23925-23963 CameraView              com.tfliteexample                    I  invokeOnStopped()
2024-03-19 17:19:48.849 23925-23974 BufferQueueProducer     com.tfliteexample                    E  [ImageReader-1280x960f23m3-23925-0](id:5d7500000003,api:4,p:449,c:23925) dequeueBuffer: BufferQueue has been abandoned
2024-03-19 17:19:48.851 23925-23963 CameraSession           com.tfliteexample                    I  Creating outputs for Camera #10...
2024-03-19 17:19:48.852 23925-23963 CameraSession           com.tfliteexample                    I  Adding 1280x960 Video Output in YUV_420_888...
2024-03-19 17:19:48.852 23925-23963 VideoPipeline           com.tfliteexample                    I  Initializing 1280 x 960 Video Pipeline (format: YUV)
2024-03-19 17:19:48.852 23925-23963 VideoPipeline           com.tfliteexample                    I  Using ImageReader round-trip (format: #35)
2024-03-19 17:19:48.852 23925-23963 VideoPipeline           com.tfliteexample                    I  Using API 29 for GPU ImageReader...
2024-03-19 17:19:48.853 23925-23963 CameraSession           com.tfliteexample                    I  Adding 1280x960 Preview Output...
2024-03-19 17:19:48.854 23925-23925 PreviewView             com.tfliteexample                    I  Setting PreviewView Surface Size to 1626 x 2891...
2024-03-19 17:19:48.855 23925-23963 CreateCaptureSession    com.tfliteexample                    I  Camera #10: Creating Capture Session #2... (Hardware Level: 0 | Outputs: [VIDEO (1280x960 in YUV), PREVIEW (1280 x 960)])
2024-03-19 17:19:48.855 23925-23963 CreateCaptureSession    com.tfliteexample                    I  Using new API (>=28)
2024-03-19 17:19:48.860 23925-23925 CameraSession           com.tfliteexample                    I  PreviewView Surface updated! Surface(name=null)/@0x29c2de0 1280 x 960
2024-03-19 17:19:48.869 23925-23951 Process                 com.tfliteexample                    I  Sending signal. PID: 23925 SIG: 9
2024-03-19 17:19:52.308 24103-24128 AndroidRuntime          pid-24103                            E  FATAL EXCEPTION: mqt_native_modules
                                                                                                    Process: com.tfliteexample, PID: 24103
                                                                                                    com.facebook.react.common.JavascriptException: Error: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/mrousavy/camera/frameprocessor/FrameProcessor;.<init>(Lcom/facebook/jni/HybridData;)V", js engine: hermes, stack:
                                                                                                    setFrameProcessor@1:602717
                                                                                                    onViewReady@1:602821
                                                                                                    invokeGuardedCallbackImpl@1:284974
                                                                                                    invokeGuardedCallback@1:285031
                                                                                                    invokeGuardedCallbackAndCatchFirstError@1:285063
                                                                                                    executeDispatch@1:285192
                                                                                                    executeDispatchesAndReleaseTopLevel@1:289361
                                                                                                    forEachAccumulated@1:286650
                                                                                                    anonymous@1:289724
                                                                                                    batchedUpdatesImpl@1:348771
                                                                                                    batchedUpdates@1:289279
                                                                                                    _receiveRootNodeIDEvent@1:289562
                                                                                                    receiveEvent@1:343266
                                                                                                    __callFunction@1:41328
                                                                                                    anonymous@1:39633
                                                                                                    __guard@1:40589
                                                                                                    callFunctionReturnFlushedQueue@1:39591
                                                                                                    
                                                                                                    	at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(Unknown Source:75)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.facebook.react.bridge.JavaMethodWrapper.invoke(Unknown Source:142)
                                                                                                    	at com.facebook.react.bridge.JavaModuleWrapper.invoke(Unknown Source:21)
                                                                                                    	at com.facebook.jni.NativeRunnable.run(Native Method)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:958)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                    	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(Unknown Source:0)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:205)
                                                                                                    	at android.os.Looper.loop(Looper.java:294)
                                                                                                    	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(Unknown Source:37)
                                                                                                    	at java.lang.Thread.run(Thread.java:1012)
2024-03-19 17:19:52.437 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:52.467 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:52.500 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:52.534 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:52.566 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:52.601 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:52.632 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:52.666 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:52.700 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:52.734 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:52.766 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:52.800 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:52.834 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:52.867 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:52.899 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:52.932 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:52.965 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:52.999 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.033 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.066 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.081 24103-24122 EGL_emulation           com.tfliteexample                    D  app_time_stats: avg=10.84ms min=0.81ms max=71.05ms count=51
2024-03-19 17:19:53.101 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.134 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.168 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.201 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.234 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.266 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.300 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.335 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.367 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.401 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.433 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.467 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.500 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.534 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.567 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.602 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.635 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.670 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.703 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.736 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.767 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.801 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.834 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.868 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.900 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.933 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:53.967 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.000 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.032 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.068 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.102 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.103 24103-24122 EGL_emulation           com.tfliteexample                    D  app_time_stats: avg=2.39ms min=1.08ms max=6.75ms count=49
2024-03-19 17:19:54.135 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.168 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.200 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.234 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.269 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.300 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.334 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.366 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.402 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.433 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.467 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.502 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.537 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.569 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.602 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.634 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.668 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.702 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.735 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.769 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.802 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.834 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.869 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.924 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.938 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:54.972 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.006 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.039 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.075 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.107 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.108 24103-24122 EGL_emulation           com.tfliteexample                    D  app_time_stats: avg=2.68ms min=0.82ms max=7.11ms count=46
2024-03-19 17:19:55.141 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.173 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.207 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.240 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.273 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.307 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.340 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.373 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.408 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.441 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.474 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.507 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.541 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.574 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.606 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.638 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.672 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.705 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.738 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.773 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.805 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.837 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.870 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.904 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.939 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:55.974 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:56.008 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:56.040 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:56.076 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:56.106 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:56.114 24103-24122 EGL_emulation           com.tfliteexample                    D  app_time_stats: avg=3.53ms min=0.94ms max=14.37ms count=39
2024-03-19 17:19:56.143 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!
2024-03-19 17:19:56.204 24103-24138 VideoPipeline           com.tfliteexample                    I  ImageReader::onImageAvailable!

result classes only shows array of numbers [TFLite}

I am currently using TFLite to load my model.tflite and I am trying to get the name of the classes that detected by the Camera. But, the problem is it only shows the number of arrays. Any suggestions for me to solve my problem?

Dependencies:
image

Code in my FrameProcessor:
image

model.tflite - I don't have labels.txt cause this is from the kaggle and it didn't provide any..
image

How to run inference with dynamic shape model ?

Hi bro,
I have a model that supports dynamic shape, but tflite does not support it when converting, but it does support it from the code.

Doc from TFL
https://www.tensorflow.org/lite/guide/inference#run_inference_with_dynamic_shape_model

If you want to run a model with dynamic input shape, resize the input shape before running inference. Otherwise, the None shape in Tensorflow models will be replaced by a placeholder of 1 in TFLite models.

The following examples show how to resize the input shape before running inference in different languages. All the examples assume that the input shape is defined as [1/None, 10], and need to be resized to [3, 10].

// Resize input tensors before allocate tensors
interpreter->ResizeInputTensor(/*tensor_index=*/0, std::vector<int>{3,10});
interpreter->AllocateTensors();

How to operate with react-native-fast-tflite

Problems and confusion regarding the input format

First of all, many thanks for this library. It looks really promising to me, but I struggle to get it working correctly. In a first step, I wanted to test the library without a camera, using just a local image. I managed to get an output, but my problem is that it doesn't seem to be accurate. I use the object detection example from the Tensorfow website as my model. Based on netron.app I can tell that the input tensor of the model is shaped as follows: uint8[1,300,300,3].

My first hurdle was to get my local image into the desired ArrayBuffers format, taking into account the expected input format of the model. I endet up using the Image object from react-native-skia. I draw my testimage onto a 300x300 pixel canvas to extract the pixels and convert them to the desired data-shape using the following code:

    ...
    const imageBytes = image.readPixels()
    const rgbData = new Uint8Array(300 * 300 * 3)

    // Input shape: 1 uint8[1,300,300,3]
    // Meaning: 300 x 300 Pixels + 3 bit for RGB
    // Copy pixel but leave out alpha channel
    for (let i = 0, j = 0; i < imageBytes.length; i += 4, j += 3) {
      rgbData[j] = imageBytes[i] // Red
      rgbData[j + 1] = imageBytes[i + 1] // Green
      rgbData[j + 2] = imageBytes[i + 2] // Blue
    }

    const dataArray = await model.model.run([rgbData])

    const locations = dataArray[0]
    const classes = dataArray[1]
    const scores = dataArray[2]

    const topDetections = []

    for (let i = 0; i < Math.min(classes.length, 3); i++) {
      topDetections.push({
        location: locations[i],
        score: scores[i],
        class: labelmap[classes[i]]
      })
    }

    const output = 'Guesses:\n' + topDetections.map((detection) => `${detection.class} (${detection.score})\n`)
    setGuess(output)

First I was a bit confused, as I am passing an Uint8Array instead of an array buffer, but I was happy the model finally returned something. However, as you can see from my screenshot, the result is not as expected (there is a "cat" class in the model..).
Bildschirmfoto 2023-11-28 um 19 20 29

Does anyone have any idea where my error could lie? I'm not sure what the first 1 in the input format [1,300,300,3] means. Somewhere I read it's called batch dimension, but I have no clue if or how to add it to my input tensor.

Error building the app

After running npx pod-install && yarn ios on a brand new react native project, I got following error:

** BUILD FAILED **


The following build commands failed:
        CompileC /Users/movila/Library/Developer/Xcode/DerivedData/Zproc-brjekwuaqyjzkngtrxtlfqaagxvs/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-fast-tflite.build/Objects-normal/arm64/Tflite.o /Users/shbai/Dev/test/rctnative/NewEnv/Zproc/node_modules/react-native-fast-tflite/ios/Tflite.mm normal arm64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'react-native-fast-tflite' from project 'Pods')
(1 failure)

react-native info

info Fetching system and libraries information...
System:
  OS: macOS 13.6
  CPU: (8) arm64 Apple M1 Pro
  Memory: 91.20 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.2.0
    path: ~/.nvm/versions/node/v20.2.0/bin/node
  Yarn:
    version: 1.22.19
    path: ~/.nvm/versions/node/v20.2.0/bin/yarn
  npm:
    version: 9.6.6
    path: ~/.nvm/versions/node/v20.2.0/bin/npm
  Watchman:
    version: 2023.09.04.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
  Xcode:
    version: 15.0/15A240d
    path: /usr/bin/xcodebuild
Languages:
  Java: Not Found
  Ruby:
    version: 3.2.2
    path: /Users/movila/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.6
    wanted: 0.72.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: true

I also tried #26118 (comment), still not working.

iOS does not build on x86 Simulators

On iOS, we currently build TensorFlowLiteC from source. This builds a fat iOS binary:

bazel build --config=ios_fat -c opt --cxxopt=--std=c++17 //tensorflow/lite/ios:TensorFlowLiteC_framework
bazel build --config=ios_fat -c opt --cxxopt=--std=c++17 //tensorflow/lite/ios:TensorFlowLiteCCoreML_framework

..for some reason users have reported that this does not work when running the app on an iOS Simulator on a Intel x86 Mac.

I don't have such Mac anymore, but I am not sure what's going wrong - maybe there is a way to also build for x86?

Unable to resolve module ./LogBoxImages/close.png

In IOS when I use this package and run code I get this error

Error: Unable to resolve module ./LogBoxImages/close.png from /node_modules/react-native/Libraries/LogBox/UI/LogBoxNotification.js

  107 |         style={dismissStyles.press}>
  108 |         <Image
> 109 |           source={require('./LogBoxImages/close.png')}
      |                            ^
  110 |           style={dismissStyles.image}
  111 |         />
  112 |       </LogBoxButton>

React Native: v0.73.10
react-native-fast-tflite: 1.1.3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.