Computer/NN_Trainer/cnnModel_Keras.py
def nVidiaModel():
    """
    Creates nVidea Autonomous Car Group model
    """
    resizeWidth = 320;
    resizeHeight = 128;
    model = Sequential()
    #crop 108 from top, and 36 from bottom, to get [108:204], or 96 elements, and 0 cropped from width
    model.add(Cropping2D(cropping=((112, 12), (0, 0)),
                         dim_ordering='tf',  # default
                         input_shape=(240, 320, 3)))
    model.add(Lambda(lambda x: x/255.0 - 0.5, input_shape=(resizeHeight, resizeWidth, 3)))
    #TODO: look into cropping layer. Why add it??
    model.add(Conv2D(24,(5,5), subsample=(2,2), activation='elu', padding='same'))
    model.add(Conv2D(36,(5,5), subsample=(2,2), activation='elu', padding='same'))
    model.add(Conv2D(48,(5,5), subsample=(2,2), activation='elu', padding='same'))
    model.add(Conv2D(64,(3,3), activation='elu', padding='same'))
    model.add(Conv2D(64,(3,3), activation='elu', padding='same'))
    model.add(Flatten())
    model.add(Dense(100,activation='elu'))
    model.add(Dense(50,activation='elu'))
    model.add(Dense(10,activation='elu'))
    model.add(Dense(1))
    model.compile(loss='mse', optimizer=Adam(lr=lrate),metrics=['accuracy'])
    return model

    Creates nVidea Autonomous Car Group model
    
Creates nVidea Autonomous Car Group model
Creates nVidea Autonomous Car Group model
def nVidiaModel():
    resizeWidth = 320;
    resizeHeight = 128;
    model = Sequential()
    model.add(Cropping2D(cropping=((112, 12), (0, 0)),
                         dim_ordering='tf',  
                         input_shape=(240, 320, 3)))
    model.add(Lambda(lambda x: x/255.0 - 0.5, input_shape=(resizeHeight, resizeWidth, 3)))
    model.add(Conv2D(24,(5,5), subsample=(2,2), activation='elu', padding='same'))
    model.add(Conv2D(36,(5,5), subsample=(2,2), activation='elu', padding='same'))
    model.add(Conv2D(48,(5,5), subsample=(2,2), activation='elu', padding='same'))
    model.add(Conv2D(64,(3,3), activation='elu', padding='same'))
    model.add(Conv2D(64,(3,3), activation='elu', padding='same'))
    model.add(Flatten())
    model.add(Dense(100,activation='elu'))
    model.add(Dense(50,activation='elu'))
    model.add(Dense(10,activation='elu'))
    model.add(Dense(1))
    model.compile(loss='mse', optimizer=Adam(lr=lrate),metrics=['accuracy'])
    return model
def nVidiaModel ( ) : resizeWidth = 320 ; resizeHeight = 128 ; model = Sequential ( ) model . add ( Cropping2D ( cropping = ( ( 112 , 12 ) , ( 0 , 0 ) ) , dim_ordering = 'tf' , input_shape = ( 240 , 320 , 3 ) ) ) model . add ( Lambda ( lambda x : x / 255.0 - 0.5 , input_shape = ( resizeHeight , resizeWidth , 3 ) ) ) model . add ( Conv2D ( 24 , ( 5 , 5 ) , subsample = ( 2 , 2 ) , activation = 'elu' , padding = 'same' ) ) model . add ( Conv2D ( 36 , ( 5 , 5 ) , subsample = ( 2 , 2 ) , activation = 'elu' , padding = 'same' ) ) model . add ( Conv2D ( 48 , ( 5 , 5 ) , subsample = ( 2 , 2 ) , activation = 'elu' , padding = 'same' ) ) model . add ( Conv2D ( 64 , ( 3 , 3 ) , activation = 'elu' , padding = 'same' ) ) model . add ( Conv2D ( 64 , ( 3 , 3 ) , activation = 'elu' , padding = 'same' ) ) model . add ( Flatten ( ) ) model . add ( Dense ( 100 , activation = 'elu' ) ) model . add ( Dense ( 50 , activation = 'elu' ) ) model . add ( Dense ( 10 , activation = 'elu' ) ) model . add ( Dense ( 1 ) ) model . compile ( loss = 'mse' , optimizer = Adam ( lr = lrate ) , metrics = [ 'accuracy' ] ) return model
Creates nVidea Autonomous Car Group model
Creates nVidea Autonomous Car Group model
"""
    Creates nVidea Autonomous Car Group model
    """ #crop 108 from top, and 36 from bottom, to get [108:204], or 96 elements, and 0 cropped from width # default #TODO: look into cropping layer. Why add it??