Git Product home page Git Product logo

yolowell's Introduction

yolowell

yolowell is a lib to generate VHDL code of convolutional networks and becomes part of a co-design hardware/software with a simplified version of Darknet running in a NIOS II processor. To improve parameter passing and generate different versions of the architecture better then with TCL or other type of script, we implement all the code in python language with HWToolKit.

How to use

To generate the VHDL code, you will need to extract the weights, bias, and batch normalization params from your Darknet model and write him in binary format. After this, you can set a yaml config file as the following example.

weights_path: "./binary/weights.pickle"
variance_path: "./binary/variance.pickle"
mean_path: "./binary/mean.pickle"
scale_path: "./binary/scale.pickle"
biases_path: "./binary/biases.pickle"
output_path: "./generated"
channels: 3
layer_groups:
- filters: 16
  layers:
  - type: "conv_layer"
    parallelism: 4
    size: 3
    binary: False
  - type: "max_pool_layer"
- filters: 32
  layers:
  - type: "conv_layer"
    size: 3
    binary: True
  - type: "max_pool_layer"

So, you need to set some variables:

  • output_path: path to the generate vhdl files;
  • weights_path: file path to the float weight values in binary format;
  • bn_variance_path: file path to the float variance values from batch normalization in binary format;
  • bn_mean_path: file path to the float mean variance from batch normalization values in binary format;
  • scale_path: file path to the float scale values in binary format;
  • biases_path: file path to the float biases values in binary format;
  • channels: set the input channels of the architecture;
  • filters: number of filters in the current block of layers (layer_groups will a list of dicts);
  • type: "conv_layer" or "max_pool_layer";
  • size: size of the filters (e.g., 3x3 -> 3, 1x1 -> 1);
  • binary: type of operations, false to use multipliers, true to use xor gates;

If you are still here, import NetworkParser and be happy (or not):

from components.network_parser import NetworkParser
from utils import get_std_logger, to_vhdl

get_std_logger()
net = NetworkParser("config.yaml")
layers = net.parse_network()
net.generate(layers, to_vhdl)

References

yolowell's People

Contributors

himewel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

amd-rezaei

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.