Giter Site home page Giter Site logo

caffe-yolov2's Introduction

YOLOv2 using Caffe

This is an implementation for converting YOLOv2 from DarkNet to Caffe, with the option to convert Leaky ReLU to default ReLU instead. It is a minimal fork of this repo, and existing code has not been complemented with any docstrings or comments if they were missing.

For the original YOLOv2 paper, see: "Redmon, Joseph, and Ali Farhadi. “YOLO9000: Better, Faster, Stronger." arXiv preprint arXiv:1612.08242 (2016).

What's inside

  • YOLO to Caffe model converter (thanks to Duangenquan).

Supported models

Tiny YOLOv2: cfg and weights

YOLOv2 without Reorg and Route layers, without weight conversion: cfg

This converter does not support Route and Reorg layers.

Getting started

NOTE The following instructions assume that you already have a running Caffe v1.0 distribution in Python (see here for instructions). Optionally you may make use of the Dockerfile included in this repo, see instructions for usage below.

  1. Download the pre-trained YOLO models (config file .cfg and pre-trained weights .weights).

  2. Convert the config file using create_yolo_prototxt.py:

python create_yolo_prototxt.py -c CFG_INPUT -m PROTOTXT_OUTPUT [--noleaky for replacing Leaky ReLU with ReLU activation]
  1. Convert the pre-trained weights using create_yolo_caffemodel.py:
python create_yolo_caffemodel.py [-h] -m PROTOTXT_INPUT -w WEIGHTS_INPUT -o CAFFEMODEL_OUTPUT

Setup with Docker

Build a Docker image with a minimal Caffe 1.0 installation, using the Dockerfile inside this repo:

docker build --network=host -t caffe-cpu18.04 .

Then create a Docker container based on this image and open a terminal inside:

docker run -v $PWD:/workspace --net=host -it caffe-cpu18.04 /bin/bash
cd /workspace
python3 create_yolo_prototxt.py [with arguments from above]
python3 create_yolo_caffemodel.py [with arguments from above]

Disclaimer

Please note that unlike DarkNet, Caffe does not support default padding in their pooling layers. Depends on your model, you might find a difference in the output size. In our case of tiny-yolo-voc, Darknet produces 13x13x125 output whilst Caffe produces 12x12x125.


Credits

This application uses Open Source components. You can find the source code of their open source projects below. We acknowledge and are grateful to these developers for their contributions to open source.

Project: YoloV2NCS by duangenquan for the YOLOv2 output parser and region parameter implementation

Project: caffe-yolov2 by nodefluxio, serving as the baseline for the YOLOv2 parser.

Project: darknet by pjreddie, the framework YOLOv2 is originally implemented in.

License

The code is released under the YOLO license.

caffe-yolov2's People

Contributors

nvoliver avatar richardharmadi 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.