Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BeerClassifier

Classify your beer bottle images using Core ML and Keras / Turi Create.
Demo app for this presentation: Core ML 🏃 iOS Engineer

Note that after I tap Download New Model, app starts recognizing Ho*gaarden as well.

Requirements

  • Swift 4.2
  • Xcode 10.0
  • Python 3.6
  • virtualenv
  • pip

Setup

virtualenv -p python3 ./
source ./bin/activate
pip install -r requirements.txt

Usage

Before running any script, run:

source ./bin/activate

General scripts

scraper.py

Downloads images using Microsoft Cognitive API. Note that you need to register Azure and set your azure key as AZURE_KEY in .env.

python scripts/scraper.py

quantize.py

python scripts/quantize.py -i ./models/BeerClassifier.mlmodel -o ./models/BeerClassifierQuantized.mlmodel

Keras-targetted scripts

keras/preprocess.py

Crops and resize all images.

python scripts/keras/preprocess.py

keras/create_data_csv.py

Creates train_data.csv and test_data.csv.

python scripts/keras/create_data_csv.py

keras/train.py

Trains using collected images to create model file.

python scripts/keras/train.py

keras/hdf5_to_mlmodel.py

Converts keras model (in HDF5) file to .mlmodel format.

python scripts/keras/hdf5_to_mlmodel.py

TuriCreate-targetted scripts

turicreate/convert_image_format.py

Convert images to turicreate-supporting formats.

python scripts/turicreate/convert_image_format.py

turicreate/create_sframe.py

Create an sframe file from prepared images.

python scripts/turicreate/create_sframe.py

turicreate/train.py

Trains using prepared images and and sframe file to create model file.

python scripts/turicreate/train.py

About

Sample app to classify beer bottle using Keras / Turi Create and Core ML.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages