lecture 02
Data prep using python
(pandas dataframe)
+
Sound classification with Create ML
+
Python basics 02
SeAts APp SEAtS ApP SEaTS APP
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!!! ๐คฉ
-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!
we can start from scrach,
or from the DataPrep-todo.py
below are steps from textbook Page 312 to 315
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
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 !