ML Two
Lecture 01
🤗Introduction to ML Two
+
👍First time training an AI model with CreateML: image classification
Welcome 👩‍🎤🧑‍🎤👨‍🎤
First of all, don't forget to confirm your attendence on Seats App!
🎤As usual,
- a made-with-AI music video to wake us up,
- an AI research work that is relevant to that music video,
- more from this researcher Shiry Ginosar
🎊🧧WELCOME TO ML TWO🎊🧧
ML Two keywords:
🔨Making models
🌬️with CreateML
(and some other tools...)
In ML Two, we will:
- train our own AI models🌶️
- see example Apps that integrate a variety of AI models🌶️
- a variety of AI models: computer vision models (classification, object detection, etc.), image generation model, audio synthesis model, large language model, etc.👌
ML Two assessment:
- Part 1: Multiple choice test.
ML Two assessment:
- Part 2: A presentation around a bespoke ML model.
- start thinking about this "bespoke ML model" early!!!
- you can use your ML One presentation proposal as a starting point,
- of course you can also build something new!
- Make good use of CCI resources around, google, your peers, Mick and I 😎
- We also have a fantastic AI and Data Science technician Mayra Berrones 😎
👍First time training an AI model with CreateML: image classification
question time! imagine you are the principal AI engineer at a fast-growing tech startup that is specialised in classifying fruit images being apple🍎 or banana🍌
what skills do you need? what are the steps to take to make a fruit image classification model ? (anything you can think of)
the hidden technical debt in machine learning system
Only a small fraction of real-world ML systems is composed of the ML code
1. DATA PREP
- - data collection
- - data pre-processing
2. TRAINING
- - fine tuning
- - from scratch
3. DEPLOYMENT
- - Apple dev, etc.
1. DATA PREP
- - data collection (p)
- - data pre-processing (p)
2. TRAINING
- - fine tuning (p,c)
- - from scratch (p,t)
3. DEPLOYMENT (c)
p: python 🐍
C: CoreML and CreateML 🍎🤖
Let's start building the fruit classification model🍎🍏!
We will be following this typical ML dev pipeline:
1. DATA PREP
- - data collection
- - data pre-processing
2. MODEL TRAINING
- - train a model in CreateML (super simple)
- - evaluate and improve
3. DEPLOYMENT
step 1 data collection: fruit images dataset

- download this starter project
- put it in a folder for ML Two stuff and unzip
- open *ICDemo-working xcodeproj*
- NOT the ICDemo-starter
- NOT the ICDemo-working mlproj
Step 2 data pre-processing:
- that's just raw data(images scattered in folders), often times we need to preprocess the raw data to our needs!
- this part is usually done by coding in python,
- but CreateML just makes our life easier 🤓
Step 2.1 Summon CreateML 😈
- open Xcode and select Xcode
→ Open Developer Tool
- → Create ML from the drop-down menu
Step 2 data pre-processing:
What data pre-processing do we need in this task?
- For supervised learning, we need data and their labels.
=>
- for image classification, we need images and their classes
=>
- How does CreateML know the corresponding label for each image?
🤗 Label info is inferred from file structure!
- this is also how we should prepare our img classification data (which is already done in this fruit classification example), when using CreateML
- Though when training in python, there are many other ways to feed in labels information...
Step 3 importing dataset into Create ML and training
Let's test the model trained with 25 iterations
How to check if a trained model performs well or not?
In CreateML, we can firstly look at the training/evaluation tab,
where the higher accuracy the better
Secondly, thanks to CreateML, we can live preview the results using camera!
not working great 🫤
this is a good example of "you should not only looking at the accuracies,
but also inputting images to the model and seeing the classification result yourself!"
How to improve?
Check out my model with 150 iterations and added noise & flips as data augmentation!
Let's bring this to our App!
- 1. export the model
- 2. drop the model file to the IOS App code.
😎Done! Here is a summary of what we have done so far:
- 1. Collect a dataset of images of different classes.
- 2. Organise the images into folders with folder name being the class name.
- 3. Open CreateML.
- 4. Drag and drop the images into the data pool.
- 5. Select the hyper-parameters to your liking and hit training!
- 6. Evaluate the results, adjust hyper-parameters, and train again!
- 7. Export the model and drop into the IOS App code.
💙Homework: find an image classification dataset with a NICE file structure (or build your own)
this one for example
train a classifier and import to App
send a demo
We'll see you next week same time same place! 🫡