{"id":14963800,"url":"https://github.com/uehwan/csharp-yolo-video","last_synced_at":"2025-10-25T03:30:35.955Z","repository":{"id":117488690,"uuid":"235780532","full_name":"Uehwan/CSharp-Yolo-Video","owner":"Uehwan","description":"C# Yolo for Video","archived":false,"fork":false,"pushed_at":"2020-01-23T12:09:08.000Z","size":12,"stargazers_count":10,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T05:25:10.340Z","etag":null,"topics":["csharp","object-detection","tutorial","windows-form-application","windows-forms","windows-forms-csharp","windows-presentation-foundation","wpf","wpf-application","yolo"],"latest_commit_sha":null,"homepage":null,"language":null,"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/Uehwan.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-23T11:25:05.000Z","updated_at":"2023-03-05T11:33:26.000Z","dependencies_parsed_at":"2023-03-12T20:00:38.162Z","dependency_job_id":null,"html_url":"https://github.com/Uehwan/CSharp-Yolo-Video","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"ec680fcecb44e3868d2630ed8030e08ce8526ef1"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Uehwan%2FCSharp-Yolo-Video","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Uehwan%2FCSharp-Yolo-Video/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Uehwan%2FCSharp-Yolo-Video/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Uehwan%2FCSharp-Yolo-Video/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Uehwan","download_url":"https://codeload.github.com/Uehwan/CSharp-Yolo-Video/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238071052,"owners_count":19411599,"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":["csharp","object-detection","tutorial","windows-form-application","windows-forms","windows-forms-csharp","windows-presentation-foundation","wpf","wpf-application","yolo"],"created_at":"2024-09-24T13:32:09.845Z","updated_at":"2025-10-25T03:30:30.633Z","avatar_url":"https://github.com/Uehwan.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSharp-Yolo-Video\nAlthough [the C# wrapper for Darknet](https://github.com/AlturosDestinations/Alturos.Yolo) exists, I went through a hard time figuring out how to apply the wrapper for videos. For later use for myself and saving others' time, I summarize how to apply the Yolo wrapper on videos.\n\n## Getting Started\nThe following instructions will lead you to setting the environment for using the Yolo wrapper in your project.\n\n### System requriements\n- .NET Framework 4.6.1\n- [Microsoft Visual C++ Redistributable for Visual Studio 2017 x64](https://aka.ms/vs/16/release/vc_redist.x64.exe)\n\n### Install Alturos.Yolo using [NuGet](https://www.nuget.org/packages/Alturos.Yolo) as follows or you can use the NuGet GUI instead. If you're using NuGet GUI, search for \"Alturos.Yolo\".\n```\nPM\u003e install-package Alturos.Yolo (C# wrapper and C++ dlls 28MB)\nPM\u003e install-package Alturos.YoloV2TinyVocData (YOLOv2-tiny Pre-Trained Dataset 56MB)\n```\n\n### (Optional) For GPU support, install and download the followings.\n1) Install the latest Nvidia driver for your graphic device.\n2) [Install Nvidia CUDA Toolkit 10.1](https://developer.nvidia.com/cuda-downloads) (must be installed add a hardware driver for cuda support)\n3) [Download Nvidia cuDNN v7.6.3 for CUDA 10.1](https://developer.nvidia.com/rdp/cudnn-download)\n4) Copy the `cudnn64_7.dll` from the output directory of cdDNN v7.6.3. into the `x64` folder of your project.\n\n### Install [OpenCvSharp3-AnyCPU](https://github.com/shimat/opencvsharp) over NuGet as follows or search for \"OpenCvSharp3-AnyCPU\". Although the package name contains CvSharp3, it is actually an OpenCv 4.x wrapper.\n```\nPM\u003e install-package OpenCvSharp3-AnyCPU\n```\n\n### Download pretrained weights and place it in your project directory. For more information, visit [Alturos.Yolo](https://github.com/AlturosDestinations/Alturos.Yolo/blob/master/README.md#pre-trained-dataset)\n\nModel | Processing Resolution | Cfg | Weights | Names |\n--- | --- | --- | --- | --- |\nYOLOv3 | 608x608 | [yolov3.cfg](https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolov3.cfg) | [yolov3.weights](https://pjreddie.com/media/files/yolov3.weights) | [coco.names](https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/coco.names) |\nYOLOv3-tiny | 416x416 | [yolov3-tiny.cfg](https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolov3-tiny.cfg) | [yolov3-tiny.weights](https://pjreddie.com/media/files/yolov3-tiny.weights) | [coco.names](https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/coco.names) |\nYOLOv2 | 608x608 | [yolov2.cfg](https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolov2.cfg) | [yolov2.weights](https://pjreddie.com/media/files/yolov2.weights) | [coco.names](https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/coco.names) |\nYOLOv2-tiny | 416x416 | [yolov2-tiny.cfg](https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolov2-tiny.cfg) | [yolov2-tiny.weights](https://pjreddie.com/media/files/yolov2-tiny.weights) | [voc.names](https://raw.githubusercontent.com/pjreddie/darknet/master/data/voc.names) |\nyolo9000 | 448x448 | [yolo9000.cfg](https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolo9000.cfg) | [yolo9000.weights](https://github.com/philipperemy/yolo-9000/tree/master/yolo9000-weights) | [9k.names](https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/9k.names) |\n\n## Write Codes for Video Object Recognition\nThe following is the minimum code for running the Yolo wrapper on a video file. For running the code, set the solution platform as \"x64\"!\n```cs\nusing OpenCvSharp;\nusing OpenCvSharp.Extensions;\n\nusing Alturos.Yolo;\n\nprivate void VideoObjectDetection()\n{\n  // YOLO setting\n  int yoloWidth = 608, yoloHeight = 608;\n  var configurationDetector = new ConfigurationDetector();\n  var config = configurationDetector.Detect();\n  YoloWrapper yoloWrapper = new YoloWrapper(config);\n  \n  // OpenCV \u0026 WPF setting\n  VideoCapture videocapture;\n  Mat image = new Mat();\n  WriteableBitmap wb = new WriteableBitmap(yoloWidth, yoloHeight, 96, 96, PixelFormats.Bgr24, null);\n  \n  byte[] imageInBytes = new byte[(int)(yoloWidth * yoloHeight * image.Channels())];\n  \n  // Read a video file and run object detection over it!\n  using (videocapture = new VideoCapture(address))\n  {\n    using(Mat imageOriginal = new Mat())\n    {\n      // read a single frame and convert the frame into a byte array\n      videocapture.Read(imageOriginal);\n      image = imageOriginal.Resize(new OpenCvSharp.Size(yoloWidth, yoloHeight));\n      imageInBytes = image.ToBytes();\n      \n      // conduct object detection and display the result\n      var items = yolowrapper.Detect(imageInBytes);\n      foreach(var item in items)\n      {\n        var x = item.X;\n        var y = item.Y;\n        var width = item.Width;\n        var height = item.Height;\n        var type = item.Type;  // class name of the object\n        \n        // draw a bounding box for the detected object\n        // you can set different colors for different classes\n        Cv2.Rectangle(image, new OpenCvSharp.Rect(x, y, width, height), Scalar.Green, 3);\n      }\n      \n      // display the detection result\n      WriteableBitmapConverter.ToWriteableBitmap(image, wb);\n      /* WPF component: videoViewer\n      \u003cCanvas Name=\"canvasYoloVideo\" Height=\"608\" Width=\"608\"\u003e\n        \u003cImage Name=\"videoViewer\" Height=\"608\" Width=\"608\" Stretch=\"Fill\" /\u003e\n      \u003c/Canvas\u003e\n      */\n      videoViewer.Source = wb;\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuehwan%2Fcsharp-yolo-video","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuehwan%2Fcsharp-yolo-video","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuehwan%2Fcsharp-yolo-video/lists"}