 Can you hear me fine? Yes, sounds like it. Okay Well, it's been a long day for you guys. It's been a long day for me Flying very early this morning from from Paris, but it's good to be here. I hope you have some energy left It's a it's a longer session And so we will have plenty of time and I suggest if you have any questions during the session Please ask your questions. Please raise your hand and we have a microphone somewhere That you can grab and ask your question, okay? I'd rather have a more interactive session than just wait until the end and answer questions on stuff I was talking about 34 minutes ago. Okay, so please raise your hand and ask all your questions so my name is Julian or Julian or Julian or whatever you want to to use that's fine. I'm a tech evangelist For a ws I'm based in the Paris office some sometimes because most of the time I'm really traveling and And talking to developers and like today and that's that's fine I've been with a ws for about a year and a half and before that I was I've spent the last 10 years or so as a CTO and VP engineering in web startups in Paris. Okay So indeed today we're going to talk about artificial intelligence and I'm going to take you on that long journey that started in in the 50s and If everything goes well, we'll end up running some stuff on my Raspberry Pi robot, which is Waiting in the shadow To exterminate us all maybe who knows and and we'll see what we can do with this. Okay? So I'll start with a very quick introduction of AI and and why it's been mostly frustrating so far and then we're going to talk about Amazon AI Why what do we do at Amazon and AWS and Recently fairly recently we've had some some new stuff coming out And then I'm going to talk about and that the most of the presentation actually will focus on An Apache project called MX net Who has already heard of MX net? All right. Well, okay I'm progressing usually it's zero people which is why I'm talking about it So MX net is is a deep learning library, which is extremely developer friendly It's really designed for quick experimentation By developers and by non experts right so I always say you don't have to have a PhD to use MX net and that's fine. That's exactly what we want to do So we'll talk about MX net for a minute, you know the high-level features and so on and then of course we'll go into some demos Using Python code code. What a surprise, right? I can show you some other code if you want, but you're gonna throw stuff at me, right? So it has to be Python today And then of course, I'll point you to some more tools and some more resources to get you started So the story so far. Well, that's it, right? So Who has no idea what this is it's okay if you raise your hand. All right Okay, so you make thank you for make me making me feel very old Yeah, I keep thinking some people in the room are older than me But as time goes by this becomes false and you know all the time So this obviously is from the Stanley Kubrick movie 2001 a space Odyssey if you haven't seen it you have to see this it's a masterpiece and it's the first visual representation of artificial intelligence it came out in 1968 or 1969 and This computer is inside a spaceship and it's really running the ship and the astronauts You know, you even wonder why you have astronauts in there Which is probably why the computer decides to kill them eventually So, you know the end, but you should still see the movie and I guess a lot of geeks like me and computer scientists and researchers have been obsessed with with this You know when when we first saw the movie. This is what we're trying to build right? This is Ultimate artificial intelligence that can understand natural language that can speak That can handle very different and very complex tasks, you know imagine driving a spaceship, you know, how complicated is that? so this is basically what people have been trying to conceive and build over the years and well, have they succeeded and Actually in 2001 The real year 2001 A famous computer scientist called Marvin Minsky is one of the fathers of artificial intelligence. He founded the the AI lab at the MIT and did plenty of other things and Actually was an advisor to Kubrick on the movie, right? So he worked with Kubrick in 68 to design what hell would look like, right? So pretty funny and so in 2001 Minsky wrote a paper said it's 2001. Where is hell? and well, obviously nowhere and It gave a number of reasons why artificial intelligence had not made a lot of progress in 40 or 50 years, right? And he thought we were very still very very far away from having how and I think it's a paradox because in the mid 2000s Machine learning started to explode right and now today everybody who's doing machine learning in the room? See all right, okay. Thank you Everybody right all right at least everybody has machine learning on their resume and that's fair enough, right? I have it So It's a commodity. It's easy to do machine learning You can do you can get some open source libraries. You can grab in, you know, the psychic tools in Python and build Machine learning models in just a few lines of code. You can use cloud-based services. You can use, you know, you have a wide choice. So You know, why did machine learning become so successful? starting in, you know, 2000 Until you know 2010 and now even more so why did this make a lot of progress? And why did AI not make a lot of progress in the same years, right? Well, it's because as you know in machine learning It's all about the features, right? So you it's fairly easy to build a prediction model Provided that you have clear features and actually most of the work of data science is to find what features are useful in the data set How to engineer them how to prepare them so that they can deliver a nice efficient working model Okay, so let's take an example if you have a web log Apache log or something similar and you want to use those logs to predict user activity You know, it could be predict what link they're going to click on but add they're going to click on etc etc typical activities then All the features are pretty much available, right? You just look at what the log has and you know the time and date and and URL and user agent and and Blah blah blah blah and probably 50 more and You just have to figure out which ones a user ID obviously and you have to figure out which ones are the ones that are the most relevant for your machine learning model, okay, and you go and tweak them and combine them and Twist them into form until you have a working model now. Let's take a different problem. Okay Suppose I take a picture of this room, you know, a thousand pixels by a thousand pixels And I want to know who's in the room or what's in the room or is that even a room? I Want to know what the picture is? Okay, so it's a million pixels and if it's a color picture, it's likely that it's actually three million pixels, right? red green and blue So does this mean I have three million features? should I Take those three million features, you know flatten them and and and send them into a prediction model would that work Probably not right. I'm sure some some people have tried but you know, that's not really working And if you think about it, does it even make sense, right? Is every single pixel in this picture? a Useful information right look at your this the seat you're sitting on I mean, it's all gray and it's all the same color So do I need all those individual pixels to figure out? This is a seat and it's gray Again, probably not right common sense tells me no I don't okay But that's the difficulty in in building those smart applications right common sense Human common sense tells us the answer immediately if we brought a five-year-old kid a five-year-old kid in this room and And asked okay, what do you see? He said well I see people sitting in the room So it looks like a classroom maybe right and If you show animal pictures to that kid and say okay, is that is that a cat? Is that a tiger? Is this a dog? He would know instantly Okay, but if you ask that kid, okay How do you know it's a how do you know it's a lion and how do you know this is a cat, right? Then it becomes more complicated Okay, and he would give you some answers right? but how do you fit that into Data that a computer can understand and that's the number one problem with deep learning right and this is the problem that Deep learning is actually trying to solve It's trying to solve It's trying to teach computers to understand Informal things right things that you and me know Pretty much, you know from four-year-olds From being four-year-olds and older, but it's impossible to teach a computer to do this Okay, so machine if you try to do the machine learning way it doesn't work Okay, because there are too many features There's just too much information and you cannot feed all this information to a machine learning model and get a decent result So of course the answers to this is neural networks, and they're not new at all. They've been around for Decades the early work even goes back to the late 40s but the The first major Applications came in the 50s right so it's literally 60 years old technology right 60 years old and And What is the neural network actually well? People have Written books about this I've spent their life Explaining this so I'll keep it shorter and simple Basically a neural network is a universal approximation machine It's the name of a theorem that says that if a network is large enough, and if you give it enough data It's gonna learn anything perfectly, right That's it so it's a learning machine It's a learning machine You design it you show some data over and over and over again, and it learns perfectly how to predict a given output from a set of given inputs it can predict absolutely anything and You know magically you don't have to understand exactly what happens in there, which is nice But okay Thematically the gray they're great theoretically they're great for limited applications. They were great, but You know until very recently they didn't really work, right? They didn't really work and if some of you the older ones like me Where in the University? Let's say in the 90s and you studied probably you either you know a few hours on neural networks and AI I'm sure your teacher told you something like well Yes, okay artificial intelligence is really cool neural networks are really cool You can do all kinds of crazy stuff on paper but you know Outside of the lab they're pretty much useless because we cannot solve bigger problems with those so it's all about scale scale scale so That's it. That's the reason why they didn't work That's the reason why in the 60s and the 70s and beyond they just stayed in the lab And they were cool stuff to play with but there were no industry applications. No real-life applications of these because Data was just not available Okay, and remember I said you need lots of data to train and Computing power was not available either right so tough luck But it changed right It's changed for three reasons the first one is Data sets are everywhere right digital data is literally everywhere. Okay? audio text Pictures everything Some public data sets are available on the internet large ones. You can grab them. You can mind them You can go on Kaggle. You can do machine learning competitions deep learning competition. So data is just everywhere So everybody now can grab data and start training and start building apps the second thing is computing power is Well, it's always a problem, isn't it? It's less of a problem than it used to be right because now we have GPUs and in the mid 2000s and later on research teams found that Actually GPUs could be used for something smarter than playing 3d games, right? So instead of using all that fantastic power to build 3d games and shoot each other Well, we could you know do some actual scientific work and you know, I guess that's the good thing And so now GPUs are everywhere They're fairly cheap and and they deliver massive amounts of computing power and the third thing that helped deep learning explode is The elasticity and the skill of the skill ability provided by clouds okay, because Just like everything else Why would you buy 50? fancy GPUs to train for you know, a couple of hours a week and Have them do nothing the rest of the time when you can just go to the cloud and grab a few GPUs for a few hours Train your model and pay for those few hours and release them, right? So the elasticity the pay as you go, you know everything that you know for cloud Also applies there right compute storage, etc. It's all there grab it use it Release it and pay exactly what you have to pay and nothing else so deep learning exploded right but let's look at a concrete application every year there's a competition called Is ILS VRC Among you know research teams across the world and what they do is they take that in image net data set Which is a very large data set Hold which is composed of images With a single thing in them so it's either animals or objects or plants no humans and They have thousands of categories and they have to predict the right category for each image, right? That's the game So actually they can predict five categories for each image And if the correct category is in the top five then it's considered a win, okay? And so they've done this for years and years and years Here's an example These are real images from the data set so who thinks These dogs are so it's not the same dog, but are they From the same breed who thinks they're not the same breed Do we have any Eskimos or Norwegians in the room right Norwegians are usually pretty good at this Yeah, and who has no idea Well, personally, I have no idea and I think if you gave me 15 minutes. I would still have no idea Some some things tells me some things tell me it's the same some things tell me it's not the same, right? So for the record, it's not the same breed Okay, but How would you know right? How would you know unless you're real your real dog expert? And you could actually explain to me that oh see the difference here and here on here Okay, and then I show you different breed and you're not an expert of those dogs and you don't know, right? So that's that informal knowledge. We need to fit into the computers So they've been playing this game with dogs and plenty of other categories for years and these are the results So they started in 2010 and the blue line is The blue line is the error rate. Okay, so it goes from 28 to 25 to 16 to 11 down to 3 percent last year Okay, only 3% error and The red bar is how deep how many layers? The neural network that one was okay So in the first couple of years, it was just one layer and then it went up as you can see 8 and 19 and 22 up to that Crazy number of 269 layers Okay, so now the question is what do you think this the score would be for humans? Right a normal humans If I gave you the image net data set all right and lots of coffee and as I asked you to score It's it's millions of images. So it would take a while, but okay theoretically you could do it with lots of coffee What would be your average error? I have no idea. Well, I guess our brains are much more than 269 layers Okay, so but still our brain is different So what would be the what would be the score? Who says Less than five or less than three Who thinks humans would actually beat the machine? Who says more than 10 percent? Okay And between five and ten Okay, so so the answer is actually five 5.1 if you want to be exact Okay But again, it's theoretical because if I give you maybe 50 images You would do this if I gave you a thousand images Maybe not so much if I gave you a million images you would never get to the end, right So the computer can do it faster longer Is never tired And you know, it will give the same answer all the time So what this means is actually Deep running models and computers are now better at recognizing stuff than us right with the With I would say Given the condition that they actually have been trained on it, of course If you show them something they've never seen, right, they won't know and maybe we will Because we're smarter, right But still, um, it's an impressive number and I'm sure it will keep going down So This is just one example. There are many more applications of deep learning and we'll see a few more as we go Um, but now let's try to talk about, um, how we how you can actually oh, yeah, please you have a question What does it mean a layer? Means this And the top in the top right corner. So a layer is A set of neurons That are connecting to the connected to the previous layer and to the next layer And and they all work in parallel to do some computation, right So at the minimum you will have an input layer Okay, which will be your input data. So let's say my pixels, right? So let's go back to my million pixel example. So I would have one million input neurons Okay, each of them with the input with the picks with one pixel value And the output layer will be probably The number of categories I have so let's have a thousand different categories Okay, so I would have a thousand neurons in the output layer And I would just want one to be activated for a given image, right and in the middle I've got What we call hidden layers, which are just additional layer of neurons that Do their magic, right that just extract features. We'll see some examples extract features from the input layer and gradually Learn how to Activate the correct output neuron for a given input Right So there are different structures in this example. Here's is what we call a fully connected Network So each neuron is connected to all the inputs and all the outputs of the previous and next layer Okay But there are different architectures, right and now you can you start to understand why it's so heavy From a computation point of view, right because it's you know, it's n1 times n2 times n3 times So it's it's a lot of connections and each of them has to be Optimized and computed Yeah, yeah training is we'll we'll do some live training on on a smaller dataset, right? You'll see you'll see that Okay, so now let's talk about what we do at amazon so Actually amazon has been doing lots of ai for i want to say forever. It's probably not quite true, but Feels right amazon was started in 95 And as a bookshop as you know And if you go to the internet and look for screenshots of the early website very early on you had Recommendation right and then you had per content personalization, etc. So very early on um You know they felt they had to have that Smart feeling to the website right that custom experience to the website and then as time went by Amazon started to use ai for their for the what we call the fulfillment centers So where the where the goods are actually stored and where they're shipped from you may have seen Those videos on youtube of the the amazon robots that pick up the shelves and and move the shelves To to the humans so that they can pick the objects and prepare your order, right? If you haven't seen this you you should take a look Just look for amazon robotics on On youtube and today we have more than 40 000 robots live Every single minute in all of our fulfillment centers Just moving around and autonomously and moving stuff So that you know we can all get our orders in time Um, of course there are tons of ai and machine learning on the website If all of us went to the same web page on amazon We would not see the same thing for sure right we would see different products different layouts different everything actually And i'm sure you've seen this Although i don't think it's available in italy But it's available in the uk and in in germany and in the us so hopefully it's And not in france Hopefully soon So the amazon echo family of of devices the personal assistants And you can just talk to them and order a taxi order a pizza ask for the news ask for weather information Every single day we have new new skills as we call them that come out for for the echo devices And it's it's evidently all based on deep running technology natural language processing Text to speech etc right so that's A consumer product that's i would say the visible side Of all the work that amazon is doing on ai right But there's of course we're developers so we want to build stuff and there's a There's a full stack of AI and machine learning solutions and services that are available in aws Right starting from of course the infrastructure the C the instances So obviously we have cpu instances. We have also gpu instances. I'll show you. I'll show you one in a minute We'll do some training On top of this We could run Your favorite deep learning libraries so today i'm going to use mx net But you could use tensorflow or keras or or something else Then if you want to actually Go deeper and and really do You know build your custom algorithms and your custom applications You could use Our emr service, which is the basically a managed service for the hadoop ecosystem To do spark and and and all the other hadoop friends You could do You could do amazon machine learning etc etc So we have a full set of services that allow you to build smarter applications But you need to be an expert right and although we all Have machine learning and And soon deep learning on our resumes Right not everyone is an expert okay, so We thought and you know our customers asked us to do that That it might be interesting to build some higher level services Right, which are just an api call away And and very simple to use and yet able to do very complex things And these are the three services that you see on top Lex poly and recognition and i'm going to talk about those for a minute and then show them to you okay So the first one is poly Well, it's easiest to explain poly is text to speech right so it's just one api call select a language select a voice and And you get the sound file in real time With a human sounding voice. So today we have 24 languages including italian so we can try that And 48 different voices. Okay, and we'll keep adding more The next service is lex. So lex is a chatbot service. So you can design a conversational interface using text or using again voice And and integrate that in in the AWS platform with Your web app or your mobile app or or on facebook or you know on external channels So pretty cool service if you're into chatbots And the last one is recognition So recognition is image recognition. So it can do object detection and face detection Face comparison etc etc and as you can imagine all these are obviously based on deep learning But all you have to do here is just call an api, right? So let's give it a try okay So of course we could play in the console here and you know recognition and poly. Oh, yeah, we want to try the italian. All right Um, could could have the mic for a second Okay, so that might be a little small. Okay. So here are all the voices that we support, right? And so for italian we have two voices. We have carla and george joel Very italian names. So let's try this Hopefully have some Oh, no, I don't It's coming. Oh, it's on the hgmi All right. That's okay. We can do this Okay, let's try that again Okay, so that's carla and let's have george joel Mi chiamo george leggerò qualsiasi testo che digiterei qui Okay, and and you can go tell this stupid and if you want to do Do you have anyone from iceland in the room? Too bad. Okay. All right. Let's do icelandic Okay, all right. Well, we could do this all day, but that's not the point. Thank you. Okay. So as you can see This is really just This is just an api call. So I could do this I could do this on my on my laptop too. We'll do it on the robot afterwards. Okay. I can just show you Okay, so this is local here And let's okay, so that's pauli. Basically, I want to show you recognition now. So that's pauli, right 24 voices The 24 languages 48 voices And And it's extremely fast. So you can either play the sound file and have an interactive thing going or you can save it and use it in your applications So very very easy to use If you want to see what the api looks like after all, let's do this Well, this is it really right That's all there is to it. You select a voice and and the The format which is mp3 here by default and the text That you want to generate and that's it. So one api call away and you get in real time a human sounding voice Okay, and then either you play it or you Either you play it or you save it for for further you So that's all you need to do one api call. You don't have to be a deep running expert to do this Okay, let's take a look at the recognition now so Let's take my favorite image Should I show it to you? Yeah, of course Okay, so it's october fest but i'm sure we have a remini fest and bologna fest and We have the same thing all over the world, right? Okay, so that's my picture. It's a fairly complex picture so now let's Call recognition on that picture and see what happens Oh, and I Oh, sorry I need to copy that image to s3 So that's my bucket name Or could we have the sound on the hdmi? No, maybe not we don't have a tape. Yeah Oh, wow. So I need to go in my max settings. All right. I'm gonna learn something now. Yeah, it says hdmi. So Uh, just try this again Oh, okay. See what you mean Okay, thanks No, I'll be fine actually You can hear it, right? Or not. Do you want the mic? Yeah, let's have the mic. Okay, so Let's uh Let's send that image to recognition and see what happens. Okay, so Pretty immediately. I see some labels and confidence faces have been detected Here are some key words about this picture people person human alcohol beverage drink crowd female girl Okay, so I would say that's a fairly accurate description of that picture, right? And so like I said, we've got labels. We've got confidence scores and Then we find 15 faces, which is the maximum number we can find it's it's a Predetermined limit, right? We stopped it at 15 And for each of them we get some information like gender age range emotion detection and there's additional information on Where where the noses and where the eyes are etc, but I didn't print it out so If I show you my script and you know Highlights the faces that has been found that have been found and as you can see we see 15 faces, right? And we could check that. Okay face to here that lady here Is uh, where is she? Okay, here she is. Okay. She's female. She looks pretty happy Well, she looks to be closer to 23 than 14, but okay You know pretty pretty safe. Oh, by the way, never do this with your girlfriend. Okay Never take a picture of your girlfriend and use this never right or your wife never right or your your mother might forgive you but Uh, your girlfriend will not Okay, trust me all right, um Okay, let's try a different one just for a second Okay, so I I'm not showing you this picture for now A single face has been detected Here are some key words about this picture city downtown metropolis urban Okay, and obviously that's poly that you hear here I'm extracting some outputs and sending them to poly Okay, so Let's see how fast you can find the face because there is a face in here ready All right So it's a larger crowd, but we usually with a smaller groups You know, I have like a you know, I ask people to raise their hand when they see the the face and Yeah, thanks But You know for some people it takes a few seconds, right? So, uh, because it's way over there And it's it's hidden in this very complex picture And it's interesting to see that the The cartoon face is not picked up because it's not a face because no one has eyes eyes Half the size of their Face at least not where I come from Or or maybe after a very very long evening Abusing substances, but in general case, that's not a human face, right? Okay, so this is recognition Okay Pretty cool But and and you will find all the all the code and and everything again. It's it's on github I can just show you the the riko api. It's It's super easy as well Okay, so this is the one to detect faces, right? Again single api You literally copy the mh2 s3 and and point recognition to it Comparing faces needs a source image and a destination image But as you can see, you know, it's and detecting an image Again is as easy as this Right where the image is how many labels you want and what's the minimum confidence score that you want to to report? Okay, so Pretty smart, uh services But if you're if you're a very bad python developer like me, you can use them in minutes, right? You don't have to be an expert Okay, but there's a problem with this Okay, and yeah, we have tons of customers. Oh, let me let me mention a few Uh, the the washington post Is using poly in their mobile app to uh to read articles, right? So you can you don't have to look at your phone like this. You can just you know Click play and and let uh let the the washington app read The article to you right and you can actually focus on what's outside, which is nice Um, and you know capital one is one of the top 10 banks in the u.s Very large bank and they have a a lex application Um For people to use to have information on their banking details, right? So you can just Instead of going to the bank website and looking at the You know the the detailed report that we never quite understand You can just use a chat bot and say, okay, uh, how much did I spend on the restaurants last month? Right that that kind of thing. So that's very very cool So again, like I said, there is a problem with what I showed you, right? In I would say in the context of uh, you know devices and robots, etc The problem is we need the cloud Right, we need the cloud connection. We need network connectivity And sure I could use recognition and And and everything on my on my robot over there. So maybe it's time to bring the robot now So, okay Here's my friend So it's a it's a raspberry pi robot so So sure I can I can connect to that little guy and I could use I could use poly to do tons of silly things like this Thank you for visiting us today. I hope you'll have a great time Now julian, could you please stop clowning around and get on with the talk? Right, thank you And thank you too far to our friends for not crushing the robot this time Yeah, it's pretty. Yeah, it's a pretty regular event. I keep fixing it, but now it's okay so, um So, yeah, you know, it's it's a raspberry pi. It has a wi-fi key. I can connect to the internet I can use anything I want with this. Okay, it's it's a Linux system But can we expect all the robots of the world and all the uh devices of the world to be uh, always on always connected to To the cloud probably not right. It's it's an unsafe assumption Autonomous cars and stuff, right? You go in the tunnel and then what happens? so, um We need something different, right something that could work and not be cloud-based Um, and this is what I'm going to talk about for for the rest of the presentation It's uh, we can build deep learning applications Um using mx net and embed them on devices like this which are not powerful at all, right? This has a one gigahertz Clock speed and one gig of memory. So it's a very very small device if you compare it to a typical computer or server, right? And and we're going to do local ai on this little fellow here without any cloud connection So if you were to buy mx net first so mx net is for programmers, right? It's it's really like I said It's developer friendly. It supports multiple languages Like of course python c++ javascript matlab And julia and I'm sure I'm forgetting something here It's an apache project. So it's open. It's not controlled by any company aws has committed to supporting this project because we think it's uh, it's the most appropriate and I will explain one in a minute Um, both for a cloud-based application and for smaller devices And in I think in the top 10 mx net committers we have Four people four or five people working for aws right now um It's high performance You know as will you will see even on a small device like this it runs fairly fast And it doesn't require gigabytes and gigabytes of memory, right? And like I said We endorsed it Because for all those reasons And also because in in a wider context It scales very well Right So why is scaling important scaling is not really important at this stage scaling is important is important when you train the model Right So when you actually take those million of images or those terabytes of sound Bites etc and you train the model, okay These these this is where the operations are the heaviest And so you want to be able to use as many gpus as you can to speed up training Okay, and mx net can do this very easily In in the code and it can do it very efficiently When it's running on as you can see here up to 16 gpus with almost linear scaling Which means if you train on 16 gpus, it's pretty much 16 times faster Than when you train on one gpu, right almost perfect linearity And it goes beyond this if you Why 16 because 16 is the largest gpu instance that we have right the largest instance that we have a 16 gpus So in one server, that's the limit But we can have multiple instances and we could go up to 256 gpus so 16 instances with 16 gpus in them And again as we scale on multiples training on multiple servers We see almost linear scalability again, and That's something you will not see in other frameworks, right Most other frameworks Can either Not do gpu at all or they can do maybe one gpu Or maybe maybe if you tweak your code like a maniac you can get it to run on multiple gpus in the same machine And that's just one line of code when you do that in mx net And then training on multiple hosts Then it becomes this becomes a real project if you want to do this with all the libraries for mx net It's almost as simple as sharing ssh keys Across the nodes so so that they can connect to one another and that's about it, right The data set will be split automatically and so on. It's it's really nice So that's one of the reasons also why we like Why we like mx net it's because you know scalability is very important for our customers And thus it's very important for us and we want to make sure we build services that scale to the max Right, so let's do some demos So let's start with something simple. Let's do some training for a second So here I'm going to use a gpu instance to train an image recognition model on the data set Which is called mnist and I guess Most of you or some of you have seen this before mnist. Yeah, it's very popular It's a 70 000 handwritten digits from zero to nine And of course the goal is to show an image and get their the proper result at the end. Okay So let's do this And you can see Where is my instance? Okay So here I'm running on the On a smaller gpu instance. It has only one gpu, but that's more than enough For what I need And I'm running an amazon machine image, which is called a deep learning. Am I which is built by us And you can use it for at no at no cost And the cool thing was this is that it comes pre-installed with everything So whatever framework you use, you know, uh, cafe mx net types of flow, blah, blah, blah Anything else it's already in there So you can just boot up your gpu instance with this image and everything is ready for you to work You don't need to go and install the kuda drivers and the nvidia stuff, which is a little tricky to do. Okay And so here, um, whoops, okay, I wrote Oh mx net, yeah All right So I designed A very simple model Right So it's Okay, it's 30 lines of code, right To do everything so it's like when I say it's developer friendly, it really is it's very high level, right? so you don't have to go and Coming back to your questions earlier You don't have to go into the details of every single neuron and just define layers connect them and that's it Okay, and that's what I'm doing here. So um I've got a series of blog articles on this with every single detail explained So I'm going to go a little faster here because I want to get to the point Um, basically here, um, you uh, you just load the data set, right? So you load those images There's a training set that we use for training and there's a validation set That we use to evaluate the quality of the model just like we do in machine learning. Okay This is the network definition Okay, so an input layer Uh, then um a first Hidden layer fully connected A second hidden with a 128 neurons A second fully connected layer with 64 neurons And then the output layer with 10 neurons and 10 is not a surprise. It's because we have, uh, 10 categories, right From zero to nine. Okay, so we need to figure out what digit this is And that's all it takes, right? That's all it takes to define my network Okay, define the layers Define how they're connected Define how many networks how many neurons are in each layer and that's it So we have multiple types of networks But this is um, this is the simplest one and as you can see it's only six or seven lines of code Okay Then I bind my data to that model. Okay data. I loaded I just say, okay, this is what you're going to train on And now you train Then I'm saving the results. So I'm saving all the weights for all the layers, right because I want to reuse it afterwards And then I use my validation set to measure the accuracy of the of the model Okay So Not a lot of code, right? So let's do this How do I train it just like this? So it's going to load the data And then it's going to run for I think it's 10 epochs. So an epoch is learning The full data set once Okay, so here I'm taking that data set and I'm sending it 10 times Into into my model. Okay batch by batch, but the full set goes 10 times In a row into the network and I can see my uh, I can see my training accuracy going up right And actually if I If I let it run for a little more Let's give it maybe 30 epochs You will see it gets to one Okay, that's that universal approximation theorem I mentioned Okay, so it's gonna it's gonna learn that data set perfectly. It's gonna learn the training set perfectly But then when I take the validation set and I run it Of course, I get a lower score because These are images that the network has never seen before Okay So again, yeah, we'll get to one Okay, so maybe I need 30 32 or 35 epochs, right Okay, so training accuracy almost gets to one and then validation accuracy is 97 Okay And then I could use Um, I could use some um handmade digits that you can see here. So I Did them myself and I could try and run them through the network Right, so I'm gonna load each image And and and load the model that I trained and just run it through there Okay, and do this and see what the scores are Okay, so well So you can see 10 Probabilities, right because obviously we have 10 categories. So they're pretty close to one. They're not perfect But they're pretty close to one. So the first image is a zero and the second and all these are pretty good And well, the nine is not so great. The probability is lower, but we're still okay with the fact that it's a nine Okay, so I could have a better network. I could train for longer. I could improve everything etc etc Okay But okay, that's just that's just a very simple model here Um Now I want to do something more complex, right? I want to be able to do that image net thing I mentioned earlier. I want to do it here I want to Use a pre-trained network, right training on image net takes a while. I cannot do it here um And I want to uh take that model say Train it in the cloud using the cloud scalability save it and then copy it in there and use it locally Okay, and that's what I'm doing here. So let's go back to Let's go back to my robot here So here's the model. I'm talking about it's the inception model. It's 44 megabytes. So it's not huge But it's it's a fairly uh, it's a fairly advanced model. Okay. It's been trained on image net And I'm going to do pretty much the same thing that like you saw here. I'm going to load the model And I'm going to ask the robot to recognize images, right But to make it a little more fun. Actually, I'm going to have the robot take a picture of objects, right using the camera down there and Recognizing that Okay So it's all in python. It's fairly easy to do and we just have to start that server And hopefully it still works Okay, yeah Yeah, the loudspeaker is on So can the thing move or not? Okay, so just to make it a little more even difficult to set up. Okay. I've got this thing here So it's an arduino Which is italian, right? Or something So it's an arduino, uh with a I guess it's a playstation joystick connected to it And here this has nothing to do with deep learning, but it's pretty funny. So why not? And uh, whoops, and I mean it's an iot thing. Okay, so I'm using the iot service of aws to through wi-fi here To send messages back and forth to the cloud. So from from here to the cloud to the robot, etc, etc Okay, so I can drive that thing Can you see it? Yeah So I'm making sure it's not falling off. That's why it's stopping Okay, so let's let's have an object somewhere I'll take my lucky object the one that should work and then if you want we can try something else Hmm, okay. I need to cheat It's not yeah, okay Yeah, you know I keep saying it's it's it's a running. I mean, it's an old joke now But sorry I have to do it again, but some people think robots are gonna kill us all We're quite safe. We're this one is very friendly It's got a twitter page. You can follow him on twitter Okay, so I'm gonna try something else that's probably not gonna work either, but okay fine So have you seen this before? It's the iot button You just click it and it sends an iot message Uh to a ws iot and so this one if it gets through if not, I will fake it That's right We'll send a message to uh to the robot asking it to take a picture. Oh, yes, it is working And telling us what it sees I'm 98% sure that this is a baseball. All right It's 31 centimeters away. Okay. Thanks All right, bring me your objects now. Okay. Yeah. Yeah, I'm I'm I'm up for that. Okay So I click here sends an iot message to a ws iot in in Dublin The robot gets it. So it's back and forth to island. As you can see, it's pretty fast The robot takes a picture The robot takes a picture with the camera and uses the local mx that model to To detect it this button has been giving me trouble. So I should Try something else. Oh, come on. Okay. I can fake it. That's okay. No worries Works only once Just use violence Yeah, see that works I'm 69% sure that this is a water bottle The object is 51 centimeters away Okay, pretty good, right so So, you know, it's all fun and everything and of course we're gonna try those and it's gonna fail Um Because this is a really small object. I don't know. I don't know what the distance should be maybe here So once again, what happens is okay, there's the iot thing going on But and there's poly right the voice comes from poly as you can understand as you can imagine So I really need to hit it right come on work Okay, I'll fake it. I can send I can send a message from here as well And so it takes the picture That's my complex protocol I'm 13% sure that this is a pole The object is 22 centimeters away. What did he see? Oh, yeah Oh lighter is in there. Hey, I get I get five remember I get five categories. So I won um so Now this this is not gonna work at all I'm quite sure because it has a picture and it's you know It's if you show it a picture of something it you know, it gets it wrong. So if you have some other objects Do you have a laptop or something laptops usually work? We can try that and then conclude before they kick me off the stage You want to try? Yeah, I don't I don't have much in here. Oh Okay, we can try this. All right last one, right? Oh man. Yeah, okay fine. That's a tough one Now that's never gonna work Yeah, I'm very dependent on my phone here and it's not working great. Yeah, here we go I'm 67% sure that this is a thimble The object is 20. What? Okay, peel bottle man. It's in there. Come on Hey, I still win All right, they're gonna kick me off the stage So julian one remini zero okay All right, so oh, no, I don't need this. Thanks So I'm getting to the end. I mentioned the deep running am I already Again, I went very fast because there's so much stuff. I wanted to show you today You know keep you hopefully interested You will find all this stuff in detail on my on my medium blog. So just go to medium.com Uh Jules simon well, it's easy to find and and you will find All the tutorials to get started with mx net To do training etc. How to do the raspberry pi thing Etc etc. Okay, so it's all it's all out there All right, there are plenty more resources. There's one. I want to mention I recorded a w s podcast A couple of weeks ago With an introduction to mx net So just look for a w s podcasts mx net. There's only one and it's mine. So You can listen to that and and get some additional information. Okay. So I want to say Thank you Gracias and I'll still there, you know, I cannot do the 24 voices. Thank you very much euro python for having me Thanks for listening and if you have questions