# Tutorial: Building and Training the Traffic Image Model

Published: 11/12/2018

Last Updated: 11/12/2018

## Introduction

According to a 2011 World Health Organization (WHO) report, traffic accidents kill 1.3 million people every year. Unfortunately, the violation of traffic signs is a critical reason behind this incidence. The situation gets event worse for international tourists and foreigners due to misinterpretation or misunderstanding of traffic signs posted in a foreign language.

Deep learning is a new emerging technology for solving many image/object detection problems, especially in healthcare, autonomous driving, facial recognition, and home security. The big question is, can we apply deep learning to solving real-world problems associated with comprehending traffic signs. As deep learning continues to develop, it is certain that image detection technology will play a pivotal role. Interestingly, the development of advanced image detection technology has improved many fold, significantly influencing our world in all sorts of ways.

The goal of this article is to educate users to build AI models to predict the meaning of German traffic signals. Users will gain a good understanding of the AI model for image detection so that they can apply the same knowledge to predict German traffic images and then leverage that learning to build AI prediction models related to their area of interest. We provide step-by-step instructions to build an application using Intel technologies specifically to predict German traffic signs for a non-German person with the goal of articulating their meaning in English back to the user. Such a system is significant when designing apps for self-driving cars.

This article is intended for a wide range of AI professionals, including AI developers, data scientists, data engineers, solution architects and college students. It covers the essential tools and techniques for building an AI model for German traffic signs. We show how to deploy an AI model in a web application and translate German signs into English language.

Figure 1. Traffic signal AI model – A schematic representation

## Building a Team

To develop an AI use-case application predicting traffic signs, DataTiles* recommends having an agile team that includes:

• A Python* developer
• A data scientist with knowledge of deep learning, especially convolutional neural networks (CNN)
• A domain expert experienced in image processing, rules and regulation of traffic signals, vehicle transportation, etc.
• A front-end application developer

## Designing a German Traffic Sign Model

We start by providing a big picture of the traffic image model and then address the technicalities of building such a model. In brief, the user will photograph a traffic sign and upload it to the application, so that it can try to predict the meaning and relay it back to the user.

For this application, a developer will use a model-view-controller (MVC) framework to build the front end, middle layer, and back end of the application. As shown in figure 2 below, the view contains the front end of the application, the controller makes up the middle layer, and the model represents the back end.

Figure 2. German traffic signal AI model View showing front end, controller and back end.

### Front End (View)

The front end will be constructed using HTML and CSS. If you prefer, the front end can also be developed using ReactJS, Ruby on Rails, or another front-end tool. The basic aim is for the front end to provide the utility for a user to upload a photo of a traffic sign and a means by which the user can predict the uploaded traffic sign. For the current demo app we built a “Predict” button for the front end to use the function Predict() to talk to the Flask server, the controller. The front end provides the image to be predicted to the Predict() function. The image will be the argument for the Predict() function.

For the application to work effectively, some parameters regarding which images can be used are necessary. For this demo app, the image needs to be three-channel RGB so it can be properly processed. (We have not tested the application for images made of YUV, CMYK, or HSV channels). This document has a section on image pre-processing.

### Middle Layer (Controller)

After the front end provides an image to Flask, the Predict() function calls a model located in the back end. The Predict() function then unpickles this Machine Learning Model located in the back end. Subsequently, the image supplied by the front end is used as an argument, and prediction occurs. The result comes as a respective class label for German traffic.

### Back End (Model)

The back end will use supervised machine learning to create the model. The deep learning model will be created using the Keras API and TensorFlow*. An initial dataset of “German Images” will be loaded. This dataset will be split into Training Dataset and Test Dataset. As we are taking a supervised machine learning approach, an initial 40,000 + images will be used to train the model, effectively providing its “ground roots”. Now, when a new image appears, the machine learning algorithm should be able to predict a correct label. A subsequent set of test images will then be used to test the model. Once we have fit the model, gaining 98% accuracy, we can save the model as a .pickle file as it is now ready to predict the new image.

Finally, figure 2 above shows that within the Flask server, the Predict() function unpickles the machine learning model we created and uses the image provided by the front end to make a prediction. The result is the respective Class Label for German traffic, which is then displayed in the front end to the user.

Details related to technical requirements – installing and checking technical components, building and activating virtual environments, and training, saving and using the model – are clearly explained in this document. In the following sections, we will walk developers through the technical process of building the Traffic Image Model as described above. The appendix section contains details for formatting images, directory structure of Images, and how the training and prediction images were preprocessed for the given model. Python* source code for traffic Image model is also provided in the appendix.

## Step-by-Step Guide

We are covering all the technical requirements for hardware and software, including the steps a data scientist or developer must follow to build and train the AI Traffic Image model on a local machine.

##### Local machine

We tested the instructions on the local machine that meets the following requirements:

##### macOS*

High Sierra (Operating System) Version 10.13.3
Processor: 2.2 GHz, Intel® Core™ i7
Memory: 8GB
Graphics: Intel HD Graphics 6000 1536MB

##### Ubuntu* system

Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
Memory: 8GB
CPU Speed: 2.400 GHz

##### Approach

The following are the components of the solution:

• Web app: This is a flask app. The pages are rendered on server side using flask
• Offline (batch) model training: A deep learning model is trained using the available data
• Model deployment: The built deep learning model is served as a REST API using Flask
##### Step-by-step instructions

This information pertains to building a virtual environment on macOS* or Ubuntu* for the AI model application.

The following instructions are for Mac* and should run locally.

### Step 1. Installation of Anaconda*

The complete project is packaged into three parts. Download all three zip files and unpack the complete project.

Once all are unpacked the project should follow the file organization in figure 3.

Figure 3. Project components organization

### Step 3. Installation of Necessary Packages (Framework, Libraries)

This process uses the Intel® Distribution for Python*; we recommend creating a virtual environment to install this distribution. You should already downloaded the environment.yml file in previous step - see appendix D. It contains a list of all Intel and non-Intel packages and libraries with correct version. For a checklist of libraries, open environment.yml file in your terminal.

Execute the following commands on the terminal:

conda update conda
This command will update conda

conda env create -f environment.yml
This command will create the environment for the application

source activate idp
Activate the conda environment “idp” that was created in the above step

Note: If you experience permission issue during TensorFlow installation, you can add --user with abovementioned code. Finally, you will see a successful installation message in the terminal.

Upgrade TensorFlow* for Mac. TensorFlow 1.4.0 is specific for the CPU (device specific). If you don’t have TensorFlow installed, you can get it from “pip install

pip install keras --ignore-installed
This command will install keras in your local machine. It is a high-level API on top of TensorFlow and we will be writing the model in keras

python3 -c 'import tensorflow as tf; print(tf.__version__)'
Check the TensorFlow version
Output: 1.4.0

python3 -c 'import keras; print(keras.__version__)'
Check the keras version
Output: 2.2.0

### Step 4. Data Collection, Data Processing and Preprocessing

##### Data source

German traffic sign image data was collected from Stallkamp Research Paper (Stallkamp et al 2011) (GTSRB). You will find the same data in “data” folder, which you have already downloaded in step 2 above. Each input image is a single traffic sign. Refer to Appendix C for more information on the dataset.

##### Data pre-processing

As mentioned before, we need to pre-process the images before feeding them into the Traffic Image model. The model we currently developed accepts images for training and testing in a certain format, so pre-processing is required for both the Training and Testing datasets. Since the images are available in several formats, you can modify or change the Traffic Image model accordingly. Below is an explanation of the pipeline we used for pre-processing of Training Images and for pre-processing of prediction images. We also provided the relevant Python code for pre-processing images specific to our Traffic Image model; you can modify this code for different formatting based on the model requirement.

The input images are pre-processed before they can be used for building the model. The images are normalized and centered. Every image is then re-sized to 48x48 pixels and fed into the model for training.

Figure 4. Image preprocessing for training

##### Relevant Python Code (build_model.py)
# Histogram normalization in y
hsv = color.rgb2hsv(img)
hsv[:,:,2] = exposure.equalize_hist(hsv[:,:,2])
img = color.hsv2rgb(hsv)
# central scrop
min_side = min(img.shape[:-1])
centre = img.shape[0]//2, img.shape[1]//2
img = img[centre[0]-min_side//2:centre[0]+min_side//2,
centre[1]-min_side//2:centre[1]+min_side//2,
:]

# rescale to standard size
img = transform.resize(img, (IMG_SIZE, IMG_SIZE))
# roll color axis to axis 0
img = np.rollaxis(img,-1)



During prediction, the input image for testing is pre-processed the same way as it was done for training. It is then fed into the model for prediction. Here is the summary of images:

• Single-image, multi-class classification problem
• More than 40 classes
• More than 50,000 images in total
• Large, life like database
• Reliable ground-truth data due to semi-automatic annotation
##### Splitting of image dataset

We need to split the whole image dataset into a Training dataset and a Test dataset. Here is the code for splitting datasets:

model.fit(X, Y,
batch_size=batch_size,
epochs=nb_epoch,
validation_split=0.2,
shuffle=True,
callbacks=[LearningRateScheduler(lr_schedule),
ModelCheckpoint(&#39;../webapp/models/model.h5&#39;,save_best_only=True)]
)


It will split the whole image dataset into an 80/20 ratio. This means 80% of the image dataset is for training the model and 20% of the image dataset is to test the accuracy of the model. You can modify the split to 75/25 by simple modification in code (validation_split=0.25).

For your convenience the data was already split for training (folder “train”) and testing (folder “test”). Find these folders in the “data” folder you already downloaded in step 2.

(If you want to create a new directory named “test” and “train” inside the data folder, copy all the training images in the folder ~/IA/DemoApp/data/train and testing images in folder ~/IA/DemoApp/data$test folder). ##### Training dataset The training image dataset has a set of directories, each for a single traffic sign, and a list of images related to that traffic sign class within the directory. Sample screenshot of the training images directory structure is shown in figure 5. Training images are grouped by their respective folders; each folder contains 30 images for one single physical traffic sign. Each directory contains one CSV file with annotations ("GT-<ClassID>.csv") and the training images. Each test image dataset follows a similar pattern. Figure 5. Training dataset directory structure ### Step 5. Building the Model Once you have created the environment and split the image dataset, it’s time to write the code for building the convolution network model for image detection. Developing the back end for this application includes training the CNN model with the training image dataset. Trained model can be saved in the .h5 format. We are ready to code for the traffic model. This section shows you step-by-step instructions on how to access the Model folder, followed by how to build the traffic image model within the Model folder. ~/IA/DemoApp$ cd model
# Access the ‘model’ folder
~/IA/DemoApp/model$vi build_model.py # build_model file was used to build the Traffic Image model within the Model Folder NOTE: build_model.py was developed by DataTiles to specifically build and train the FORMATTED Traffic Images. Refer to appendix A: Source Code for build_model.py* file, to see the source code of build_model.py Now you will use python to execute build_model.py file using the following command: ~/IA/DemoApp/model$/anaconda3/bin/ipython build_model.py

Model has an accuracy of 97.63%. Refer to Appendix B for more information on Model accuracy and Loss function.

This command will create a model.h5 file and classification lables.pkl files in the /IA/DemoAPP/webapp/models folder. These two files are required for the front end to make prediction. This concludes building and saving of the DataTiles Traffic Image Prediction Model. This model will be integrated with the front-end application.

### Step 6. Building the Front End with Back End to Predict the Image

The front end of the application is built using Flask. The user interface of the demo application is created using HTML and the CSS is done using bootstrap (https://getbootstrap.com/). Flask is a micro framework for Python based on Werkzeug and Jinja 2, which is a full-featured template engine for Python. The app is server-side rendered. All pages are constructed on the server. The model is trained in a batch process. Once the model is trained, the model is serialized. In the Flask app, the model is loaded and remains in the RAM (memory) of the server, and predictions are now served real-time.

Figure 6. Image pre-processing for prediction

##### Relevant Python Code (build_model.py)
# Histogram normalization in y
hsv = color.rgb2hsv(img)
hsv[:,:,2] = exposure.equalize_hist(hsv[:,:,2])
img = color.hsv2rgb(hsv)
# central scrop
min_side = min(img.shape[:-1])
centre = img.shape[0]//2, img.shape[1]//2
img = img[centre[0]-min_side//2:centre[0]+min_side//2,
centre[1]-min_side//2:centre[1]+min_side//2,
:]
# rescale to standard size
img = transform.resize(img, (IMG_SIZE, IMG_SIZE))
# roll color axis to axis 0
img = np.rollaxis(img,-1)

# Extract img from object
if img.dtype == 'object':
img = img[0]
# Convert RGBA to rgB
if img.shape[2] == 4:
img = color.rgba2rgb(img)


When an input image is loaded in the app and the predict button is clicked, the API served by Flask is called. The API function uses the predict function of the model object to predict the traffic sign. Once the prediction is obtained from the model, the response page is constructed and is sent to the browser for rendering.

Figure 7. Interaction of model and app/web server

app.py is the main file which uses index.html. index.html uses simple html tags and CSS to create the front end. The back-end model is built using Python code; find the code in build_model.py file. We are using Flask as a web server.

### Step 7. Running Demo App of AI traffic Sign

Once you are done with building, training, and saving the image prediction model and integrating the back end with the front-end application, the entire application is pushed on to the cloud.

This section demonstrates how to use the demo AI application for predicting traffic images through a series of screen captures. The demo AI application is hosted in the cloud. We are using Google Chrome browser to provide step-by-step guidance on using the application.

Now, to deploy the Flask app, navigate to the webapp folder and run the following commands (assuming you are in the model folder):

cd ../webapp

python app.py 127.0.0.1

This will start the server and deploy the app. Once the server is started, you can open it on the (local host) browser link.

Accessing the demo app through the URL takes you to the home page of the application.

The front-end application will access the test traffic images stored or placed either in the cloud or local desktop.

Figure 9. Selecting the test (data/test) image to predict its label

Select the traffic image you would like the model to predict the label for and click the Open button.

After you have selected the traffic image file, click on Predict. The application predicts the label for the traffic image file using the back end.

Figure 10. Predict the label of selected image

Figure 11. Correct label prediction by AI App

Once you are done predicting the label for the selected traffic image, click on the Model Demo button to go to the home page of the application.

## Conclusion

This article introduces building AI models that predict the meaning of German traffic signals. These step-by-step instructions cover the use of AI models for image detection, enabling AI developers, engineers, solution architects and others to apply this information to predict German traffic images and then leverage that knowledge to create applications related to their area of interest. Now it’s your turn: start using Intel technologies for new solutions that predict German traffic signs and alert non-German users to their meaning in English, or any other language.

## Appendix A. Source Code for build_model.py* file

build_model.py* was developed by DataTiles* to specifically build and train the formatted German traffic images.

build_model.py file:

# © DataTiles.io, DataTiles.ai
#!/glob/intel-python/python3/bin/python

# To build and deploy the application, we need to import a number of Python libraries. Following are our key libraries:

# numpy: This is the fundamental package for scientific computing with Python. It helps us manipulate matrices.
# pandas: It is a high-level abstraction on top of numpy providing us with easy-to-use data analysis capabilities.
# sklearn: This is the base machine learning library in Python
# skimage: this is the base image processing library in Python
# keras: Keras is one of the most popular deep learning libraries in Python. It provides a higher-level abstraction to a number of deep learning libraries like Tensorflow.
# joblib: Joblib helps us serialize the deep learning model.

import numpy as np
import pandas as pd
from skimage import io, color, exposure, transform
from sklearn.cross_validation import train_test_split
import os
import glob
import h5py
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential, model_from_json
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Conv2D
from keras.layers.pooling import MaxPooling2D
from keras.optimizers import SGD
from keras.utils import np_utils
from keras.callbacks import LearningRateScheduler, ModelCheckpoint
from keras import backend as K
K.set_image_data_format('channels_first')
from matplotlib import pyplot as plt
import joblib
NUM_CLASSES = 43
IMG_SIZE = 48

# Data pre-processing of the images helps us in training deep learning models better. The input images could come with different settings # of lens and lightings. Normalizing the pixel intensities help in ensuring that models converge faster. For this use case, consider getting
# images with poor contrast due to glare. Histogram normalization helps us address many of these challenges.

# The input images are of different shapes and sizes. While histogram normalization helps in normalizing the intensity, the traffic sign
#  could still be off and be present in different parts of the image. In this step, we standardize the images to 32 x 32. First, a haircut along
# the sides are carried out -based on the center. The crop is based on the minimum dimension side.
# This ensures that the center remains in prominence. Then, the image is resized to 32 x 32.
# The following function pre-processes the raw images, using the functions defined above, before being used to train the deep learning model. H5 data file stands for Hierarchical Data Format. It contains multi-dimensional array of numeric data. It is designed to store and # # organize large amounts of data.
# We need to process the images and store them in HDF5 format. The following set of code achieves that.
# In this code, each image is read and the pre-processing functions are run on them. The resulting images are stored in HDF5 format and is saved on disk. For each image, its corresponding class is also stored.

# # Preprocess the image
def preprocess_img(img):
# Histogram normalization in y
hsv = color.rgb2hsv(img)
hsv[:,:,2] = exposure.equalize_hist(hsv[:,:,2])
img = color.hsv2rgb(hsv)

# central scrop
min_side = min(img.shape[:-1])
centre = img.shape[0]//2, img.shape[1]//2
img = img[centre[0]-min_side//2:centre[0]+min_side//2,
centre[1]-min_side//2:centre[1]+min_side//2,
:]

# rescale to standard size
img = transform.resize(img, (IMG_SIZE, IMG_SIZE))

# roll color axis to axis 0
img = np.rollaxis(img,-1)

return img

def get_class(img_path):
return img_path.split('/')[-2]

# # Preprocess training images into numpy array

get_ipython().system('rm X.h5')

try:
with  h5py.File('X.h5') as hf:
X, Y = hf['imgs'][:], hf['labels'][:]

except (IOError,OSError, KeyError):
print("Error in reading X.h5. Processing all images...")
root_dir = '/home/userid/demoPP/data/train'
imgs = [ ]
labels = [ ]
#print("here")
all_img_paths = glob.glob(os.path.join(root_dir, '*/*.png'))
#print("---")
#print(all_img_paths)
np.random.shuffle(all_img_paths)
for img_path in all_img_paths:
try:
label = get_class(img_path)
imgs.append(img)
labels.append(label)

if len(imgs)%1000 == 0: print("Processed {}/{}".format(len(imgs), len(all_img_paths)))
except (IOError, OSError):
print('missed', img_path)
pass

X = np.array(imgs, dtype='float32')
Y = np.array(pd.get_dummies(pd.DataFrame(labels)))

with h5py.File('X.h5','w') as hf:
hf.create_dataset('imgs', data=X)
hf.create_dataset('labels', data=Y)

# Defining the model. Convolutional Neural Network models are the current state-of-art for image recognition. We have a number of # classes and about 50k data points. Building a very deep network might result in over-fitting, while building a model with less number of # layers might result in lower accuracy.
# For a problem of this size, starting with 3 layer deep CNN is a good start. We observe the validation accuracy and then decide if we need # to increase the layers or reduce the layers.
# In a standard CNN model, each convolutional layer is followed by a max pooling layer and that is followed by a dropout layer.
# Convolutional layer helps in feature identification/transformation. Examples include: edge detection, sharpness etc. Convolutional layer is characterized by shared weights – thereby decreasing the number of weights that need to be learnt in this layer. This makes it powerful # (compared to multi-layer perceptron). Also, the images layout is preserved in this layer. This ensures that many characteristics of the
# images are exploited and learnt during the training phase.

# Once we identify the features(say:edge) in the convolutional layer, the relative positions are less important than the areas they exist.
# Maxpooling achieves this. Dropouts help in avoiding overfitting. The parameter (here: 0.2) tells that 20% of the neurons aren’t available for training during that particular batch. This makes it robust.
# The last layer is a dense classification layer. We are doing a multi-class classification and so, softmax is the appropriate choice of
# classifier.

# To train the model, apart from the architecture, you need to define the following:
#Optimizer: This is the algorithm that will be used for updating the weights. We will go with stochastic gradient descent.

# For SGD, the loss we will use is categorical cross entropy. Cross-entropy loss increases as the predicted probability diverges from the actual label.
# Learning Rate: It is a good practice to provide a learning rate schedule.
# A fixed learning rate might either be too aggressive or too conservative. If it is too aggressive, it may not converge and if it is too
# conservative, the training might take a lot of time. Ideally, the initial learning rates are aggressive and as the training continues, it
# becomes more and more conservative. This ensures that the most promising region is quickly zoomed into and slowly/iteratively,
# the best model parameters are learnt in that region.

# We used Keras with TensorFlow as you can achieve your goals with Kera with fewer lines of code. You can achieve same results using only TensorFlow code, but code is going to be much longer and much complex.
# TensorFlow also have advantages including Python plus Numpy support, Computational graph abstraction, Faster compile times than Theano, TensorBoard for visualization and Data & model parallelism

# # Define keras model

def cnn_model():
model = Sequential()

input_shape=(3, IMG_SIZE, IMG_SIZE),
activation='relu'))

activation='relu'))

activation='relu'))
return model

model = cnn_model()
# let's train the model using SGD + momentum (how original).
lr = 0.01
sgd = SGD(lr=lr, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(loss='categorical_crossentropy',
optimizer=sgd,
metrics=['accuracy'])

def lr_schedule(epoch):
return lr*(0.1**int(epoch/10))

# Now that the model architecture is defined, you need to train the model on the data. We set the batch size to 32.
# The nb_epoch parameter defines the number of epochs that are run.
# Keras has a “fit” function that trains the model.
# We use 20% of the data as validation and use the remaining for training. After each epoch, the training and validation score are printed.
# We use the learning rate scheduler to control the training process. It starts with a high learning rate and then, learning rate reduces. This
# helps in rapidly narrowing to the region where we have the greatest chances of finding the model parameters with the lowest error.
# After every epoch, if the validation accuracy is the best so far in the training process, the model (weights) are checkpointed (saved) at the # file name mentioned in the model checkpoint parameter.


The labels are also serialized. This is needed for us to lookup the traffic sign, given the label.

# # Model training

batch_size = 32
nb_epoch = 3

model.fit(X, Y,
batch_size=batch_size,
epochs=nb_epoch,
validation_split=0.2,
shuffle=True,
callbacks=[LearningRateScheduler(lr_schedule),
ModelCheckpoint('/home/userid/demoPP/webapp/models/model.h5',save_best_only=True)]
)

classification_labels = pd.get_dummies(pd.DataFrame(labels)).columns

joblib.dump(classification_labels, "/home/userid/demoPP/webapp/models/classification_labels.pkl")



## Appendix B. Accuracy and Loss function for the model

Following shows the accuracy of the model is 97.63%. We are using 3 Epoch (iterations) for this model.

~/IA/DemoApp/model $source activate idp ~/IA/DemoApp/model$ /anaconda3/bin/ipython build_model.py

/anaconda3/lib/python3.6/site-packages/sklearn/cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators is different from that of this module. This module will be removed in 0.20.

/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:34: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.

from ._conv import register_converters as _register_converters

Using TensorFlow backend.

/anaconda3/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6

return f(*args, **kwds)

Error in reading X.h5. Processing all images...

/anaconda3/lib/python3.6/site-packages/skimage/transform/_warps.py:84: UserWarning: The default mode, 'constant', will be changed to 'reflect' in skimage 0.15.

warn("The default mode, 'constant', will be changed to 'reflect' in "

Processed 1000/39209
Processed 2000/39209
Processed 3000/39209
Processed 4000/39209
Processed 5000/39209
Processed 6000/39209
Processed 7000/39209
Processed 8000/39209
Processed 9000/39209
Processed 10000/39209
Processed 11000/39209
Processed 12000/39209
Processed 13000/39209
Processed 14000/39209
Processed 15000/39209
Processed 16000/39209
Processed 17000/39209
Processed 18000/39209
Processed 19000/39209
Processed 20000/39209
Processed 21000/39209
Processed 22000/39209
Processed 23000/39209
Processed 24000/39209
Processed 25000/39209
Processed 26000/39209
Processed 27000/39209
Processed 28000/39209
Processed 29000/39209
Processed 30000/39209
Processed 31000/39209
Processed 32000/39209
Processed 33000/39209
Processed 34000/39209
Processed 35000/39209
Processed 36000/39209
Processed 37000/39209
Processed 38000/39209
Processed 39000/39209

2018-02-11 11:46:51.755885: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA

Train on 31367 samples, validate on 7842 samples

Epoch 1/3

31367/31367 [==============================] - 1596s 51ms/step - loss: 1.0481 - acc: 0.7129 - val_loss: 0.0973 - val_acc: 0.9749

Epoch 2/3

31367/31367 [==============================] - 1520s 48ms/step - loss: 0.1514 - acc: 0.9576 - val_loss: 0.0430 - val_acc: 0.9880

Epoch 3/3

31367/31367 [==============================] - 1510s 48ms/step - loss: 0.0848 - acc: 0.9763 - val_loss: 0.0472 - val_acc: 0.9894

## Appendix C. Images Dataset

The German traffic Image Dataset used for this Demo App is from professors Stallkamp Research papers. Please refer to http://benchmark.ini.rub.de/?section=gtsrb&subsection=dataset for complete explanation of the dataset.

##### Citation

J. Stallkamp, M. Schlipsing, J. Salmen, and C. Igel. The German Traffic Sign Recognition Benchmark: A multi-class classification competition. In Proceedings of the IEEE International Joint Conference on Neural Networks, pages 1453–1460. 2011.

## Appendix D. environment.yml

name: idp
channels:
- intel
- defaults
dependencies:
- astroid
- click
- isort
- itsdangerous
- lazy-object-proxy
- mccabe
- pylint
- werkzeug
- wrapt
- appnope
- asn1crypto=0.22.0=py36_0
- backports=1.0=py36_intel_6
- bleach=2.0.0=py36_intel_0
- bzip2=1.0.6=intel_13
- certifi=2017.7.27.1=py36_intel_0
- cffi=1.10.0=py36_intel_0
- chardet=3.0.4=py36_intel_0
- cryptography=2.0.3=py36_intel_0
- cycler=0.10.0=py36_intel_5
- cython=0.27.1=py36_intel_0
- daal=2018.0.1.20171012=1
- decorator=4.1.2=py36_intel_0
- entrypoints=0.2.3=py36_intel_0
- freetype=2.8=intel_0
- get_terminal_size=1.0.0=py36_intel_5
- hdf5=1.10.1=intel_0
- html5lib=0.999999999=py36_intel_0
- icc_rt=2018.0.0=intel_0
- idna=2.6=py36_intel_0
- intelpython=2018.0.0=3
- intelpython3_core
- intelpython3_full=2018.0.1=0
- ipykernel=4.6.1=py36_intel_0
- ipython=6.1.0=py36_intel_0
- ipython_genutils=0.2.0=py36_intel_0
- ipywidgets=7.0.0=py36_intel_0
- jinja2=2.9.6=py36_intel_0
- jsonschema=2.6.0=py36_intel_0
- jupyter=1.0.0=py36_intel_5
- jupyter_client=5.1.0=py36_intel_0
- jupyter_console=5.1.0=py36_intel_0
- jupyter_core=4.3.0=py36_intel_1
- libpng=1.6.32=intel_0
- llvmlite=0.20.0=py36_intel_0
- markupsafe=1.0=py36_intel_0
- matplotlib=2.0.2=np113py36_intel_1
- mistune=0.7.4=py36_intel_1
- mkl
- mkl_fft=1.0.0=np113py36_intel_15
- mkl_random=1.0.0=np113py36_intel_6
- mpmath=0.19=py36_intel_5
- nbconvert=5.2.1=py36_intel_0
- nbformat=4.4.0=py36_intel_0
- nose=1.3.7=py36_intel_16
- notebook=5.0.0=py36_intel_0
- numba=0.35.0=py36_intel_0
- numexpr=2.6.2=np113py36_intel_5
- numpy=1.13.3=py36_intel_6
- openmp=2018.0.0=intel_8
- openssl=1.0.2l=intel_0
- pandas=0.20.3=np113py36_intel_4
- pandocfilters=1.4.1=py36_intel_0
- path.py=10.3.1=py36_intel_0
- pexpect=4.2.1=py36_intel_1
- pickleshare=0.7.4=py36_intel_1
- pip=9.0.1=py36_intel_0
- prompt_toolkit=1.0.15=py36_intel_0
- ptyprocess=0.5.2=py36_intel_0
- pycparser=2.18=py36_intel_0
- pydaal=2018.0.1.20171012=np113py36_intel_0
- pygments=2.2.0=py36_intel_1
- pyopenssl=17.2.0=py36_intel_0
- pyparsing=2.2.0=py36_intel_0
- pysocks=1.6.7=py36_intel_0
- pytables=3.4.2=np113py36_intel_2
- python=3.6.3=intel_3
- python-dateutil=2.6.0=py36_intel_3
- pytz=2017.2=py36_intel_3
- pyyaml=3.12=py36_intel_3
- pyzmq=16.0.2=py36_intel_4
- requests=2.18.4=py36_intel_0
- scikit-learn=0.19.0=np113py36_intel_6
- scipy=0.19.1=np113py36_intel_23
- setuptools=27.2.0=py36_intel_0
- simplegeneric=0.8.1=py36_intel_5
- six=1.10.0=py36_intel_8
- sqlite=3.20.1=intel_0
- sympy=1.1.1=py36_intel_0
- tbb=2018.0.1=py36_intel_3
- tcl=8.6.4=intel_17
- testpath=0.3.1=py36_intel_0
- tk=8.6.4=intel_26
- traitlets=4.3.2=py36_intel_1
- urllib3=1.22=py36_intel_0
- wcwidth=0.1.7=py36_intel_5
- webencodings=0.5.1=py36_0
- wheel=0.29.0=py36_intel_5
- widgetsnbextension=3.0.2=py36_0
- xz=5.2.3=intel_0
- yaml=0.1.7=intel_0
- zlib=1.2.11=intel_3
- pip:
- backports.shutil-get-terminal-size==1.0.0
- enum34==1.1.6
- h5py==2.7.1
- joblib==0.11
- keras==2.1.2
- markdown==2.6.10
- networkx==2.0
- olefile==0.44
- pillow==4.3.0
- protobuf==3.5.1
- pywavelets==0.5.2
- scikit-image==0.13.1
- tables==3.4.2


#### Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.