GithubHelp home page GithubHelp logo

prabindh / darknet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pjreddie/darknet

122.0 14.0 46.0 7.37 MB

Convolutional Neural Networks

Home Page: http://pjreddie.com/darknet/

License: Other

Makefile 0.66% Python 0.88% Shell 0.20% Cuda 7.66% C 88.28% C++ 2.32%

darknet's Introduction

Darknet Logo

Darknet-cpp

Darknet-cpp project is a bug-fixed and C++ compilable version of darknet (including Yolov3 and v2), an open source neural network framework written in C and CUDA. Darknet-cpp builds on Linux, Windows and also tested on Mac by users.

Prebuilt binaries for evaluation now available

  • Prebuilt binaries are provided for evaluation purposes.

    • Tegra TK1 (CPU, CUDA, CUDA + CUDNN) - Yolov2 only
    • Jetson Nano - CUDA + CUDNN - Yolov3 - tiny only
    • Windows x64 (CUDA + CUDNN) - Yolov3
    • Linux x64 (CUDA + CUDNN) - Yolov3
    • Darwin Mac x64 (CUDA + CUDNN) - Yolov3
  • Download the binaries from yolo-bins

Features of darknet-cpp

  • Uses same source code-base as original darknet (ie same .c files are used). Modification is done only for runtime bug-fixes, compile time fixes for c++, and the build system itself. For list of bugs fixed, refer to this thread - https://groups.google.com/forum/#!topic/darknet/4Hb159aZBbA, and https://github.com/prabindh/darknet/issues

  • The Linux build system supports 3 targets -

    • original darknet (with gcc compiler),
    • darknet-cpp (with g++ compiler and Visual Studio compiler), and
    • Shared library (libdarknet-cpp-shared.so)
  • Can use bounding boxes directly from Euclid object labeller (https://github.com/prabindh/euclid)

  • C++ API - arapaho, that works in conjunction with libdarknet-cpp-shared.so, and a test wrapper that can read images or video files, and show detected regions in a complete C++ application.

  • darknet-cpp supports OpenCV3 and OpenCV4. Tested on Ubuntu 16.04, 18.04 and windows, with CUDA 8.x to 10.x

  • Note: darknet-cpp requires a C++11 compiler for darknet-cpp, and arapaho builds.

  • Note: CMake wrapper for Linux is available at - https://gist.github.com/prabindh/6bb3c429b8e8347edcf9b5e0b2f54a20 This uses existing Makefile and is just a wrapper.

Usage

Using the Makefile in the root directory of the darknet source repository,

  • make darknet - only darknet (original code), with OPENCV=0
  • make darknet-cpp - only the CPP version, with OPENCV=1
  • make darknet-cpp-shared - build the shared-lib version (without darknet.c calling wrapper), OPENCV=1
  • make arapaho - build arapaho and its test wrapper (from within arapaho folder)

Steps to test (Yolov3)

After performing `make darknet-cpp`, the executable `darknet-cpp` is generated. Run the below command to recognise the provided data objects.

./darknet-cpp detect cfg/yolov3.cfg yolov3.weights data/dog.jpg
layer     filters    size              input                output
0 conv     32  3 x 3 / 1   256 x 256 x   3   ->   256 x 256 x  32  0.113 BFLOPs
1 conv     64  3 x 3 / 2   256 x 256 x  32   ->   128 x 128 x  64  0.604 BFLOPs
2 conv     32  1 x 1 / 1   128 x 128 x  64   ->   128 x 128 x  32  0.067 BFLOPs
3 conv     64  3 x 3 / 1   128 x 128 x  32   ->   128 x 128 x  64  0.604 BFLOPs
4 res    1                 128 x 128 x  64   ->   128 x 128 x  64
5 conv    128  3 x 3 / 2   128 x 128 x  64   ->    64 x  64 x 128  0.604 BFLOPs
6 conv     64  1 x 1 / 1    64 x  64 x 128   ->    64 x  64 x  64  0.067 BFLOPs
7 conv    128  3 x 3 / 1    64 x  64 x  64   ->    64 x  64 x 128  0.604 BFLOPs
8 res    5                  64 x  64 x 128   ->    64 x  64 x 128
9 conv     64  1 x 1 / 1    64 x  64 x 128   ->    64 x  64 x  64  0.067 BFLOPs
10 conv    128  3 x 3 / 1    64 x  64 x  64   ->    64 x  64 x 128  0.604 BFLOPs
11 res    8                  64 x  64 x 128   ->    64 x  64 x 128
12 conv    256  3 x 3 / 2    64 x  64 x 128   ->    32 x  32 x 256  0.604 BFLOPs
13 conv    128  1 x 1 / 1    32 x  32 x 256   ->    32 x  32 x 128  0.067 BFLOPs
14 conv    256  3 x 3 / 1    32 x  32 x 128   ->    32 x  32 x 256  0.604 BFLOPs
15 res   12                  32 x  32 x 256   ->    32 x  32 x 256
16 conv    128  1 x 1 / 1    32 x  32 x 256   ->    32 x  32 x 128  0.067 BFLOPs
17 conv    256  3 x 3 / 1    32 x  32 x 128   ->    32 x  32 x 256  0.604 BFLOPs
18 res   15                  32 x  32 x 256   ->    32 x  32 x 256
19 conv    128  1 x 1 / 1    32 x  32 x 256   ->    32 x  32 x 128  0.067 BFLOPs
20 conv    256  3 x 3 / 1    32 x  32 x 128   ->    32 x  32 x 256  0.604 BFLOPs
21 res   18                  32 x  32 x 256   ->    32 x  32 x 256
22 conv    128  1 x 1 / 1    32 x  32 x 256   ->    32 x  32 x 128  0.067 BFLOPs
23 conv    256  3 x 3 / 1    32 x  32 x 128   ->    32 x  32 x 256  0.604 BFLOPs
24 res   21                  32 x  32 x 256   ->    32 x  32 x 256
25 conv    128  1 x 1 / 1    32 x  32 x 256   ->    32 x  32 x 128  0.067 BFLOPs
26 conv    256  3 x 3 / 1    32 x  32 x 128   ->    32 x  32 x 256  0.604 BFLOPs
27 res   24                  32 x  32 x 256   ->    32 x  32 x 256
28 conv    128  1 x 1 / 1    32 x  32 x 256   ->    32 x  32 x 128  0.067 BFLOPs
29 conv    256  3 x 3 / 1    32 x  32 x 128   ->    32 x  32 x 256  0.604 BFLOPs
30 res   27                  32 x  32 x 256   ->    32 x  32 x 256
31 conv    128  1 x 1 / 1    32 x  32 x 256   ->    32 x  32 x 128  0.067 BFLOPs
32 conv    256  3 x 3 / 1    32 x  32 x 128   ->    32 x  32 x 256  0.604 BFLOPs
33 res   30                  32 x  32 x 256   ->    32 x  32 x 256
34 conv    128  1 x 1 / 1    32 x  32 x 256   ->    32 x  32 x 128  0.067 BFLOPs
35 conv    256  3 x 3 / 1    32 x  32 x 128   ->    32 x  32 x 256  0.604 BFLOPs
36 res   33                  32 x  32 x 256   ->    32 x  32 x 256
37 conv    512  3 x 3 / 2    32 x  32 x 256   ->    16 x  16 x 512  0.604 BFLOPs
38 conv    256  1 x 1 / 1    16 x  16 x 512   ->    16 x  16 x 256  0.067 BFLOPs
39 conv    512  3 x 3 / 1    16 x  16 x 256   ->    16 x  16 x 512  0.604 BFLOPs
40 res   37                  16 x  16 x 512   ->    16 x  16 x 512
41 conv    256  1 x 1 / 1    16 x  16 x 512   ->    16 x  16 x 256  0.067 BFLOPs
42 conv    512  3 x 3 / 1    16 x  16 x 256   ->    16 x  16 x 512  0.604 BFLOPs
43 res   40                  16 x  16 x 512   ->    16 x  16 x 512
44 conv    256  1 x 1 / 1    16 x  16 x 512   ->    16 x  16 x 256  0.067 BFLOPs
45 conv    512  3 x 3 / 1    16 x  16 x 256   ->    16 x  16 x 512  0.604 BFLOPs
46 res   43                  16 x  16 x 512   ->    16 x  16 x 512
47 conv    256  1 x 1 / 1    16 x  16 x 512   ->    16 x  16 x 256  0.067 BFLOPs
48 conv    512  3 x 3 / 1    16 x  16 x 256   ->    16 x  16 x 512  0.604 BFLOPs
49 res   46                  16 x  16 x 512   ->    16 x  16 x 512
50 conv    256  1 x 1 / 1    16 x  16 x 512   ->    16 x  16 x 256  0.067 BFLOPs
51 conv    512  3 x 3 / 1    16 x  16 x 256   ->    16 x  16 x 512  0.604 BFLOPs
52 res   49                  16 x  16 x 512   ->    16 x  16 x 512
53 conv    256  1 x 1 / 1    16 x  16 x 512   ->    16 x  16 x 256  0.067 BFLOPs
54 conv    512  3 x 3 / 1    16 x  16 x 256   ->    16 x  16 x 512  0.604 BFLOPs
55 res   52                  16 x  16 x 512   ->    16 x  16 x 512
56 conv    256  1 x 1 / 1    16 x  16 x 512   ->    16 x  16 x 256  0.067 BFLOPs
57 conv    512  3 x 3 / 1    16 x  16 x 256   ->    16 x  16 x 512  0.604 BFLOPs
58 res   55                  16 x  16 x 512   ->    16 x  16 x 512
59 conv    256  1 x 1 / 1    16 x  16 x 512   ->    16 x  16 x 256  0.067 BFLOPs
60 conv    512  3 x 3 / 1    16 x  16 x 256   ->    16 x  16 x 512  0.604 BFLOPs
61 res   58                  16 x  16 x 512   ->    16 x  16 x 512
62 conv   1024  3 x 3 / 2    16 x  16 x 512   ->     8 x   8 x1024  0.604 BFLOPs
63 conv    512  1 x 1 / 1     8 x   8 x1024   ->     8 x   8 x 512  0.067 BFLOPs
64 conv   1024  3 x 3 / 1     8 x   8 x 512   ->     8 x   8 x1024  0.604 BFLOPs
65 res   62                   8 x   8 x1024   ->     8 x   8 x1024
66 conv    512  1 x 1 / 1     8 x   8 x1024   ->     8 x   8 x 512  0.067 BFLOPs
67 conv   1024  3 x 3 / 1     8 x   8 x 512   ->     8 x   8 x1024  0.604 BFLOPs
68 res   65                   8 x   8 x1024   ->     8 x   8 x1024
69 conv    512  1 x 1 / 1     8 x   8 x1024   ->     8 x   8 x 512  0.067 BFLOPs
70 conv   1024  3 x 3 / 1     8 x   8 x 512   ->     8 x   8 x1024  0.604 BFLOPs
71 res   68                   8 x   8 x1024   ->     8 x   8 x1024
72 conv    512  1 x 1 / 1     8 x   8 x1024   ->     8 x   8 x 512  0.067 BFLOPs
73 conv   1024  3 x 3 / 1     8 x   8 x 512   ->     8 x   8 x1024  0.604 BFLOPs
74 res   71                   8 x   8 x1024   ->     8 x   8 x1024
75 conv    512  1 x 1 / 1     8 x   8 x1024   ->     8 x   8 x 512  0.067 BFLOPs
76 conv   1024  3 x 3 / 1     8 x   8 x 512   ->     8 x   8 x1024  0.604 BFLOPs
77 conv    512  1 x 1 / 1     8 x   8 x1024   ->     8 x   8 x 512  0.067 BFLOPs
78 conv   1024  3 x 3 / 1     8 x   8 x 512   ->     8 x   8 x1024  0.604 BFLOPs
79 conv    512  1 x 1 / 1     8 x   8 x1024   ->     8 x   8 x 512  0.067 BFLOPs
80 conv   1024  3 x 3 / 1     8 x   8 x 512   ->     8 x   8 x1024  0.604 BFLOPs
81 conv    255  1 x 1 / 1     8 x   8 x1024   ->     8 x   8 x 255  0.033 BFLOPs
82 detection
83 route  79
84 conv    256  1 x 1 / 1     8 x   8 x 512   ->     8 x   8 x 256  0.017 BFLOPs
85 upsample            2x     8 x   8 x 256   ->    16 x  16 x 256
86 route  85 61
87 conv    256  1 x 1 / 1    16 x  16 x 768   ->    16 x  16 x 256  0.101 BFLOPs
88 conv    512  3 x 3 / 1    16 x  16 x 256   ->    16 x  16 x 512  0.604 BFLOPs
89 conv    256  1 x 1 / 1    16 x  16 x 512   ->    16 x  16 x 256  0.067 BFLOPs
90 conv    512  3 x 3 / 1    16 x  16 x 256   ->    16 x  16 x 512  0.604 BFLOPs
91 conv    256  1 x 1 / 1    16 x  16 x 512   ->    16 x  16 x 256  0.067 BFLOPs
92 conv    512  3 x 3 / 1    16 x  16 x 256   ->    16 x  16 x 512  0.604 BFLOPs
93 conv    255  1 x 1 / 1    16 x  16 x 512   ->    16 x  16 x 255  0.067 BFLOPs
94 detection
95 route  91
96 conv    128  1 x 1 / 1    16 x  16 x 256   ->    16 x  16 x 128  0.017 BFLOPs
97 upsample            2x    16 x  16 x 128   ->    32 x  32 x 128
98 route  97 36
99 conv    128  1 x 1 / 1    32 x  32 x 384   ->    32 x  32 x 128  0.101 BFLOPs
100 conv    256  3 x 3 / 1    32 x  32 x 128   ->    32 x  32 x 256  0.604 BFLOPs
101 conv    128  1 x 1 / 1    32 x  32 x 256   ->    32 x  32 x 128  0.067 BFLOPs
102 conv    256  3 x 3 / 1    32 x  32 x 128   ->    32 x  32 x 256  0.604 BFLOPs
103 conv    128  1 x 1 / 1    32 x  32 x 256   ->    32 x  32 x 128  0.067 BFLOPs
104 conv    256  3 x 3 / 1    32 x  32 x 128   ->    32 x  32 x 256  0.604 BFLOPs
105 conv    255  1 x 1 / 1    32 x  32 x 256   ->    32 x  32 x 255  0.134 BFLOPs
106 detection
Loading weights from yolov3.weights...Done!
data/dog.jpg: Predicted in 0.066842 seconds.
dog: 100%
truck: 51%
car: 77%
bicycle: 74%

Yolov3-tiny with Jetson-Nano (Maxwell 128GPU)

In Makefile, update this line

NVCC=/usr/local/cuda/bin/nvcc

./darknet-cpp detect cfg/yolov3-tiny.cfg ../yolov3-tiny.weights data/dog.jpg layer filters size input output 0 conv 16 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 16 0.150 BFLOPs 1 max 2 x 2 / 2 416 x 416 x 16 -> 208 x 208 x 16 2 conv 32 3 x 3 / 1 208 x 208 x 16 -> 208 x 208 x 32 0.399 BFLOPs 3 max 2 x 2 / 2 208 x 208 x 32 -> 104 x 104 x 32 4 conv 64 3 x 3 / 1 104 x 104 x 32 -> 104 x 104 x 64 0.399 BFLOPs 5 max 2 x 2 / 2 104 x 104 x 64 -> 52 x 52 x 64 6 conv 128 3 x 3 / 1 52 x 52 x 64 -> 52 x 52 x 128 0.399 BFLOPs 7 max 2 x 2 / 2 52 x 52 x 128 -> 26 x 26 x 128 8 conv 256 3 x 3 / 1 26 x 26 x 128 -> 26 x 26 x 256 0.399 BFLOPs 9 max 2 x 2 / 2 26 x 26 x 256 -> 13 x 13 x 256 10 conv 512 3 x 3 / 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BFLOPs 11 max 2 x 2 / 1 13 x 13 x 512 -> 13 x 13 x 512 12 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs 13 conv 256 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 256 0.089 BFLOPs 14 conv 512 3 x 3 / 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BFLOPs 15 conv 255 1 x 1 / 1 13 x 13 x 512 -> 13 x 13 x 255 0.044 BFLOPs 16 yolo 17 route 13 18 conv 128 1 x 1 / 1 13 x 13 x 256 -> 13 x 13 x 128 0.011 BFLOPs 19 upsample 2x 13 x 13 x 128 -> 26 x 26 x 128 20 route 19 8 21 conv 256 3 x 3 / 1 26 x 26 x 384 -> 26 x 26 x 256 1.196 BFLOPs 22 conv 255 1 x 1 / 1 26 x 26 x 256 -> 26 x 26 x 255 0.088 BFLOPs 23 yolo Loading weights from ../yolov3-tiny.weights...Done! data/dog.jpg: Predicted in 0.163809 seconds. dog: 56% car: 52% truck: 56% car: 62% bicycle: 58%

Steps to train (Yolov2, tag v5.3)**

This section applies to git tag v5.3 and earlier. ie, Yolov2.

  • Download latest commit of darknet-cpp, ex

git clone https://github.com/prabindh/darknet

  • Create Yolo compatible training data-set. I use this to create Yolo compatible bounding box format file, and training list file.

https://github.com/prabindh/euclid

This creates a training list file (train.txt) that will be needed in next step of training.

  • Change the files per below:

    • yolo-voc.cfg - change line classes=20 to suit desired number of classes
    • yolo-voc.cfg - change the number of filters in the CONV layer above the region layer - (#classes + 4 + 1)*(5), where 4 is '#of coords', and 5 is 'num' in the cfg file.
    • voc.data - change line classes=20, and paths to training image list file
    • voc.names - number of lines must be equal the number of classes
  • Place label-images corresponding to name of classes in data/labels, ex - data/labels/myclassname1.png

  • Download http://pjreddie.com/media/files/darknet19_448.conv.23

  • Train as below

    ./darknet-cpp detector train ./cfg/voc-myclasses.data ./cfg/yolo-myconfig.cfg darknet19_448.conv.23

    • Atleast for the few initial iterations, observe the log output, and ensure all images are found and being used. After convergence, detection can be performed using standard steps.
  • Testing with Arapaho C++ API for detection

    Arapaho needs the darknet-cpp shared library (.so file on Linux, .dll on Windows). This can be built as below on Linux.

    make darknet-cpp-shared

    On Windows, the .dll is built by default. The windows build requires the .sln files from (https://github.com/prabindh/darknet-cpp-windows)

    Refer the file https://github.com/prabindh/darknet/blob/master/arapaho/arapaho_readme.txt for more details on running Arapaho.

How to file issues

If there is a need to report an issue with the darknet-cpp port, use the link - https://github.com/prabindh/darknet/issues.

Information required for filing an issue:

  • Output of git log --format="%H" -n 1

  • Options enabled in Makefile (GPU,CUDNN)

  • If using Arapaho C++ wrapper, what options were used to build

  • Platform being used (OS version, GPU type, CUDA version, and OpenCV version)

Darknet-cpp for Windows

Currently tested with VS2017, CUDA10.1 on Win10 upto RS5.

The solution file requires the below repository.

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

The Windows port does not require any additional downloads (like pthreads), and builds the same darknet code-base for Windows, to generate the darknet.dll. Building the Arapaho C++ API and test wrapper, creates arapaho.exe, that works exactly the same way as arapaho on Linux.

Darknet

Darknet

Darknet is an open source neural network framework written in C and CUDA. It is fast, easy to install, and supports CPU and GPU computation.

For more information see the Darknet project website.

For questions or issues please use the Google Group.

darknet's People

Contributors

agirbau avatar alexey-kamenev avatar efreeto avatar inokii avatar legraphista avatar lilohuang avatar niuliang42 avatar ooobelix avatar pjreddie avatar pliablepixels avatar prabindh avatar tjluyao avatar turkishviking avatar vesom avatar voibit 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

darknet's Issues

CUDNN=1 is not working ?

I trained face with FDDB Datasets ( I wrote in #13 ), and I tried to detect face, but I can't with CUDNN=1.

$ vim MakeFile

GPU=1
CUDNN=1
OPENCV=1
DEBUG=1

$ ./darknet-cpp detector test cfg/face.data cfg/tiny-yolo-face.cfg tiny-yolo-face_final.weights FaceData2/JPEGImages/2002-07-19-big-img_254.jpg

screenshot from 2017-04-11 10-40-16

On the other hand, I can detect face successfully with CUDNN=0.

$ vim MakeFile

GPU=1
CUDNN=0
OPENCV=1
DEBUG=1


$ ./darknet-cpp detector test cfg/face.data cfg/tiny-yolo-face.cfg tiny-yolo-face_final.weights FaceData2/JPEGImages/2002-07-19-big-img_254.jpg

screenshot from 2017-04-11 10-44-49

My Enviroment is below.

  • nvidia-docker
  • nvidia tesla k40c (12G GPU)
  • Ubuntu 16.04
  • opencv 2.4 (installed by libopencv-dev)
  • CUDA 8.0
  • cudnn 5.1

undefined xxx in softmax cuda code with merge_lstm_gru_jun17

/usr/local/cuda//bin/nvcc -DGPU -DCUDNN --machine 64 -gencode arch=compute_20,code=[sm_20,sm_21] -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] -Xcompiler -fPIC -c --use_fast_math --ptxas-options=-v -I"/usr/local/cuda//include" -lcudart.so -lcufft.so -lcublas.so -lcurand.so -lcudnn.so -o bin/objs//softmax_layer_kernels_cuda.o src/darknetcpp/softmax_layer_kernels.cu 2>&1 | sed -r "s/(([0-9]+))/:\1/g" 1>&2

nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).

src/darknetcpp/softmax_layer_kernels.cu:37: error: identifier "network_state" is undefined

src/darknetcpp/softmax_layer_kernels.cu:45: error: identifier "network_state" is undefined

src/darknetcpp/softmax_layer_kernels.cu:47: error: identifier "axpy_ongpu" is undefined

3 errors detected in the compilation of "/tmp/tmpxft_00003035_00000000-15_softmax_layer_kernels.compute_52.cpp1.ii".

Looks like you changed "network" type in upstream with "network_state" here and there is no such thing.
Also axpy_ongpu should be axpy_gpu.

The accuracy of "arapaho" is different from "darknet-cpp" ?

I have experimented fish detection accuracy using a) "darknet-cpp", b) "arapaho" with same model,cfg,data file.

And result is following. I think "arapaho" is less accurate than "darkent-cpp".

a) darknet-cpp

https://youtu.be/tDdYOK9UbTE
screen shot 2017-06-26 at 13 25 21

b) arapaho

https://www.youtube.com/watch?v=WfuLMdDtRfs

screen_shot_2017-06-26_at_13_25_33

Please tell me why such a thing happens when you know the cause m(_ _)m

※ I think this difference of accuracy can reproduce when using default coco.data & yolo.weights.

Error while compiling source

I get an error when compiling your source code,,

deconvolutional_layer.c:(.text+0x8cc): undefined reference to forward_deconvolutional_layer_gpu' deconvolutional_layer.c:(.text+0x8d0): undefined reference to forward_deconvolutional_layer_gpu'
deconvolutional_layer.c:(.text+0x8d8): undefined reference to backward_deconvolutional_layer_gpu' deconvolutional_layer.c:(.text+0x8dc): undefined reference to backward_deconvolutional_layer_gpu'
deconvolutional_layer.c:(.text+0x8e4): undefined reference to update_deconvolutional_layer_gpu' deconvolutional_layer.c:(.text+0x8e8): undefined reference to update_deconvolutional_layer_gpu'
collect2: error: ld returned 1 exit status
Makefile:99: recipe for target 'darknet' failed
make: *** [darknet] Error 1

how to solve this problem

I use Jetson TX1 with Ubuntu 16.04, CUDA 8 and latest version OpenCV

Faster cpu gemm

What about that simple improvement?

void gemm_nn(int M, int N, int K, float ALPHA,
float A, int lda,
float B, int ldb,
float C, int ldc)
{
int i,j,k;
#pragma omp parallel for
for(i = 0; i < M; ++i){
for(k = 0; k < K; ++k){
register float A_PART = ALPHA
A[i
lda+k];
for(j = 0; j < N; ++j){
C[i
ldc+j] += A_PARTB[kldb+j];
}
}
}
}

arapaho.cpp:322:68: error when compiled with the latest darknet code

much thanks for this great solution, do give me a big help!
But when changing the src folder to the latest darknet source code[1e72980 ], it shows:

darknet-wrapper/arapaho.cpp: In member function ‘void ArapahoV2::__Detect(float*, float, float, int&)’:
/home/ricky/RICKY/EXTEND/PROJECT/FIRE-EYE/lib/darknet-wrapper/arapaho.cpp:322:68: error: invalid conversion from ‘float**’ to ‘int’ [-fpermissive]
   get_region_boxes(l, 1, 1, thresh, probs, boxes, 0, 0, hier_thresh);
                                                                    ^
/home/ricky/RICKY/EXTEND/PROJECT/FIRE-EYE/lib/darknet-wrapper/arapaho.cpp:322:68: error: cannot convert ‘box*’ to ‘float’ for argument ‘6’ to ‘void get_region_boxes(layer, int, int, int, int, float, float**, box*, float**, int, int*, float, int)’
make[2]: *** [darknet-wrapper/CMakeFiles/darknet_wrapper.dir/arapaho.cpp.o] 错误 1
make[1]: *** [darknet-wrapper/CMakeFiles/darknet_wrapper.dir/all] 错误 2

It seems like the definition of get_region_boxes in the darknet has been changed while the arapaho.cpp haven't adjust to it.

So has anyone faced the problem and solved it ?

Any idea of darknet dll for C#

Hi I am planning to transfer the arapaho to CLR dll for C# application But I find the network and layer struct and opencv Mat are used in arapaho which are so diffcult to figue out in CLR , So any one have idea with this?

Getting YOLO and Caffe C++ to work together

Reference to #30, we got detection working when compiling with the -DGPU and -DCUDNN flags. However, we need to classify the detections using the Caffe C++ API. When we integrate the code, errors in Caffe pop up. The Caffe C++ classifier works fine otherwise.

Is there any other way to compile darknet-cpp without the given flags and still get detections in GPU mode?

Thanks

Salman

CUDA out of memory error even with CUDNN=0

Verified that the tiny yolo model runs just fine with both CUDNN=0 and CUDNN=1
However, cannot get the full yolo model to run. Error message below. A previous version of this branch ran just fine for me (in fact, it was the only one which would run since I'm using OpenCV 3). I see an earlier commenter fixed this issue by disabling CUDNN, but that didn't work for me.

I suspect this may simply be because I'm running a low-end GPU card. My CUDA configuration below from lspci | grep VGA. Has anyone with this configuration got the latest code working with the full yolo CNN?

01:00.0 VGA compatible controller: NVIDIA Corporation GK107GLM [Quadro K1100M] (rev a1)

layer filters size input output
0 conv 32 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 32
1 max 2 x 2 / 2 416 x 416 x 32 -> 208 x 208 x 32
2 conv 64 3 x 3 / 1 208 x 208 x 32 -> 208 x 208 x 64
3 max 2 x 2 / 2 208 x 208 x 64 -> 104 x 104 x 64
4 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128
5 conv 64 1 x 1 / 1 104 x 104 x 128 -> 104 x 104 x 64
6 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128
7 max 2 x 2 / 2 104 x 104 x 128 -> 52 x 52 x 128
8 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256
9 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128
10 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256
11 max 2 x 2 / 2 52 x 52 x 256 -> 26 x 26 x 256
12 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512
13 CUDA Error: out of memory
darknet-cpp: ./src/cuda.c:38: void check_error(cudaError_t): Assertion `0' failed.

Error: Couldn't open file: data/coco.names

I have sucessfully compiled darknet-shared and arapaho in my Linux machine. However, when trying to run arapaho.out, this error appears: Couldn't open file: data/coco.names

I'm aware that such path is included in the input.data file, and I have tried to set both a path relative to the arapaho folder (../data/coco.names) and a full path. In both cases, the file can't be opened for unknown reasons...

Any ideas regarding this? Thank you in advance

calculating the filter value

Hi,

You mentioned:

yolo-voc.cfg - change the number of filters in the CONV layer above the region layer - #classes + #coords(4) + 1)*(NUM)

if I am right, the formula would be: (classes + coords + 1) * NUM

May I ask you what are the values of coords and NUM?

Image batching

Hi there,

I'm looking to find a way to detect an objects in a very large image, and since the image is scaled to the net sizes I'm losing a lot of information in the original image.

So my plan is to read the Large images, divide it to several ROIs (rectangles) and send them simulations to the net forward pass.
To do this I will probably need to use the set_batch_network(&net, ROI_num) and concatenate images when memcopy them to CUDA, but how will get the results of for each ROI?

The concept is it possible to do?

ArapahoV2ImageBuff

Would it be easier to use a cv mat in ArapahoV2.Detect since opencv is required? Is this the proper conversion for a cv::mat?

Mat image = imread(input, CV_LOAD_IMAGE_COLOR);
w = image.rows
h = image.cols;
bgr = image.reshape(1,1);

how to use caffemodel

I want to use darknet to predict with caffemodel, does darknet support caffemodel? If not, how should I convert the caffemodel to darknet model?

Memory leak from arapaho.cpp

I noticed there was a memory leak when I was running multiple instances of live video streams. It gradually slowed the computer down to an almost halt after 15 minutes.
This has gone away after I added free_image() functions in Detect() function before returning.

But I think the even better solution is to move away from using darknet's make_image() and just pass OpenCV image's data.
Also, resize_image() from darknet is quite slow. I got much faster performance using OpenCV's resize().

I can compile a pull request to switch to OpenCV if you want after a few days. I probably won't use ArapahoV2ImageBuff either.

Detection results are different from original code

hi @prabindh ,

I've trained tiny yolo model on my custom objects. It went well and detection also works okay. However, on some images, detection fails and I decided to do a quick test:

I compile "make darknet", and then run ./darknet detector test on the image and it detects objects perfectly.

I compile the shared lib "make darknet-cpp-shared, and then "make arapaho" then run ./arapaho.out on the same image, the result is different( even the probs are also very different ) and not as good as one of running the original ./darknet

What is the different part of the code that could lead to this variation? My guess is that converting image from opencv Mat to "image" is the origin of the issue but then why does it work most of the time and just fails on a couple of images?

Thanks.

Arapaho sending BGR instead of RGB to darknet

Raising on behalf of @voibit I trained a network with two different objects, namely red and green (ish). for a long time i could not figure out why arapaho showed wrong classifications though darknet-cpp got it right. Then i tested with a red image, and printed out what actually went to network_predict(), in detector.c and arapaho.cpp. The first couple of floats for detector.c was 1, and for arapaho.cpp they were 0, bingo.

Setup failed error.

Hello,
I get the setup failed error when i try to run the test.cpp sample in arapaho folder.
....
23 conv 1024 3 x 3 / 1 13 x 13 x1024 -> 13 x 13 x1024
24 conv 1024 3 x 3 / 1 13 x 13 x1024 -> 13 x 13 x1024
25 route 16
26 reorg / 2 26 x 26 x 512 -> 13 x 13 x2048
27 route 26 24
28 conv 1024 3 x 3 / 1 13 x 13 x3072 -> 13 x 13 x1024
29 conv 425 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 425
30 detection
Loading weights from yolo.weights...Done!
Setup failed!

Windows w/out GPU

Is it possible to use in Windows without a GPU? I can compile with CUDA but cannot run inference due to my current work laptop not having a GPU.

extern "C"

Is the extern "C" necessary in network.h? I've been able to compile darknet-cpp and libdarknet-cpp-shared.so just fine without it. I mainly run the detector though so I'm not sure if other runners need it.

Missing functions

Hi

It seems that some functions available in the original c darknet framework are not present in the branch.
Some examples in network.c:

  • network_width(network *net)
  • reset_rnn(network *net)
  • network_height(network *net)
  • etc.

Is there a specific reason that these functions have been discarded, or is it a matter of implementation time and are they not ported yet?

Thanks

Image format provide to the network_predict() function

Hello, my goal is to capture images from my camera and send them to direct to the network_predict() function.

In the original C code the format was XY3 normalize floats rgb (when X & Y are the sizes of the network), but on the CPP version the input image memory alignment have change to R pixel following the G pixels and the B pixels.
Am I right?, if true then why to do this?

Darknet-cpp with Yolo9000

Copying from willie maddox comment in forum - https://groups.google.com/forum/#!topic/darknet/4Hb159aZBbA

The cpp port to darknet is broken for detector demo on new yolo9000. I posted the following in an earlier thread.

I also am getting segfaults for ./darknet-cpp detector demo cfg/combine9k.data cfg/yolo9000.cfg yolo9000.weights.
I located the error and it occurs when calling free(m.data) at the bottom of image.c. (which is called in the while loop by free_image(disp) in demo.c)

I pulled the latest version of darknet and did a fresh make clean; make
I verified that the defaults in combine9k.data point to the correct files and that all the 9k.* files are present.
I also tried running ./darknet-cpp detector demo cfg/coco.data cfg/yolo.cfg yolo.weights just for a sanity check and it ran with no errors.
Also the straight c code version of darknet works fine with yolo9000.
I put a breakpoint at free(m.data) and verified that the memory pointed to by m.data was a float (usually a value between 0.5 and 0.6 depending on the run) in each of the detector demo runs listed above.

But for some reason, yolo9000 crashes when trying to free m.data.

I can't include libdarknet-cpp-shared.so in my cmake project

Hello.
I'm can tune CMakeLists.txt to use libdarknet-cpp-shared.so. Somthing wrong with cuda files.

CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
SET (target "Hierarchy_Ensemble") PROJECT (${target} CXX)
set(CMAKE_CXX_STANDARD 14)
FILE (GLOB src *.cpp)
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} )
FIND_PACKAGE (OpenCV 2.3.0 REQUIRED)
FIND_PACKAGE (LibXml2 REQUIRED)
FIND_PACKAGE (iconv REQUIRED)
FIND_PACKAGE(CUDA REQUIRED)
set (CUDA_NVCC_FLAGS "-arch=sm_52" CACHE STRING "nvcc flags" FORCE)
SET (CUDA_VERBOSE_BUILD ON CACHE BOOL "nvcc verbose" FORCE)
INCLUDE_DIRECTORIES (${OPENCV_INCLUDE_DIR})
INCLUDE_DIRECTORIES (${LIBXML2_INCLUDE_DIR})
INCLUDE_DIRECTORIES (${ICONV_INCLUDE_DIR})
ADD_EXECUTABLE (${target} ${src})
TARGET_LINK_LIBRARIES (${target} ${LIBXML2_LIBRARIES} ${OpenCV_LIBS} "/home/d3nd3r/projects/darknet_cpp_wrapper/MOT/libdarknet-cpp-shared.so" ${CUDA_LIBRARIES} )
SET_TARGET_PROPERTIES( ${target} PROPERTIES LINKER_LANGUAGE CXX)
link_directories( ${CMAKE_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR} )
link_directories( ${CMAKE_SOURCE_DIR}/.. /usr/local/lib/ /usr/local/cuda/ )
link_directories(/usr/local/cuda-8.0/lib64)
SET_SOURCE_FILES_PROPERTIES ( ${src} PROPERTIES LANGUAGE CXX)
add_definitions( -DGPU )
result:

[ 10%] Linking CXX executable Hierarchy_Ensemble
/usr/bin/ld: warning: libcudart.so.8.0, needed by /home/d3nd3r/projects/darknet_cpp_wrapper/MOT/libdarknet-cpp-shared.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libcublas.so.8.0, needed by /home/d3nd3r/projects/darknet_cpp_wrapper/MOT/libdarknet-cpp-shared.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libcurand.so.8.0, needed by /home/d3nd3r/projects/darknet_cpp_wrapper/MOT/libdarknet-cpp-shared.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: Hierarchy_Ensemble: hidden symbol `cudaGetDevice' in /usr/local/cuda/lib64/libcudart_static.a(libcudart_static.a.o) is referenced by DSO
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
CMakeFiles/Hierarchy_Ensemble.dir/build.make:324: recipe for target 'Hierarchy_Ensemble' failed
make[2]: *** [Hierarchy_Ensemble] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Hierarchy_Ensemble.dir/all' failed
make[1]: *** [CMakeFiles/Hierarchy_Ensemble.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

How to get labels using Arapaho

Hi Prabindh,
Your cpp warpper is cool, just what I need. But I am wondering how to get corresponding labels for boxes when using Arapaho? Or is that a TODO?

Frame rate drop

hello,
I am using the same video with demo. c version gives around 14fps while cpp version only gives 6 fps. Any one know the reason ?

Arapaho 0 detections, loading empty layer

Hi,

I closed issue #17 because the scope of the original problem was surpassed, but this is a new problem I'm having. I got the latest version of the repo. When I try to load the net, it loads, the config files are all detected, but it detects 0 objects. Looking back, it detects the last layer to be 0. Note that these exact files work when I run test.cpp. However when I separate the initialization of arapaho and the detecting code, it does not work. Here's the output (with some logging added by me)

Loading names from /home/halt9/dark_ws/src/detector/src/coco.names
Using cfg file /home/halt9/dark_ws/src/detector/src/input.cfg
Using weight file /home/halt9/dark_ws/src/detector/src/input.weights
layer     filters    size              input                output
    0 conv     32  3 x 3 / 1   416 x 416 x   3   ->   416 x 416 x  32
    1 max          2 x 2 / 2   416 x 416 x  32   ->   208 x 208 x  32
    2 conv     64  3 x 3 / 1   208 x 208 x  32   ->   208 x 208 x  64
    3 max          2 x 2 / 2   208 x 208 x  64   ->   104 x 104 x  64
    4 conv    128  3 x 3 / 1   104 x 104 x  64   ->   104 x 104 x 128
    5 conv     64  1 x 1 / 1   104 x 104 x 128   ->   104 x 104 x  64
    6 conv    128  3 x 3 / 1   104 x 104 x  64   ->   104 x 104 x 128
    7 max          2 x 2 / 2   104 x 104 x 128   ->    52 x  52 x 128
    8 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256
    9 conv    128  1 x 1 / 1    52 x  52 x 256   ->    52 x  52 x 128
   10 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256
   11 max          2 x 2 / 2    52 x  52 x 256   ->    26 x  26 x 256
   12 conv    512  3 x 3 / 1    26 x  26 x 256   ->    26 x  26 x 512
   13 conv    256  1 x 1 / 1    26 x  26 x 512   ->    26 x  26 x 256
   14 conv    512  3 x 3 / 1    26 x  26 x 256   ->    26 x  26 x 512
   15 conv    256  1 x 1 / 1    26 x  26 x 512   ->    26 x  26 x 256
   16 conv    512  3 x 3 / 1    26 x  26 x 256   ->    26 x  26 x 512
   17 max          2 x 2 / 2    26 x  26 x 512   ->    13 x  13 x 512
   18 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024
   19 conv    512  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 512
   20 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024
   21 conv    512  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 512
   22 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024
   23 conv   1024  3 x 3 / 1    13 x  13 x1024   ->    13 x  13 x1024
   24 conv   1024  3 x 3 / 1    13 x  13 x1024   ->    13 x  13 x1024
   25 route  16
   26 reorg              / 2    26 x  26 x 512   ->    13 x  13 x2048
   27 route  26 24
   28 conv   1024  3 x 3 / 1    13 x  13 x3072   ->    13 x  13 x1024
   29 conv    425  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 425
   30 detection
Setup: net.n = 31
net.layers[0].batch = 1
Loading weights from /home/halt9/dark_ws/src/detector/src/input.weights...Done!
Setup: layers = 0, 0, 0 and classes 0
Image expected w,h = [416][416]!
Trying to allocate boxes of 0 * 0 * 0 amount, 16 size
Trying to allocate probs of 0 amount, 8 size

My code is attached. It uses ROS, so you can't really compile it without, but you can inspect it. It compiles without error, and its structure replicates arapaho's test.cpp exactly except for some of the code being in the constructor for ImageConverter and some of it being in its imageCB method. However, I don't see why this should lead to 0 detections or a blank last layer. I'm using the default YOLO v2 config of darknet.
detector.txt

Getting bad error when test image using c++ wrapper with GPU enabled

I am using p2.xlarge EC2 instance for testing.
In makefile of darknet
GPU=1
CUDNN = 1
OPENCV = 1
DEBUG =1

In Makefile of arapaho

# Makefile to build the test-wrapper for Arapaho
# Undefine GPU, CUDNN if darknet was built without these defined. These 2 flags have to match darknet flags.
# https://github.com/prabindh/darknet  #add  -DGPU -DCUDNN after arapaho.cpp and before -D_DEBUG

arapaho: clean
        g++ test.cpp arapaho.cpp -DGPU -DCUDNN -D_DEBUG -I../src/ -I/usr/local/cuda/include/ -L./ -ldarknet-cpp-shared -L/usr/local/lib  -lopencv_stitching  -lopencv_su$

clean:
        rm -rf ./arapaho.out

Error

ubuntu@ip-10-0-0-226:~/darknet-cpp/darknet/arapaho$ make arapaho 
rm -rf ./arapaho.out
g++ test.cpp arapaho.cpp -DGPU -DCUDNN -D_DEBUG -I../src/ -I/usr/local/cuda/include/ -L./ -ldarknet-cpp-shared -L/usr/local/lib  -lopencv_stitching  -lopencv_superres  -lopencv_videostab   -lopencv_calib3d -lopencv_features2d -lopencv_objdetect -lopencv_highgui  -lopencv_photo  -lopencv_video -lopencv_ml -lopencv_imgproc -lopencv_flann   -lopencv_core  -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand -std=c++11 -o arapaho.out
ubuntu@ip-10-0-0-226:~/darknet-cpp/darknet/arapaho$ ./arapaho.out 
layer     filters    size              input                output
    0 conv     32  3 x 3 / 1   416 x 416 x   3   ->   416 x 416 x  32
    1 max          2 x 2 / 2   416 x 416 x  32   ->   208 x 208 x  32
    2 conv     64  3 x 3 / 1   208 x 208 x  32   ->   208 x 208 x  64
    3 max          2 x 2 / 2   208 x 208 x  64   ->   104 x 104 x  64
    4 conv    128  3 x 3 / 1   104 x 104 x  64   ->   104 x 104 x 128
    5 conv     64  1 x 1 / 1   104 x 104 x 128   ->   104 x 104 x  64
    6 conv    128  3 x 3 / 1   104 x 104 x  64   ->   104 x 104 x 128
    7 max          2 x 2 / 2   104 x 104 x 128   ->    52 x  52 x 128
    8 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256
    9 conv    128  1 x 1 / 1    52 x  52 x 256   ->    52 x  52 x 128
   10 conv    256  3 x 3 / 1    52 x  52 x 128   ->    52 x  52 x 256
   11 max          2 x 2 / 2    52 x  52 x 256   ->    26 x  26 x 256
   12 conv    512  3 x 3 / 1    26 x  26 x 256   ->    26 x  26 x 512
   13 conv    256  1 x 1 / 1    26 x  26 x 512   ->    26 x  26 x 256
   14 conv    512  3 x 3 / 1    26 x  26 x 256   ->    26 x  26 x 512
   15 conv    256  1 x 1 / 1    26 x  26 x 512   ->    26 x  26 x 256
   16 conv    512  3 x 3 / 1    26 x  26 x 256   ->    26 x  26 x 512
   17 max          2 x 2 / 2    26 x  26 x 512   ->    13 x  13 x 512
   18 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024
   19 conv    512  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 512
   20 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024
   21 conv    512  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 512
   22 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024
   23 conv   1024  3 x 3 / 1    13 x  13 x1024   ->    13 x  13 x1024
   24 conv   1024  3 x 3 / 1    13 x  13 x1024   ->    13 x  13 x1024
   25 route  16
   26 reorg              / 2    26 x  26 x 512   ->    13 x  13 x2048
   27 route  26 24
   28 conv   1024  3 x 3 / 1    13 x  13 x3072   ->    13 x  13 x1024
   29 conv    210  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x 210
   30 detection
Setup: net.n = 31
net.layers[0].batch = 8
Loading weights from input.weights...mj = 0, mn = 1, *(net->seen) = 448000
load_convolutional_weights: l.n*l.c*l.size*l.size = 864
load_convolutional_weights: l.n*l.c*l.size*l.size = 18432
load_convolutional_weights: l.n*l.c*l.size*l.size = 73728
load_convolutional_weights: l.n*l.c*l.size*l.size = 8192
load_convolutional_weights: l.n*l.c*l.size*l.size = 73728
load_convolutional_weights: l.n*l.c*l.size*l.size = 294912
load_convolutional_weights: l.n*l.c*l.size*l.size = 32768
load_convolutional_weights: l.n*l.c*l.size*l.size = 294912
load_convolutional_weights: l.n*l.c*l.size*l.size = 1179648
load_convolutional_weights: l.n*l.c*l.size*l.size = 131072
load_convolutional_weights: l.n*l.c*l.size*l.size = 1179648
load_convolutional_weights: l.n*l.c*l.size*l.size = 131072
load_convolutional_weights: l.n*l.c*l.size*l.size = 1179648
load_convolutional_weights: l.n*l.c*l.size*l.size = 4718592
load_convolutional_weights: l.n*l.c*l.size*l.size = 524288
load_convolutional_weights: l.n*l.c*l.size*l.size = 4718592
load_convolutional_weights: l.n*l.c*l.size*l.size = 524288
load_convolutional_weights: l.n*l.c*l.size*l.size = 4718592
load_convolutional_weights: l.n*l.c*l.size*l.size = 9437184
load_convolutional_weights: l.n*l.c*l.size*l.size = 9437184
load_convolutional_weights: l.n*l.c*l.size*l.size = 28311552
load_convolutional_weights: l.n*l.c*l.size*l.size = 215040
Done!
Setup: layers = -1121619809, -1158304637, -1116303048
Warning: Read classes from cfg (1012195420) > maxClasses (2)
Image expected w,h = [416][416]!
Error allocating boxes/probs, (nil)/(nil) !
Setup failed!
ubuntu@ip-10-0-0-226:~/darknet-cpp/darknet/arapaho$ 

Initially It was giving me following warning libdc1394 error: Failed to initialize libdc1394 But then I run this command sudo ln /dev/null /dev/raw1394. this removed the warning statement.

Tell me how can I resolve It Please ?

There is no error coming when I am testing it on CPU.

Build error on windows

Thanks you!

I build on window ,have some error ,I can't find timersub function

1>....\darknet\src\classifier.c(999): error C3861: “timersub”: 找不到标识符

image size

the width and height are 416 in .cfg file, but my labeled image size is 1280*720, did i need cut the labeled image? or some other suggestion? thank you

Rename repo to darknet-cpp?

This repository is exactly what I was looking for, but it was hard to find via Google. Does it make sense to rename to darknet-cpp? You can easily rename a github repository in the Settings tab.

Linking libdarknet-cpp-shared.so

On behalf of Willie, from thread @ https://mail.google.com/mail/u/0/#inbox/157f11cff62006e4,

Has anyone had any success linking and using the libdarknet-cpp-shared.so library?

I've been able to link successfully but I get segfault when I try to run.

The problem is with the parsing of the net. After this line,

net = parse_network_cfg(cfgfile);

you can paste these lines,

layer l0 = net.layers[0];
cout << l0.w << endl;
layer l1 = net.layers[1];
cout << l1.w << endl;
layer l = net.layers[net.n - 1];
cout << l.w << endl;

to see exactly what I'm talking about. The first layer looks good, but the data in all the layers after the first are complete garbage.

416
0 <--- garbage
32633 <--- garbage

However, If you run the .darknet-cpp executable, these lines give good data.

416
416
13

I also noticed, that when I set a breakpoint on the "net = parse_network_cfg()" line, I can't step into the function, but when running the executable, I can.

Arapaho: "libdarknet-spp-shared.so: no such file or directory"

Following compilation instructions of arapaho, I can compile it but I can't get it to work. Here's my Makefile:

COMMON= 
CFLAGS=-Wall -Wfatal-errors 

OPTS=-O0 -g
CFLAGS+=$(OPTS)

COMMON+= -DGPU -I/usr/local/cuda/include/
CFLAGS+= -DGPU
LDFLAGS+= -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand

COMMON+= -DCUDNN 
CFLAGS+= -DCUDNN
LDFLAGS+= -lcudnn

COMMON+= -DOPENCV
CFLAGS+= -DOPENCV
LDFLAGS+= `pkg-config --libs opencv-3.2.0-dev` 
COMMON+= `pkg-config --cflags opencv-3.2.0-dev` 


arapaho: clean
	g++ test.cpp arapaho.cpp  $(COMMON) $(CFLAGS) -I../src/ -L./ $(LDFLAGS) -ldarknet-cpp-shared -L/usr/local/lib -std=c++11 -o arapaho.out

clean:
	rm -rf ./arapaho.out	

The parameters are all copy-pasted from my Makefile for darknet. This compiles fine. Yet when I try to run it I get: ./arapaho.out: error while loading shared libraries: libdarknet-cpp-shared.so: cannot open shared object file: No such file or directory despite the lib file being in the same directory and rwx-enabled.

Segmentation fault (Core Dumped) on traing my own dataset...

I have same issue here...
https://groups.google.com/forum/#!topic/darknet/PSfpLeP9dTI

When I start to run training, after maybe 5 [min], "Segmentation fault (core dumped)" has come...

$ ./darknet-cpp detector train cfg/face.data cfg/tiny-yolo-face.cfg darknet19_448.conv.23
tiny-yolo-face
layer     filters    size              input                output
    0 conv     16  3 x 3 / 1   416 x 416 x   3   ->   416 x 416 x  16
    1 max          2 x 2 / 2   416 x 416 x  16   ->   208 x 208 x  16
    2 conv     32  3 x 3 / 1   208 x 208 x  16   ->   208 x 208 x  32
    3 max          2 x 2 / 2   208 x 208 x  32   ->   104 x 104 x  32
    4 conv     64  3 x 3 / 1   104 x 104 x  32   ->   104 x 104 x  64
    5 max          2 x 2 / 2   104 x 104 x  64   ->    52 x  52 x  64
    6 conv    128  3 x 3 / 1    52 x  52 x  64   ->    52 x  52 x 128
    7 max          2 x 2 / 2    52 x  52 x 128   ->    26 x  26 x 128
    8 conv    256  3 x 3 / 1    26 x  26 x 128   ->    26 x  26 x 256
    9 max          2 x 2 / 2    26 x  26 x 256   ->    13 x  13 x 256
   10 conv    512  3 x 3 / 1    13 x  13 x 256   ->    13 x  13 x 512
   11 max          2 x 2 / 1    13 x  13 x 512   ->    13 x  13 x 512
   12 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024
   13 conv   1024  3 x 3 / 1    13 x  13 x1024   ->    13 x  13 x1024
   14 conv     30  1 x 1 / 1    13 x  13 x1024   ->    13 x  13 x  30
   15 detection
Loading weights from darknet19_448.conv.23...mj = 0, mn = 1, *(net->seen) = 0
load_convolutional_weights: l.n*l.c*l.size*l.size = 432
load_convolutional_weights: l.n*l.c*l.size*l.size = 4608
load_convolutional_weights: l.n*l.c*l.size*l.size = 18432
load_convolutional_weights: l.n*l.c*l.size*l.size = 73728
load_convolutional_weights: l.n*l.c*l.size*l.size = 294912
load_convolutional_weights: l.n*l.c*l.size*l.size = 1179648
load_convolutional_weights: l.n*l.c*l.size*l.size = 4718592
load_convolutional_weights: l.n*l.c*l.size*l.size = 9437184
load_convolutional_weights: l.n*l.c*l.size*l.size = 30720
Done!
Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005
Resizing
576
Loaded: 8.695765 seconds
Region Avg IOU: 0.515059, Class: 1.000000, Obj: 0.499428, No Obj: 0.500041, Avg Recall: 0.529412,  count: 17
...
...
...
0.750000,  count: 8
110: 0.764993, 0.874893 avg, 0.001000 rate, 6.412199 seconds, 7040 images
Resizing
416
Loaded: 4.962685 seconds
Region Avg IOU: 0.618827, Class: 1.000000, Obj: 0.068952, No Obj: 0.065820, Avg Recall: 0.846154,  count: 13
Region Avg IOU: 0.547015, Class: 1.000000, Obj: 0.069931, No Obj: 0.065815, Avg Recall: 0.538462,  count: 13
Region Avg IOU: 0.556845, Class: 1.000000, Obj: 0.069298, No Obj: 0.065822, Avg Recall: 0.700000,  count: 10
Region Avg IOU: 0.585272, Class: 1.000000, Obj: 0.068502, No Obj: 0.065809, Avg Recall: 0.583333,  count: 12
Region Avg IOU: 0.568035, Class: 1.000000, Obj: 0.069173, No Obj: 0.065793, Avg Recall: 0.727273,  count: 11
Region Avg IOU: 0.527949, Class: 1.000000, Obj: 0.068757, No Obj: 0.065827, Avg Recall: 0.416667,  count: 12
Region Avg IOU: 0.598013, Class: 1.000000, Obj: 0.067833, No Obj: 0.065797, Avg Recall: 0.800000,  count: 10
Region Avg IOU: 0.525347, Class: 1.000000, Obj: 0.068029, No Obj: 0.065791, Avg Recall: 0.571429,  count: 35
111: 0.571791, 0.844583 avg, 0.001000 rate, 8.066176 seconds, 7104 images
Loaded: 0.000030 seconds
Region Avg IOU: 0.550923, Class: 1.000000, Obj: 0.064512, No Obj: 0.061997, Avg Recall: 0.583333,  count: 12
Region Avg IOU: 0.605595, Class: 1.000000, Obj: 0.064598, No Obj: 0.062016, Avg Recall: 0.666667,  count: 15
Segmentation fault (core dumped)

My enviroment is below.

  • nvidia-docker
  • nvidia tesla k40c (12G GPU)
  • Ubuntu 16.04
  • opencv 2.4 (installed by libopencv-dev)
  • CUDA 8.0
  • cudnn 5.1

I want to do face recognition, so my class is only 1.

CPU version

Could it maked wituout GPU and CUDN? (GPU=0 CUDNN=0)
If I make it without GPU and CUDN, is there anything else I need to set up?
e.g NVCC?
I have made the arapho.out, but I meet a error that Couldn't open file: data/coco.names when I run arapaho.
I check the test.cpp and arapaho.cpp and can not find the place where call the "data/coco.names".
Please tell me how to fix this problem.
PS: 1. I have copyed the weights, cfg, data and image files to the arapaho folder.
2. My arapaho makefile
arapaho: clean
g++ test.cpp arapaho.cpp -D_DEBUG -I../src/ -I/usr/local/include/ -L/home/ssd/darknet/arapaho -ldarknet-cpp-shared -L/home/ssd/darknet/arapaho -L/usr/local/lib -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_objdetect -lopencv_highgui -lopencv_photo -lopencv_video -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core -std=c++11 -o arapaho.out

clean:
rm -rf ./arapaho.out

Multiple GPUs

Is there anyway to change the code to run each instance on a different GPU if I have multiple GPUs on my machine?

Sync back up with original repo?

Are there plans to sync this up with the original repo. As of today. This fork is 37 commits behind pjreddie master. So, no lstm, no segmenter, etc.

How to calculate the mAP, for my custom dataset which is labelled using Euclid in yolo format

Hi,
I labelled my custom data set using euclid in yolo format. And I trained Yolo and everything is working fine. But now I want to calculate the mAP. For this I need to use some scripts like voc_eval.py etc, for which the ground truth annotations should be in VOC XML format. is there any way to convert Yolo format annotations to VOC format annotations, so that I can use scripts provided by VOC team. Or else is there any procedure to calculate mAP from Yolo format annotated data(using euclid)

No objects detected when using libdarknet-cpp-shared.so and GPU

ubuntu 14.04, cudnn 5.1.10, cuda 8.0, opencv 3.2
GPU = NVIDIA GTX 960
GPU=1
CUDNN=1
When I run ./darknet-cpp detector yolo.cfg yolo.weights.cfg dog.jpg, it runs fine, but when I use the same code (copied test_detector() from detector.c) in a cpp file and use the shared lib, the detector doesnt detect any objects when using GPU. Have tested it with and without cudnn, same results.

Using the shared lib works fine (same code as above) in another laptop where I compiled without GPU.
scr2

Error when using GPU mode

It is OKay when I compile in CPU mode. However, when I switch to GPU mode, something goes wrong. To be more concrete, (1) running time is exactly the same when I use CPU mode; (2) totally wrong results. Can u help me?

makefile issue

makefile(54) fatal error U1034 synatax error : separator missing

On windows 10
Try using visual studio command prompt, regular cmd and cmder

when compile arapaho folder, there is the error about opencv,how to fix?

/usr/bin/ld: cannot find -lopencv_cudabgsegm
/usr/bin/ld: cannot find -lopencv_cudaobjdetect
/usr/bin/ld: cannot find -lopencv_cudastereo
/usr/bin/ld: cannot find -lopencv_shape
/usr/bin/ld: cannot find -lopencv_cudafeatures2d
/usr/bin/ld: cannot find -lopencv_cudacodec
/usr/bin/ld: cannot find -lopencv_cudaoptflow
/usr/bin/ld: cannot find -lopencv_cudalegacy
/usr/bin/ld: cannot find -lopencv_videoio
/usr/bin/ld: cannot find -lopencv_imgcodecs
/usr/bin/ld: cannot find -lopencv_cudawarping
/usr/bin/ld: cannot find -lopencv_cudaimgproc
/usr/bin/ld: cannot find -lopencv_cudafilters
/usr/bin/ld: cannot find -lopencv_cudaarithm
/usr/bin/ld: cannot find -lopencv_viz
/usr/bin/ld: cannot find -lopencv_cudev
collect2: error: ld returned 1 exit status
make: *** [arapaho] Error 1

No Detection w/ Tiny Yolo

Running on macOS 10.13.1 with OpenCV version 3.4.0 and no GPU, I can't get tiny-yolo.weights to run correctly but I can get yolo.weights to run.

Downloading them from https://pjreddie.com/darknet/yolo/ from the COCO trainval stuff, I can only get the "YOLOv2 608x608" weights to work. I'm running with GPU and CUDNN set to 0, and using the command:

$ ./darknet-cpp detector demo cfg/coco.data cfg/yolo.cfg yolo.weights

This works fine and properly displays its predictions. However, using "Tiny YOLO" weights, and running the command:

$ ./darknet-cpp detector demo cfg/coco.data cfg/tiny-yolo.cfg tiny-yolo.weights

Nothing is detected it just displays the camera output. It is, however, taking a while to run and the FPS is pretty low, so it seems as though something is happening.

Thanks!

Error compiling cuda 8.0

I am getting the following error while compiling with cuda 8.0 and CUDNN 7.0. How can I fix it?

./src/convolutional_layer.c:133:5: error: too few arguments to function ‘cudnnSetConvolution2dDescriptor’
     cudnnSetConvolution2dDescriptor(l->convDesc, l->pad, l->pad, l->stride, l->stride, 1, 1, CUDNN_CROSS_CORRELATION);

/src/cuda.c:38: void check_error(cudaError_t): Assertion `0' failed

In the most recent version, Darknet compiles, arapaho compiles, but when I try to run arapaho.out I get the following error:

layer     filters    size              input                output
    0 CUDA Error: unknown error
arapaho.out: ./src/cuda.c:38: void check_error(cudaError_t): Assertion `0' failed.
[1]    25865 abort (core dumped)  LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./arapaho.out

As per issue #17 I was previously able to run arapaho, but with this new version, I can't. The Makefile I'm using contains:

LDFLAGS= -lm -pthread 
COMMON= 
CFLAGS=-Wall -Wfatal-errors 

OPTS=-O0 -g
CFLAGS+=$(OPTS)

COMMON+= -DGPU -I/usr/local/cuda/include/
CFLAGS+= -DGPU
LDFLAGS+= -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand

COMMON+= -DCUDNN 
CFLAGS+= -DCUDNN
LDFLAGS+= -lcudnn

COMMON+= -DOPENCV
CFLAGS+= -DOPENCV
LDFLAGS+= `pkg-config --libs opencv-3.2.0-dev` 
COMMON+= `pkg-config --cflags opencv-3.2.0-dev` 


arapaho: clean
	g++ test.cpp arapaho.cpp  $(COMMON) $(CFLAGS) -I../src/ -L./ $(LDFLAGS) -ldarknet-cpp-shared -std=c++11 -o arapaho.out

clean:
	rm -rf ./arapaho.out	

And I've made sure that all these flags are matched to the makefile for darknet-cpp-shared itself.

Detection not working with NVIDIA card of compute capability 6.0

Hi,
So, far, I've been successfully testing the arapaho C++ detection samplein an Nvidia card of compute capability 5.2. Now, I want to run some tests in a more powerful card of compute capability 6.0. For that, I have properly modified the darknet Makefile to include the new GPU architecture.

However, once I do that, detection is no longer working, in none of the cards (network is loaded, detection apparently runs -no errors- but no single detection is ever output). From the official Darknet Google Group I see others have succesfully used compute capability 6.0 (and even 6.1)

So, my question is if this repo is compatible with compute_60 or not, and if it would be possible to update whatever necessary for that

Thank you so much in advance

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.