Build your First Kaggle Deep Learning Kernel | Mohammed Ashour | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Build your First Kaggle Deep Learning Kernel

teacher avatar Mohammed Ashour, Software Engineer

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

6 Lessons (27m)
    • 1. L0 - Introduction

    • 2. L1 - Exploring.

    • 3. L2 - Creating and Adding Data to the Kernel

    • 4. L3 - Exploring and Visualizing the Data

    • 5. L4 - Data Preprocessing

    • 6. L5 - Building and testing our model

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class


Welcome to the Crash course on Building a simple Deep Learning classifier for Facial Expression Images using Keras as your first Kernel in Kaggle.

What will you learn: 

  • The process of making Kaggle kernel and Using Kaggle Dataset
  • Building Classification model using Keras
  • Some Image Preprocessing methods

This Crash course Assumes that you have basic knowledge about

  • Python programming languages
  • Deep Learning Basics.
  • Keras & Tensorflow.

In this class, we will use the FER2013 Dataset that you can get from here 


No installation of any kind of program required.


Meet Your Teacher

Teacher Profile Image

Mohammed Ashour

Software Engineer


Hello, I'm Mohammed. I'm a Computer Engineering Msc student, a Software Engineer, and a Teacher.

My interest is mainly in the AI field like Machine Learning and Building Deep NNs. Nice to meet you all!

See full profile

Class Ratings

Expectations Met?
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. L0 - Introduction: Hi. Welcome to this corpse. My name is Mohammed ASHA. What? I'm a software engineer and machine learning Master Souness. I'm also someone who loves learning and teaching things. That plan here is first showed you get get your lovely drink. Gonna need it Second, get ready for to make your hands dirty with some machine learning And ai could third get ready Build your first girl in character So let's get started on You can reach me at this email. See you them. 2. L1 - Exploring.: come to this course in this course we gonna make a facial emotion, detective or patient emotion classifier. It's basically a model that we will give it a face image and its foot thick which emotions this image present for his face scores. I'm assuming that you have a basic knowledge of deep learning and Bytom proclaiming made as there is no installation required way cannot use canyon turns. I will issue this beautiful We also we use that wagon scores will help you make your first . Okay, let's get started. 3. L2 - Creating and Adding Data to the Kernel: Hi again and welcome here. You gotta make your first rule book on cattle. First you need to make an account or gaggle. It's pretty straightforward. You just don't need to go toe cabin, look calm and create your account. Uh, then when you when you open your home page, it will be something like this. You need to go there for roadblocks section then click here for New England book. Okay, you will see something like this. You need to choose language vital on both. Then click settings. You need to We'll need to use EBU for our training for training our model. Then you click creates. Then you will see some of the player. This it's is building a turning on a virtual machine and getting started for you toe. Start writing some foods. It will take some time. It takes a random name like this and you will see something like this. He you just told you First Colonel, on in the second Listen, we will start for adding our letter on then visualizing what senate and then starting to build our first. Thank you. See you that 4. L3 - Exploring and Visualizing the Data: hi. And the last lesson we just made our first car here. We need add our data from Kargil Datasets aan den. We need two explosions that first toe. Add the better from gaggle. You click adleta and you specify if it's, ah, gather set or competition that are a colonel out Boat files. Our data will come from a competition that as competition is cold, challenges in representation learning facial expression recognition challenge. Our data is consists off 48 by 48 axle grayscale images. This images are categorized in seven labels from angry to neutral. Each label will be represented as a number from zero to sex. Ah, you just you can see how. What? What's construction off each? Uh, file Here. Here we have five files. We will use the train that sees refile this file have to calm emotion and pixels. Vixens will have would be something like this. It's it had our data or our big sins values a separated by spaces and on an on call room on . Then you have the emotion colon have from value from zero toe sex. So we have used this strange sees V is about 230 megabytes. Let's get back our child, our competition. Cold. Let's so right official and see if it's here. Area that's here. That's it. That's like ads on its adding hours that it will take some time. It just takes a copy from the challenge data set and take it to our workspace. Colonel, before we dive and are better, let's see what's options? What options? Here we can rename our Colonel. It's, uh, rename its toe if a facial expression well, then on then we can see what Okay we hear can change our currency. Too dark. A lot dark side. I love this. It's a good your theme. Here we have some statistics off how we use our HDTV at our Seaview ram GPU the algae. You in the last lesson? Uh, okay, this could be written hungry, made our current Let's run it. This goods, OK, It's basically say it tells us what it consists off at Just use or a small jewel and it walks every file and prints dire name and filed the It's easy. It's straightforward. It just imports here. Mumbai and bandits tell you there are appearance told package is huge. Okay, lets see our debt first. Let's hear how that looks like I'm here, just loading. Are trained to see as we you little it by using his I just use and vote on past our path here, named boy The challenge Name on. Then I am referencing our file name. Let's run this you Can you run this by clicking chef and answers? Okay, We have to call him emotion and vexes as we saw challenge here. Emotion on some backs values greater boy spaces. Okay, let's go. Let's get some info. We have Year 28,000 on 700. Uh, and, uh, images was there labels? Sounds good. Let's see emotion value counts here. I'm just exploring a account off each table in our death starts its its not that balanced. That is it. We'll see how that will affect our, uh, our more than here. I'm just finding some variables for our numb classes and wits and hides for our images. And also, I am referencing our emotions by its name, not just using number labels. Okay, that's strong. This here I'm just making true that every image have 48 by 48 length. I'm here using square root function from the math Mignolet's in voted. I am voting this huge first, and I'm just getting our lens on the Texans lens from the first item and split it. So I get on get squared off this island if it's 48. So we are cool. Yeah, it's 40. Let's visualize some that and see some pictures off this, that inaction here I am just defining figure size for our Medlock lap plots here, and I'm making support to represent a eight images in Monroe, and I am living through it, getting each pixels Andrea shaming H H image by the height and the wits so I can transform this Paxson's from one row toe 48 by 48 construction. Here I am, showing it in each image in their place in our access, and then I'm giving at our idea and the whole idea so I can thought a title for each one. Then I'm showing our let's run this. It's slang. Yeah, way have year eight images each image have, uh, their emotions of others. You're angry and he angry. Fear sad mutual fear said happy. Ah, it's ah, good, Good. That said, that bad. Not that great deficit. We will do our best to gets our best results from this. That's it's OK. Before finishing, let's click comments save our death that save our code. I hear I'm here. Chose that. I did it twice before. Here I am committing this as a a process that making sure that everything running Smalls uh , now it's done. Uh, you can select the see what's difference from each one here? I chose the difference between each comments. Okay, let's close it. Okay, that's it. On. See you the next list. 5. L4 - Data Preprocessing: Hi again is the last lesson we played. The letter was our datasets. Now we it's time to pre process our data. So first we have our data in the text form. It is a strain permit. Each image is represented, as we saw earlier. Huge is represented like this value separated with spaces, and it's not a very useful that representation. We need to convert it from this format to an array form it like every image in the existence we need to convert strength for net toe array format that I can deal with. As you know, every euro network is just a matter explorations stacked together. So make learning procedure. So we need to convert this format toe our permit that can feed their can feed it, toe our neural network that can process it and learn from is this function is pretty straightforward. It takes pixels and mood. Mood here is just invariable. Mood here is just a variable that chose if we need to make it one dimension or to damage. First I check out the pixels. If it's strange, if it's string I converted after slated in tow values and I convert such value toe. Enter yours. Then I convert all the whole lest in tow a nun by every. If the mood was set to the then I reshaped this pixel toe. 8 48 by 48 shape. Else I return it as it in one damage. Okay, now I have our training toe. See? Is we that I want to use it in three? I mean tasks that one straining number two is validating our training number. Streak is testing. I want to use this data as it's the better. That's a label that, as if I have now into streak category. So I am here using psychic learned model selection train Just a split to split our debt. Now, first I convert all my data toe, uh, two d are using ah, previous function. Then I used, trained to split to split my data and train and test at that. Then I split my train that toe two parts training and validation here. I split it by issue off 80% toe 20% of the training data, Then I train I. Then I split my training data toe 80% of 20% for the validation that here you can see that our training, that is the biggest portion. Then my test ETA, then my tradition. That's after that. You can see that I am converting all my data toe a nun by a break off float values type that we use in our models. I do this for extreme expand. Exe test on Dwight train waiver lighters. Then I'm he renting the shape off each month. His shape is about the number of items, then 48 by 48. Unfortunately, that's not the final shape that I can use. I need to add one dining. What? It tells that this image is in one channel only one channel, not three chance. I won't tell my CNN that my image is only won the challenge. It's a grayscale image, not a colorful image. So here I am, using reshape to add the last dimension toe age off my ex values. After this, I am checking my train and validation and test that our numbers I'm like this valuables just holding each H portion number off items then are not. It should go like this image was ambushed, shape defined our model and then our out. Our Abbott would be in this representation. This or visitation is called one representation. That one refers through the correct predicted late. So I need toe convert my Albert from previous shape to this ship. For this car tasks I will use function old in the yokels. It's in our cares framework. I give it our white tree and number of classes, and it does it politically, converting each label to this one hoat representation. This is the final shape off that Albert. It's like this. We have here six zeros on one. So that's it for the pre processing section. In the last 10 seconds in the next section, we will go on, start building our models and see how it rules. Thank you and see you in the next. 6. L5 - Building and testing our model: Hi. Now we reach its the building model section with section. We need to build our model and training on. Just test it on our test that first I'm importing some necessary functions and modules that I use it and out pulling process. Then I'm defining our debt. Virginia, that a generator in Paris. You can imagine it as the flow or source that generates or that get our better and make some operations and pass it to our model here. I'm just making some operations to make our debt our variant and may help our model to learn more. Not so. Just say that that I'm making some rotations to our images. So it's I I'm just adding some noise. Are that as so our mother can learn more about it? Then I'm making a data generator flew here. I specify how much that I am passing toe our model in each time. It's basically a patch size. I'm passing 64 images bare patch. So I am doing it for our three on validation and test flow. Then I need tojust define our I am here making a very simple small model. It consists off. Some come after the players stand was batch normalization and Max boarding. Here on MySpace final I am but our MBA cheap by 48 by 48 by 1 48 by 40. It is our as our image size and one is our channels. Then here I'm staking some comfortably and back normalization. Then I added some exporting, so I get the max value from each square in our image and making on getting the most effective. That then I'm adding a drop about toe. Prevent the over fitting on doing the same here. Then in the end, off are loaded. I'm adding a flat. Then stay layer that have seven our for each elect. It's wrong. Our mother, as you see Paris, is pretty assembled buildable. It doesn't need a lot that complex operations or complex stuff to build on best. The mother. It's pretty straightforward and pretty amazing. Here I am, bloating my model. I'm just floating the layers for each one. It's pretty. It's pretty good for visual ization. Now I'm making some checkpoints in each time I train my model. I need to save the time our mother can ahead So most accuracy. I'm doing it by using checkpoints as I save all the way its value for mine more than when it was The accuracy improves each time for each Eric, Here I am sitting in my training. Now I well trained my motive for 100 a brick I am buzzing my my train flow And I am just specifying some values for a bex on steps for ever on all this. That is, that will help me and make, uh, our training process Just automated Let's runs is and CEO our talents When you see if you notice are seaview maxed out, GBU will start now to rise. I think this Yeah, Jim, you is starting to right way. Use Jeb. Use here on now. Our model of starts training that will go through 100 epic I will goes here and start again . Hornet just finished trick. Okay, now it's It's about time. Finish our training. It took about 30 minutes. It's from 20 to 30 minutes. Are now reaching the accuracy about validation. Appears about 64 training a heresy. I think we've reached about 70. Yeah, 17. 71 Now is the last epics on. And yeah, now we've done Now we want to visualize our training, loss and training accuracy of additional loss and a validation accuracy. I made a simple functions that takes things Data from the history object we made here on Just make a bloods for each one Forage for accuracy and loss Let's run our function Run it up for our history Objects on DNA Now we see our loss Just have a lot of spikes I think our modern It's Toby more mature. Uh, Andi can train full and train can be trained more. Our accuracy reached about 61 or 63 on. Now it doesn't go mawr for training accuracy. That's still going up. I think way can make it move mature by adding some other layer. And we can also we have, ah, training set that move that parents. We can balance it by using another data, but that's enough for our first occurred. Um, Now I am. I just want Now what? Toe tests are test data that see our test data on run our mother on our test data. Okay, I run it now. I just Hey, uh, okay. Uh, here it's time to use something called confusion. Metrics. conversion. Matics is a metric that represents for us supposed represents for us conversion metrics is a metric that help us to see more about at the behavior of farm. How many? Two posted on false positives. It predicts. I'm here making a simple function. I use confusion, metrics, function from SK, learn metrics and unjust it tweaking at for our air use case. I'm adding our labels. You can check out the school. It's It's not that Publix here, Let's love it. This is our competition. Matics, Let me Zuman. Okay, You can see that this line represents how much troubles our model can predict. You can see our model. Our struggles with fear on doing a very good job was surprised and happy and for the heavy label. But for feel on discussed, it's not that good. Maybe neutral and angry. It's going somehow goading. So that's it. That's it for Ah, this course it was nice to meet you. And if you have any question, just tell me. I emailed me. Uh, anytime and I will. I replied to you as soon as boss Thank you and see you again. In other course