280 likes | 313 Views
This Keras full course will help you understand what is Keras, the working principle of Keras, Keras models, what are neural networks along with the hands-on demo. We will have look at a project where we detect whether a person is wearing a mask or not.<br><br>1. TensorFlow Tutorial<br>2. Tenserflow 1.0 vs 2.0<br>3. Keras<br>4. Implementing Neural Networks <br>5. Sequential Model<br>
E N D
What is Keras? Keras is a high-level deep learning API written in python for easy implementation of neural networks. It uses deep learning frameworks such as Tensorflow, Pytorchetc as backend to make computation faster Frontend Backends
What is Keras? Keras works by using complex deep learning frameworks such as tensorflow, pytorch, mlplaidetc as the backend for fast computation while providing a user friendly and easy-to-learn frontend Keras API Spec TF- Keras Theano-Keras ….. TensorFlow Workflow
Working principle of Keras Keras uses computational graphs to express and evaluate mathematical expressions - Expressing complex problems as combination of simple mathematical operators 2 1 Useful for calculating derivatives by using backpropagation % X Dataflow Operators Variables X 2 Y X^0.3
Working principle of Keras Keras uses computational graphs to express and evaluate mathematical expressions - For solving complex problems, specify input and outputs and make sure all nodes are connected 4 3 Easier to implement distributed computation % X Output Inputs X 2 Y X^0.3
Keras Model 1 Sequential Model Output layer Layer 1 Input Layer Layer 2 • Sequential Model is a linear stack of layers where the previous layer leads into the next layer • Useful for simple classifier or decoder models model=keras.Sequential([ layers.Dense(1,activation="relu",name="layer1"),layers.Dense(2,activation="relu",name="layer2"),layers.Dense(3,name="layer3"),]) # Call model on a test inputx=tf.ones((3,3))y=model(x)
Keras Model 2 Functional Model • Multi input and multi output model • Complex model which forks into two or more branches img_inputs=keras.Input(shape=(32,32,3)) dense=layers.Dense(64,activation="relu")x=dense(inputs) x=layers.Dense(64,activation="relu") (x)outputs=layers.Dense(10)(x) model=keras.Model(inputs=inputs,outputs=outputs, name="mnist_model")
What are Neural Networks? Neural Networks are deep learning algorithms modelled after the human brain. They use multiple neurons, which are mathematical operations to break down and solve complex mathematical problems Input Layer Hidden Layer Output Layer Neurons
Data preprocessing We will create our own data example set with Keras. The data consists of a clinical trial conducted on 2100 patients ranging from ages 13 to 100 with half the patients under 65 and the other half over 65 years of age. We want to find the possibility of a patient experiencing side effects due to their age 50% < 65 50% > 65
Implementing Neural Network with Keras After creating our samples and labels, we need to create our Keras neural network model. We will be working with a Sequential model which has three layers Hidden Layer Input Layer Output Layer Hidden Layer Nodes = 32 Relu activation function Output Layer Nodes = 2 Softmax activation function Input Layer Nodes = 16 Relu activation function
Training Neural Network with Keras Training our model is a two-step process. We first Compile our model and then we train it on our training dataset Training Compiling • Compiling converts the code into a form understandable by the machine • We shall use Adam, a gradient descent algorithm to optimize the model • Training our model means to let it learn on the training data • We will tarin the model on the scaled_train_sample set
Building a Validation set with Keras A validation set is used to verify the accuracy of our model after training it. It contains data instances which the model has not see before. We use it to see how the model will perform once deployed Data Training Validation
Creating a Confusion Matrix with Keras As we are performing classification on our data, we need a confusion matrix to check the results. A confusion matrix breaks down the various misclassifications as well as correct classification to get the accuracy • True Positives : Number of correct predictions for the positive label • False Positives : Number of negative values classified as positive • True Negatives : Number of correctly classified negative values • False Negatives : Number of positive values falsely classified as negative
Face Mask Detection with Keras We will build a Keras model to check if a person is wearing a mask or not in real time. Mask No Mask
Join us to learn more! simplilearn.com UNITED STATES Simplilearn Solutions Pvt. Limited 201 Spear Street, Suite 1100 San Francisco, CA 94105 Phone: (415) 741-3319 INDIA Simplilearn Solutions Pvt. Limited #53/1C, 24th Main, 2nd Sector HSR Layout, Bangalore 560102 Phone: +91 8069999471 UNITED STATES Simplilearn Solutions Pvt. Limited 801 Corporate Center Drive, Suite 138 Raleigh, NC 27607 Phone: (919) 205-5565