Giter Site home page Giter Site logo

darknet-cpp-windows's Introduction

darknet-cpp-windows

Windows support for Darknet-cpp. This repository provides visual studio project files for Darknet-cpp. This repository does not require additional libraries like pthread, and provides all requirements integrated. It supports Yolo v3.

  • Support for 2015, 2017 Visual Studio versions, with one of below.
  • Needs CUDA 8.0 (and its environment settings correctly defined, with Visual studio integration enabled), and CUDNN, OpenCV3 or
  • Needs CUDA 9.1 (and its environment settings correctly defined, with Visual studio integration enabled), and CUDNN, OpenCV3
  • Needs CUDA 10.1 (and its environment settings correctly defined, with Visual studio integration enabled), and CUDNN, OpenCV3.4

Steps to build darknet-cpp-windows:

  • Download the darknet-cpp port, from

https://github.com/prabindh/darknet

  • At the same level as the darknet folder, clone or download the darknet-cpp-windows sources

https://github.com/prabindh/darknet-cpp-windows

  • Open the below solution file in Visual Studio

darknet-cpp-windows\darknet\darknet.sln (for CUDA10.1 and CUDNN7),

darknet-cpp-windows\darknet_cuda91\darknet_cuda91.sln (for CUDA9.1),

  • Change the OpenCV folder path if needed (default expected to be 2 levels above, ....\opencv3\build\x64\vc15\lib)

  • Build the project arapaho, which will also build the darknet project dependency

  • Copy the required data, weight, cfg and input image file for detection into the arapaho folder. All the files need to be named as {input.cfg, input.data, input.jpg or input.mp4, input.weights}. The names can be changed in the darknet\arapaho\test.cpp file.

(Note: Yolov3 default model config will not fit on a GPU like a QuadroM, hence the tiny config can be used for checking)

Yolov3 and Tiny weights can both be obtained from the links at - https://pjreddie.com/darknet/yolo/

The corresponding configs are available at the darknet tree in "cfg" folder.

  • Run the generated binary arapaho.exe, for detection, from

darknet-cpp-windows\bin\win64$(Configuration)\arapaho.exe

  • This will run the arapaho C++ wrapper, and generate output for the provided image, and show each frame with detected regions in a Window. Example output below:

[YOLOV2] .... Image data = 000001362EF87060, w = 992, h = 620 Detect: Resizing image to match network l.softmax_tree = 0000000000000000, nms = 0.400000 Detected 1 objects Box #0: x,y,w,h = [0.406386, 0.283149, 0.384096, 0.509924] `

[YOLOV3] ... 106 detection Setup: net->n = 107 net->layers[0].batch = 1 Loading weights from input.weights...Done! Setup: layers = 32, 32, 3 Warning: Read classes from cfg (80) > maxClasses (2) Image expected w,h = [256][256]! Setup: Done Image data = 00000226B3EC3020, w = 640, h = 424 Detect: Resizing image to match network ==> Detected [3] objects in [3.275245] seconds Box #0: center {x,y}, box {w,h} = [0.765709, 0.575041, 0.383576, 0.504763] Label:horse Box #1: center {x,y}, box {w,h} = [0.217989, 0.722828, 0.222815, 0.199334] Label:dog Box #2: center {x,y}, box {w,h} = [0.363993, 0.551002, 0.133328, 0.627906] Label:person cap.read failed/EoF - AV file input.jpg

The detected regions will be overlaid and shown in the Window that will open showing each frame.

For a brief about Arapaho C++ API, refer to https://github.com/prabindh/darknet/blob/master/arapaho/arapaho_readme.txt

darknet-cpp-windows's People

Contributors

prabindh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

darknet-cpp-windows's Issues

No Detection with Custom Models

Hi, I trained custom models and when I tested those models with original darknet C code everything seems to work fine. I am getting proper detection results. But when I use same config/weights with this C++ extension I am getting 0 detections.

Note : This C++ wrapper is working properly with the pretrained YOLO(both tiny and full) models, the problem persists only when trained on custom dataset. I even tried keeping the config file same and then training on custom dataset, even then I am getting zero detections.

how to build without cuda

hi, i want to build it without cuda under windows/visual studio, but it seems the project file has no options on it

Visual Studio 2015 and OpenCV 3.2.0

To get it working with Visual Studio 2015 and OpenCV 3.2.0 , I had to change the following items:

Arapaho project properties:

  • pthread.h -> change (comment out) the timespec (which is available in time.h):
    /*struct timespec { long long tv_sec; long long tv_nsec; };*/
    Without this change I got error for redeclared timespec struct.
  • pthread.h -> add time.h to the includes: #include <time.h>
  • Linker -> General -> Additional Library Directories -> change [....\opencv3\build\x64\vc12\lib] to [....\opencv3\build\x64\vc14\lib] (so change vc12 to vc14 )
  • Linker -> Input -> Additional Dependencies -> change opencv_world310.lib to opencv_world320.lib

Data files?

When running the arapaho exe, I need next to cfg files (yolo.cfg from darknet rep) and weights files (yolo.weights from darknet site) ) so called data files. Where do I obtain those files?

CMake support for Arapaho API

Can you please add CMake support for the Arapaho API and provide a sample CMakeLists.txt to be used as a template?

Huge RAM usage

Hello,

I have runned arapaho.exe with YOLOv3 configuration. Everything works perfectly, but after loading network process memory reaches up to 3,2 GB (!). Is that normal behaviour?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.