Skip to content

Commit

Permalink
added logging
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon.maness committed Apr 9, 2020
1 parent 6312f1c commit f430a13
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions android/src/main/java/sq/flutter/tflite/TflitePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@ public void onMethodCall(MethodCall call, Result result) {
}

private String loadModel(HashMap args) throws IOException {
Log.v("loadModel");
String model = args.get("model").toString();
Object isAssetObj = args.get("isAsset");
boolean isAsset = isAssetObj == null ? false : (boolean) isAssetObj;
Log.v("isAsset=" + isAsset);
MappedByteBuffer buffer = null;
String key = null;
AssetManager assetManager = null;
Expand All @@ -210,6 +212,7 @@ private String loadModel(HashMap args) throws IOException {
long declaredLength = fileDescriptor.getDeclaredLength();
buffer = fileChannel.map(FileChannel.MapMode.READ_ONLY, startOffset, declaredLength);
} else {
Log.v("model=" + model);
FileInputStream inputStream = new FileInputStream(new File(model));
FileChannel fileChannel = inputStream.getChannel();
long declaredLength = fileChannel.size();
Expand All @@ -228,6 +231,7 @@ private String loadModel(HashMap args) throws IOException {
key = mRegistrar.lookupKeyForAsset(labels);
loadLabels(assetManager, key);
} else {
Log.v("loadLabels.key=" + key);
loadLabels(null, key);
}
}
Expand All @@ -246,6 +250,7 @@ private void loadLabels(AssetManager assetManager, String path) {
String line;
labels = new Vector<>();
while ((line = br.readLine()) != null) {
Log.v("line=" + line);
labels.add(line);
}
labelProb = new float[1][labels.size()];
Expand Down

0 comments on commit f430a13

Please sign in to comment.