It's now time to write the code for Android. The first thing to do is to add the files we exported from the Custom Vision service to the Android project. For TensorFlow, the actual model and the labels (the tags) are separated into two files. Let's set this up by going through the following steps:
- Extract the .zip file that we got from the Custom Vision service.
- Find the model.tflite file and rename it as hotdog-or-not-model.tflite.
- Find the labels.txt file and rename it as hotdog-or-not-labels.txt.
- Import the files to the Assets folder in the Android project. Make sure that the build action is AndroidAsset.
When we have imported the files into the Android project, we can start to write code. To get the libraries we need for TensorFlow, we also need to install a NuGet package by going through the following steps:
- In the HotDogOrNotDog.Android project, install the Xamarin.Tensorflow...