Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shingt/beerclassifier
Sample app to classify beer bottle using Keras / Turi Create and Core ML.
https://github.com/shingt/beerclassifier
coreml ios keras python swift vision-framework
Last synced: 17 days ago
JSON representation
Sample app to classify beer bottle using Keras / Turi Create and Core ML.
- Host: GitHub
- URL: https://github.com/shingt/beerclassifier
- Owner: shingt
- License: mit
- Created: 2017-12-15T08:26:04.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T02:02:30.000Z (almost 2 years ago)
- Last Synced: 2024-10-03T16:17:05.538Z (about 1 month ago)
- Topics: coreml, ios, keras, python, swift, vision-framework
- Language: Swift
- Homepage:
- Size: 25.7 MB
- Stars: 11
- Watchers: 3
- Forks: 3
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BeerClassifier
Classify your beer bottle images using Core ML and Keras / Turi Create.
Demo app for this presentation: [Core ML 🏃 iOS Engineer](https://speakerdeck.com/_shingt/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
```sh
virtualenv -p python3 ./
source ./bin/activate
pip install -r requirements.txt
```## Usage
Before running any script, run:
```sh
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`.```sh
python scripts/scraper.py
```### `quantize.py`
```sh
python scripts/quantize.py -i ./models/BeerClassifier.mlmodel -o ./models/BeerClassifierQuantized.mlmodel
```## Keras-targetted scripts
### `keras/preprocess.py`
Crops and resize all images.
```sh
python scripts/keras/preprocess.py
```### `keras/create_data_csv.py`
Creates `train_data.csv` and `test_data.csv`.
```sh
python scripts/keras/create_data_csv.py
```### `keras/train.py`
Trains using collected images to create model file.
```sh
python scripts/keras/train.py
```### `keras/hdf5_to_mlmodel.py`
Converts keras model (in HDF5) file to `.mlmodel` format.
```sh
python scripts/keras/hdf5_to_mlmodel.py
```## TuriCreate-targetted scripts
### `turicreate/convert_image_format.py`
Convert images to turicreate-supporting formats.
```sh
python scripts/turicreate/convert_image_format.py
```### `turicreate/create_sframe.py`
Create an sframe file from prepared images.
```sh
python scripts/turicreate/create_sframe.py
```### `turicreate/train.py`
Trains using prepared images and and sframe file to create model file.
```sh
python scripts/turicreate/train.py
```