xmartlabs/Bender sits at 1.8k stars on GitHub, written primarily in Swift. Easily craft fast Neural Networks on iOS! Use TensorFlow models. Metal under the hood.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Bender is an abstraction layer over MetalPerformanceShaders useful for working with neural networks.
Contents
Introduction
Why did we need Bender
Basic usage
Requirements
Getting involved
Examples
Installation
Changelog
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:
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
Xmartlabs SRL (@xmartlabs)
Change Log
This can be found in the CHANGELOG.md file.
License
Citation
If you use this code in your research please cite us:
@misc{xmartlabs-2017-bender,
author = {Mathias Claassen and Santiago Castro},
title = {Bender: Easily craft fast Neural Networks on {iOS}!},
year = {2017},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://xmartlabs.github.io/Bender/}}
}
The most recent commit recorded on xmartlabs/Bender was 3.0 years ago, based on the GitHub push timestamp. The repository has 88 forks — one of the better signals of community interest.
How many stars does xmartlabs/Bender have?
xmartlabs/Bender has 1.8k GitHub stars — refresh the page for the live number, or check github.com/xmartlabs/Bender. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is xmartlabs/Bender open source?
Yes — xmartlabs/Bender ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/xmartlabs/Bender.
What else is in the AI Tools space?
xmartlabs/Bender is tracked by TopGit under the AI Tools category, alongside 11 GitHub-tagged topics. Trending and Topics pages list peer repositories of comparable stars and language.
What is xmartlabs/Bender?
xmartlabs/Bender (xmartlabs/Bender) is a Swift project on GitHub. From the project's own README: Easily craft fast Neural Networks on iOS! Use TensorFlow models. Metal under the hood.
What language is xmartlabs/Bender written in?
xmartlabs/Bender is written primarily in Swift. GitHub's language field is based on the largest share of bytes in the default branch.
What license does xmartlabs/Bender use?
xmartlabs/Bender is released under the MIT license. Always verify the LICENSE file directly on GitHub for the authoritative terms — license strings can be edited out of sync with a project's actual stance.
Where do I read more about xmartlabs/Bender?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/xmartlabs/Bender is the definitive source.
Read full README in the tab above.
Want a second opinion on Bender?
Ask an AI that can read this page — one click and you get its take on Bender.