This document describes a convolutional neural network model that was trained to play the 1990 video game Stunts. The model takes screenshots of the game as 320x200 pixel RGB images and uses them to train a multi-class classification model with 8 direction outputs plus a no input option. The model was trained on over 21,000 images and takes around 50 minutes to fit. Resources for learning more about neural networks and deep learning with Python are also provided.
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Convolutional Neural Networks plays Racing Game
1. Convolutional Neural Network plays
Racing Game
Andre Odendaal
September 2019
v-anoden@microsoft.com
@Fengol
https://github.com/aodendaal/
ai-stunt-driver
6. Python Dependencies
• Numpy – Support for large, multi-dimensional arrays, matrices and their operations
• Pandas – Data structures and operations for manipulatingnumerical tables
• Pillow – Opening, manipulating, and saving many different image file formats
• win32gui -Provides access to much of the Win32 API
• Pynput – Control and monitor input devices
8. KerasModel
from tensorflow.keras import layers, models
model = models.Sequential()
model.add(layers.Conv2D(32, (3, 3), activation='relu’,
input_shape=(height, width, channels)))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(64, (3, 3), activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(64, (3, 3), activation='relu'))
model.add(layers.Flatten())
model.add(layers.Dense(64, activation='relu'))
model.add(layers.Dense(9, activation='softmax'))
ReLU activation is a
commonactivation type
2x2size for Max Pooling is
also common
Filter Size &Filter Count
takenfrom other
examples
Based on
image
10. Conclusion
MainTake-away
• UseKeras overTensorflow
• higher-level Keras over the complexity of Tensorflow
• Data Preparationisvery important
• Initially scaled screenshots too small
• Shouldn’t have grey-scaled
• Flattened data instead of preserving 2-dimensional array
• Re-capture after every change
OtherLessons
• RequiresintermediateknowledgeofPythontorefactorscripts
• UsePython’svirtualenvironments
• UsetheGPU
11. Resources
• 3Blue1Brown - Neural networks
• Machine Learning – Coursera – Andrew Ng
• Deep Learning with Tensorflow – edX – (IBM - DL0120EN)
• Deep Learning with Python – 2017 – Francois Chollet
• Towards Data Science - A Comprehensive Guide to Convolutional Neural Networks