Open Manugoyal123 opened 6 years ago
To use this frozen model create assets
folder in your project folder where java
and res
folder reside. Now paste this frozen_inference_graph.pb
in this assets
folder.
create a string in your java file where you will use tensorflow mobile.
private final static String MODEL_FILE = "file:///android_asset/frozen_inference_graph.pb";
now create TensorFlowInferenceInterface to use this model
public synchronized static boolean initialize(Context context) {
sTFInterface=new TensorFlowInferenceInterface(context.getAssets(), MODEL_FILE);
.
.
.
}
flatten your bitmap data, pass it onto the sTFInterface and fetch results.
sTFInterface.feed(INPUT_NAME, mFlatIntValues, 1, h, w, 3 );
sTFInterface.run(new String[] { OUTPUT_NAME }, true);
sTFInterface.fetch(OUTPUT_NAME, mOutputs);
The mOutputs is your Flattened segment mask use it as per your requirement .👍👍
dailystudio has created this awsome project but (No disrespect) my project required the model file to be embedded in the apk itself so i had to use assets.. You can look at the full working code of the above snippet here in my project CameraBlur.
I generated frozen model as per instructions. Now I am wondering how to install this application on android.