This project involves an autonomous vehicle control system using computer vision and neural networks to predict steering and throttle commands based on camera input. The system includes modules for data collection, model training, and real-time prediction.
- Data Collection: Collects training data using a joystick and camera for capturing images with steering and throttle labels.
- Model Training: Trains a convolutional neural network (CNN) to predict steering and throttle from images.
- Real-Time Prediction: Deploys the trained model for real-time vehicle control based on camera input.
- GPIO Motor and Servo Control: Uses GPIO pins to control motor and steering servo for autonomous driving.
- Python 3.x
- OpenCV (wcv2w)
- PyTorch
- gpiozero
- pygame
- matplotlib
- pandas
- numpy
-
Clone the Repository:
git clone https://github.com/HarrisonBounds/FlashFire.git cd autonomous-vehicle-control -
Set Up a Virtual Environment (Optional):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
If
requirements.txtis not provided, install manually:pip install opencv-python torch torchvision gpiozero pygame matplotlib pandas numpy
Collect data using a joystick to control the vehicle while capturing images and recording steering and throttle inputs.
Steps:
-
Connect a Joystick and Set Up the Camera.
-
Run the Data Collection Script:
python data_collection.py
-
Navigate the vehicle while the script captures images and records inputs in the
data/directory.
Use the collected data to train a CNN model for predicting steering and throttle commands.
Steps:
-
Specify Dataset Path: Pass the dataset directory as a command-line argument.
-
Run the Training Script:
python train.py data/2023_12_01_15_30 # Replace with your dataset path -
Training Process: The script will train the model and save it along with training graphs and loss metrics.
Deploy the trained model for real-time prediction and vehicle control.
Steps:
-
Specify Model Path: Pass the trained model path as a command-line argument.
-
Run the Autopilot Script:
python autopilot.py models/your_model.pth
-
Observe: The vehicle will use the camera feed to control steering and throttle autonomously.