lecture 02
Data prep using python
(pandas dataframe)
+
Sound classification with Create ML
+
Python basics 02
SeAts APp SEAtS ApP SEaTS APP
install this , don't ask
also download this , don't ask
after today's lecture:
-- sound classification with CreateML ๐Ÿ”Š
-- a much deeper understanding of python ๐Ÿ˜‰
(this is just our second python time!) ๐Ÿซก
this lecture will prepare you for our following lectures of training generative AIs, stay tuned!!! ๐Ÿคฉ
an AI-related video project to wake us up
-Part1-
REVISION TIME
last lecture:
part 1. train a classifier from scratch with CreateML (file structure and handy drag-n-drops)
part 2. python basics 01
today's lecture:
part 1. train a sound classifier with CreateML
with data prep using python basics 01
What was in python basics 01?
- variables
- lists
- conditionals
- loops
- functions
an AI-related to wake us up
let's look at exercises from python basics 01
with one thing to add:
Indentation is important in python!
What were the important bits from training an image classifier in CreateML?
- to inform the CreateML what the labels are,
- we need to put images of the same label
- into one folder named by the label
sadly not every classification dataset look like this out-of-box
Exanmine OUR FRESHLY collected dataset for sound classification
unzip the dataset, put it in your MLTwo data folder :)
take a look at what's inside
All files are scrambled in one big folder ๐Ÿฅฒ
interactive classroom Q&A time:
where can I find the labels/classes information?
preview meta/esc50.csv
ask chatgpt what csv is...
Here, each row in "meta/esc50.csv" contains the mapping relation from a filename to its category
we need to use the information in the csv and organize the dataset into the NICE structure for createML
ML system pipeline

DATA PREP
- - data collection (p)
- - data pre-processing (p)
TRAINING
- - fine tuning (p,t,c)
- - from scratch (p,t)
DEPLOYMENT (c)
p: python
t: Turi Create
C: Core ML and Create ML
apparently we need to do some data pre-processing
let's write a cool python script that does the organization! ๐Ÿง‘โ€๐ŸŽค
PREPARE OUR PYTHON IDE (say bye to google colab for now)
install anaconda
install spyder in anaconda (sounds horrible i know) and open it
familiarise ourselves with Spyder interface, it is quite nice!
two tricks in Spyder:
- enter #%% to create new cell
- press shift + enter to run one cell, just like colab notebook!
Python time!
template here
we can start from scrach, or from the DataPrep-todo.py
below are steps from textbook Page 312 to 315
new series -- computational creativity researchers Shiry Ginosar
keywords:
new directory creations,
csv,
dataframe,
iterate rows in a dataframe,
copy-paste files
summon CreateML ๐Ÿ˜ˆ
importing dataset into Create ML and training
textbook p316- 320
-Part2-

Echoing from MLOne (last unit):

- numeric representation
- matrix arithmetic
- layers in neural network
- Apple's Vision framework
Why numeric representation and matrix arithmetic?
To be able to introduce maths, and have computers to help us doing the maths!
Today part 2:
python basics 02
realization of numeric representation and matrix arithmetic using python
with THE library called Numpy
we will be using
this google colab notebook
don't forget to open in playground mode!
summary today 01 ๐ŸŒถ
Create ML
- sound classification
summary today IMPORTANT ๐ŸŒถ๐ŸŒถ๐ŸŒถ
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 !!! ๐Ÿ’ฅ๐Ÿ’ฅ๐Ÿ’ฅ
summary today 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
don't be scared!
you don't have to memorise any of these.
it will become more familiar through experience.
you can always google.
or chatgpt.
homework ๐Ÿง‘โ€๐ŸŽค:
Read and run the cells through all python basics 00, 01, 02
- These three notebooks would provide most basics for training AIs
- There is one last library to go and we will start training cool AIs ourselves
-- I don't want you to miss the fun of those !