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
import the model into style classification model and play
2. convert pytorch model to .mlmodel
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
python note book basics 02
summary today
- readiness of ML models ๐ญ
- create new python environment ๐ป
- convert caffe model into .mlmodel๐
- style classification app๐
- python basics enhanced ๐ป