• Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language
    C
  • License
    Other
  • Created over 8 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Extension of the public darknet repository with additional features and code improvements for YOLO.

Darknet Logo

#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.


#About This Fork#

Yolo logo

This fork repository adds additional methods and options to make working with yolo from pjreddie more simple and generic. Several new features include:

(1). Optional arguments passable via terminal call with less stringent order.

(2). Known categories do not longer need to be modified within the source code but can be passed from an external text file at runtime.

(3). A help dialog listing calls and options for yolo.

(4). Additional flags for yolo while training, e.g., arbitrary ending of ground-truth files or selectable number of snapshot iterations.

(5). Test-mode detection on a given file list

(6). More minor improvements.

#Examples# 0. Help dialog
./darknet yolo help
This will print all supported modes to run yolo and lists possible configuration parameters and default values.

  1. Testing ./darknet yolo test cfg/yolo.cfg [path-to-weights]/yolo.weights -c_filename data/dog.jpg -c_classes data/classnames_VOC.txt -draw 1 -write 1 -dest ./bboxes.txt
This runs the pre-trained yolo network on the dog image, drawing bounding boxes to the image, and writing results to the file bboxes.txt
  1. Training
./darknet yolo train cfg/yolo_finetuning_example.cfg [path-to-weights]/extraction.conv.weights -c_fl_train [path-to-your-data]/filelist_train.txt -c_dir_backup [path-to-store-snapshots-in] -c_classes data/classnames_VOC.txt NOTE: you do not longer need to adapt the source code to specify how many and which categories to use. Everything can be adjusted with the external file -c_classes

#Contact# If you have any suggestions for further enhancements or problems with applying the code to your task, contact me at [email protected] . Complementary, you might want to check out the Google Group to seek feedback from a broader audience.


#About The Fork by Guanghan Ning#

Yolo logo

  1. This fork repository adds some additional niche in addition to the darknet from pjreddie. e.g.

    (1). Read a video file, process it, and output a video with boundingboxes.

    (2). Some util functions like image_to_Ipl, converting the image from darknet back to Ipl image format from OpenCV(C).

    (3). Adds some python scripts to label our own data, and preprocess annotations to the required format by darknet.

    ...More to be added

  2. This fork repository illustrates how to train a customized neural network with our own data, with our own classes.

    The procedure is documented in README.md.

    Or you can read this article: Start Training YOLO with Our Own Data.

#DEMOS of YOLO trained with our own data# Yield Sign: https://youtu.be/5DJVLV3P47E

Stop Sign: https://youtu.be/0CQMb3NGlMk

The cfg that I used is here: darknet/cfg/yolo_2class_box11.cfg

The weights that I trained can be downloaded here: (UPDATED 1/13/2016) yolo_2class_box11_3000.weights

The pre-compiled software with source code package for the demo: darknet-video-2class.zip

You can use this as an example. In order to run the demo on a video file, just type:

./darknet yolo demo_vid cfg/yolo_2class_box11.cfg model/yolo_2class_box11_3000.weights /video/test.mp4

If you would like to repeat the training process or get a feel of YOLO, you can download the data I collected and the annotations I labeled.

images: images.tar.gz

labels: labels.tar.gz

The demo is trained with the above data and annotations.

#How to Train With Customized Data and Class Numbers/Labels#

  1. Collect Data and Annotation

    (1). For Videos, we can use video summary, shot boundary detection or camera take detection, to create static images.

    (2). For Images, we can use BBox-Label-Tool to label objects. The data I used for the demo was downloaded from Google Images, and hand-labeled by my intern employees. (Just kidding, I had to label it myself. Damn it...) Since I am training with only two classes, and that the signs have less distortions and variances (compared to person or car, for example), I only trained around 300 images for each class to get a decent performance. But if you are training with more classes or harder classes, I suggest you have at least 1000 images for each class.

  2. Create Annotation in Darknet Format

    (1). If we choose to use VOC data to train, use scripts/voc_label.py to convert existing VOC annotations to darknet format.

    (2). If we choose to use our own collected data, use scripts/convert.py to convert the annotations.

    At this step, we should have darknet annotations(.txt) and a training list(.txt).

    Upon labeling, the format of annotations generated by BBox-Label-Tool is:

    class_number

    box1_x1 box1_y1 box1_width box1_height

    box2_x1 box2_y1 box2_width box2_height

    ....

    After conversion, the format of annotations converted by scripts/convert.py is:

    class_number box1_x1_ratio box1_y1_ratio box1_width_ratio box1_height_ratio

    class_number box2_x1_ratio box2_y1_ratio box2_width_ratio box2_height_ratio

    ....

    Note that each image corresponds to an annotation file. But we only need one single training list of images. Remember to put the folder "images" and folder "annotations" in the same parent directory, as the darknet code look for annotation files this way (by default).

    You can download some examples to understand the format:

    before_conversion.txt

    after_conversion.txt

    training_list.txt

  3. Modify Some Code

    (1) In src/yolo.c, change class numbers and class names. (And also the paths to the training data and the annotations, i.e., the list we obtained from step 2. )

    If we want to train new classes, in order to display correct png Label files, we also need to moidify and run [data/labels/make_labels] (https://github.com/Guanghan/darknet/blob/master/data/labels/make_labels.py)
    

    (2) In src/yolo_kernels.cu, change class numbers.

    (3) Now we are able to train with new classes, but there is one more thing to deal with. In YOLO, the number of parameters of the second last layer is not arbitrary, instead it is defined by some other parameters including the number of classes, the side(number of splits of the whole image). Please read the paper

    (5 x 2 + number_of_classes) x 7 x 7, as an example, assuming no other parameters are modified.  
    
    Therefore, in [cfg/yolo.cfg](https://github.com/Guanghan/darknet/blob/master/cfg/yolo.cfg), change the "output" in line 218, and "classes" in line 222.
    

    (4) Now we are good to go. If we need to change the number of layers and experiment with various parameters, just mess with the cfg file. For the original yolo configuration, we have the pre-trained weights to start from. For arbitrary configuration, I'm afraid we have to generate pre-trained model ourselves.

  4. Start Training

    Try something like:

    ./darknet yolo train cfg/yolo.cfg extraction.conv.weights

#Contact# If you find any problems regarding the procedure, contact me at [email protected].

Or you can join the aforesaid Google Group; there are many brilliant people asking and answering questions out there.

More Repositories

1

cnn-models

ImageNet pre-trained models with batch normalization for the Caffe framework
Python
362
star
2

semantic-embeddings

Hierarchy-based Image Embeddings for Semantic Image Retrieval
Python
263
star
3

cn24

Convolutional (Patch) Networks for Semantic Segmentation
C++
123
star
4

artos

Adaptive Real-Time Object Detection System with HOG and CNN Features
C++
67
star
5

libmaxdiv

Implementation of the Maximally Divergent Intervals algorithm for Anomaly Detection in multivariate spatio-temporal time-series.
C++
61
star
6

alpha_pooling

Code for our paper "Generalized Orderless Pooling Performs Implicit Salient Matching" published at ICCV 2017.
Jupyter Notebook
49
star
7

part_constellation_models

Code for the ICCV 2015 paper "Neural Activation Constellations: Unsupervised Part Model Discovery with Convolutional Networks."
MATLAB
47
star
8

eu-flood-dataset

Dataset with images from the central European flood 2013 for usage in the context of context-based image retrieval.
39
star
9

Felzenszwalb-Segmentation

An easy-to-use Matlab wrapper around the original felzenszwalb segmentation code
C++
26
star
10

deic

Benchmark for Data-Efficient Image Classification
Jupyter Notebook
23
star
11

chimpanzee_faces

Two datasets of chimpanzee faces with curated meta data such as age, gender, and identity.
MATLAB
22
star
12

labelmefacade

LabelMeFacade Dataset
Perl
20
star
13

PartDetectorDisovery

Code of the paper "Part Detector Discovery in Deep Convolutional Neural Networks" by Marcel Simon, Erik Rodner and Joachim Denzler
Python
17
star
14

ITAL

Information-Theoretic Active Learning
Python
14
star
15

cifair

A duplicate-free variant of the CIFAR test set.
Python
14
star
16

finegrained-cvpr2014

Nonparametric part-transfer for fine-grained recognition
MATLAB
13
star
17

activeLearning-GP

This repo contains active learning query strategies as introduced in our GCPR 2013 paper.
MATLAB
11
star
18

aid

Automatic Query Image Disambiguation (AID)
Python
11
star
19

nice-core

Computer vision library with interfaces for IPP and LinAL
C++
11
star
20

ecuador-moths

Images of Ecuador Moths for Fine-grained Recognition
11
star
21

gp-hik-core

Fast Gaussian process inference with HIK
C++
10
star
22

bowInversion

Visualizing quantization effects in common bag-of-visual-words representations fro images.
MATLAB
10
star
23

local_novelty_detection

Local learning for novelty detection
MATLAB
9
star
24

whoGeneric

Generic version of WHO for object detection with LDA models
MATLAB
9
star
25

caffe_pp

Modified version of the caffe CNN framework (https://github.com/BVLC/caffe).
C++
8
star
26

analyzing-chimpanzees

several tasks with chimpanzees, e.g., age recognition, identification, gender prediction, etc.
MATLAB
8
star
27

patchDiscovery

Discover (discriminative) mid-level patches in an (un-)supervised manner.
MATLAB
7
star
28

twitter-flood-dataset

A dataset of images posted on Twitter with flood-related keywords, annotated according to their relevance regarding flood impact analysis.
Jupyter Notebook
7
star
29

caffe_pp2

Custom caffe with signed power, compact bilinear and spatial transformer layer.
C++
6
star
30

chiasmus-annotations

Python
3
star
31

knfst

Kernel Null Foley-Sammon Transform for Novelty Detection
MATLAB
3
star
32

JeFaPaTo

JeFaPaTo - A tool for the analysis of facial features
Python
3
star
33

chiasmus-detector

Python
2
star
34

nee-partitioning

A data-driven approach to partitioning net ecosystem exchange (NEE) using a deep state space model DeepState
Jupyter Notebook
2
star
35

cn24-active

Code for "Active Learning for Deep Object Detection"
C++
2
star
36

moth_scanner_demo

Jupyter Notebook
2
star
37

TensorDecompositions4PINNs

Code accompanying manuscript "Functional Tensor Decompositions for Physics-Informed Neural Networks"
Jupyter Notebook
2
star
38

4DPADCurvAnalysis

Implementation of the 4D curvature analysis for facial behavior analysis using a single Intel RealSense camera.
C++
2
star
39

costarica-moths

Image Dataset of Costa-Rica Moths for Fine-grained Recognition
Shell
1
star
40

scalebar

Python
1
star
41

corc

Computation of Radial Curves
Python
1
star
42

blob_detector

Python
1
star
43

gpapprox

Diagonal Gaussian process approximations
MATLAB
1
star
44

liblinearwrapper

MATLAB
1
star
45

caffe_tools

Matlab wrapper functionality for recent Caffe layout
MATLAB
1
star
46

fve_experiments

Jupyter Notebook
1
star
47

electromyogram

This is a small python package to create a Electromyogram (EMG) plots for facial muscles.
Python
1
star
48

mdi-attribution

This repository contains the source code for the method described in the following publication: Anomaly Attribution of Multivariate Time-Series using Counterfactual Reasoning
Jupyter Notebook
1
star
49

face-projection

This projects main goal is to have a simple library to project information into faces while retaining the facial structure.
Jupyter Notebook
1
star
50

ESPBM

Eye State Prototype Blink Matching
Jupyter Notebook
1
star
51

GradStats4PINNs

This repository contains code accompanying the paper "Gradient statistics based multi-objective optimization in Physics Informed Neural Networks"
Jupyter Notebook
1
star
52

mvlm

Multi-view 3D facial landmarking
Python
1
star