...
Keras 1.2.2 with MXNet Backend
Highlights
- Adding Apache MXNet backend for Keras 1.2.2.
- Easy to use multi-gputraining with MXNet backend.
- High-performance model training in Keras with MXNet backend.
Getting Started Resources
- Installation - https://github.com/dmlc/keras/wiki/Installation
- How to use Multi-GPU for training in Keras with MXNet backend - https://github.com/dmlc/keras/wiki/Using-Keras-with-MXNet-in-Multi-GPU-mode
- For more examples explore keras/examples directory.
- Source Repo - https://github.com/dmlc/keras
For more details on unsupported functionalities, known issues and resources refer to release notes - https://github.com/dmlc/keras/releases
Apple CoreML Converter
You can now convert your MXNet models into Apple CoreML format so that they can be run on Apple devices which means that you can build your next iPhone app using your own MXNet model!
This tool currently supports conversion of models that are similar to:
- Inception
- Network-In-Network
- Squeezenet
- Resnet
- Vgg
List of layers that can be currently converted: Activation, Batchnorm, Concat, Convolution, Deconvolution, Dense, Elementwise, Flatten, Pooling, Reshape, Softmax, Transpose.For more details on how to convert the models, refer to https://github.com/apache/incubator-mxnet/tree/master/tools/coreml
Requires:
- MacOS - High Sierra 10.13
- Xcode 9
- Coremltools 0.5.0 or greater (pip install coremltools)
- Mxnet 0.10.0 or greater (Installation Instructions)
- Yaml (pip install pyyaml)
- Python 2.7
- Coremltools 0.5.0 or greater Yaml (Pyyaml)
Example:
In order to convert, say a squeezenet model, you'll have to:
- Download the MXNet version of the model from here: http://data.mxnet.io/models/imagenet/squeezenet/
Execute the following command (assuming you are in the directory where mxnet_coreml_converter.py resides):
python mxnet_coreml_converter.py --model-prefix='squeezenet_v1.1' --epoch=0 --input-shape='{"data":"3,227,227"}' --mode=classifier --pre-processing-arguments='{"image_input_names":"data"}' --class-labels classLabels.txt --output-file="squeezenetv11.mlmodel"
In the command above:
model-prefix: MXNet model prefix (may include the directory).
epoch: The suffix of the MXNet model file.
input-shape: Input shape information in a JSON string format where the key is the name of the input variable (="data") and the value is the shape of that variable.
mode: Coreml model mode. Can either be 'classifier', 'regressor' or None. In this case, we use 'classifier' since we want the resulting CoreML model to classify images into various categories.
pre-processing-arguments: In the Apple world images have to be of type Image. By providing image_input_names as "data", we are saying that the input variable "data" is of type Image.
class-labels: The name of the file which contains the classification labels (a.k.a. synset file).
output-file: The file where the CoreML model will be dumped.
You can find more detailed explanations as well as more examples of the converter here.
In order to use the generated CoreML model file into your project, refer to Apple's tutorial here.