All Projects → ayush1999 → Keras.jl

ayush1999 / Keras.jl

Licence: MIT license
Run keras models with a Flux backend

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to Keras.jl

keras-chatbot-web-api
Simple keras chat bot using seq2seq model with Flask serving web
Stars: ✭ 51 (+168.42%)
Mutual labels:  keras-models
flux-action-class
Boilerplate free class-based action creator. Following flux-standard-action spec. Built with TypeScript. Works with redux and ngrx.
Stars: ✭ 22 (+15.79%)
Mutual labels:  flux
keras tfrecord
Extending Keras to support tfrecord dataset
Stars: ✭ 61 (+221.05%)
Mutual labels:  keras-models
TF-Model-Deploy-Tutorial
A tutorial exploring multiple approaches to deploy a trained TensorFlow (or Keras) model or multiple models for prediction.
Stars: ✭ 51 (+168.42%)
Mutual labels:  keras-models
continuous-analytics-examples
A collection of examples of continuous analytics.
Stars: ✭ 17 (-10.53%)
Mutual labels:  flux
relite
a redux-like library for managing state with simpler api
Stars: ✭ 60 (+215.79%)
Mutual labels:  flux
NaiveNASflux.jl
Your local Flux surgeon
Stars: ✭ 20 (+5.26%)
Mutual labels:  flux
farabio
🤖 PyTorch toolkit for biomedical imaging ❤️
Stars: ✭ 48 (+152.63%)
Mutual labels:  models
react-evoke
Straightforward action-driven state management for straightforward apps built with Suspense
Stars: ✭ 15 (-21.05%)
Mutual labels:  flux
DeepLearningCode
深度学习相关代码
Stars: ✭ 21 (+10.53%)
Mutual labels:  keras-models
assembler
Functional, type-safe, stateless reactive Java API for efficient implementation of the API Composition Pattern for querying/merging data from multiple datasources/services, with a specific focus on solving the N + 1 query problem
Stars: ✭ 102 (+436.84%)
Mutual labels:  flux
django-i18nfield
Store internationalized strings in Django models with full forms support
Stars: ✭ 32 (+68.42%)
Mutual labels:  models
weather app
Study react and redux by a simple application
Stars: ✭ 29 (+52.63%)
Mutual labels:  flux
variant
Variant types in TypeScript
Stars: ✭ 147 (+673.68%)
Mutual labels:  flux
limitless-engine
OpenGL C++ Graphics Engine
Stars: ✭ 95 (+400%)
Mutual labels:  models
hermes-js
Universal action dispatcher for JavaScript apps
Stars: ✭ 15 (-21.05%)
Mutual labels:  flux
GeometricFlux.jl
Geometric Deep Learning for Flux
Stars: ✭ 288 (+1415.79%)
Mutual labels:  flux
traceml
Engine for ML/Data tracking, visualization, dashboards, and model UI for Polyaxon.
Stars: ✭ 445 (+2242.11%)
Mutual labels:  models
LatentDiffEq.jl
Latent Differential Equations models in Julia.
Stars: ✭ 34 (+78.95%)
Mutual labels:  flux
microservice-remote-models
A Lumen package to provide a familiar model paradigm for distributed data.
Stars: ✭ 22 (+15.79%)
Mutual labels:  models

Keras.jl

Load Keras models in Julia.

This is not a wrapper around Keras. This is built on top of Flux, to directly load Keras models into Flux. [W.I.P]

How?

Loading a model in Flux is fairly simple. Clone this repository into ~/.julia/v0.6. Make sure you have all dependencies installed. In order to load a model, you need to have two files:

  1. The model.json file. This stores the structure of the model. This can be obtained from any Keras model using the model.to_json() method.
  2. The weights.h5 file. This stores the weights associated with different layers of the pre-trained Keras model. This file can be produced from a Keras model using Keras.save_weights(weight_file_name).

(The files can have any other name (as long as they are in the correct format). I'm using model.json and weights.h5 as an example here)

Keras models can broadly be divided into two categories:

  1. The models using the sequential API.
  2. The models using the functional API. (Also called Model API)

Due to subtle differences in their structure and functioning, you need to follow different steps to run these models in Flux. You can check the type of the model by:

>>> using Keras

>>> Keras.check_modeltype("model.json")

Running Sequential Models

>>> using Keras

>>> model = Keras.load("model.json", "weights.h5")

model is now the corresponding model in Flux. This can be used directly as:

>>> model(rand(28,28,1,1))

Another straight-forward way of running such models is:

>>> using Keras

>>> Keras.load("model.json", "weights.h5", ip)

Where ip is our input. This directly returns the models output.

Running Functional Models.

Functional models can be tricky as they may consist of a number of sub-graphs within themselves. Running such models is similar to the second way of running Sequential models mentioned above.

>>> using Keras

>>> Keras.load("model.json", "weight.h5", ip)

Where ip is the input to our model. This directly returns the output. (Note: Currently there is no other way of running functional API models).

Intermediate outputs

Keras.jl also allows you to get the intermediate outputs of a model. Suppose your model contains m layers, and you need the output after n layers (m > n).

>>> model[1:n](ip)

Should give you the output after exactly n layers.

Insight

The process of loading and running a Keras model in Flux mainly consists of two parts:

  1. Converting all Keras operators to Flux ops.
  2. Generating the computation graph from the Flux operators obtained.

In order to get correct results, make sure that the value of mode parameter is set to 0 (here). It's default value is 0, so if you haven't played around with NNlib.jl, you're good to go!

Issues

Since this is currently under development, feel free to open any issue you encounter. You can post your queries on Julia Slack, generally on the #machine-learning channel.

Current Impediments:

Lambda layers cannot be handled at this moment. This is because we'd need to handle the Python AST, for parsing it as JSON.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].