{"id":20601727,"url":"https://github.com/lkuich/coach-unity","last_synced_at":"2026-05-02T23:31:30.806Z","repository":{"id":95905888,"uuid":"185670227","full_name":"lkuich/coach-unity","owner":"lkuich","description":"Unity SDK for Coach","archived":false,"fork":false,"pushed_at":"2020-07-21T04:19:50.000Z","size":57227,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-27T22:05:53.413Z","etag":null,"topics":["machine-learning","ml","tensorflow","unity"],"latest_commit_sha":null,"homepage":"https://coach.lkuich.com/","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/lkuich.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-05-08T19:49:40.000Z","updated_at":"2024-10-30T08:54:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"bfa0603e-fc92-4092-9537-4e81d785f552","html_url":"https://github.com/lkuich/coach-unity","commit_stats":null,"previous_names":["lkuich/coach-unity"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/lkuich/coach-unity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkuich%2Fcoach-unity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkuich%2Fcoach-unity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkuich%2Fcoach-unity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkuich%2Fcoach-unity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lkuich","download_url":"https://codeload.github.com/lkuich/coach-unity/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkuich%2Fcoach-unity/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262341618,"owners_count":23296069,"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":["machine-learning","ml","tensorflow","unity"],"created_at":"2024-11-16T09:11:49.443Z","updated_at":"2025-10-26T22:01:32.614Z","avatar_url":"https://github.com/lkuich.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Coach Unity SDK\n\nCoach is an end-to-end Image Recognition platform, we provide the tooling to do effective data collection, training, and on-device parsing of Image Recognition models.\n\nThe Unity SDK interacts with the Coach web API in order to download and parse your trained Coach models.\n\n## Installation\n\nSee the [Releases](https://github.com/lkuich/coach-unity/releases) page for a `.unitypackage`\n\n## Usage\n\nCoach can be initialized 2 different ways. If you are only using the offline model parsing capabilities and already have a model package on disk, you can initialize like so:\n\n```csharp\nvar coach = new CoachClient();\n\n// We already had the `flowers` model on disk, no need to authenticate:\nvar prediction = coach.GetModel(\"flowers\").Predict(\"rose.jpg\").Best();\nConsole.WriteLine($\"{prediction.Label}: {prediction.Confidence}\");\n```\n\nHowever, in order to download your trained models, you must authenticate with your API key:\n```csharp\nvar coach = new CoachClient().Login(\"myapikey\");\n\n// Now that we're authenticated, we can cache our models for future use:\nawait coach.CacheModel(\"flowers\");\n\n// Evaluate a Texture2D with our cached model:\nTexture2D image = MyRawImage.texture as Texture2D;\nvar results = coach.GetModel(\"flowers\").Predict(image);\nvar bestMatch = results.Best();\n```\n\nAnother, more concise example not using caching:\n```csharp\nTexture2D image = MyRawImage.texture as Texture2D;\nvar coach = new CoachClient().Login(\"myapikey\");\nvar prediction = await coach.GetModelRemote(\"flowers\").Predict(image).Best();\n```\n\nWhen finished with the model, run the `CleanUp` to free up resources:\n```csharp\nvoid Destroy() {\n    Model.CleanUp();\n}\n```\n\n## Examples\n\nHere's a complete implementation in a `MonoBehaviour`:\n\n```csharp\nusing UnityEngine;\nusing UnityEngine.UI;\nusing Coach;\n\npublic class CoachController : MonoBehaviour\n{\n    public RawImage Image;\n    private CoachModel Model { get; set; }\n    public void TakePhoto()\n    {\n        var results = Model.Predict(Image.texture as Texture2D);\n        var best = results.Best();\n        Debug.Log(best.Label + \": \" + best.Confidence);\n    }\n\n    // Start is called before the first frame update\n    async void Start()\n    {\n        var coach = await new CoachClient().Login(\"\");\n        await coach.CacheModel(\"flowers\");\n\n        // var coach = new CoachClient();\n        Model = coach.GetModel(\"flowers\");\n    }\n\n    void Destroy() {\n        Model.CleanUp();\n    }\n}\n```\n\n\n## API Breakdown\n\n### CoachClient\n`CoachClient(bool isDebug = false)`  \nOptional `isDebug`, if `true`, additional logs will be displayed.\n\n`async Task\u003cCoachClient\u003e Login(string apiKey)`  \nAuthenticates with Coach service and allows for model caching. Accepts API Key as its only parameter. Returns its instance of `CoachClient`.\n\n`async Task CacheModel(string name, string path=\".\")`  \nDownloads model from Coach service to disk. Default path is `Application.streamingAssetsPath`. Specify the name of the model, and the path to store it. This will create a new directory in the specified path and store any model related documents there. By default it will skip the download if the local version of the model matches the remote.\n\n`CoachModel GetModel(string modelName, string path=\".\")`  \nLoads model into memory. Specify the name and path of the model. Default path is `Application.streamingAssetsPath`.\n\n`async Task\u003cCoachModel\u003e GetModelRemote(string name, string path=\".\")`  \nDownloads model from Coach service to disk, and loads it into memory. Default path is `Application.streamingAssetsPath`\n\n### CoachModel\n`CoachModel(TFGraph graph, string[] labels, string module, float coachVersion)`  \nInitializes a new instance of `CoachModel`.\n\n`CoachResult Predict(Texture2D texture, string inputName = \"input\", string outputName = \"output\")`  \nSpecify the image as a Texture2D. Parses the specified image as a Tensor and runs it through the loaded model. Optionally accepts `input` and `output` tensor names.\n\n`CoachResult Predict(string image, string inputName = \"input\", string outputName = \"output\")`  \nSpecify the directory of an image file. Parses the specified image as a Tensor and runs it through the loaded model. Optionally accepts `input` and `output` tensor names.\n\n`CoachResult Predict(byte[] image, string inputName = \"input\", string outputName = \"output\")`  \nSpecify the image as a byte array. Parses the specified image as a Tensor and runs it through the loaded model. Optionally accepts `input` and `output` tensor names.\n\n### CoachResult\n`List\u003cLabelProbability\u003e Results`  \nUnsorted prediction results.\n\n`List\u003cLabelProbability\u003e SortedResults`  \nSorted prediction results, descending in Confidence.\n\n`LabelProbability Best()`  \nMost Confident result.\n\n`LabelProbability Worst()`  \nLeast Confident result.\n\n### LabelProbability\n`string Label` -\u003e Label of result\n\n`float Confidence` -\u003e Confidence of result","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flkuich%2Fcoach-unity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flkuich%2Fcoach-unity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flkuich%2Fcoach-unity/lists"}