GithubHelp home page GithubHelp logo

caffe-yolo's Introduction

Python27

Caffe-YOLO

Introduction

This is a set of tools to convert models from Darknet to Caffe, and in particular to convert the YOLO networks for object detection. For more details, see the paper:

"You Only Look Once: Unified, Real-Time Object Detection" [Redmon2015]

Usage

The repository includes a tool to convert the Darknet configuration file .cfg to the .prototxt definition in Caffe, a tool to convert the weight file .weights to .caffemodel in Caffe and a detection demo to test the converted networks.

Convert the configuration file with:

python create_yolo_prototxt.py tiny-yolo.cfg yolo_tiny

By default, only the deploy prototxt is generate. If the --train option is passed, the train_val version of the prototxt file is generated; however, the file lacks the information about input annotations, training loss and it's meant as a form of partial automation of a manually defined training.

The YOLO weights are available on the YOLO and YOLO v1 websites. See the instructions there on how to download the weight files. To convert them to Caffe, use:

python create_yolo_caffemodel.py yolo_tiny_deploy.prototxt tiny-yolo.weights \
       yolo_tiny.caffemodel

If the number of weights is not compatible with the given prototxt, an error is returned.

Test the results on one of the images in the repository with:

python yolo_detect.py yolo_tiny_deploy.prototxt yolo_tiny.caffemodel images/dog.jpg

By default, the presets for the CoCo networks are used. To use the Pascal VOC preset pass --mode voc option in order to use the correct set of class labels. Classification is also supported for the Darknet networks: use --mode darknet to enable it.

Limitations

The process only supports a limited number of layers and options. The detection layer in YOLO is not implemented and parsing of the network output is left to the caller application.

The most recent yolo and yolo-coco models in Darknet v1 use the Local Convolution layer (convolutions without weight sharing) which is not supported by the official Caffe repository. There is partial support to the version in caffe-mt by passing --loclayer to create_yolo_prototxt.py but the implementation is still buggy.

The shortcut connections introduced in the Darknet v2 YOLO models are also not supported.

Model files

Two models converted from YOLO v2 are available in the prototxt directory:

  • YOLO tiny (CoCo): converted from tiny-yolo.cfg, caffemodel.
  • YOLO tiny VOC: converted from tiny-yolo-voc.cfg, caffemodel.
  • Darknet (Imagenet 1k): converted from darknet.cfg, caffemodel.
  • Tiny Darknet (Imagenet 1k): converted from tiny.cfg, caffemodel

Legacy models

Three converted models from YOLO v1 are available in the prototxt/v1 directory:

  • YOLO tiny: converted from yolov1/tiny-yolo.cfg, caffemodel.
  • YOLO small: converted from yolov1/yolo-small.cfg, caffemodel.
  • YOLO CoCo tiny: converted from yolov1/tiny-coco.cfg, caffemodel.

The models originally converted by xingwangsfu (https://github.com/xingwangsfu/caffe-yolo) are available in the directory prototxt/legacy. The converted weights can be downloaded here:

Requirements

  • Caffe with pycaffe support
  • OpenCV 2 with python interfaces (python-opencv in Ubuntu)

License

The code is released under the YOLO license.

caffe-yolo's People

Contributors

banus avatar xingwangsfu avatar

Watchers

 avatar  avatar

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.