This file contains hidden or 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
| def get_lenet_like_model( | |
| input_shape, num_outputs, | |
| l2_reg=1e-3, filter_sz=5, num_filters=24, num_dense_neurons=512, | |
| ): | |
| inp = Input(input_shape) | |
| x = Conv2D(num_filters, (filter_sz, filter_sz), | |
| padding='same', kernel_regularizer=l2(l2_reg))(inp) | |
| x = MaxPooling2D(2, 2)(x) | |
| x = ELU()(x) |
This file contains hidden or 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
| def clip_throttle(throttle, curr_speed, target_speed): | |
| return np.clip( | |
| throttle - 0.1 * (curr_speed-target_speed), | |
| 0.25, | |
| 1.0 | |
| ) |
This file contains hidden or 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
| def get_lenet_like_embedder( | |
| input_shape, | |
| act='elu', l2_reg=1e-3, filter_sz=5, num_filters=24, num_dense_neurons=512, | |
| ): | |
| """ | |
| Returns a 2-tuple of (input, embedding_layer) that can later be used | |
| to create a model that builds on top of the embedding_layer. | |
| """ | |
| inp = Input(input_shape) | |
This file contains hidden or 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
| def add_throttle_upon_steer_w_odometry( | |
| outputs_spec, embed_getter, | |
| act='elu', l2_reg=1e-3, num_dense_neurons=512, | |
| ): | |
| """Build output layers on top of the embedding layer, and return a model. | |
| An example of the `outputs_spec` argument is an OrderedDict specifying | |
| the names of the output layers, their respective: activation function, | |
| loss, and weight (multiplicative constant modifying the loss), e.g.: |