AI and Machine learning workshop
January 2021
https://teachablemachine.withgoogle.com/train/image
To save some time ahead of tomorrows session ✨
If your providing your own images of your pet/houseplant 🐶🐱🐹🐠🌱
Keep a few images separate from the main folder that we’ll be working with - we will need them to test with! Can you download one of the folders from here - if your pet is a dog don’t download the dog folder etc
If your not providing your own images :cd: Can you download the ‘provided-images’ folder from here.
Training your model
We're going to train our own model to recognise your pet or houseplant!
if your using your own images you'll need to take out a few images
On the left hand side upload your training images. Dont forget to name them
Click “Train”
Upload any of the images from the test folder to see how accurately it has learnt.
(change the dropdown to file)
Click export model -> and click 'upload my model' Copy the sharable link - we'll use this later
Epochs - an epoch is the number of times your training sample has been through the model - 50 epochs is 50 times through the model. Increasing this can make it more accurate but it can lead to more errors
Batch size - is the number of samples used in an iteration of training
Learning rate - a value too small may result in a long training process that could get stuck, whereas a value too large may result in learning a sub-optimal set of weights too fast or an unstable training process.
Accuracy per class - how accurately it predicted the test samples
Confusion matrix - A confusion matrix summarizes how accurate your model's predictions are. You can use this matrix to figure out which classes the model gets confused about.
Accuracy per epoch - the percentage of classifications that a model gets right during training
Loss per epoch - Loss is a measure for evaluating how well a model has learned to predict the right classifications for a given set of samples. If the model's predictions are perfect, the loss is zero; otherwise, the loss is greater than zero
Apply your model
We need to give the page a title!
We also need a place for someone to insert an image.
Once they have uploaded an image we want to display it on the page First of all we need a place to hold the image Secondly we need to do something with the file when its uploaded
Now we need to submit the button First add a button Second add a function to run when you click that button
When we click submit we want to show a loading icon so we realise something is happening
Now we need to load your model - to do this replace the url with your own one from the previous exercise - or just leave it as is to check for guinea pigs!
We now need to fetch the image - theres some jiggery pokery happening here to get it in the correct format for the library we're using
After the result we will need to show the results and hide the loader
We also need to display the results on the index.html page
The prediction function goes away and comes back with the result and updates the results section with the correct information
20 min theory + intro 40 min exercises
give people something they can take away and refer back too
homework
https://www.tensorflow.org/js/demos
2 part
naive model + train diff pretrained model and run it on some new data
- need to find a way to code online only
google slides + zoom call +
https://codesandbox.io/ https://codepen.io/
guinea pigs vs cats + dogs
Slides
Start here
https://glitch.com/edit/#!/remix/fg-ml-base
Code snippets
https://gist.github.com/apricot13/dde8789027979bf62ae0fba8cfa50532
Final product
https://glitch.com/~fg-basic-ml-example
Take a pre-trained model and apply it using Glitch
Or, experiment with an online demo
Google’s introduction to machine learning
Build deep learning models with tensorflow
Created on: 1st January, 2021
Last updated: 28th October, 2022
Tagged With: