Skip to content

Instantly share code, notes, and snippets.

@truongsinh
Created September 19, 2019 00:43
Show Gist options
  • Save truongsinh/d570a4469d09916e857d81dd52b919ce to your computer and use it in GitHub Desktop.
Save truongsinh/d570a4469d09916e857d81dd52b919ce to your computer and use it in GitHub Desktop.
Parse raw bytes to approximately corresponding type
// https://www.tensorflow.org/lite/models/object_detection/overview
final outputTensors = localInterpreter.getOutputTensors();
final outputLocationsTensor = outputTensors[0];
// shape 1, 10, 4;
Float32List outputLocations =
outputLocationsTensor.data.buffer.asFloat32List();
final outputClassesTensor = outputTensors[1];
// shape 1, 10
Float32List outputClasses = outputClassesTensor.data.buffer.asFloat32List();
final outputScoresTensor = outputTensors[2];
// shape 1, 10
Float32List outputScores = outputScoresTensor.data.buffer.asFloat32List();
final numDetectionsTensor = outputTensors[3];
// shape 1
double numDetections = numDetectionsTensor.data.buffer.asFloat32List().single;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment