All Projects → xmartlabs → Bender

xmartlabs / Bender

Licence: other
Easily craft fast Neural Networks on iOS! Use TensorFlow models. Metal under the hood.

Programming Languages

swift
15916 projects
Metal
113 projects
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Bender

Iresnet
Improved Residual Networks (https://arxiv.org/pdf/2004.04989.pdf)
Stars: ✭ 163 (-90.57%)
Mutual labels:  deep-neural-networks, convolutional-neural-networks, neural-networks
Hyperdensenet
This repository contains the code of HyperDenseNet, a hyper-densely connected CNN to segment medical images in multi-modal image scenarios.
Stars: ✭ 124 (-92.82%)
Mutual labels:  deep-neural-networks, convolutional-neural-networks, neural-networks
Livianet
This repository contains the code of LiviaNET, a 3D fully convolutional neural network that was employed in our work: "3D fully convolutional networks for subcortical segmentation in MRI: A large-scale study"
Stars: ✭ 143 (-91.72%)
Mutual labels:  deep-neural-networks, convolutional-neural-networks, neural-networks
Easy Deep Learning With Keras
Keras tutorial for beginners (using TF backend)
Stars: ✭ 367 (-78.76%)
Mutual labels:  deep-neural-networks, convolutional-neural-networks, neural-networks
Top Deep Learning
Top 200 deep learning Github repositories sorted by the number of stars.
Stars: ✭ 1,365 (-21.01%)
Mutual labels:  deep-neural-networks, convolutional-neural-networks
Paddlex
PaddlePaddle End-to-End Development Toolkit(『飞桨』深度学习全流程开发工具)
Stars: ✭ 3,399 (+96.7%)
Mutual labels:  deep-neural-networks, neural-networks
Pytorchnlpbook
Code and data accompanying Natural Language Processing with PyTorch published by O'Reilly Media https://nlproc.info
Stars: ✭ 1,390 (-19.56%)
Mutual labels:  deep-neural-networks, neural-networks
Deep architect
A general, modular, and programmable architecture search framework
Stars: ✭ 110 (-93.63%)
Mutual labels:  deep-neural-networks, neural-networks
Grenade
Deep Learning in Haskell
Stars: ✭ 1,338 (-22.57%)
Mutual labels:  deep-neural-networks, convolutional-neural-networks
Ssd Pytorch
SSD: Single Shot MultiBox Detector pytorch implementation focusing on simplicity
Stars: ✭ 107 (-93.81%)
Mutual labels:  deep-neural-networks, neural-networks
Deephyper
DeepHyper: Scalable Asynchronous Neural Architecture and Hyperparameter Search for Deep Neural Networks
Stars: ✭ 117 (-93.23%)
Mutual labels:  deep-neural-networks, neural-networks
Awslambdaface
Perform deep neural network based face detection and recognition in the cloud (via AWS lambda) with zero model configuration or tuning.
Stars: ✭ 98 (-94.33%)
Mutual labels:  deep-neural-networks, convolutional-neural-networks
Har Keras Cnn
Human Activity Recognition (HAR) with 1D Convolutional Neural Network in Python and Keras
Stars: ✭ 97 (-94.39%)
Mutual labels:  deep-neural-networks, convolutional-neural-networks
Sigmoidal ai
Tutoriais de Python, Data Science, Machine Learning e Deep Learning - Sigmoidal
Stars: ✭ 103 (-94.04%)
Mutual labels:  convolutional-neural-networks, neural-networks
Pytorch Learners Tutorial
PyTorch tutorial for learners
Stars: ✭ 97 (-94.39%)
Mutual labels:  deep-neural-networks, convolutional-neural-networks
Faceswap
Deepfakes Software For All
Stars: ✭ 39,911 (+2209.66%)
Mutual labels:  deep-neural-networks, neural-networks
Lenet 5
PyTorch implementation of LeNet-5 with live visualization
Stars: ✭ 122 (-92.94%)
Mutual labels:  deep-neural-networks, convolutional-neural-networks
Jsnet
Javascript/WebAssembly deep learning library for MLPs and convolutional neural networks
Stars: ✭ 126 (-92.71%)
Mutual labels:  convolutional-neural-networks, neural-networks
Chainer Cifar10
Various CNN models for CIFAR10 with Chainer
Stars: ✭ 134 (-92.25%)
Mutual labels:  convolutional-neural-networks, neural-networks
Breast Cancer Classification
Breast Cancer Classification using CNN and transfer learning
Stars: ✭ 86 (-95.02%)
Mutual labels:  deep-neural-networks, convolutional-neural-networks

Bender

Build status Platform iOS Swift 4 compatible CocoaPods compatible Carthage compatible License: MIT

Bender

Bender is an abstraction layer over MetalPerformanceShaders useful for working with neural networks.

Contents

The documentation can be found under the Documentation folder:

  • API contains the most important information to get started.
  • Supported Layers explains which layers are supported and how they map to TensorFlow ops.
  • Importing explains how to import models from other frameworks such as TensorFlow. You can also find information on how to enhance this functionality for custom implementations.

Introduction

Bender is an abstraction layer over MetalPerformanceShaders which is used to work with neural networks. It is of growing interest in the AI environment to execute neural networks on mobile devices even if the training process has been done previously. We want to make it easier for everyone to execute pretrained networks on iOS.

Bender allows you to easily define and run neural networks using the most common layers like Convolution, Pooling, FullyConnected and some normalizations among others. It is also flexible in the way it receives the parameters for these layers.

We also want to support loading models trained on other frameworks such as TensorFlow or Caffe2. Currently Bender includes an adapter for TensorFlow that loads a graph with variables and "translates" it to Bender layers. This feature supports a subset of TensorFlow's operations but we plan to enhance it to cover more cases.

Why did we need Bender?

At Xmartlabs we were about to start a Machine Learning project and investigated frameworks to use in iOS. We found MetalPerformanceShaders useful but not very user friendly and we saw ourselves repeating a lot of code and information. That is why we starting building a framework to handle that kind of stuff.

We also found ourselves creating scripts to translate the models we had from training with TensorFlow to iOS. This means transposing the weights to the MPSCNN format and also mapping the parameters of the different kinds of layers in TensorFlow to the parameters used by the MPSCNN kernels. TensorFlow can be compiled for iOS but currently it does not support running on GPU which we wanted to do. We also did not want to include TensorFlow's static library into our project. This is why we also started to work on an adapter that would parse a TF graph and translate it to our Bender layers.

Usage

You can define your own network in Bender using our custom operator or you can load a model exported from TensorFlow. Defining a network and loading a model can be done like this:

import MetalBender

let url = Bundle.main.url(forResource: "myModel", withExtension: "pb")! // A TensorFlow model.
let network = Network.load(url: url, inputSize: LayerSize(h: 256, w: 256, f: 3))

network.run(input: /* ... */) { output in
    // ...
}

You can read more information about this in Importing.

If you want to define your network yourself you can do it like this:

let network = Network(inputSize: LayerSize(h: 256, w: 256, f: 3))

network.start
    ->> Convolution(convSize: ConvSize(outputChannels: 16, kernelSize: 3, stride: 2))
    ->> InstanceNorm()
    ->> Convolution(convSize: ConvSize(outputChannels: 32, kernelSize: 3, stride: 2), neuronType: .relu)
    ->> InstanceNorm()
    ->> FullyConnected(neurons: 128)
    ->> Neuron(type: .tanh)
    ->> FullyConnected(neurons: 10)
    ->> Softmax()
// ...

and once you're done with all your layers:

network.initialize()

To know more about this have a look at API.

Requirements

  • Xcode 9
  • iOS 11.0+ (but deployment target is iOS 10.0, so iOS 10 is supported)

Getting involved

  • If you want to contribute please feel free to submit pull requests.
  • If you have a feature request please open an issue.
  • If you found a bug or need help please check older issues, FAQ and threads on StackOverflow before submitting an issue.

Before contribute check the CONTRIBUTING file for more info.

If you use Bender in your app We would love to hear about it! Drop us a line on Twitter.

Examples

Follow these steps to run the examples:

  • Clone Bender repository (or download it).
  • Run carthage update --platform iOS in the downloaded folder.
  • Open Bender workspace and run the Example project.

There is an Image recognition example which includes a MobileNet model in Bender and one in CoreML. It is also set up to run an Inception model but you will have to download it separately as it is almost 100 MB in size. You can download it from http://download.tensorflow.org/models/inception_v3_2016_08_28.tar.gz but then you have to freeze it and add it to the 'Example' Xcode project as 'inception_v3.pb'.

Installation

CocoaPods

To install Bender, simply add the following line to your Podfile:

pod 'MetalBender', '~> 0.5'

Remember that Bender compiles for iOS 10. So you must add platform :ios, '10.0' to your Podfile

Carthage

Carthage is a simple, decentralized dependency manager for Cocoa.

To install Bender, add the following line to your Cartfile:

github "xmartlabs/Bender" ~> 0.5

Then run:

carthage update --platform iOS

Finally, drag the built .framework binaries for MetalBender, MetalPerformanceShadersProxy and SwiftProtobuf to your application's Xcode project.

Author

Change Log

This can be found in the CHANGELOG.md file.

License

FOSSA Status

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].