Skip to content

A voice controlled currency detection application that speaks aloud the result after scanning a currency. Currently the app recognizes only Indian currency notes but you can create your own tensorflow model with different currencies in it and add it to the assets folder.

License

Notifications You must be signed in to change notification settings

Rudresh22/Currency_Detection

Repository files navigation

services platforms author
cognitive-services,custom-vision
java, Android
Rudresh

Getting Started

Prerequisites

Quickstart

  1. Clone the repository and open the project image_classification in Android Studio
  2. Build and run the sample on your Android device

Replacing the sample model with your own classifier

The model provided with the sample recognizes some currencies. To replace it with your own model exported from Custom Vision Service do the following, and then build and launch the application:

  1. Create and train a classifer with the Custom Vision Service. You must choose a "compact" domain such as General (compact) 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.

  2. Export your model by going to the Performance tab. Select an iteration trained with a compact domain, an "Export" button will appear. Click on Export then TensorFlow Lite then Export. Click the Download button when it appears. A .zip file will download that contains all of these three files:

    • TensorFlow model (.tflite)
    • Labels (.txt)
    • Export manifest file (cvexport.manifest).
  3. Drop all of model.tflite, labels.txt and cvexport.manifest into your Android project's Assets folder.

  4. Build and run.

Compatibility

This latest sample application relies on the new Android library Custom Vision inference run-time (or simply run-time) to take care of compatibility. It handles:

  • The following two were originally handled in ‘MSCognitiveServicesClassifier.classifyImage’ but now been encapsulated into the run-time.

  • Subtract mean values: Check if the exported model has a normalization layer, and if not subtract the RGB mean values from their respective pixel RGB components of the input image before passing to TensorFlow inference engine.

  • Resize and crop input image: Resize the image such that the longest dimension is 1600 pixels in length then take a center crop after which the image is resized to dimensions is then resized to dimensions that the model network is expecting.

  • Version check: Check the version of the exported model by looking at cvexport.manifest (more specifically, look for ExporterVersion field) and switch logic depending on model version.

    • Fowrard compatibility: It is when model version is newer than run-time's maximum supported model version.

      • Major version is greater: Throw exception (supposing model format is unknown)

      • Major version is same but minor version is greater: Still works. Run inference.

    • Backward compatiblity: Any newer version of the run-time should be able to handle older model versions.

Supported model versions

Run-time version Model version
Run-time 1.0.0 Work with model version 1.x
Work with model version 2.x
Not work with model version 3.0 or higher

Resources

About

A voice controlled currency detection application that speaks aloud the result after scanning a currency. Currently the app recognizes only Indian currency notes but you can create your own tensorflow model with different currencies in it and add it to the assets folder.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages