lecture 4
🍎 construction time:
image similarity
+
speech recognition
image similarity
textbook page 214
create a new Xcode project
->
iOS/App (the default one)
->
next
give it a cute name
as for the interface, make sure SwiftUI (the default one) is selected
->
next
now that the project is created
choose your level of difficulty:
easy mode:
example codes here , under folder "imgsim"
easy mode:
1. under your project, create a new swift file named as Views
2. under your project, create another new swift file named as Similarity
3. download the example codes, unzip and open
how to download from github
easy mode:
4. cut and paste everything FROM
Views.swift
Similarity.swift
ContentView.swift
in the example codes
TO the corresponding files in your new project
just like we did before
boost mode:
1. download the example codes, unzip and put it aside
boost mode:
2. follow the textbook from page 214, cut and paste step by step !
be careful, make sure you delete
- the double quotes "" before and after the block of codes
- and the disclaimer text ("Excerpt From..."")
every time you paste in
boost mode:
if you are uncertain about where (inside which scope) to paste in, use the example codes as reference
both easy and boost mode:
now that you have all the codes ready in place, lets add final magic dusts
both easy and boost mode:
add placeholder to your project's Assets (like we did in previous lectures)
- 1. from downloaded example codes' Assets, drag the placeholer (.imageset)
- 2. drop into YOUR project's Assets
both easy and boost mode:
add privacy - camera usage to info list (like we did in previous lectures)
- 1. select YOUR project's name from the navigator column on the left
- 2. select the tab "info" in the middle of the editor panel
both easy and boost mode:
add privacy - camera usage to info list (like we did in previous lectures)
- 3. Hover over any row, (the first row is called "Bundle name"), click on the plus➕ sign
- 4. select "Privacy - Camera Usage Description" from the dropdown menu
- 5. add customised text to it under "Value" column
connect to your phone, build and play !!!
let's move to speech recognition (i like this app)
textbook page 325
create a new Xcode project
->
iOS/App (the default one)
->
next
give it a cute name
as for the interface, make sure SwiftUI (the default one) is selected
->
next
now that the project is created
choose your level of difficulty:
easy mode:
example codes here , under folder "what_u_saying"
easy mode:
1. under your project, create a new swift file named as Speech
2. download the example codes, unzip and open
easy mode:
4. cut and paste everything FROM
Speech.swift
ContentView.swift
in the example codes
TO the corresponding files in your new project
just like we did before
boost mode:
1. download the example codes, unzip and put it aside
boost mode:
2. follow the textbook from page 325, cut and paste step by step !
be careful, make sure you delete
- the double quotes "" before and after the block of codes
- and the disclaimer text ("Excerpt From..."")
every time you paste in
- if this is too tiring, you can cut things step by step from the example codes, there are comments denoting each step
boost mode:
if you are uncertain about where (inside which scope) to paste in, use the example codes as reference
boost mode:
unfortunately there are two extra steps the textbook forgot to mention
boost mode:
extra step #1:
ADD
import Speech
import AVFoundation
TO the beginnig of your Speech.swift
(you will see errors❌ going away once these two imports are added)
boost mode:
extra step #2:
- open the downloaded example codes
- open ContentView.swift
- copy from line 42 (//extra step 1) to line 71 ( } )
boost mode:
extra step #2:
- switch back to YOUR project
- open ContentView.swift
- scroll down to struct ContentView: View {
- select entire var body: some View{...}
- delete and paste
(this step is to update the entire var body: some View{...} inside struct ContentView: View {} using example codes)
both easy and boost mode:
now that you have all the codes ready in place, lets add final magic dusts
both easy and boost mode:
add AppIcon to your project's Assets (like we did in previous lectures)
- 1. from YOUR proect's Assets, delete the (empty) AppIcon
- 2. from downloaded example codes' Assets, drag the AppIcon
- 3. drop into YOUR project's Assets
like this
both easy and boost mode:
add privacy - microphoe usage to info list (similar to what we did in previous lectures)
- 1. select YOUR project's name from the navigator column on the left
- 2. select the tab "info" in the middle of the editor panel
both easy and boost mode:
add privacy - microphoe usage to info list
- 3. Hover over any row, (the first row is called "Bundle name"), click on the plus➕ sign
- 4. select "Privacy - Microphoe Usage Description" from the dropdown menu
- 5. add customised text to it under "Value" column
both easy and boost mode:
add privacy - speech recognition usage to info list
- 1. Under the same info tab, hover over any row, (the first row is called "Bundle name"), click on the plus➕ sign
- 2. select "Privacy - Speech Recognition Usage Description" from the dropdown menu
- 3. add customised text to it under "Value" column
connect to your phone, build and play !!!
that's all, just one more question and documentation for your interest
what is the input and output of this speech recogniser (model) ?
here is Apple's built-in speech recognizer documentation
homework 💅
here (vid1) and here (vid2) are two nice little neural network introductions of different styles, give these two videos a watch
the first youtuber sometimes talks fast, rewind and rewatch if you find some explanations flying by too fast (this is what i did)
don't pressure yourself on understanding everything from these videos
the home work is only to write down any words and ideas from the videos that are unfamiliar/difficult-to-understand to you
and send this "strange words/ideas list" to me via slack
enjoy and have a nice weekend 🫶