Code Monkey home page Code Monkey logo

keras2go's Introduction

keras2go

English | 中文

  • keras2go uses go code to re-implement the functionality of keras2c
  • keras2go is a library for deploying keras neural networks in pure go, using only standard libraries. It is designed to be as simple as possible for real time applications.

Quickstart

After cloning the repo, install the necessary packages with pip install -r requirements.txt.

  1. Clone the repo
  2. install the necessary packages pip install -r requirements.txt
  3. Run the conversion tool to convert the .h5 model to the implementation of the go code, then run go test
    cd conv_tool
    python -m keras2go --num_tests 15 --model_path ./model.h5 --function_name Example --package_name example
    go fmt *.go
    go test -v .

keras2go can be used from the command line:

    python -m keras2go [-h] [--num_tests] 10 --model_path ./model.h5 --function_name Example2 --package_name example

    A library for converting the forward pass (inference) part of a keras model to a go function
    arguments:
      -t, --num_tests       Number of tests to generate. Default is 10
      -m, --model_path      File path to saved keras .h5 model file
      -f, --function_name   What to name the resulting go function
      -p, --package_name    What to name the resulting go package
      -h, --help            show this help message and exit      

Supported Layers

  • Core Layers: Dense, Activation, Dropout, Flatten, Input, Reshape, Permute, RepeatVector, ActivityRegularization, SpatialDropout1D, SpatialDropout2D, SpatialDropout3D
  • Convolution Layers: Conv1D, Conv2D, Conv3D, Cropping1D, Cropping2D, Cropping3D, UpSampling1D, UpSampling2D, UpSampling3D, ZeroPadding1D, ZeroPadding2D, ZeroPadding3D
  • Pooling Layers: MaxPooling1D, MaxPooling2D, AveragePooling1D, AveragePooling2D, GlobalMaxPooling1D, GlobalAveragePooling1D, GlobalMaxPooling2D, GlobalAveragePooling2D, GlobalMaxPooling3D,GlobalAveragePooling3D
  • Recurrent Layers: SimpleRNN, GRU, LSTM, SimpleRNNCell, GRUCell, LSTMCell
  • Embedding Layers: Embedding
  • Merge Layers: Add, Subtract, Multiply, Average, Maximum, Minimum, Concatenate, Dot
  • Advanced Activation Layers: LeakyReLU, PReLU, ELU, ThresholdedReLU, Softmax, ReLU
  • Normalization Layers: BatchNormalization
  • Noise Layers: GaussianNoise, GaussianDropout, AlphaDropout
  • Layer Wrappers: TimeDistributed, Bidirectional

ToDo

  • test code
  • Core Layers: Lambda, Masking
  • Convolution Layers: SeparableConv1D, SeparableConv2D, DepthwiseConv2D, Conv2DTranspose, Conv3DTranspose
  • Pooling Layers: MaxPooling3D, AveragePooling3D
  • Locally Connected Layers: LocallyConnected1D, LocallyConnected2D
  • Recurrent Layers: ConvLSTM2D, ConvLSTM2DCell
  • Merge Layers: Broadcasting merge between different sizes
  • Misc: models made from submodels

License

MIT

Similar projects

I found another similar projects on Github:

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.