Skip to content

Instantly share code, notes, and snippets.

@frogermcs
Created June 26, 2019 11:16
Show Gist options
  • Save frogermcs/3ea71a68d11afa1f61fbebca9ab3a829 to your computer and use it in GitHub Desktop.
Save frogermcs/3ea71a68d11afa1f61fbebca9ab3a829 to your computer and use it in GitHub Desktop.
private void runInferenceOnQuantizedModel(ByteBuffer byteBufferToClassify) {
byte[][] result = new byte[1][labels.size()];
interpreter.run(byteBufferToClassify, result);
float[][] resultFloats = new float[1][labels.size()];
byte[] bytes = result[0];
for (int i = 0; i < bytes.length; i++) {
float resultF = (bytes[i] & 0xff) / 255.f;
resultFloats[0][i] = resultF;
}
classificationListener.onClassifiedFrame(getSortedResult(resultFloats));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment