{"id":13642064,"url":"https://github.com/LdDl/go-darknet","last_synced_at":"2025-04-20T15:34:35.492Z","repository":{"id":34640888,"uuid":"243174066","full_name":"LdDl/go-darknet","owner":"LdDl","description":"Go bindings for Darknet (YOLO v4 / v7-tiny / v3)","archived":false,"fork":false,"pushed_at":"2023-01-05T14:16:52.000Z","size":10046,"stargazers_count":83,"open_issues_count":5,"forks_count":20,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-05T15:51:10.164Z","etag":null,"topics":["computer-vision","darknet","darknet-bindings","hacktoberfest","neural-network","object-detection","yolo","yolov2","yolov2-tiny","yolov3","yolov3-tiny","yolov4","yolov7","yolov7-tiny"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"gyonluks/go-darknet","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LdDl.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":"2020-02-26T05:10:21.000Z","updated_at":"2025-01-15T14:04:36.000Z","dependencies_parsed_at":"2023-01-15T08:15:09.106Z","dependency_job_id":null,"html_url":"https://github.com/LdDl/go-darknet","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LdDl%2Fgo-darknet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LdDl%2Fgo-darknet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LdDl%2Fgo-darknet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LdDl%2Fgo-darknet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LdDl","download_url":"https://codeload.github.com/LdDl/go-darknet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249918654,"owners_count":21345393,"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":["computer-vision","darknet","darknet-bindings","hacktoberfest","neural-network","object-detection","yolo","yolov2","yolov2-tiny","yolov3","yolov3-tiny","yolov4","yolov7","yolov7-tiny"],"created_at":"2024-08-02T01:01:27.022Z","updated_at":"2025-04-20T15:34:35.212Z","avatar_url":"https://github.com/LdDl.png","language":"Go","funding_links":[],"categories":["Other Versions of YOLO"],"sub_categories":[],"readme":"[![GoDoc](https://godoc.org/github.com/LdDl/go-darknet?status.svg)](https://godoc.org/github.com/LdDl/go-darknet)\n[![Sourcegraph](https://sourcegraph.com/github.com/LdDl/go-darknet/-/badge.svg)](https://sourcegraph.com/github.com/LdDl/go-darknet?badge)\n[![Go Report Card](https://goreportcard.com/badge/github.com/LdDl/go-darknet)](https://goreportcard.com/report/github.com/LdDl/go-darknet)\n[![GitHub tag](https://img.shields.io/github/tag/LdDl/go-darknet.svg)](https://github.com/LdDl/go-darknet/releases)\n\n# go-darknet: Go bindings for Darknet (Yolo V4, Yolo V7-tiny, Yolo V3)\n### go-darknet is a Go package, which uses Cgo to enable Go applications to use V4/V7-tiny/V3 in [Darknet].\n\n#### Since this repository https://github.com/gyonluks/go-darknet  is no longer maintained I decided to move on and make little different bindings for Darknet.\n#### This bindings aren't for [official implementation](https://github.com/pjreddie/darknet) but for [AlexeyAB's fork](https://github.com/AlexeyAB/darknet).\n\n#### Paper Yolo v7: https://arxiv.org/abs/2207.02696 (WARNING: Only 'tiny' variation works currently)\n#### Paper Yolo v4: https://arxiv.org/abs/2004.10934\n#### Paper Yolo v3: https://arxiv.org/abs/1804.02767\n\n## Table of Contents\n\n- [Why](#why)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Documentation](#documentation)\n- [License](#license)\n\n## Why\n**Why does this repository exist?**\n\nBecause this repository https://github.com/gyonluks/go-darknet is no longer maintained.\n\n**What is purpose of this bindings when you can have [GoCV](https://github.com/hybridgroup/gocv#gocv) (bindings to OpenCV) and it handle Darknet YOLO perfectly?**\n\nWell, you don't need bunch of OpenCV dependencies and OpenCV itself sometimes.\n\nExample of such project here: https://github.com/LdDl/license_plate_recognition#license-plate-recognition-with-go-darknet---- .\n\n\n## Requirements\n\nYou need to install fork of [darknet](https://github.com/AlexeyAB/darknet). Latest commit I've tested is [here](https://github.com/AlexeyAB/darknet/commit/9d40b619756be9521bc2ccd81808f502daaa3e9a). It corresponds last official [YOLOv4 release](https://github.com/AlexeyAB/darknet/releases/tag/yolov4)\n\nUse provided [Makefile](Makefile).\n\n* For CPU-based instalattion:\n    ```shell\n    make install_darknet\n    ```\n* For both CPU and GPU-based instalattion if you HAVE CUDA installed:\n    ```shell\n    make install_darknet_gpu\n    ```\n    Note: I've tested CUDA [10.2](https://developer.nvidia.com/cuda-10.2-download-archive) and cuDNN is [7.6.5](https://developer.nvidia.com/rdp/cudnn-archive#a-collapse765-102))\n\n* For both CPU and GPU-based instalattion if you HAVE NOT CUDA installed:\n    ```shell\n    make install_darknet_gpu_cuda\n    ```\n    Note: There is some struggle in Makefile for cuDNN, but I hope it works in Ubuntu atleast. Do not forget provide proper CUDA and cuDNN versions.\n\n\n## Installation\n\n```shell\ngo get github.com/LdDl/go-darknet\n```\n\n## Usage\n\nExample Go program is provided in the [examples] directory. Please refer to the code on how to use this Go package.\n\nBuilding and running program:\n\n* Navigate to [examples] folder\n    ```shell\n    cd ${YOUR PATH}/github.com/LdDl/go-darknet/cmd/examples\n    ```\n\n* Download dataset (sample of image, coco.names, yolov4.cfg (or v3), yolov4.weights(or v3)).\n    ```shell\n    #for yolo v4\n    ./download_data.sh\n    #for yolo v4 tiny\n    ./download_data_v4_tiny.sh\n    #for yolo v7 tiny\n    ./download_data_v7_tiny.sh\n    #for yolo v3\n    ./download_data_v3.sh\n    ```\n* Note: you don't need *coco.data* file anymore, because sh-script above does insert *coco.names* into 'names' field in *yolov4.cfg* file (so AlexeyAB's fork can deal with it properly)\n    So last rows in yolov4.cfg file will look like:\n    ```bash\n    ......\n    [yolo]\n    .....\n    iou_loss=ciou\n    nms_kind=greedynms\n    beta_nms=0.6\n\n    names = coco.names # this is path to coco.names file\n    ```\n\n* Also do not forget change batch and subdivisions sizes from:\n    ```shell\n    batch=64\n    subdivisions=8\n    ```\n    to\n    ```shell\n    batch=1\n    subdivisions=1\n    ```\n    It will reduce amount of VRAM used for detector test.\n\n\n* Build and run example program\n    \n    Yolo v7 tiny:\n    ```shell\n    go build -o base_example/main base_example/main.go \u0026\u0026 ./base_example/main --configFile=yolov7-tiny.cfg --weightsFile=yolov7-tiny.weights --imageFile=sample.jpg\n    ```\n\n    Output should be something like this:\n    ```shell\n    truck (7): 53.2890% | start point: (0,143) | end point: (89, 328)\n    truck (7): 42.1364% | start point: (685,182) | end point: (800, 318)\n    truck (7): 26.9703% | start point: (437,170) | end point: (560, 217)\n    car (2): 87.7818% | start point: (509,189) | end point: (742, 329)\n    car (2): 87.5633% | start point: (262,191) | end point: (423, 322)\n    car (2): 85.4743% | start point: (427,198) | end point: (549, 309)\n    car (2): 71.3772% | start point: (0,147) | end point: (87, 327)\n    car (2): 62.5698% | start point: (98,151) | end point: (197, 286)\n    car (2): 61.5811% | start point: (693,186) | end point: (799, 316)\n    car (2): 49.6343% | start point: (386,206) | end point: (441, 286)\n    car (2): 28.2012% | start point: (386,205) | end point: (440, 236)\n    bicycle (1): 71.9609% | start point: (179,294) | end point: (249, 405)\n    person (0): 85.4390% | start point: (146,130) | end point: (269, 351)\n    ```\n\n    Yolo v4:\n    ```shell\n    go build -o base_example/main base_example/main.go \u0026\u0026 ./base_example/main --configFile=yolov4.cfg --weightsFile=yolov4.weights --imageFile=sample.jpg\n    ```\n\n    Output should be something like this:\n    ```shell\n    traffic light (9): 73.5040% | start point: (238,73) | end point: (251, 106)\n    truck (7): 96.6401% | start point: (95,79) | end point: (233, 287)\n    truck (7): 96.4774% | start point: (662,158) | end point: (800, 321)\n    truck (7): 96.1841% | start point: (0,77) | end point: (86, 333)\n    truck (7): 46.8694% | start point: (434,173) | end point: (559, 216)\n    car (2): 99.7370% | start point: (512,188) | end point: (741, 329)\n    car (2): 99.2532% | start point: (260,191) | end point: (422, 322)\n    car (2): 99.0333% | start point: (425,201) | end point: (547, 309)\n    car (2): 83.3920% | start point: (386,210) | end point: (437, 287)\n    car (2): 75.8621% | start point: (73,199) | end point: (102, 274)\n    car (2): 39.1925% | start point: (386,206) | end point: (442, 240)\n    bicycle (1): 76.3121% | start point: (189,298) | end point: (253, 402)\n    person (0): 97.7213% | start point: (141,129) | end point: (283, 362)\n    ```\n\n    Yolo v4 tiny:\n    ```shell\n    go build -o base_example/main base_example/main.go \u0026\u0026 ./base_example/main --configFile=yolov4-tiny.cfg --weightsFile=yolov4-tiny.weights --imageFile=sample.jpg\n    ```\n\n    Output should be something like this:\n    ```shell\n    truck (7): 77.7936% | start point: (0,138) | end point: (90, 332)\n    truck (7): 55.9773% | start point: (696,174) | end point: (799, 314)\n    car (2): 53.1286% | start point: (696,184) | end point: (799, 319)\n    car (2): 98.0222% | start point: (262,189) | end point: (424, 330)\n    car (2): 97.8773% | start point: (430,190) | end point: (542, 313)\n    car (2): 81.4099% | start point: (510,190) | end point: (743, 325)\n    car (2): 43.3935% | start point: (391,207) | end point: (435, 299)\n    car (2): 37.4221% | start point: (386,206) | end point: (429, 239)\n    car (2): 32.0724% | start point: (109,196) | end point: (157, 289)\n    person (0): 73.0868% | start point: (154,132) | end point: (284, 382)\n    ```\n\n    Yolo V3:\n    ```\n    go build main.go \u0026\u0026 ./main --configFile=yolov3.cfg --weightsFile=yolov3.weights --imageFile=sample.jpg\n    ```\n\n    Output should be something like this:\n    ```shell\n    truck (7): 49.5123% | start point: (0,136) | end point: (85, 311)\n    car (2): 36.3694% | start point: (95,152) | end point: (186, 283)\n    truck (7): 48.4177% | start point: (95,152) | end point: (186, 283)\n    truck (7): 45.6520% | start point: (694,178) | end point: (798, 310)\n    car (2): 76.8402% | start point: (1,145) | end point: (84, 324)\n    truck (7): 25.5920% | start point: (107,89) | end point: (215, 263)\n    car (2): 99.8782% | start point: (511,185) | end point: (748, 328)\n    car (2): 99.8193% | start point: (261,189) | end point: (427, 322)\n    car (2): 99.6405% | start point: (426,197) | end point: (539, 311)\n    car (2): 74.5627% | start point: (692,186) | end point: (796, 316)\n    car (2): 72.7975% | start point: (388,206) | end point: (437, 276)\n    bicycle (1): 72.2760% | start point: (178,270) | end point: (268, 406)\n    person (0): 97.3007% | start point: (143,135) | end point: (268, 343)\n    ```\n\n## Documentation\n\nSee go-darknet's API documentation at [GoDoc].\n\n## License\n\ngo-darknet follows [Darknet]'s [license].\n\n\n[Darknet]: https://github.com/pjreddie/darknet\n[license]: https://github.com/pjreddie/darknet/blob/master/LICENSE\n[darknet.h]: https://github.com/AlexeyAB/darknet/blob/master/include/darknet.h\n[include/darknet.h]: https://github.com/AlexeyAB/darknet/blob/master/include/darknet.h\n[Makefile]: https://github.com/alexeyab/darknet/blob/master/Makefile\n[examples]: cmd/examples/base_example\n[GoDoc]: https://godoc.org/github.com/LdDl/go-darknet\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLdDl%2Fgo-darknet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLdDl%2Fgo-darknet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLdDl%2Fgo-darknet/lists"}