This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
#include "tensorflow/lite/java/src/main/native/normalize.h" | |
#include "tensorflow/lite/java/src/main/native/predict.h" | |
#include "tensorflow/lite/java/src/main/native/extract_feature.h" | |
namespace tflite { | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
hdrs = [ | |
"exception_jni.h", | |
"nativeinterpreterwrapper_jni.h", | |
"tensor_jni.h", | |
"tensorflow_lite_jni.h", | |
"normalize.h", | |
"predict.h", | |
"extract_feature.h", | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bazel build --cxxopt='--std=c++11' -c opt \ | |
--fat_apk_cpu=x86,x86_64,arm64-v8a,armeabi-v7a \ | |
//tensorflow/lite/java:tensorflow-lite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> Task :crash:app:preDebugBuild FAILED | |
Warning: The app gradle file must have a dependency on com.google.firebase:firebase-core for Firebase services to work as intended. | |
Warning: The app gradle file must have a dependency on com.google.firebase:firebase-core for Firebase services to work as intended. | |
> Task :admob:app:preDebugBuild FAILED | |
Warning: The app gradle file must have a dependency on com.google.firebase:firebase-core for Firebase services to work as intended. | |
> Task :appindexing:app:preDebugBuild FAILED | |
Warning: The app gradle file must have a dependency on com.google.firebase:firebase-core for Firebase services to work as intended. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
// ... | |
// Add the In-App Messaging depencency: | |
implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.0' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun getPokemonFromBitmap(bitmap: Bitmap?) { | |
val inputs = FirebaseModelInputs.Builder() | |
.add(convertBitmapToByteBuffer(bitmap)) // add() as many input arrays as your model requires | |
.build() | |
fireBaseInterpreter.run(inputs, inputOutputOptions) | |
?.addOnSuccessListener { | |
val pokeList = mutableListOf<Pokemon>() | |
/** | |
* Run a foreach loop through the output float array containing the probabilities |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val pokeArray: Array<String> = arrayOf("abra", "aerodactyl", "alakazam", "arbok", "arcanine", "articuno", "beedrill", "bellsprout", | |
"blastoise", "bulbasaur", "butterfree", "caterpie", "chansey", "charizard", "charmander", "charmeleon", "clefable", "clefairy", "cloyster", "cubone", "dewgong", | |
"diglett", "ditto", "dodrio", "doduo", "dragonair", "dragonite", "dratini", "drowzee", "dugtrio", "eevee", "ekans", "electabuzz", | |
"electrode", "exeggcute", "exeggutor", "farfetchd", "fearow", "flareon", "gastly", "gengar", "geodude", "gloom", | |
"golbat", "goldeen", "golduck", "golem", "graveler", "grimer", "growlithe", "gyarados", "haunter", "hitmonchan", | |
"hitmonlee", "horsea", "hypno", "ivysaur", "jigglypuff", "jolteon", "jynx", "kabuto", | |
"kabutops", "kadabra", "kakuna", "kangaskhan", "kingler", "koffing", "krabby", "lapras", "lickitung", "machamp", | |
"machoke", "machop", "magikarp", "magmar", "magnemite", "magneton", "mankey", "marowak", "meowth", "metapod", | |
"m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onCreate(savedInstanceState: Bundle?) { | |
//... | |
private fun getPokemonFromBitmap(bitmap: Bitmap?) { | |
val inputs = FirebaseModelInputs.Builder() | |
.add(convertBitmapToByteBuffer(bitmap)) // add() as many input arrays as your model requires | |
.build() | |
fireBaseInterpreter.run(inputs, inputOutputOptions) | |
?.addOnSuccessListener { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onCreate(savedInstanceState: Bundle?) { | |
//... | |
val firebaseModelOptions = FirebaseModelOptions.Builder() | |
.setLocalModelName("pokedex") | |
.setCloudModelName("pokedex") | |
.build() | |
fireBaseInterpreter = FirebaseModelInterpreter.getInstance(firebaseModelOptions)!! | |
//... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PokemonDetectorActivity : BaseCameraActivity() { | |
companion object { | |
/** Dimensions of inputs. */ | |
const val DIM_IMG_SIZE_X = 224 | |
const val DIM_IMG_SIZE_Y = 224 | |
const val DIM_BATCH_SIZE = 1 | |
const val DIM_PIXEL_SIZE = 3 | |
const val IMAGE_MEAN = 128 | |
private const val IMAGE_STD = 128.0f |