Giter Site home page Giter Site logo

yad2k's Introduction

YAD2K: Yet Another Darknet 2 Keras

license

Welcome to YAD2K

You only look once, but you reimplement neural nets over and over again.

YAD2K is a 90% Keras/10% Tensorflow implementation of YOLO_v2.

Original paper: YOLO9000: Better, Faster, Stronger by Joseph Redmond and Ali Farhadi.

YOLO_v2 COCO model with test_yolo defaults


Requirements

Installation

git clone https://github.com/allanzelener/yad2k.git
cd yad2k

# [Option 1] To replicate the conda environment:
conda env create -f environment.yml
source activate yad2k
# [Option 2] Install everything globaly.
pip install numpy

pip install tensorflow-gpu  # CPU-only: conda install -c conda-forge tensorflow
pip install keras # Possibly older release: conda install keras

Until Keras PR 5350 is merged:

pip install git+https://github.com/allanzelener/keras.git@func_defaults_to_tuple

Quick Start

  • Download Darknet model weights from the official YOLO website.
  • Convert the Darknet YOLO_v2 model to a Keras model.
  • Test the converted model on the small test set in images/.
wget http://pjreddie.com/media/files/yolo.weights
./yad2k.py cfg/yolo.cfg yolo.weights model_data/yolo.h5
./test_yolo.py model_data/yolo.h5  # output in images/out/

See ./yad2k.py --help and ./test_yolo.py --help for more options.


More Details

The YAD2K converter currently only supports YOLO_v2 style models, this include the following configurations: darknet19_448, tiny-yolo-voc, yolo-voc, and yolo.

yad2k.py -p will produce a plot of the generated Keras model. For example see yolo.png.

YAD2K assumes the Keras backend is Tensorflow. In particular for YOLO_v2 models with a passthrough layer, YAD2K uses tf.space_to_depth to implement the passthrough layer. The evaluation script also directly uses Tensorflow tensors and uses tf.non_max_suppression for the final output.

voc_conversion_scripts contains two scripts for converting the Pascal VOC image dataset with XML annotations to either HDF5 or TFRecords format for easier training with Keras or Tensorflow.

yad2k/models contains reference implementations of Darknet-19 and YOLO_v2.

Known Issues and TODOs

  • Error deserializing Lambda wrapping space_to_depth. Apply this PR to Keras.
    • pip install git+https://github.com/allanzelener/keras.git@func_defaults_to_tuple
  • Add YOLO_v2 loss function.
  • Script to train YOLO_v2 reference model.
  • Support for additional Darknet layer types.
  • Tuck away the Tensorflow dependencies with Keras wrappers where possible.
  • YOLO_v2 model does not support fully convolutional mode.

Darknets of Yore

YAD2K stands on the shoulders of giants.


yad2k's People

Contributors

allanzelener avatar

Watchers

James Cloos avatar Allen 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.