Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// create a model interpreter for local model (bundled with app)
FirebaseModelOptions modelOptions = new FirebaseModelOptions.Builder()
modelInterpreter = FirebaseModelInterpreter.getInstance(modelOptions);
// specify input output details for the model
// SqueezeNet architecture uses 227 x 227 image as input
modelInputOutputOptions = new FirebaseModelInputOutputOptions.Builder()
.setInputFormat(0, FirebaseModelDataType.FLOAT32, new int[]{1, 227, 227, 3})
.setOutputFormat(0, FirebaseModelDataType.FLOAT32, new int[]{1, numLabels})
// create input data
FirebaseModelInputs input = new FirebaseModelInputs.Builder().add(imgDataArray).build(); // imgDataArray is a float[][][][] array of (1, 227, 227, 3)
// run inference, modelInputOutputOptions);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment