0 1 00:00:00,420 --> 00:00:05,030 Hello, everyone, and welcome back to a brand-new module. In this module, 1 2 00:00:05,040 --> 00:00:07,860 we're going to be doing something really, really exciting. 2 3 00:00:07,860 --> 00:00:11,380 We're kind of at the bleeding edge of technology here. 3 4 00:00:11,400 --> 00:00:19,800 We're going to use Apple's latest API called CreateML to build our own machine learning models. 4 5 00:00:19,830 --> 00:00:27,000 So whereas previously, we were using pre-trained machine learning models that used tools such as Caffe 5 6 00:00:27,000 --> 00:00:35,760 or Keras and we were taking those pre-trained models for defined problems and converting it to a CoreML 6 7 00:00:35,820 --> 00:00:43,490 compatible format using CoreML tools and using a different programming language called Python. 7 8 00:00:44,010 --> 00:00:50,670 And then we ended up with something that had a format of .mlmodel which we dropped into our 8 9 00:00:50,670 --> 00:00:55,340 Xcode project, and then we used that model inside our app. 9 10 00:00:55,350 --> 00:01:01,170 Now, a lot of you have been frustrated by the fact that there's a limited number of pre-trained models 10 11 00:01:01,380 --> 00:01:03,960 that you can actually convert to use for CoreML. 11 12 00:01:04,410 --> 00:01:11,670 And I've seen a lot of you wanting to be able to train your very own models based off your own data, 12 13 00:01:12,060 --> 00:01:18,600 so that instead of having to depend on these tools, you can use the tools that you already know and that 13 14 00:01:18,600 --> 00:01:26,420 you've already learned about, namely, Swift and Xcode. And in WWDC this year and for the launch of Xcode 10 14 15 00:01:26,450 --> 00:01:28,210 and iOS 12, 15 16 00:01:28,320 --> 00:01:35,910 this is exactly the precedent that we got, and it's called CreateML. What it allows us to do is to take 16 17 00:01:36,480 --> 00:01:44,280 data such as text or images or other types of files and feed it through this framework CreateML 17 18 00:01:44,670 --> 00:01:52,260 to create our very own CoreML Models which we can then incorporate into our app the same way as 18 19 00:01:52,260 --> 00:01:53,430 we did before. 19 20 00:01:53,430 --> 00:01:58,950 Now, in this case, the training is done entirely inside the Xcode, 20 21 00:01:58,950 --> 00:02:05,820 macOS playgrounds, and we'll be using the latest version of Swift as well as the latest version of the 21 22 00:02:05,820 --> 00:02:09,060 iOS 12 APIs in order to achieve this. 22 23 00:02:09,090 --> 00:02:15,450 And I'm going to walk you through step by step exactly how it works and how to create any model that 23 24 00:02:15,450 --> 00:02:16,530 you wish. 24 25 00:02:16,530 --> 00:02:21,540 Now, for the first project that we're going to be building is we're going to be creating a machine learning 25 26 00:02:21,540 --> 00:02:24,650 model that can do image recognition. 26 27 00:02:24,690 --> 00:02:30,600 Now, of course, because we're training our own model this time, we actually have to source some data and 27 28 00:02:30,600 --> 00:02:33,150 we have to teach our model a number of things. 28 29 00:02:33,330 --> 00:02:38,790 In this case, we're going to teach our model what dogs look like, and it's just as you would take a child 29 30 00:02:38,820 --> 00:02:45,510 and you would show it lots of pictures or let it play with a real dog, and its eyes gets accustomed to 30 31 00:02:45,510 --> 00:02:51,270 the various features of dogs. For example, they're kind of fluffy, they're kind of weird, and they have 31 32 00:02:51,270 --> 00:02:57,600 these floppy ears. And when we're training our model, it's going to look at all of the features that are 32 33 00:02:57,600 --> 00:03:00,010 common to all of these images 33 34 00:03:00,060 --> 00:03:03,300 that is what we would normally call a dog. 34 35 00:03:03,300 --> 00:03:09,150 And once it's learned all of those features that are unique to dogs, then we have our machine learning 35 36 00:03:09,150 --> 00:03:16,540 model that has the intelligence to be able to recognize an image of a dog, so that the next time when 36 37 00:03:16,550 --> 00:03:24,810 we show it a new image that it's never seen before, but of a dog, then we pass that image through our 37 38 00:03:24,810 --> 00:03:31,090 machine learning model. It will be able to recognize it and tell us that this is a dog. 38 39 00:03:31,110 --> 00:03:34,430 So this is essentially what we're trying to achieve. 39 40 00:03:34,710 --> 00:03:41,610 Now, if it just recognized dog or not dog, it's a bit like our previous sort of "Hotdog!" or "Not Hotdog!" 40 41 00:03:41,850 --> 00:03:44,700 type of intelligence, right, which is kind of low. 41 42 00:03:45,000 --> 00:03:48,060 And so we're going to give it a few more things to learn. 42 43 00:03:48,090 --> 00:03:53,850 We're going to also teach it what cats are and what rabbits look like, so that we can give it an image 43 44 00:03:53,910 --> 00:04:02,100 of a cat or dog or a rabbit, and it should be able to correctly identify what that animal is based off 44 45 00:04:02,100 --> 00:04:04,700 the features that it's already learned about 45 46 00:04:04,740 --> 00:04:09,750 each of these animals. And then we're going to take that model that we've created and we're gonna put 46 47 00:04:09,750 --> 00:04:17,010 it into our app and build our own image recognition app using data that we've sourced and a model that 47 48 00:04:17,010 --> 00:04:18,280 we've created. 48 49 00:04:18,300 --> 00:04:25,980 So it's essentially an end-to-end tutorial where we're going to learn about every step of creating a 49 50 00:04:26,010 --> 00:04:31,580 artificially intelligent image recognition machine learning algorithm. 50 51 00:04:31,590 --> 00:04:35,520 So once you're ready, head over to the next tutorial and we'll get started.