Hi, everybody.
Does everybody understand the reference of this title, yeah?
You're old!
[Laughter].
So thank you.
My name is Asim Hussain.
You can find me on Twitter @jawache.
I blog about Angular and JavaScript.
I'm also a cloud developer advocate at Microsoft.
I co-run the a AI JavaScript meet-up group.
We started it early last year when we started to notice that JavaScript and machine learning
were starting to integrate in very, very interesting ways.
We've been running this meet-up for about a year now, and what would happen at the end
of every meet-up is somebody would come up to us and say, "Hey, here's an interesting
link to a JavaScript AI-powered website or application."
What we did is we put all that together into another website called aijs.rocks.
If you go to this website, you can find a whole bunch of different AI-powered JavaScript
applications.
While I do this talk I'm going to quickly go over three of the applications that are
- that you can find on aijs.rocks and very, very briefly explain to you the high level
of what is going on there.
The first one is the Mojifier.
I wrote this one.
It's not trashing, it's just TheMojifier.
If you give it an image.
It detects any faces in the image, and then detects the emotion in the face, and then
finds the appropriate emoji and puts it on the face and pastes it back in.
You can find it on - if you go to TheMojifier.com, you can add it to your own Slack work space.
Here is a picture of my son.
This is exactly how he emojifies!
It works with multiple faces.
There is that meme.
There we go.
It works.
It has finally answered that age-old question which has plagued people for hundreds of years:
there you go!
Answered it!
[Laughter].
So, it's doing quite a few things, but how does it calculate emotion?
I do give workshops or teach people how to do machine learning in JavaScript and I can
teach you how to train a neural network to detect emotion, but when I give these workshops
people come and speak to you afterwards and ask me a question, "I've got this particular
use case, I want to implement it, how do I do it with machine learning?"
I'm like, "There's an API for that."
We are solving all these problems, we have a face API at Microsoft.
It does a whole bunch of different things.
This is how it works.
Post an image to it.
It can actually return for you all the faces in an image plus the emotion s, anger contempt,
disgust, fear, happiness, sadness, surprise.
Hands up if you have a beard?
You can never be 100 per cent happy, I'm really sorry about that.
I'm sorry about that.
You can't be!
That's the first lesson, when you try to delve into the space, you might not necessarily
have to go deep-dive into machine learning.
Check for an API.
A large amount of what we've been doing over the last year as Microsoft has been commoditising
these services for you.
Ttf and MobileNet, afterwards we made this application.
This is a simple CodePen.
As you click on something at the bottom, it's doing a search on unsplash for image.
The percentages in the bottom left-hand side is what we think is inside the image, right?
But puppies is good, I think.
I think we recognise terrier.
The only API request that is beak made here is to un-Spanish for the image.
The detection inside the image is happening in JavaScript in the browser.
Now, it's using a technology called TensorFlow which allows us to run machine learning calculations
of over 100s of GPUs, and CPUs, written in C, and hard-core calculation-focused.
Start of last year, they announced, they announced TensorFlow.js.
I love it when they add .just.
It's like plain jacket potato, but plain jacket potato and butter - better.
This is the cool thing about TensorFlow.js is that this is the only dependency that you
need.
You don't need to install anything else.
It's TensorFlow rewritten from scratch in JavaScript.
That's all you need to do in order to use it.
You can train models, put in data, train it, do the number-crunching computation I agree
aspect of it.
You can load pre-trained models that have been exported in a certain format.
There's now available on the internet, a bunch of pre-trained models that you can start using.
What Oliver used was something called MobileNet which can detect one of 1,000 things in the
world in an image.
Just 1,000 things.
It's been optimised for mobile, you see.
That's what he used, in four lines of code, gave you that functionality there.
Pretty impressive, right?
But this has been optimised for mobile.
It's the size issue, right?
If you really want to detect and get an image and really understand what is inside it, you
need to use a much, much bigger model which has been trained on much, much more data.
Again, you can do that yourself, or API.
Excellent!
Well done.
You can use an API.
There's another one we have in Microsoft.
Everyone's got APIs like this.
We've got one called Computer Vision.
You can give it an image, and one of the amazing things I think is that it can give you a caption,
a human-readable sentence to describe the image.
My friend Sarah actually created a demo to demonstrate this, which is quite useful.
We are supposed to put at tags in or alt tags where images, for screenreaders, you can have
a description of the image if you can't see.
She thought wouldn't be it cool to use it for that purpose?
You can go to the CodePen.
That's the caption that came on to the top.
This is a TV series called Halt and Catch Fire?
Anybody know it?
I have not watched the last episode.
I will never watch the last episode.
It will never end for me!
But this is what it tells you.
It says Mackenzie Davis et al standing in front of a building.
It tells you a lot of clever things.
Twitter is a useful, helpful place.
When you post it on Twitter, people let her know that it didn't work in certain situations.
This image, for instance, star-filled sky, didn't get that one right.
The next one could be right, could be true.
[Laughter].
You don't know, though?
That could be dead stuffed animals on a bed.
You have no idea!
I like the next one because we are half right on the next one.
Half correct.
There you go!
Pretty good.
50 per cent is a pass mark in my book!
I'm not going to summarise it, I'm going to move to the next one.
Image to image.
One of my favourite demos.
It is available on aijs.rocks.
Running in JavaScript in the browser, okay?
You draw an outline of a cat, it draws the rest of the cat!
Okay!
It uses an algorithm called pix2pix, a generative on your neural network, and it takes this
input and outline and it generates an image of a cat.
It doesn't have to work with cats.
It will work with human faces as well.
Now the laughter stops now!
Human faces, okay?
But this isn't a pix2pix algorithm, it's a vid2vid algorithm.
This isn't running in JavaScript yet.
How about this one?
The input doesn't have to be outlined.
The input can be whatever you want it to be.
You can train it up on whatever you want.
This input is a segmented image that gives you depth.
Right?
Again, she's not dancing, that's generated, okay?
The input can even be text.
Right?
Top is text.
The images are the outputs.
Yes?
How far away do you think we are from somebody being able to type "create me an application
use this Azure reference architecture for an e-commerce company based in Japan that
will have this many customers"?
I don't think we are that far off.
That's it.
Thank you very much.
I'm thinking of writing a book on TensorFlow.
If you're interested, sign up. I'm done!
Yes, ten minutes!