GithubHelp home page GithubHelp logo

alexeyab / darknet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pjreddie/darknet

21.5K 21.5K 7.9K 14.41 MB

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )

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

License: Other

Makefile 0.29% Python 4.55% Shell 0.57% Cuda 14.69% C 62.21% C++ 12.49% Batchfile 0.57% C# 0.27% CMake 1.70% PowerShell 2.66%
computer-vision deep-learning deep-learning-tutorial deep-neural-networks dnn neural-network object-detection scaled-yolov4 scaledyolov4 yolo yolov3 yolov4

darknet's People

Contributors

2b-t avatar acxz avatar adujardin avatar alexeyab avatar aughey avatar avensun avatar bouncyphoton avatar cenit avatar cyyever avatar davidssmith avatar duohappy avatar enesozi avatar ilyaovodov avatar imaami avatar jaledmc avatar judwhite avatar jveitchmichaelis avatar lineofbestgit avatar marvinklemp avatar mmaaz60 avatar nuzhny007 avatar pjreddie avatar renaultfernandes avatar stephanecharette avatar tiagoshibata avatar tigerhawkvok avatar tinohager avatar tomheaven avatar vinjn avatar willbattel 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  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

darknet's Issues

Some questions regarding training and detection(test) images and their sizes

Hello,

  1. When we gather the training images, all of them should have the same size (resolution)? for example 800 * 600

  2. if we train the YOLO (height and width of the Net) with 416 * 416, then the test images or input camera resolution should be 416 * 416 or an integer multiplication result of 416 * 416? for example (416 * 2 = 832 * 832)?

if Yes, then we should change the 416 * 416 to the input camera or test image resolution (for example 1024 * 768)?

  1. How the batch and subdivision parameters are calculated in case of changing the height and width of the Net?

Problem with multi-threading in detector.c

Hi @AlexeyAB ,
I am trying to validate face detector that I trained on WIDER dataset
The problem is validation set contains 3226 images, but when I call validate_detector function, it processes sometimes all the 3226 images, sometimes 1044 and sometimes 1956.
For example, in this screenshoot it is 1956 images
image


Could you help me to figure out the problem? I think it has something to do with threading, but I am not sure since I myself never had experience with multi-threading.

When I process 3226 with single thread (nthreads = 1), it is only processing first 1044 images.

only modification I did is in the for block as below, plus adding print_wider_detections function.

for(i = nthreads; i < m+nthreads; i += nthreads){
        fprintf(stderr, "%d\n", i);
        for(t = 0; t < nthreads && i+t-nthreads < m; ++t){
            pthread_join(thr[t], 0);
            val[t] = buf[t];
            val_resized[t] = buf_resized[t];
        }
        for(t = 0; t < nthreads && i+t < m; ++t){		
	    args.path = paths[i+t];
            args.im = &buf[t];
            args.resized = &buf_resized[t];
            thr[t] = load_data_in_thread(args);
        }
        for(t = 0; t < nthreads && i+t-nthreads < m; ++t){
            char *path = paths[i+t-nthreads];
	    printf("m = %d,\ti = %d \titer = %d\n\n",m,i, i + t - nthreads);
            char *id = basecfg(path);
            float *X = val_resized[t].data;
            network_predict(net, X);
            int w = val[t].w;
            int h = val[t].h;
            get_region_boxes(l, w, h, thresh, probs, boxes, 0, map);
            if (nms) do_nms_sort(boxes, probs, l.w*l.h*l.n, classes, nms);
			
	    if (coco){
                print_cocos(fp, path, boxes, probs, l.w*l.h*l.n, classes, w, h);
            } else if (imagenet){
                print_imagenet_detections(fp, i+t-nthreads+1, boxes, probs, l.w*l.h*l.n, classes, w, h);
	    }
	    else if (wider) {
	        print_wider_detections(id, boxes, probs, l.w*l.h*l.n, classes, w, h);
	    }
	    else {
                print_detector_detections(fps, id, boxes, probs, l.w*l.h*l.n, classes, w, h);
            }
            free(id);
            free_image(val[t]);
            free_image(val_resized[t]);
        }
    }

Continue training or train from begining, with modified/increased training/val images ...

Hello,

I've heard if we gather those images which a model finds false positive objects inside, then annotate and add them inside existing images dataset, then we can increase the accuracy of the model dramatically.

in this case, assume that we have trained the model for 2000 iterations and we have a weight file of this. Then we add these new images into the dataset.

Should we start training from the beginning (from 1) or we can continue training by 2001?

Custom training - amount of images needed for training

Hi,

Thanks for sharing your Windows build for darknet, I want to run some custom training but I am unsure as to how many samples I need, I want to train using two extra classes headphones and video cards (I do not need these classes to be generalised) I just need the detection to be done on those particular objects that I have taken pictures from.

I know this question probably doesn't just have one correct answer but thought I'd throw it out there to get an idea in regards to how much labelling I would have to do.

Kind regards,
Waj

How to install Raspberry Pi 3?

Hi, I'm student studying NN with your great source.

Thanks for your project, we succeeded image recognition in window and linux inspite of having trouble with many dependency problems with GPU)

Now we are plan to make a RCcar able to real time detection.

Does It can be possible installing darknet on RaspberryPi 3?
(we are seriously worried about gpu's spec. Your darkent is using CUDA but Rasp doesn't have NVIDIA GPU...........it uses VIDEO CORE IV 3D Graphics core)
or we consider to approach another way indirectly.

I really*3 look forward to your reply :-D

Graphics Card

Hi guys!

I am going to buy an Nvidia GTX just to use this awsome build of darknet on windows. What would you reccomend? I am thinkig about 1060/1070/(1080). Budget is lower than the 1080's price, I am leaning towards the GTX 1070 but would be happy if the cheaper 1060 would be still okay. Is there anybody who has experience with said type of cards? What are you guys using? I will mostly do test (recognition), not so much traing. What kind of fps results can I expect with the COCO dataset? Do I have to be careful selecting a brand or card? Are there any issues with drivers, or Cuda8? As you can see, I am a bit lost here, so if you know a guide or a wiki, I would be glad for a link.

Thx.

Training images terms and conditions, [net] layer parameters

Hello,

I changed the weight and height of the [net] layers to 544, but this led the model to an strange behavior and as it was iterating more, an un-detection behavior became more powerful and finally it goes to no detection even on Training images!. Do you know why? Strange.

Besides when I look at YOLOv2 544x544 in the Darket website, its cfg files wrote the height and width as 416, why?!

Also I realize that input images' sizes do not affect the consumed GPU memory. This is unique for YOLO because big training images (in size or resolution) would easily lead to out of memory on other models.

demo on video stream

If i try the demo on an rtmp video stream it works but the framerate is not synced.
So the detection works too fast ( eg. stream is 25fps and detection around 40) and video feed freezes until the next chunk.

What do i have to change in the demo.c to make it synced ?

Segmentation fault when training yolo v2 with VOC dataset

Hi,

Currently I got problem when trying to train the darknet with original voc 2007-2012 following the guide in this repo.

My error is always segmentation fault like below:

./darknet detector train cfg/voc.data cfg/yolo-voc.cfg darknet19_448.conv.23
yolo-voc
layer     filters    size              input                output
    0 conv     32  3 x 3 / 1   416 x 416 x   3   ->   416 x 416 x  32
   ....
   30 detection
Loading weights from darknet19_448.conv.20...mj = 0, mn = 1, *(net->seen) = 0
load_convolutional_weights: l.n*l.c*l.size*l.size = 864
...
load_convolutional_weights: l.n*l.c*l.size*l.size = 128000
Done!
Learning Rate: 0.0001, Momentum: 0.9, Decay: 0.0005
Segmentation fault (core dumped)

In more detail, gdb shows this related error:

Core was generated by `./darknet detector train cfg/voc.data cfg/yolo-voc.cfg darknet19_448.conv.23'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  ipl_to_image (src=0xffffffffa0007dc0) at ./src/image.c:461

any hint to resolve this issue?

Darknet can't detect object from train images with threshold = 0.8

I just noticed that I trained Yolo V2 on VOC2007 dataset,and I tested on the training images,find that yolo v2 can't fit the train images ,in other words,i set threshold = 0.8 no bounding box was detected.
I followed your instructions to train ,and checked it for several times,the result didn't change a lot.
I was wondering whether is the lose function of Yolo causing this error?By the way,I did the same test on mxnet-ssd,faster RCNN on caffe,everything was ok,the bounding boxes were detected with probability 1.0.

fine tuning

hi
how i can fine tuning the model?
thanks

Differntiating the detected objects ...

Hi,

Consider that we have a video stream that each frame may include no, one or several detection. for example pedestrian detection. How can we hold the information of each object detection till I don't want or the detection is destroyed?

For example consider we have an image of 10 detected pedestrian. all detected objects belong to one class as pedestrian class, but each person is different and I want to label them in the software as person1, person2 ... person10.

of course this list may be increased or decreased in each frame when new objects come in or old objects get out, but what I want is that each detected object hold its own label even if they belong to a same class.

How can I do this in the code?

How to add new files (header and source to project)

Hi, sorry if my question is trivial, but I am new to windows and visual C.

I wanted to add some additional functions. Therefore, when I added below two Files and then compile, VS is not compiling.

temp_header.h

#pragma once
void some_function();

and
temp_source.cpp


#include <iostream>
#include "temp_header.h"
void some_function() {
	printf("hey I am a definition of the function in temp_header");
}

After adding this, it is not building and giving me a lot of errors.

So I was thinking, maybe I need to perform some extra step when I add new source.

Could you guyz help me out, Alex?

Thanks!

bbox annotations will be loaded automatically if txt file has the same name as image file?

The step 5 in the section How to train (to detect your custom objects) written as:

Create .txt-file for each .jpg-image-file - in the same directory and with the same name, but with .txt-extension,

When training, the detector can find the images from train.txt. If I understand correctly, as long as one create the bbox txt file as the same name as the image file, for example,

  • image file name: car_001.jpg
  • bbox txt file name: car_001.txt

Then the detector can find the corresponding bbox txt file automatically, is it?

A bug with multi-threading? Caffe trains with no problem while Darknet quits during training

Hi @AlexeyAB ,

I am still having training problem darknet.
I posted it in detail at google groups.

However, since problem is occuring on windows port,
I thought you might be the right person to ask for help.

The gpu training is going smooth on caffe, but not Darknet.
So I have been thinking maybe there is some issue with the software and not the hardware.
The copies I produced the error occcured with the YOLOv2 from this repo, nothing I added.

Below is my content that I pasted on
https://groups.google.com/forum/#!topic/darknet/ZCWS6RGMuCM


So I have been using darknet for last 2 months, everything was just perfect.

However, last week program quits during training saying "darknet.exe is accessing the memory location that does not exist", immediately GPU power, temperature goes down.
Error persists even when I set subdivisions=batch=1, so I do not think it is because of the memory. Error occurs after training 1K or 2K or 3K iterations.

A) My first doubt is that it might have something to do with core clocks.
1.darknet is setting core clock=1923/1989 MHz, when training with subdivisions=batch=1 while using 1.3GB of GPU memory

  1. While caffe is setting core clock = 1885 at maximum. while taking 4GB memory for VOC12 classification training on Alexnet (I am just doing this to test GPUs).

B) My second doubt is that maybe it has something to do with my power Supply (it is not related to darknet, but I think you could be help)

power supply 850 Wt
SSD 512GB
HDD 1 TB
CPU Core i7-6800K CPU 3.4GHz(12 CPUs), ~3.4GHz
RAM 16 GB, DDR4

The basis for my doubt is outervision.com power supply calculator recommends me 1200 W PSU even when I excluding GPUs from calculation.
Does that mean I have to buy bigger power supply, but if that is the case why problem does not occur when I train on caffe and occur when I train with darknet?

I also tested my GPU with FUR test and I got above ~7200 score for both of my MSI GTX 1080 Armor GPUs, which seems to be the normal score for 1080.

Any help or suggestions would be appreciated!

Update I:
It is not a temprature issue because when darknet quit, GPU2(darknet was using) did not even hit the 67%.
While at the same time caffe was training on GPU1 with 76% temperature.

Now I am also starting to think maybe it is not even a power issue, because when darknet quit, caffe was working fine.

Update II:
I performed the experiment A) by reversing the GPUs as well.
Meaning I trained caffe on GPU2 and darknet on GPU1/
Stil, darknet quits after some time, caffe does not.

Problem ---> Cuda Error: invalid device function

Hi,
i got a CUDA error and can't solve it.
When i use the darknet_coco or voc.cmd i get the following problem:

CUDA error: invalid device function
CUDA error: invalid device function: No error

darknet_cmd_problem

The darknet_no_gpu.exe works fine. The samples of CUDA are also working.
I use VS2015 Community, CUDA 8.0, OpenCV 2.4.9 and CuDnn 5.1

I hope you can help me!
Thanks in advance

Greetings
Vitali

-nogpu not work

if i call
darknet_no_gpu.exe detector test data/coco.data tiny-yolo-voc.cfg tiny-yolo-voc.weights data/person.jpg -i 10.0

predictions

The result is good, however,since my gpu can work in training but alway out of memory when detection, I build the darknet in gpu. If I call the nogpu function in normal darknet:

darknet.exe -nogpu detector test data/coco.data tiny-yolo-voc.cfg tiny-yolo-voc.weights data/person.jpg -i 10.0
it would be all miserable
predictions2

Using a trained weight in an standalone application

Hello,

How can I use the trained weight in an standalone software?

As I see we have to use Darknet.exe, with some command-line parameters, but is there anyway to have a DLL/module or something like that to be able to load the weight inside another VS project, detect/classify objects and get their coordinates, detection percentage ... and so on?

Greater IoU than Recall?

Hi,
I'm training YOLO over VOC 2007 & 2012. While I want to get the curve of IoU and Recall, I validated every weight in /backup, but I noticed immediately after validating on 2007_test with yolo-voc_100.weights, that the average IoU is 44.04% and Recall 29.57%.
As I see it, IoU is Area of Overlap/Area of Union, and Recall is Area of Overlap/Area of Object, and since Area of Object is no larger than Area of Union, Recall should always be greater than (or equal to) IoU , yet my data shows something different.
Please tell me which part did I get it wrong.

How to train YOLOv2 544x544 ?

thanks alexeyab!
I want more higher mAP, so YOLOv2 544x544 is best choice ,but there is not have train script and cfg file in darknet, Do you have train this resolution?

Train Yolo-2 on a remote server

Hello

My laptop does not have a high end GPU, therefore training a model could take ages with nogpu

DO you know is there anyway to train this on a remote server? most of them run Linux and they say if you want to run a custom task (job), you gonna use Docker. Do you know how?

traing problem:can't load image in linux

@AlexeyAB
Hello
27 route 26 24
28 conv 1024 3 x 3 / 1 13 x 13 x3072 -> 13 x 13 x1024
29 conv 30 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 30
30 detection
Loading weights from darknet19_448.conv.23...Done!
/home/mars/yolo/darknet/data/voc-person/000050.jpg
/home/mars/yolo/darknet/data/voc-person/000089.jpg
/home/mars/yolo/darknet/data/voc-person/000030.jpg
/home/mars/yolo/darknet/data/voc-person/000041.jpg
/home/mars/yolo/darknet/data/voc-person/000104.jpg
/home/mars/yolo/darknet/data/voc-person/000035.jpg
/home/mars/yolo/darknet/data/voc-person/000073.jpg
/home/mars/yolo/darknet/data/voc-person/000017.jpg
Couldn't open file: /home/mars/yolo/darknet/data/voc-person/000050.txt
Couldn't open file: /home/mars/yolo/darknet/data/voc-person/000104.txt
段错误 (核心已转储)
mars@harzone:~/yolo/darknet$ ./darknet imtest /home/mars/yolo/darknet/data/voc-person/000050.jpg
/home/mars/yolo/darknet/data/voc-person/000050.jpg
L2 Norm: 347.581116

Linux
when i train my new class ,why it cannot load images? but i can imtest it????
thanks.

Builds fine on Windows 10 but cannot run the executable

I'm trying to build in Windows 10. VC creates the executable for me. But I'm not able to run it. Windows complains - "The application was unable to start corectly (0xc000007b). Click OK to close the application"

Should I make any changes to the VC project before building?

how to track objects using darknet

darknet has good performance on object detection, is it possible to track objects, e.g, with IDs for different objects in a video? thank you

Image size

@AlexeyAB if I use 416x416 in my config file, do I have to resize all my images to 416x416? If not, does darknet take in images of varying sizes or aren't square?

data.h #includes non-Windows pthread.h

After installing Visual Studio 2015 Community 14.0.25431.01 Update 3, CUDA 8.0, and OpenCV 2.4.9 as linked, attempting to build build\darknet\darknet.sln results in "Cannot open include file: 'pthread.h'", and therefore "Identifier "pthread_t" is undefined" later in data.h. Does this project have an undocumented dependency on some Linux-compatibility package? Like, for instance: https://technet.microsoft.com/en-us/library/bb463209.aspx If so, which pthread library is working for you to build under Windows?

Yolo training

Hello,

is there anyway to pause the Yolo training at some stages (to turn off the computer or something like that) and then re-train it some time later from where it has paused?

how to use Win32 compile the project?

hello ,I have compiled the project with x64 successful. but now , I want to use Win32 to compile the project , my environment is VS2013 that have update5, CUDA 8.0 . I changed the 3rdparty path to x86 as corresponded. but when I compile the project. there is some errors about CUDA. can you help me ? thank you very much.

Train Yolo2 with custom data, yolo-obj.cfg file

Hello,

In the description you have mentioned:

  • change line filters=425 to filters=(classes + 5)*5

inside yolo-voc.cfg , I could not find the filters=425 phrase. Several filters= ... exist inside this file, which one should be modified?
or I have to modify them all?

I think you meant the last convolution layer

Assertion `l.outputs == params.inputs' failed

I made changes according to the steps mentioned in 'How to make train for custom objects' but I am getting this error:

darknet: ./src/parser.c:242: parse_region: Assertion `l.outputs == params.inputs' failed.
Aborted (core dumped)

What does this mean and how do i solve it?

Training trick ...

Hello,

is it good that we stop straining after 1000 iterations and continue training with yolo-obj_1000.weights?

or is it good that we go from the beginning to end with darknet19_448.conv.23?

My personal assumption is the first one, I mean interruption at 1000 (or maybe sooner) and continue with the new weights, which I believe it will deliver higher accuracy/mAP, but you please confirm the best.

I asked this in a new topic because it was different and it could be helpful for others as well. Thanks.

RE: Average Loss accelerates to infinity

I don't know why but the training doesn't seem to be working well.

It is gradually descending in the loss function but approaching a meager value of 1.4 then accelerates up to very large numbers 100,000-1,000,000. And mind you I am only at 400 counts, no where close to the suggested approx. 5000 for training 5 classes.

Thank you so much for any advice.

PS. I also turn random=1 and same result

Weights of YOLO 2

Hello,

The pre-trained weights which you have mentioned in the description, I mean darknet19_448.conv.23, refers to the 416 *416 resolution?

What about if we use the YOLO2 weights in its website in accompany with modified .cfg files?

2017-02-04_11-40-22

How can we compile a Debug version of YOLO v2?

I have tried to change the setting of Visual Studio to Debug, the compilation is successful. But the break point I set didn't work at all. Would it be possible to debug this program? Thanks.

Missing runtime dependencies

After successfully compiling darknet following the README, trying to detect with tiny-yolo fails because opencv_core249.lib isn't on the PATH (because the link in the readme just extracts the files to a particular location and doesn't add anything to the path). Adding the OpenCV lib path to PATH fixes this problem, but then cublas64_80.dll can't be found. Adding the CUDA path to PATH mysteriously does not fix this problem (see screenshot). What is the proper way to make sure darknet knows where to find its dependencies at runtime?
missingruntime

Problem with tiny models

Hi guys,

The larger models work perfectly well and produce good results. However, when I run it with the tiny models it produces no output, I use the -c flag and it just shows the raw image with no detections. I have tried reducing the -thresh to a very low number but it still produces no output, when -thresh is set to zero it only shows "person", so I am guessing the model has only been trained using people?

Kind regards,
Waj

Multiclass detection?

Just a quick question about multiclass detection.
Can i make for example 3 classes where 1 class combines images of the two other classes so that i get a specialized detection ?
Like for example make a class car with photos of cars and 2 specialized classes with Lamborghini and Ferari so that my output would be something like:
90% car
75% Lamborghini
with practically nearly identical bounding boxes.
Is this possible and is this the way you qould do something like that ?

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.