{"id":22664951,"url":"https://github.com/dotnettoscana/customvisioncompanion","last_synced_at":"2025-06-18T21:42:41.530Z","repository":{"id":40937441,"uuid":"117899686","full_name":"DotNetToscana/CustomVisionCompanion","owner":"DotNetToscana","description":"A Xamarin.Forms app for UWP, Android \u0026 iOS showcasing how to use Custom Vision Service with either online and offline models. ","archived":false,"fork":false,"pushed_at":"2022-06-22T15:34:28.000Z","size":55106,"stargazers_count":24,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T03:41:33.251Z","etag":null,"topics":["android","cognitive-services","coreml","custom-vision","mlmodel","offline-models","onnx","tensorflow","uwp","xamarin"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DotNetToscana.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-17T22:20:10.000Z","updated_at":"2024-12-16T07:16:24.000Z","dependencies_parsed_at":"2022-09-20T17:20:38.959Z","dependency_job_id":null,"html_url":"https://github.com/DotNetToscana/CustomVisionCompanion","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DotNetToscana%2FCustomVisionCompanion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DotNetToscana%2FCustomVisionCompanion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DotNetToscana%2FCustomVisionCompanion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DotNetToscana%2FCustomVisionCompanion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DotNetToscana","download_url":"https://codeload.github.com/DotNetToscana/CustomVisionCompanion/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248540424,"owners_count":21121356,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","cognitive-services","coreml","custom-vision","mlmodel","offline-models","onnx","tensorflow","uwp","xamarin"],"created_at":"2024-12-09T13:18:10.841Z","updated_at":"2025-04-12T08:33:09.734Z","avatar_url":"https://github.com/DotNetToscana.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Custom Vision Companion\n\nA Xamarin.Forms app showcasing how to use Custom Vision Service with either online and offline models. Android, iOS and UWP are currently supported.\n\n![A screenshot of the Android version](https://raw.githubusercontent.com/DotNetToscana/CustomVisionCompanion/master/Screenshots/Android-1.png)\n\n![A screenshot of the UWP version](https://raw.githubusercontent.com/DotNetToscana/CustomVisionCompanion/master/Screenshots/Uwp-1.png)\n\n**Getting started**\n\nTo use an online model, launch the app, go to the **Settings** page and then set *Region*, *Project Name*, *Prediction Key* and *Iteration Id* using the values you can grab from Custom Vision Service Portal.\n\nThe sample contains an offline model exported from Custom Vision Service, for [Android](https://github.com/DotNetToscana/CustomVisionCompanion/tree/master/Src/CustomVisionCompanion/CustomVisionCompanion.Android/Assets), [iOS](https://github.com/DotNetToscana/CustomVisionCompanion/blob/master/Src/CustomVisionCompanion/CustomVisionCompanion.iOS/Resources/Computer.mlmodel) and [UWP](https://github.com/DotNetToscana/CustomVisionCompanion/blob/master/Src/CustomVisionCompanion/CustomVisionCompanion.UWP/Assets/Models/Computer.onnx). It has been trained to recognize laptops, keyboards, mice, monitors and controllers. You can easily replace it with your own: after the training, you just need to download the models from [Custom Vision Service Portal](https://docs.microsoft.com/en-us/azure/cognitive-services/custom-vision-service/export-your-model).\n\n**Android offline models**\n\n- Replace the *model.pb* and *labels.txt* files in the [Assets](https://github.com/DotNetToscana/CustomVisionCompanion/tree/master/Src/CustomVisionCompanion/CustomVisionCompanion.Android/Assets) folder with your own model. Be sure that the Build Action of both files must be set to *AndroidAsset*.\n\n- Add the following line in the [OnCreate](https://github.com/DotNetToscana/CustomVisionCompanion/blob/master/Src/CustomVisionCompanion/CustomVisionCompanion.Android/MainActivity.cs#L31) method in *MainActivity.cs*:\n\n```\nCrossOfflineClassifier.Current.InitializeAsync(ModelType.General, \"model.pb\", \"labels.txt\");\n```\n\n**iOS offline models**\n\n- Replace the *.mlmodel* file in the [Resources](https://github.com/DotNetToscana/CustomVisionCompanion/tree/master/Src/CustomVisionCompanion/CustomVisionCompanion.iOS/Resources) folder with your own model. Be sure that the Build Action of this file must be set to *BundleResource*. The model will be automatically compiled at app startup.\n- OR\n1. Manually compile the ML model and add it to the project. The CoreML compiler is included with the Xcode developer tools (Xcode 9 and higher). To compile an *.mlmodel*, run:\n\n```\nxcrun coremlcompiler compile {model.mlmodel} {outputFolder}\n```\n\n2. Put the output folder inside the [Resources](https://github.com/DotNetToscana/CustomVisionCompanion/tree/master/Src/CustomVisionCompanion/CustomVisionCompanion.iOS/Resources) folder. Be sure that the Build Action of each file must be set to *BundleResource*.\n\n- Add the following line in the [FinishedLaunching](https://github.com/DotNetToscana/CustomVisionCompanion/blob/master/Src/CustomVisionCompanion/CustomVisionCompanion.iOS/AppDelegate.cs#L47) method in *AppDelegate.cs*:\n\n```\nCrossOfflineClassifier.Current.InitializeAsync(ModelType.General, \"Computer\");\n```\n\n**UWP offline models**\n\n- Replace the *Computer.onnx* file in the [Assets/Models](https://github.com/DotNetToscana/CustomVisionCompanion/tree/master/Src/CustomVisionCompanion/CustomVisionCompanion.UWP/Assets/Models) folder with your own model. Be sure that the Build Action of this file must be set to *Content*. Note that, when you add the file to the project, Visual Studio will automatically create a .cs file containing the code to use the model. You can safely delete it, as this project already contains a standard implementation.\n\n- Add the following line in the [constructor](https://github.com/DotNetToscana/CustomVisionCompanion/blob/master/Src/CustomVisionCompanion/CustomVisionCompanion.UWP/MainPage.xaml.cs#L28) of *MainPage.xaml.cs*:\n\n```\nCrossOfflineClassifier.Current.InitializeAsync(ModelType.General, \"ms-appx:///Assets/Models/Computer.onnx\");\n```\n\n**Contribute**\n\nThe project is continuously evolving. We welcome contributions. Feel free to file issues and pull requests on the repo and we'll address them as we can.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotnettoscana%2Fcustomvisioncompanion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotnettoscana%2Fcustomvisioncompanion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotnettoscana%2Fcustomvisioncompanion/lists"}