<filename>model.py
import os
os.environ["CUDA_VISIBLE_DEVICES"]="-1"
import tensorflow as tf
from keras.layers import Dense, Flatten, Lambda, Activation, MaxPooling2D
from keras.layers.convolutional import Convolution2D
from keras.models import Sequential
from keras.optimizers import Adam

import helper

# tf.python.control_flow_ops = tf

number_of_epochs = 8
number_of_samples_per_epoch = 379 # 20032 # Adjust to your corredsponing value
number_of_validation_samples = 100
learning_rate = 1e-4
activation_relu = 'relu'

# Our model is based on NVIDIA's "End to End Learning for Self-Driving Cars" paper
# Source:  https://images.nvidia.com/content/tegra/automotive/images/2016/solutions/pdf/end-to-end-dl-using-px.pdf
model = Sequential()

model.add(Lambda(lambda x: x / 127.5 - 1.0, input_shape=(64, 64, 3)))

# TODO: starts with five convolutional and maxpooling layers

#########################################
# ADD MISSING CONV AND POOL LAYERS HERE #
#########################################

model.add(Flatten())

# TODO: Next, four fully connected layers

###########################################
# ADD MISSING FULLY CONNECTED LAYERS HERE #
###########################################

# Last, single output value
model.add(Dense(1))

model.summary()

model.compile(optimizer=Adam(learning_rate), loss="mse", )

# Fix arbitarty csv file 
helper.fix_csv_header()

# create two generators for training and validation
train_gen = helper.generate_next_batch()
validation_gen = helper.generate_next_batch()

history = model.fit_generator(train_gen,
                              samples_per_epoch=number_of_samples_per_epoch,
                              nb_epoch=number_of_epochs,
                              validation_data=validation_gen,
                              nb_val_samples=number_of_validation_samples,
                              verbose=1)

# finally save our model and weights
helper.save_model(model)

<filename>model.py
import os
os.environ["CUDA_VISIBLE_DEVICES"]="-1"
import tensorflow as tf
from keras.layers import Dense, Flatten, Lambda, Activation, MaxPooling2D
from keras.layers.convolutional import Convolution2D
from keras.models import Sequential
from keras.optimizers import Adam

import helper

# tf.python.control_flow_ops = tf

number_of_epochs = 8
number_of_samples_per_epoch = 379 # 20032 # Adjust to your corredsponing value
number_of_validation_samples = 100
learning_rate = 1e-4
activation_relu = 'relu'

# Our model is based on NVIDIA's "End to End Learning for Self-Driving Cars" paper
# Source:  https://images.nvidia.com/content/tegra/automotive/images/2016/solutions/pdf/end-to-end-dl-using-px.pdf
model = Sequential()

model.add(Lambda(lambda x: x / 127.5 - 1.0, input_shape=(64, 64, 3)))

# TODO: starts with five convolutional and maxpooling layers

#########################################
# ADD MISSING CONV AND POOL LAYERS HERE #
#########################################

model.add(Flatten())

# TODO: Next, four fully connected layers

###########################################
# ADD MISSING FULLY CONNECTED LAYERS HERE #
###########################################

# Last, single output value
model.add(Dense(1))

model.summary()

model.compile(optimizer=Adam(learning_rate), loss="mse", )

# Fix arbitarty csv file 
helper.fix_csv_header()

# create two generators for training and validation
train_gen = helper.generate_next_batch()
validation_gen = helper.generate_next_batch()

history = model.fit_generator(train_gen,
                              samples_per_epoch=number_of_samples_per_epoch,
                              nb_epoch=number_of_epochs,
                              validation_data=validation_gen,
                              nb_val_samples=number_of_validation_samples,
                              verbose=1)

# finally save our model and weights
helper.save_model(model)

# tf.python.control_flow_ops = tf # 20032 # Adjust to your corredsponing value # Our model is based on NVIDIA's "End to End Learning for Self-Driving Cars" paper # Source:  https://images.nvidia.com/content/tegra/automotive/images/2016/solutions/pdf/end-to-end-dl-using-px.pdf # TODO: starts with five convolutional and maxpooling layers ######################################### # ADD MISSING CONV AND POOL LAYERS HERE # ######################################### # TODO: Next, four fully connected layers ########################################### # ADD MISSING FULLY CONNECTED LAYERS HERE # ########################################### # Last, single output value # Fix arbitarty csv file # create two generators for training and validation # finally save our model and weights