Open Hasanhsk opened 5 years ago
I am experiencing the exact same issue! An
Also @Hasanhsk i think you left out your componentWillMount method which should look like this:
componentWillMount() { this.classifyImage("assets/images/<IMAGE_NAME>") // path to image }
Here is a screenshot of the error!
import React, { Component } from 'react' import { StyleSheet, View, Text, Image, TouchableOpacity } from 'react-native'
import { TFLiteImageRecognition } from 'react-native-tensorflow-lite'
export default class App extends Component { constructor() { super() this.state = {}
}
async classifyImage(imagePath) { try { const results = await this.classifier.recognize({ // Your image path. image: imagePath, // the input shape of your model. If none given, it will be default to 224. inputShape: 224 })
}
componentWillUnmount() { // Must close the classifier when destroying or unmounting component to release object. this.classifier.close() }
render() { return (
} }
const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF' }, results: { textAlign: 'center', fontSize: 24 }, images: { flexDirection: 'row' }, imageContainer: { flex: 1, justifyContent: 'center', overflow: 'hidden' }, image: { resizeMode: 'contain' } })