avatarDhanoop Karunakaran

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

4174

Abstract

ing around her.</p><h2 id="3057">5. She’s Endlessly Patient</h2><p id="0ca0">The alpha woman might not be known for her patience, but the delta woman has a surplus of it. She’s not rushing through life in a hurry. She’s savoring it as she goes. The delta woman also extends this patience to others and takes interruptions to her schedule in stride.</p><p id="d267">You won’t find her pacing in a waiting room or pulling a Karen move when she doesn’t get immediate service. She’s perfectly happy to sit with her own thoughts and to wait patiently. She’s not the one who gets attention for asserting her entitlement. She’s the one you didn’t notice in a room because she was patiently waiting rather than making waves.</p><h2 id="ad83">6. She Tends Toward Low Self-Esteem</h2><p id="f969">Even though the delta woman doesn’t require outside validation, she can struggle with low self-esteem. She can be the wallflower, easily overlooked, and it can, at times, undermine her sense of self-worth. She thrives when she surrounds herself with positive, self-motivated support, but she’s susceptible to energy vampires who seek to drain her dry for their own purposes.</p><p id="5d1e">The delta female might not have the confidence of an alpha or sigma, but this doesn’t mean she thinks she has no value. Rather, she sometimes wonder if anyone else sees it. Just because she doesn’t need outside approval doesn’t mean she doesn’t long for outside appreciation.</p><h2 id="0c77">7. She Can Be Conflict-Avoidant</h2><p id="f3b0">The delta woman usually smooths down ruffled feathers with no one the wiser. She’s a natural mediator, but it’s mostly because she’s highly conflict-avoidant. Fights and arguments stress her out, so she’s adapted to avoid them.</p><p id="1c48">This makes her an effortless communicator, but when her usual bag of tricks doesn’t work, she’s unlikely to address an issue directly. She’s more likely to busy herself or to run and hide than to face a problem — or a person with a problem — head on.</p><h2 id="c1da">8. She’s a Worrier</h2><p id="92ac">The delta woman’s naturally caring personality also means that she’s an innate worrier. She thinks and over-thinks because she’s constantly anticipating — and avoiding — conflict in any form. This hypervigilance often pays off when she successfully manages tension within a group, which often reinforces her worrying nature. Even though she claims she wants to be free of the stress of worrying, she also feels like her worrying is rewarded when she thwarts conflict and achieves peace.</p><h2 id="e11d">9. She’s a Nurturer</h2><p id="bac1">You may have noticed that the delta woman in your life has strong nurturing energy. She’s the friend who will bring you soup when you’re sick or water your plants when you’re out of town. She enjoys taking care of others and feeling useful.</p><h2 id="6d77">10. She Stays Focused on Self-Improvement</h2><p id="adbb">A key trait that often goes unnoticed is that the delta woman stays focused on improving herself. She’s aware of her challenges and diligently tries to be a better human being. Sometimes, she fails. What she doesn’t do, and will never do, is stop trying.</p><p id="b4df">Don’t get this twisted. She’s not walking around flinging toxic positivity in every direction. She just looks for ways to keep improving even when it’s tough. Her bounce back after a setback is impressive indeed!</p><h2 id="d60c">11. She’s Shy</h2><p id="10b4">The wallflower delta female isn’t stuck up or judging you. She’s just shy. Her reserve can be misinterpreted. She’s genuinely friendly, but she’s often uncomfortable being the first to initiate contact or a conversation.</p><h2 id="0f40">12. She’s Slow to Commit</h2><p id="238c">The delta woman sounds like a catch, doesn’t she? She’s caring, kind, self-aware, and driven by peace. But that doesn’t mean she’ll be quick to commit. In fact, she will likely move at a snail’s pace just to be sure she’s making the right decision.</p><p id="7ce5">Her slow relationship pace could drive partners crazy, but it just means that she’s taking it seriously. She wants to make sure she can honor her commitments and that the

Options

relationship is the best fit for her. You can be sure of her loyalty once she finally takes the plunge, but until then, she’ll be slowly going over a pros and cons list without rushing to get to some perceived destination.</p><h2 id="71e6">13. She’s Quiet Unless She Has Something to Say</h2><p id="b9cb">The delta woman doesn’t just talk to hear the sound of her own voice. She’s quiet until she has something important to say. She usually has incredible insights to share if others will pipe down and listen. When she’s not sharing those insights, she’s more likely to fade into the background as an observer until she has something important to contribute.</p><h2 id="bf10">14. She’s Aware of Her Flaws</h2><p id="74a3">Self-awareness is certainly a key trait of the delta woman. She knows she’s not perfect. Luckily, she has no desire to be. She’s aware of each of her flaws, and she doesn’t excuse them. She accepts them even though it undermines her self-esteem at times. Because she combines this self-awareness with a growth mindset, she’s getting better every day.</p><h2 id="a515">15. She’s Loyal to Others</h2><p id="03bf">Her hesitance to commit aside, the delta woman is one of the most loving and loyal. She has a real sense of devotion to the people she loves, and she’ll do almost anything for them. Her loyalty has limits, however. She’s capable of cutting out unhealthy connections and deciding to love them from afar if necessary.</p><h2 id="4a42">16. She’s Incredibly Intelligent</h2><p id="e468">Your studious, shy, and quiet bookworm is likely a delta woman. She’s incredibly intelligent but doesn’t brag about it. She loves deep conversations over small talk, and she constantly soaks up knowledge. She’s not just book smart either. She also has the street smarts to go with it.</p><h1 id="d8cb">A Final Word about the Delta Woman</h1><p id="739e">The delta woman is quiet, smart, and caring. She sometimes worries that she’s not good enough, but that doesn’t stop her from showing up or doing her best. She’s determined to keep getting better.</p><p id="0701">Although the delta woman finds herself at a lower rung on the sociosexual scale, she’s happy just to be included. She doesn’t need to lead. She doesn’t mind following. She just wants to be included, valued, and seen — just like anyone else.</p><div id="1f58" class="link-block"> <a href="https://readmedium.com/to-the-emotionally-unavailable-partner-with-love-16232d9981a3"> <div> <div> <h2>To the Emotionally Unavailable Partner, With Love</h2> <div><h3>It’s time to do the thing you’re most afraid of</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*QmR0vE0MFTU_6Iaj)"></div> </div> </div> </a> </div><div id="dbe6" class="link-block"> <a href="https://readmedium.com/7-things-the-nice-guy-does-that-a-good-man-would-never-do-132f002998d"> <div> <div> <h2>7 Things the “Nice Guy” Does That a Good Man Would Never Do</h2> <div><h3>Louder for the men in the back</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*lKeBjIo0NI9ToGXz)"></div> </div> </div> </a> </div><div id="e435" class="link-block"> <a href="https://readmedium.com/21-traits-of-a-high-value-man-9c846eca76fe"> <div> <div> <h2>21 Traits of a High-Value Man</h2> <div><h3>How to recognize and appreciate the high-value men in your life.</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*Zsa568jOV2oJwNHs)"></div> </div> </div> </a> </div></article></body>

Traffic sign detection - Udacity’s selfdriving car nanodegree— deep learning series 3

1. Introduction

Convolutional Neural Network (CNN) is a powerful tool in computer vision and self driving cars. Traffic sign detection is one of the major task in self-driving as it gives the input of what sign is in the image to decision making. I have done this project as part of Udacity’s self-driving car engineer course and all the credit goes to them. If you would like to get a brief introduction on CNN, please visit my previous article in this series.

2. Dataset

We have been provided with training, validation, and testing dataset in pickle format. Each dataset contains number of images and it’s label. We can use below code to load the data from pickle.

# Load pickled data
import pickle
import pandas as pd
import numpy as np

# TODO: Fill this in based on where you saved the training and testing data

training_file = 'traffic-signs-data/train.p'
validation_file= 'traffic-signs-data/valid.p'
testing_file = 'traffic-signs-data/test.p'

with open(training_file, mode='rb') as f:
    train = pickle.load(f)
with open(validation_file, mode='rb') as f:
    valid = pickle.load(f)
with open(testing_file, mode='rb') as f:
    test = pickle.load(f)
    
X_train, y_train = train['features'], train['labels']
X_valid, y_valid = valid['features'], valid['labels']
X_test, y_test = test['features'], test['labels']

The pickled data is a dictionary with 4 key/value pairs:

  • 'features' is a 4D array containing raw pixel data of the traffic sign images, (num examples, width, height, channels).
  • 'labels' is a 1D array containing the label/class id of the traffic sign. The file signnames.csv contains id -> name mappings for each id.
  • 'sizes' is a list containing tuples, (width, height) representing the original width and height the image.
  • 'coords' is a list containing tuples, (x1, y1, x2, y2) representing coordinates of a bounding box around the sign in the image. THESE COORDINATES ASSUME THE ORIGINAL IMAGE. THE PICKLED DATA CONTAINS RESIZED VERSIONS (32 by 32) OF THESE IMAGES.

Here is Summary statistics of the traffic signs data set we have:

Number of training examples = 34799
Number of validation examples = 4410
Number of testing examples = 12630
Image data shape = (32, 32, 3)
Number of classes = 43
Example dataset

3. Pre-processing

Before starting the training processs, dataset needs to have basic preprocessing using normalisation, grayscale etc. I found out normalisation itself gives very good output result and did not use other preprocessing techniques.

I did a reshuffling of the data so that it can increase the random nature of the datset.

from sklearn.utils import shuffle
X_train, y_train = shuffle(X_train, y_train)
X_valid, y_valid = shuffle(X_valid, y_valid)
X_test, y_test = shuffle(X_test, y_test)

Then did the normalisation to make sure the image data has been normalized so that the data has mean zero and equal variance.

#Nomralisation
X_train = (X_train-X_train.mean())/(np.max(X_train)-np.min(X_train))
X_valid = (X_valid-X_valid.mean())/(np.max(X_valid)-np.min(X_valid))
X_test = (X_test-X_test.mean())/(np.max(X_test)-np.min(X_test))

Image before and after normalisation are displayed here.

Before:

After:

4. Model architecture

The above picture is the architecture of LeNet-5 which is considered as one of the first Convolutional Neural Network(CNN). We are using LeNet-5 for the traffic sign detection project.

Pseudo-code of the architecture as follows:

Input

The LeNet architecture accepts a 32x32x3 image as input

Architecture

Layer 1: Convolutional. The output shape should be 28x28x6.

Activation. Your choice of activation function.

Pooling. The output shape should be 14x14x6.

Layer 2: Convolutional. The output shape should be 10x10x16.

Activation. Your choice of activation function.

Pooling. The output shape should be 5x5x16.

Flatten. Flatten the output shape of the final pooling layer such that it’s 1D instead of 3D. The easiest way to do is by using tf.contrib.layers.flatten, which is already imported for you.

Layer 3: Fully Connected. This should have 120 outputs.

Activation. Your choice of activation function.

Layer 4: Fully Connected. This should have 84 outputs.

Activation. Your choice of activation function.

Layer 5: Fully Connected (Logits). This should have 43 outputs.

Actual code implementation is below:

def LeNet(x): 
    
    # Layer 1: Convolutional. Input = 32x32x3. Output = 28x28x6.
    conv1_W = tf.Variable(tf.truncated_normal(shape=(5, 5, 3, 6), mean = 0, stddev = 0.1))
    conv1_b = tf.Variable(tf.zeros(6))
    conv1   = tf.nn.conv2d(x, conv1_W, strides=[1, 1, 1, 1], padding='VALID') + conv1_b
    
    # Activation 1.
    conv1 = tf.nn.relu(conv1)
    # Pooling. Input = 28x28x6. Output = 14x14x6.
    conv1 = tf.nn.max_pool(conv1, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='VALID')
    
    
    # Layer 2: Convolutional. Input = 14x14x6. Output = 10x10x16.
    conv2_W = tf.Variable(tf.truncated_normal(shape=(5, 5, 6, 16), mean = 0, stddev = 0.1))
    conv2_b = tf.Variable(tf.zeros(16))
    conv2   = tf.nn.conv2d(conv1, conv2_W, strides=[1, 1, 1, 1], padding='VALID') + conv2_b
    
    # Activation 2.
    conv2 = tf.nn.relu(conv2)
    # Pooling. Input = 10x10x16. Output = 5x5x16.
    conv2 = tf.nn.max_pool(conv2, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='VALID')
    
    # Flatten. Input = 5x5x16. Output = 400.
    flattened   = flatten(conv2)
    
    #Matrix multiplication
    #input: 1x400
    #weight: 400x120 
    #Matrix multiplication(dot product rule)
    #output = 1x400 * 400*120 => 1x120
    
     # Layer 3: Fully Connected. Input = 400. Output = 120.
    fullyc1_W = tf.Variable(tf.truncated_normal(shape=(400, 120), mean = 0, stddev = 0.1))
    fullyc1_b = tf.Variable(tf.zeros(120))
    fullyc1   = tf.matmul(flattened, fullyc1_W) + fullyc1_b
    
    # Full connected layer activation 1.
    fullyc1    = tf.nn.relu(fullyc1)
    
    # Layer 4: Fully Connected. Input = 120. Output = 84.
    fullyc2_W  = tf.Variable(tf.truncated_normal(shape=(120, 84), mean = 0, stddev = 0.1))
    fullyc2_b  = tf.Variable(tf.zeros(84))
    fullyc2    = tf.matmul(fullyc1, fullyc2_W) + fullyc2_b
    
    # Full connected layer activation 2.
    fullyc2    = tf.nn.relu(fullyc2)
    
    # Layer 5: Fully Connected. Input = 84. Output = 43.
    fullyc3_W  = tf.Variable(tf.truncated_normal(shape=(84, 43), mean = 0, stddev = 0.1))
    fullyc3_b  = tf.Variable(tf.zeros(43))
    logits = tf.matmul(fullyc2, fullyc3_W) + fullyc3_b
    
    return logits

5. Train & Evaluate

To train the model, I used following hyperparameter after several trial and error method.

learning_rate = 0.001
epochs = 40
batch_size = 64

Lenet model gives the logits and cross entropy. Then loss operation give the error compared to actual result and predicted result. Finally Adam optimiser is used for optimisation.

logits = LeNet(x)
cross_entropy = tf.nn.softmax_cross_entropy_with_logits(labels=one_hot_y, logits=logits)
loss_operation = tf.reduce_mean(cross_entropy)
optimizer = tf.train.AdamOptimizer(learning_rate = learning_rate)
training_operation = optimizer.minimize(loss_operation)

The above steps do the forward and backward pass and doing this on iterative manner will reduce the error at the end.

with tf.Session() as sess:
    sess.run(tf.global_variables_initializer())
    num_examples = len(X_train)
    
    print("Training...")
    print()
    for i in range(epochs):
        X_train, y_train = shuffle(X_train, y_train)
        for offset in range(0, num_examples, batch_size):
            end = offset + batch_size
            batch_x, batch_y = X_train[offset:end], y_train[offset:end]
            sess.run(training_operation, feed_dict={x: batch_x, y: batch_y})
            
        valid_loss, valid_accuracy = evaluate(X_valid, y_valid)
        print("Epoch {}, Validation loss = {:.3f}, Validation Accuracy = {:.3f}".format(i+1, valid_loss, valid_accuracy))
        print()
        
    saver1.save(sess, './classifier')
    print("Model saved")

The above code is the typical way of running the training in Tensorflow. Then evaluate function added below get called to check the validation accuracy at each epoch.

def evaluate(X_data, y_data):
    num_examples = len(X_data)
    total_accuracy = 0
    total_loss = 0
    sess = tf.get_default_session()
    for offset in range(0, num_examples, batch_size):
        batch_x, batch_y = X_data[offset:offset+batch_size], y_data[offset:offset+batch_size]
        loss, accuracy = sess.run([loss_operation, accuracy_operation], feed_dict={x: batch_x, y: batch_y})
        total_accuracy += (accuracy * len(batch_x))
        total_loss += (loss * len(batch_x))
    return total_loss/num_examples, total_accuracy/num_examples

7. Testing

Once the training is done, we can run the model against test dataset to check the final accuracy. In this case, trained model is able to correctly guess 6 of the 6 traffic signs, which gives an accuracy of 100%.

The result of the prediction as follows:

The above table gives the indication that, if we provide an image of traffic signs, then it can predict it accurately. I have only provided the label on the image columns instead of image due to this article space constraints.

If you would like to see the full code in action, please visit my github repo.

If you like my write up, follow me on Github, Linkedin, and/or Medium profile.

Deep learning series

  1. Deep learning series 1- Intro to deep learning
  2. Deep learning series 2 — simple image classification using deep learning

Reference

  1. Udacity’s self-driving car engineer nanodegree
Artificial Intelligence
Deep Learning
Machine Learning
Self Driving Cars
Technology
Recommended from ReadMedium