This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Converts angle from a float number to binary code for the neural net classifier (also known as one hot encoding) | |
# In this case it is divided into 15 brackets, represented by an array of 14 zeros and 1 one. | |
# The location or index of the one amount the zeros indicate where the float falls in that range. | |
def to_bin(a): | |
arr = np.zeros(15) | |
a = a + 1 | |
b = round(a/(2/14)) | |
arr[int(b)] = 1 | |
return arr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#3DCNN base model | |
img_in3D = Input(shape=(3, 120, 160, 3), name='img_in') | |
x = img_in3D x = Cropping3D(cropping = ((0, 0),(60, 0),(0, 0)))(x) | |
x = Convolution3D(8, (3, 3, 3), strides=(1, 2, 2), activation='relu')(x) | |
x = MaxPooling3D(pool_size=(1, 2, 2))(x) | |
x = BatchNormalization()(x) x = Dropout(0.1)(x) | |
x = Flatten(name='flattened')(x) | |
x = Dense(50, activation='relu')(x) | |
x = Dropout(0.2)(x) |