Giter Site home page Giter Site logo

tianrui / coremltools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from apple/coremltools

0.0 1.0 0.0 16.74 MB

Core ML Community Tools.

License: BSD 3-Clause "New" or "Revised" License

C++ 31.16% Objective-C++ 0.72% Objective-C 0.10% Python 64.62% CMake 0.45% C 1.75% HTML 0.09% JavaScript 0.55% CSS 0.05% Dockerfile 0.37% Shell 0.15%

coremltools's Introduction

Build Status PyPI Release Python Versions

Core ML Community Tools

Core ML community tools contains all supporting tools for Core ML model conversion, editing and validation. This includes deep learning frameworks like TensorFlow, Keras, Caffe as well as classical machine learning frameworks like LIBSVB, scikit-learn, and XGBoost.

To get the latest version of coremltools:

pip install --upgrade coremltools

For the latest changes please see the release notes.

Table of Contents

Neural Network Conversion

Link to the detailed NN conversion guide.

There are several converters available to translate neural networks trained in various frameworks into the Core ML model format. Following formats can be converted to the Core ML .mlmodel format through the coremltools python package (this repo):

  • Caffe V1 (.prototxt, .caffemodel format)
  • Keras API (2.2+) (.h5 format)
  • TensorFlow 1 (1.13+) (.pb frozen graph def format)
  • TensorFlow 2 (.h5 and SavedModel formats)

In addition, there are two more neural network converters build on top of coremltools:

  • onnx-coreml: to convert .onnx model format. Several frameworks such as PyTorch, MXNet, CaffeV2 etc provide native export to the ONNX format.
  • tfcoreml: to convert TensorFlow models. For producing Core ML models targeting iOS 13 or later, tfcoreml defers to the TensorFlow converter implemented inside coremltools. For iOS 12 or earlier, the code path is different and lives entirely in the tfcoreml package.

To get an overview on how to use the converters and features such as post-training quantization using coremltools, please see the neural network guide.

Core ML Specification

  • Core ML specification is fully described in a set of protobuf files. They are all located in the folder mlmodel/format/
  • For an overview of the Core ML framework API, see here.
  • To find the list of model types supported by Core ML, see this portion of the model.proto file.
  • To find the list of neural network layer types supported see this portion of the NeuralNetwork.proto file.
  • Auto-generated documentation for all the protobuf files can be found at this link

User Guide and Examples

Installation

We recommend using virtualenv to use, install, or build coremltools. Be sure to install virtualenv using your system pip.

pip install virtualenv

The method for installing coremltools follows the standard python package installation steps. To create a Python virtual environment called pythonenv follow these steps:

# Create a folder for your virtualenv
mkdir mlvirtualenv
cd mlvirtualenv

# Create a Python virtual environment for your Core ML project
virtualenv pythonenv

To activate your new virtual environment and install coremltools in this environment, follow these steps:

# Active your virtual environment
source pythonenv/bin/activate


# Install coremltools in the new virtual environment, pythonenv
(pythonenv) pip install -U coremltools

The package documentation contains more details on how to use coremltools.

coremltools's People

Contributors

aseemw avatar 1duo avatar slin07 avatar srikris avatar gustavla avatar tobyroseman avatar rehanrishi21 avatar bhushan23 avatar znation avatar dawerg avatar mstronach avatar ghop02 avatar necross avatar keith-wyss avatar rxwei avatar mrfarhadi avatar freedomtan avatar vladx avatar jakesabathia2 avatar diddlypop avatar denmoroz avatar califrench avatar shantanuchhabra avatar sberardi-apple avatar msiracusa avatar tjia1818 avatar okapple avatar mdwelsh-apple avatar agnosticdev avatar mliesenberg avatar

Watchers

James Cloos avatar

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.