Skip to content

Instantly share code, notes, and snippets.

View Muosvr's full-sized avatar

Jason Wu Muosvr

  • Klaviyo
  • Boston, MA
View GitHub Profile
# 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
@Muosvr
Muosvr / donkey_3DCNN_base_model.py
Last active October 14, 2018 01:59
Base reference model of donkeycar pilot using Keras 3DCNN
#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)