{"id":13642374,"url":"https://github.com/developer-ken/YoloPredictorMLDotNet","last_synced_at":"2025-04-20T16:32:04.951Z","repository":{"id":143463876,"uuid":"566793529","full_name":"developer-ken/YoloPredictorMLDotNet","owner":"developer-ken","description":null,"archived":false,"fork":false,"pushed_at":"2023-07-08T03:06:32.000Z","size":62,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-09-28T19:18:13.988Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/developer-ken.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2022-11-16T12:40:52.000Z","updated_at":"2022-12-09T19:47:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"fad89cce-c17c-446f-bc7b-fed6ba6aae92","html_url":"https://github.com/developer-ken/YoloPredictorMLDotNet","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer-ken%2FYoloPredictorMLDotNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer-ken%2FYoloPredictorMLDotNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer-ken%2FYoloPredictorMLDotNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer-ken%2FYoloPredictorMLDotNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/developer-ken","download_url":"https://codeload.github.com/developer-ken/YoloPredictorMLDotNet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223797117,"owners_count":17204375,"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":[],"created_at":"2024-08-02T01:01:30.605Z","updated_at":"2024-11-09T13:31:37.017Z","avatar_url":"https://github.com/developer-ken.png","language":"C#","readme":"# YoloPredictorMLDotNet  \n  \nThis project provide following packages:  \n|Package|Link|\n|-------|----|\n|DevKen.YoloPredictor|[![NuGet version (DevKen.YoloPredictor)](https://img.shields.io/nuget/v/DevKen.YoloPredictor.svg?style=flat)](https://www.nuget.org/packages/DevKen.YoloPredictor/)|  \n|DevKen.YoloPredictor.Yolov5|[![NuGet version (DevKen.YoloPredictor.Yolov5)](https://img.shields.io/nuget/v/DevKen.YoloPredictor.Yolov5.svg?style=flat)](https://www.nuget.org/packages/DevKen.YoloPredictor.Yolov5/)|  \n|DevKen.YoloPredictor.OpenCvBridge|[![NuGet version (DevKen.YoloPredictor.OpenCvBridge)](https://img.shields.io/nuget/v/DevKen.YoloPredictor.OpenCvBridge.svg?style=flat)](https://www.nuget.org/packages/DevKen.YoloPredictor.OpenCvBridge/)|  \n  \n------  \n## What is this?  \nThis project is designed to make YOLO intergration with .NET fast, easy and convenient. Programmers don't have to understand details about YOLO or ML, just feed the Predictor with trained moudle and images, then receive the results.  \n\n## Reproduce under DirectML  \nIn this section, I will explain some details on how to use this repo.  \n### What is DirectML?\nDirectML is a new feature in DirectX 12. It allows most kind of GPUs to be used to accelerate machine learning, even some of those embeded into  CPUs.  \n### Envirounment\nWhen editing this, I just verified that the 3 packages in the table above is all I need to run YOLOv5 via DirectML on `Intel(R) Iris(R) Xe Graphics` in my laptop. It's running `Windows11 22H2 version 22621.1848`, with `Windows Feature Experience Pack 1000.22642.1000.0`.  \n  \nPackages: \n|Package|Version|\n|-------|-------|\n|DevKen.YoloPredictor|22.11.322.18|  \n|DevKen.YoloPredictor.Yolov5|22.11.322.18|  \n|DevKen.YoloPredictor.OpenCvBridge|22.11.322.4|  \n|OpenCvSharp4|4.7.0.20230115|  \n|OpenCvSharp4.runtime.win|4.7.0.20230115|  \n|OpenCvSharp4.Extentions|4.6.0.20220608|  \n### Export onnx file from YOLOv5  \nFollowing command is verified to export an onnx file works well with this repo.  \nRemember to replace `PATH_TO_TRAINED_WEIGHT_PT` with your weight file (`latest.pt` or `best.pt`),  \nreplace `PATH_TO_DATASET_CONFIG_FILE_YML` with your `dataset.yml` file.  \nDo **NOT** use `--dynamic` if you want to use auto-configure function of the repo, as that prevent some metadata from being written into the onnx file. You have to fill all parameters when creating the YoloPredictor if you use  `--dynamic`.  \n`--opset 15` is required because the onnx execution engine we use will complain about opset\u003e15 and throw an exception.\n```\npython export.py --weights PATH_TO_TRAINED_WEIGHT_PT --data PATH_TO_DATASET_CONFIG_FILE_YML --include onnx --opset 15\n```  \nThen use the code examples at the bottom of this page, change `backend:YoloPredictorV5.Backend.CUDA` to `backend:YoloPredictorV5.Backend.DirectML`.\n\n## Cuda  \nTo run OnnxRuntime.Cuda, refer to the official documentation: [CUDA-ExecutionProvider](https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html)\n\n## Usage example  \n### Predict on Bitmap  \n```  \n//Create a predictor by providing modulepath and a backend.\n//Install corresponding OnnxRuntime nuget package.\n//For example, you need Microsoft.ML.OnnxRuntime.Gpu for CUDA.\nYoloPredictor predictor = new YoloPredictorV5(modulepath, backend:YoloPredictorV5.Backend.CUDA);\n\n//Predict on a Bitmap, then apply NMS and Confidence filter.\nvar detresult = predictor.Predict((Bitmap)Bitmap.FromFile(picture)).NMSFilter().ConfidenceFilter();\n```  \n### Predict on Mat  \nOpencv read camera and run prediction.\n```  \n//Create a predictor by providing modulepath and a backend.\nYoloPredictor predictor = new YoloPredictorV5(modulepath, backend:YoloPredictorV5.Backend.CUDA);\n\n//Open video device\nVideoCapture vc = new VideoCapture(0);\n\nwhile (true)\n{\n  //If frame presents\n  if (vc.Read(image))\n  {\n    //Run detector on that frame, then apply NMSFilter and ConfidenceFilter.\n    var detresult = predictor.Predict(image).NMSFilter().ConfidenceFilter();\n    //** Do something with detresult here **\n  }\n}\n```\n","funding_links":[],"categories":["Other Versions of YOLO"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloper-ken%2FYoloPredictorMLDotNet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeveloper-ken%2FYoloPredictorMLDotNet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloper-ken%2FYoloPredictorMLDotNet/lists"}