This project is a little modified version of TFLite andorid example.
Custom classifer can be implemented by Classier
abstract class and implementing recognizeImage(Bitmap bitmap)
. Classifier needs to put labels file in Classifier.labels
. Model (Interpretor) can be set using:
Classifier.tflite = new Interpreter(loadModelFile(assetManager, modelFilename));
Results
Classifier.Result
class is used to get results from model. For showing bounding boxes, model should return bounding location of object detected.
- Place model with
.tflite
file and labels filelabel.txt
in 'app/src/assets' folder. - Reference the model file in
ClassifierActivity
orDetectorActivity
depending on type of model. - Build app
Android API > 21