Giter Club home page Giter Club logo

swifty-ml's Introduction

Swifty-ML

Train and convert Keras models to Core ML models easily

Features

  • Train a CNN with only images
  • Convert pre-trained keras models to Core ML models
  • Train and Convert a CNN into a Core ML Model
  • Edit attributes of existing Core ML Models

Why does this exist?

Swifty-ML allows developers with no experience in ML to create classifiers and improve their apps. It's also good for playing around!

Requirements

Usage

To train a model using Swifty-ML, run the following command in terminal.

python modeler.py train path/to/data inceptionv3

This usually takes a very long time, even with a good laptop, but once finished, there will be two files. A Core ML Model and a Keras .h5 model. Saved in exported_models/coreml and exported_models/keras respectively. The system also saves the state of the model during training after each epoch.

To edit a coreml model...

python modeler.py edit path/to/coreml/model.mlmodel

To convert a Keras model (.h5) to CoreML format

python modeler.py convert-pre-trained path/to/keras/model.h5

Data Directory Format

The format for training and validation images must be the following

.
├── training
│   ├── class1
│   ├── class2
│   └── class3
└── validation
    ├── class1
    ├── class2
    └── class3

If I was training a network on images of the different flags, I would have a structure like so...

.
├── training
│   ├── belgium
│   ├── canada
│   └── unites_states
└── validation
    ├── belgium
    ├── canada
    └── unites_states

Note: training and validation cannot change, but the sub folders' names can, and will be the class labels for the images inside them.

Installing Core ML Tools on Python 3.6

As of now, Core ML Tools does not provide support for Python 3.6 via pip. Instead, you will need to download the latest version from their GitHub and install it manually.

https://github.com/apple/coremltools

After downloading the project, cd into the project and run

python setup.py install

Supported models

As of now, only a few model architectures are supported. In the future, all models supported by both coremltools and keras will be supported.

Future models include

  • Xception
  • VGG16
  • VGG19
  • ResNet50
  • InceptionV3
  • InceptionResNetV2
  • MobileNet

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.