lecture 03
Convert trained model with Python and CoreML Tool
+
Style classification app
+
Python basics revisited
SeAts APp SEAtS ApP SEaTS APP
open anaconda
create an environment
with python 3.6
(what's this???)
select that new environment in anaconda
spyder disappears!
because this is a new environment!
install spyder
as usual, an AI-related project to wake us up
after today's lecture:
-- three levels of "readiness" of ML model
-- how to convert trained models from other formats into Apple's mlmodel ๐Ÿฅฐ
-- a deeper understanding of python ๐Ÿ˜‰
(this is just our third python time!) ๐Ÿซก
three stages of ML model
level 1: not ready at all
- newborn, needs training from scratch
level 2: trained, but on a different datasets/tasks
- needs fine-tuning (popular approach and we have seen this already)
level 3: trained, on the exactly same dataset and task
- everything is ready ๐Ÿง
Today we will be looking at the level 3, aka the most ready ML models. No training is needed.
so, can we just download the trained models and dra-n-drop them into the xcode project?
- nope
deep learning frameworks: caffe, pytorch, tensorflow, etc.
models trained using different frameworks have different formats and Apple can't just directly take these formats in.
Apple ML ecosystem has its own ML model format!

caffe: .caffemodel and .prototxt
pytorch: .pt
tensorflow: .tf2 and more
๐ŸŽ: .mlmodel
like how you convert between audio/video formats
e.g.
.mp3 to .wav,
or .mp4 to .mov
we need to convert ML models into apple's .mlmodel
This part is handy when you want to plugin and play a trained model downloaded from github/huggingface, etc.
1. convert caffe model to .mlmodel
download this repo
caffe model zoo
import the model into style classification model and play
fun ai time part 1
2. convert pytorch model to .mlmodel
torch model zoo
recap from last lecture 01
How can we numerically represent audios and images in python?
-- There are libraries that read them into numbers...
How are these numbers being stored in python?
-- Numpy arrays !!! ๐Ÿ’ฅ๐Ÿ’ฅ๐Ÿ’ฅ
recap from last lecture 02
python
- for data pre-processing ๐Ÿ”จ
-- os, makedirs
-- pandas, dataframe
- for holding numbers, arithmetic operations ๐Ÿงฎ
-- numpy
- for reading audio ๐Ÿ”ˆ
-- librosa
- for reading image ๐ŸŽ‡
-- cv2
- for visualizing numbers๐Ÿ‘
-- matplotlib
python note book basics 00
python note book basics 01
- variables
- lists
- conditionals
- loops
- functions
new series episode 2 queer the dataset
new series episode 2 jake elwes
python note book basics 02
fun ai time part 2
summary today
- readiness of ML models ๐Ÿ’ญ
- create new python environment ๐Ÿ’ป
- convert caffe model into .mlmodel๐ŸŽ
- style classification app๐ŸŽ
- python basics enhanced ๐Ÿ’ป