Replacing the sample model with your own classifier
The model provided with the sample recognizes some fruits. to replace it with your own model exported from the
Custom Vision Service
do the following, and then build and launch the application:
Create and train
a classifer with the Custom Vision Service. You must choose a "compact" domain such as
to be able to export your classifier. If you have an existing classifier you want to export instead, convert the domain in "settings" by clicking on the gear icon at the top right. In setting, choose a "compact" model, Save, and Train your project.
Export your model by going to the Performance tab. Select an iteration trained with a compact domain, an "Export" button will appear. Click on
button when it appears. A
file will download that contains TensorFlow model (.pb) and Labels (.txt)
file into your Android project's Assets folder.
Build and run.
Make sure the mean values (IMAGE_MEAN_R, IMAGE_MEAN_G, IMAGE_MEAN_B in MSCognitiveServicesClassifier.java) are correct based on your project's domain in Custom Vision: