Base Classes
KerasPilot
Abstract base class for all Keras-based pilots. Constructor:Interpreter
default:"KerasInterpreter()"
Model interpreter (Keras, TFLite, TensorRT)
tuple
default:"(120, 160, 3)"
Input image shape (height, width, channels)
(img_arr: np.ndarray, *other_arr) -> (angle, throttle)
Run inference on image and optional additional inputs. Returns steering angle and throttle.
(model_path: str) -> None
Load a trained model from file
(model_path, train_data, train_steps, ...) -> history
Train the model on provided dataset
() -> None
Compile the model with optimizer and loss function
Linear Pilots
KerasLinear
Linear regression pilot with continuous outputs. Constructor:int
default:"2"
Number of outputs (typically 2: angle and throttle)
- 5 convolutional layers (24, 32, 64, 64, 64 filters)
- Dropout layers for regularization
- 2 dense layers (100, 50 neurons)
- Linear output layer per output
KerasCategorical
Categorical classification pilot that bins outputs. Constructor:float
default:"0.5"
Maximum throttle range (0 to throttle_range)
- 5 convolutional layers
- Dropout layers
- 2 dense layers
- Softmax outputs: 15 bins for angle, 20 bins for throttle
Recurrent Pilots
KerasMemory
Pilot with memory of previous steering/throttle commands. Constructor:int
default:"3"
Number of previous commands to remember
int
default:"0"
Number of dense layers for memory processing
float
default:"0.0"
Initial throttle value for memory
- Standard CNN layers for image
- Additional dense layers for memory input
- Concatenation of image and memory features
- Linear outputs
KerasLSTM
Long Short-Term Memory (LSTM) pilot for temporal sequences. Constructor:int
default:"3"
Number of frames in sequence
int
default:"2"
Number of outputs
- Time-distributed convolutional layers
- 2 LSTM layers (128 units each)
- Dense layers
- Linear output
Keras3D_CNN
3D Convolutional Neural Network for temporal sequences. Constructor:int
default:"20"
Number of frames in sequence
- 4 Conv3D layers with max pooling
- Flatten and dense layers
- Batch normalization and dropout
Multi-Input Pilots
KerasIMU
Pilot that uses camera image + IMU sensor data. Constructor:int
default:"6"
Number of IMU inputs (accel_xyz + gyro_xyz)
- CNN branch for image processing
- Dense branch for IMU data
- Concatenated features
- Linear outputs
KerasBehavioral
Behavioral cloning with behavior state input. Constructor:int
default:"2"
Number of behavior state inputs
- CNN branch for image
- Dense branch for behavior state
- Categorical outputs (like KerasCategorical)
KerasLocalizer
Pilot with track localization output. Constructor:int
default:"8"
Number of track location categories
- Steering angle
- Throttle
- Track location (0 to num_locations-1)
Training
Training a Model
Optimizer Configuration
'adam': Adam optimizer'sgd': Stochastic Gradient Descent'rmsprop': RMSProp
Configuration
Typical configuration inmyconfig.py:
