Objective: To design and implement a system that uses AI algorithms to detect distracted driving behaviours in real-time.
Key Steps:
Step 1: Data Collection
Step 2: Model Training and Fine-Tuning
Step 3: Real-Time Processing
Step 4: Front-End Development
Step 5: Backend Development
Step 6: Dashboard Development
Takeaways
We were able to train a Resnet neural network model sucessfully by gathering distracted driver dataset.
We used ultra-sonic sensors to detect any nearby objects and give an alert to the driver.
We were sucessful in fetching data from google APIs and recommend nearby hotels for the driver.
We were able to build a database to store numerical aspects of distracted drivers and analyse the data through pie-charts.
We tried exploring explainable AI and assist the drivers.
git clone https://github.com/kramachandrashenoy/Satark.git
cd satark
-
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows use \`venv\Scripts\activate\`
-
Install the required Python packages:
pip install -r requirements.txt
- Set up a MongoDB Atlas account If you don't already have one.
- Update the MongoDB connection string in the `main.py` file:
client = MongoClient("your_mongodb_connection_string")
- Connect the ultrasonic sensors to your Arduino as per the provided code.
- Upload the provided Arduino code (`ultrasonic_sensor.ino`) to your Arduino board using the Arduino IDE.
- Ensure the correct serial port is set in the `main.py` file:
serial_port = 'COM6' # For Windows
- Get your API key from LocationIQ.
- Update the `locationiq_api_key` variable in the `main.py` file with your API key.
python main.py
The application will start on `http://127.0.0.1:5000/\`.
Open a web browser and go to `http://127.0.0.1:5000/\` to access the main interface.
- Endpoint: `/video_feed`
- Description: Provides the real-time video feed with drowsiness detection.
- Parameters: `driver_id` (optional, default: 1)
- Endpoint: `/prediction`
- Description: Returns the current drowsiness detection status.
- Response: `{ 'prediction': 'Drowsiness Detected' | 'Alert' | 'No Eyes Detected' }`
- Endpoint: `/ultrasonic`
- Description: Returns the distance measured by the ultrasonic sensors.
- Response: `{ 'distance1': , 'distance2': }`
- Endpoint: `/current_driving_data`
- Description: Returns the current driving statistics for the specified driver.
- Parameters: `id` (optional, default: 1)
- Endpoint: `/total_driving_data`
- Description: Returns the all-time driving statistics for the specified driver.
- Parameters: `id` (optional, default: 1)
- Endpoint: `/fetch_nearby_places`
- Description: Returns the nearby places of interest.
- Response: `{ 'hotel': [...], 'restaurant': [...], 'hospital': [...] }`
- Dlib for facial landmark detection.
- Keras for the drowsiness detection model.
- MongoDB for database services.
- LocationIQ for location services.
Contributions are welcome! Please open an issue or submit a pull request.