LogoLogo
HomeDocsAPI & SDKsProjectsForumStudio
  • Welcome
    • Featured Machine Learning Projects
      • Getting Started with the Edge Impulse Nvidia TAO Pipeline - Renesas EK-RA8D1
      • Smart City Traffic Analysis - NVIDIA TAO + Jetson Orin Nano
      • ROS 2 Pick and Place System - Arduino Braccio++ Robotic Arm and Luxonis OAK-D
      • Optimize a cloud-based Visual Anomaly Detection Model for Edge Deployments
      • Rooftop Ice Detection with Things Network Visualization - Nvidia Omniverse Replicator
      • Surgery Inventory Object Detection - Synthetic Data - Nvidia Omniverse Replicator
      • NVIDIA Omniverse - Synthetic Data Generation For Edge Impulse Projects
      • Community Guide – Using Edge Impulse with Nvidia DeepStream
      • Computer Vision Object Counting - Avnet RZBoard V2L
      • Gesture Appliances Control with Pose Detection - BrainChip AKD1000
      • Counting for Inspection and Quality Control - Nvidia Jetson Nano (TensorRT)
      • High-resolution, High-speed Object Counting - Nvidia Jetson Nano (TensorRT)
    • Prototype and Concept Projects
      • Renesas CK-RA6M5 Cloud Kit - Getting Started with Machine Learning
      • TI CC1352P Launchpad - Getting Started with Machine Learning
      • OpenMV Cam RT1062 - Getting Started with Machine Learning
      • Getting Started with Edge Impulse Experiments
  • Computer Vision Projects
    • Workplace Organizer - Nvidia Jetson Nano
    • Recyclable Materials Sorter - Nvidia Jetson Nano
    • Analog Meter Reading - Arduino Nicla Vision
    • Creating Synthetic Data with Nvidia Omniverse Replicator
    • SonicSight AR - Sound Classification with Feedback on an Augmented Reality Display
    • Traffic Monitoring - Brainchip Akida
    • Multi-camera Video Stream Inference - Brainchip Akida
    • Industrial Inspection Line - Brainchip Akida
    • X-Ray Classification and Analysis - Brainchip Akida
    • Inventory Stock Tracker - FOMO - BrainChip Akida
    • Container Counting - Arduino Nicla Vision
    • Smart Smoke Alarm - Arduino Nano 33
    • Shield Bot Autonomous Security Robot
    • Cyclist Blind Spot Detection - Himax WE-I Plus
    • IV Drip Fluid-Level Monitoring - Arduino Portenta H7
    • Worker PPE Safety Monitoring - Nvidia Jetson Nano
    • Delivered Package Detection - ESP-EYE
    • Bean Leaf Disease Classification - Sony Spresense
    • Oil Tank Measurement Using Computer Vision - Sony Spresense
    • Object Counting for Smart Industries - Raspberry Pi
    • Smart Cashier with FOMO - Raspberry Pi
    • PCB Defect Detection with Computer Vision - Raspberry Pi
    • Bicycle Counting - Sony Spresense
    • Counting Eggs with Computer Vision - OpenMV Cam H7
    • Elevator Passenger Counting - Arduino Nicla Vision
    • ESD Protection using Computer Vision - Seeed ReComputer
    • Solar Panel Defect Detection - Arduino Portenta H7
    • Label Defect Detection - Raspberry Pi
    • Dials and Knob Monitoring with Computer Vision - Raspberry Pi
    • Digital Character Recognition on Electric Meter System - OpenMV Cam H7
    • Corrosion Detection with Computer Vision - Seeed reTerminal
    • Inventory Management with Computer Vision - Raspberry Pi
    • Monitoring Retail Checkout Lines with Computer Vision - Renesas RZ/V2L
    • Counting Retail Inventory with Computer Vision - Renesas RZ/V2L
    • Pose Detection - Renesas RZ/V2L
    • Product Quality Inspection - Renesas RZ/V2L
    • Smart Grocery Cart Using Computer Vision - OpenMV Cam H7
    • Driver Drowsiness Detection With FOMO - Arduino Nicla Vision
    • Gastroscopic Image Processing - OpenMV Cam H7
    • Pharmaceutical Pill Quality Control and Defect Detection
    • Deter Shoplifting with Computer Vision - Texas Instruments TDA4VM
    • Smart Factory Prototype - Texas Instruments TDA4VM
    • Correct Posture Detection and Enforcement - Texas Instruments TDA4VM
    • Visual Anomaly Detection with FOMO-AD - Texas Instruments TDA4VM
    • Surface Crack Detection and Localization - Texas Instruments TDA4VM
    • Surface Crack Detection - Seeed reTerminal
    • Retail Image Classification - Nvidia Jetson Nano
    • SiLabs xG24 Plus Arducam - Sorting Objects with Computer Vision and Robotics - Part 1
    • SiLabs xG24 Plus Arducam - Sorting Objects with Computer Vision and Robotics - Part 2
    • Object Detection and Visualization - Seeed Grove Vision AI Module
    • Bike Rearview Radar - Raspberry Pi
    • Build a Self-Driving RC Vehicle - Arduino Portenta H7 and Computer Vision
    • "Bring Your Own Model" Image Classifier for Wound Identification
    • Acute Lymphoblastic Leukemia Classifier - Nvidia Jetson Nano
    • Hardhat Detection in Industrial Settings - Alif Ensemble E7
    • Motorcycle Helmet Identification and Traffic Light Control - Texas Instruments AM62A
    • Import a Pretrained Model with "Bring Your Own Model" - Texas Instruments AM62A
    • Product Inspection with Visual Anomaly Detection - FOMO-AD - Sony Spresense
    • Visual Anomaly Detection in Fabric using FOMO-AD - Raspberry Pi 5
    • Car Detection and Tracking System for Toll Plazas - Raspberry Pi AI Kit
    • Visual Anomaly Detection - Seeed Grove Vision AI Module V2
    • Object Counting with FOMO - OpenMV Cam RT1062
    • Visitor Heatmap with FOMO Object Detection - Jetson Orin Nano
    • Vehicle Security Camera - Arduino Portenta H7
  • Audio Projects
    • Occupancy Sensing - SiLabs xG24
    • Smart Appliance Control Using Voice Commands - Nordic Thingy:53
    • Glass Window Break Detection - Nordic Thingy:53
    • Illegal Logging Detection - Nordic Thingy:53
    • Illegal Logging Detection - Syntiant TinyML
    • Wearable Cough Sensor and Monitoring - Arduino Nano 33 BLE Sense
    • Collect Data for Keyword Spotting - Raspberry Pi Pico
    • Voice-Activated LED Strip - Raspberry Pi Pico
    • Snoring Detection on a Smart Phone
    • Gunshot Audio Classification - Arduino Nano 33 + Portenta H7
    • AI-Powered Patient Assistance - Arduino Nano 33 BLE Sense
    • Acoustic Pipe Leakage Detection - Arduino Portenta H7
    • Location Identification using Sound - Syntiant TinyML
    • Environmental Noise Classification - Nordic Thingy:53
    • Running Faucet Detection - Seeed XIAO Sense + Blues Cellular
    • Vandalism Detection via Audio Classification - Arduino Nano 33 BLE Sense
    • Predictive Maintenance Using Audio Classification - Arduino Nano 33 BLE Sense
    • Porting an Audio Project from the SiLabs Thunderboard Sense 2 to xG24
    • Environmental Audio Monitoring Wearable - Syntiant TinyML - Part 1
    • Environmental Audio Monitoring Wearable - Syntiant TinyML - Part 2
    • Keyword Spotting - Nordic Thingy:53
    • Detecting Worker Accidents with Audio Classification - Syntiant TinyML
    • Snoring Detection with Syntiant NDP120 Neural Decision Processor - Arduino Nicla Voice
    • Recognize Voice Commands with the Particle Photon 2
    • Voice Controlled Power Plug with Syntiant NDP120 (Nicla Voice)
    • Determining Compressor State with Audio Classification - Avnet RaSynBoard
    • Developing a Voice-Activated Product with Edge Impulse's Synthetic Data Pipeline
    • Enhancing Worker Safety using Synthetic Audio to Create a Dog Bark Classifier
  • Predictive Maintenance and Defect Detection Projects
    • Predictive Maintenance - Nordic Thingy:91
    • Brushless DC Motor Anomaly Detection
    • Industrial Compressor Predictive Maintenance - Nordic Thingy:53
    • Anticipate Power Outages with Machine Learning - Arduino Nano 33 BLE Sense
    • Faulty Lithium-Ion Cell Identification in Battery Packs - Seeed Wio Terminal
    • Weight Scale Predictive Maintenance - Arduino Nano 33 BLE Sense
    • Fluid Leak Detection With a Flowmeter and AI - Seeed Wio Terminal
    • Pipeline Clog Detection with a Flowmeter and AI - Seeed Wio Terminal
    • Refrigerator Predictive Maintenance - Arduino Nano 33 BLE Sense
    • Motor Pump Predictive Maintenance - Infineon PSoC 6 WiFi-BT Pioneer Kit + CN0549
    • BrickML Demo Project - 3D Printer Anomaly Detection
    • Condition Monitoring - Syntiant TinyML Board
    • Predictive Maintenance - Commercial Printer - Sony Spresense + CommonSense
    • Vibration Classification with BrainChip's Akida
    • AI-driven Audio and Thermal HVAC Monitoring - SeeedStudio XIAO ESP32
  • Accelerometer and Activity Projects
    • Arduino x K-Way - Outdoor Activity Tracker
    • Arduino x K-Way - Gesture Recognition for Hiking
    • Arduino x K-Way - TinyML Fall Detection
    • Posture Detection for Worker Safety - SiLabs Thunderboard Sense 2
    • Hand Gesture Recognition - OpenMV Cam H7
    • Arduin-Row, a TinyML Rowing Machine Coach - Arduino Nicla Sense ME
    • Fall Detection using a Transformer Model – Arduino Giga R1 WiFi
    • Bluetooth Fall Detection - Arduino Nano 33 BLE Sense
    • Monitor Packages During Transit with AI - Arduino Nano 33 BLE Sense
    • Smart Baby Swing - Arduino Portenta H7
    • Warehouse Shipment Monitoring - SiLabs Thunderboard Sense 2
    • Gesture Recognition - Bangle.js Smartwatch
    • Gesture Recognition for Patient Communication - SiLabs Thunderboard Sense 2
    • Hospital Bed Occupancy Detection - Arduino Nano 33 BLE Sense
    • Porting a Posture Detection Project from the SiLabs Thunderboard Sense 2 to xG24
    • Porting a Gesture Recognition Project from the SiLabs Thunderboard Sense 2 to xG24
    • Continuous Gait Monitor (Anomaly Detection) - Nordic Thingy:53
    • Classifying Exercise Activities on a BangleJS Smartwatch
  • Air Quality and Environmental Projects
    • Arduino x K-Way - Environmental Asthma Risk Assessment
    • Gas Detection in the Oil and Gas Industry - Nordic Thingy:91
    • Smart HVAC System with a Sony Spresense
    • Smart HVAC System with an Arduino Nicla Vision
    • Indoor CO2 Level Estimation - Arduino Portenta H7
    • Harmful Gases Detection - Arduino Nano 33 BLE Sense
    • Fire Detection Using Sensor Fusion and TinyML - Arduino Nano 33 BLE Sense
    • AI-Assisted Monitoring of Dairy Manufacturing Conditions - Seeed XIAO ESP32C3
    • AI-Assisted Air Quality Monitoring - DFRobot Firebeetle ESP32
    • Air Quality Monitoring with Sipeed Longan Nano - RISC-V Gigadevice
    • Methane Monitoring in Mines - Silabs xG24 Dev Kit
    • Smart Building Ventilation with Environmental Sensor Fusion
    • Sensor Data Fusion with Spresense and CommonSense
    • Water Pollution Detection - Arduino Nano ESP32 + Ultrasonic Scan
    • Fire Detection Using Sensor Fusion - Arduino Nano 33 BLE Sense
  • Novel Sensor Projects
    • 8x8 ToF Gesture Classification - Arduino RP2040 Connect
    • Food Irradiation Dose Detection - DFRobot Beetle ESP32C3
    • Applying EEG Data to Machine Learning, Part 1
    • Applying EEG Data to Machine Learning, Part 2
    • Applying EEG Data to Machine Learning, Part 3
    • Liquid Classification with TinyML - Seeed Wio Terminal + TDS Sensor
    • AI-Assisted Pipeline Diagnostics and Inspection with mmWave Radar
    • Soil Quality Detection Using AI and LoRaWAN - Seeed Sensecap A1101
    • Smart Diaper Prototype - Arduino Nicla Sense ME
    • DIY Smart Glove with Flex Sensors
    • EdgeML Energy Monitoring - Particle Photon 2
    • Wearable for Monitoring Worker Stress using HR/HRV DSP Block - Arduino Portenta
  • Software Integration Demos
    • Azure Machine Learning with Kubernetes Compute and Edge Impulse
    • ROS2 + Edge Impulse, Part 1: Pub/Sub Node in Python
    • ROS2 + Edge Impulse, Part 2: MicroROS
    • Using Hugging Face Datasets in Edge Impulse
    • Using Hugging Face Image Classification Datasets with Edge Impulse
    • Edge Impulse API Usage Sample Application - Jetson Nano Trainer
    • MLOps with Edge Impulse and Azure IoT Edge
    • A Federated Approach to Train and Deploy Machine Learning Models
    • DIY Model Weight Update for Continuous AI Deployments
    • Automate the CI/CD Pipeline of your Models with Edge Impulse and GitHub Actions
    • Deploying Edge Impulse Models on ZEDEDA Cloud Devices
Powered by GitBook
On this page
  • Intro
  • How Does It Work
  • Hardware Requirements
  • Software Requirements
  • Hardware Setup
  • Arduino Nicla Vision
  • Software Setup
  • TinyML Model Generation
  • 1. Data Acquisition
  • 2. Impulse Design
  • 3. Feature Generation
  • 4. Model Training
  • 5. Model Testing
  • 6. Live Classification
  • Deployment
  • Final Product
  • Code

Was this helpful?

Edit on GitHub
Export as PDF
  1. Computer Vision Projects

Driver Drowsiness Detection With FOMO - Arduino Nicla Vision

Use an Arduino Nicla Vision to determine and alert if a driver's eyes are closed for more than 2 seconds.

PreviousSmart Grocery Cart Using Computer Vision - OpenMV Cam H7NextGastroscopic Image Processing - OpenMV Cam H7

Last updated 1 year ago

Was this helpful?

Created By: Shebin Jose Jacob

Public Project Link:

GitHub Repository:

Intro

Driver drowsiness is a major contributing factor to motor vehicle accidents and can have serious consequences, including injury or death. There are several reasons why driver drowsiness can lead to accidents. When a person is tired, their reaction time slows down, their decision-making abilities are impaired, and they may have difficulty maintaining their focus on the road. As a result, they may miss important visual cues, fail to notice hazards or make poor decisions while driving.

In addition to these physical effects, drowsy driving is also a cognitive impairment, meaning it affects a person's ability to think and make good decisions. When a driver is tired, their judgment and awareness are impaired, which can lead to risky or dangerous behavior behind the wheel. The risk of drowsy driving is higher for certain groups of people, including commercial truck drivers, shift workers, and those with undiagnosed or untreated sleep disorders. However, anyone can be at risk for drowsy driving if they do not get enough sleep or if they are driving for long periods of time without taking breaks.

As drowsy driving continues to be a major safety concern on our roads, we are developing a cutting-edge system to address this problem.

How Does It Work

Our solution combines the power of Computer Vision and Artificial Intelligence (AI) to monitor the driver's eyes and detect when they are closed for two seconds in a row. To ensure the accuracy and reliability of our system, we have trained and deployed an AI algorithm (model) on to an Arduino Nicla Vision. These algorithms are trained to recognize patterns and trends in the data collected by the camera and to identify when the driver's eyes are closed for an extended period of time.

If the system detects that the driver's eyes are closed for two seconds or longer, it will generate an alert to wake the driver up and remind them to stay focused and alert on the road. This alert can be in the form of a visual or auditory signal, such as a flashing light or a loud beep.

In addition to detecting drowsy driving, our system can also be extended to monitor other behaviors that may impact road safety, such as distracted driving or impairment due to drugs or alcohol. By alerting drivers to these behaviors and reminding them to stay focused and alert, we can help to reduce the risk of accidents and keep our roads safer for everyone.

Hardware Requirements

  • LED

  • Buzzer

Software Requirements

Hardware Setup

The hardware setup for data collection consists of a Nicla Vision mounted on a tripod.

Arduino Nicla Vision

Nicla Vision is a powerful and versatile product that is designed to enable users to develop and prototype projects involving image processing and machine vision at the edge. It features a 2MP color camera that supports TinyML, as well as a smart 6-axis motion sensor, microphone, and distance sensor, which provide a range of sensing capabilities.

The product is powered by a powerful STM32H747AII6 Dual ARM Cortex M7/M4 IC processor, which enables on-device intelligence and enables users to host machine learning models and other advanced algorithms on the edge. In addition, Nicla Vision is compact in size, with a form factor of just 22.86 x 22.86 mm, which makes it easy to incorporate into a wide range of projects and scenarios. With its combination of machine vision and processing capabilities, as well as its tiny form factor, Nicla Vision is an ideal solution for developing or prototyping projects involving image processing and machine vision at the edge.

Software Setup

Upon successfully establishing a connection between the device and the Edge Impulse dashboard, you should expect to see the device appear in the Devices tab.

If you do not see the device listed in the Devices tab, it is possible that there may be an issue with the connection or the configuration of the device. In this case, it may be necessary to troubleshoot the issue or refer to additional resources for assistance.

TinyML Model Generation

1. Data Acquisition

Now that the necessary software and hardware have been configured, we can proceed to build the object detection model. The first step in this process is to gather data that will be used to train the model. There are two main approaches to collecting data: using the connected device to directly capture data or uploading pre-existing data using the Uploader tool. In this particular project, we will be utilizing the first method and collecting data directly from the connected device. This data will then be used to train the object detection model, enabling it to more accurately identify and classify objects in the future.

After the data has been uploaded to the Edge Impulse platform, it will be necessary to label the unlabeled images in the Labeling queue. In this case, there are two distinct classes that the model will be trained to recognize: Closed Eye and Open Eye. As such, there are two corresponding labels that will be applied to the images in the labeling queue. This process of labeling the data is an essential step in training the object detection model, as it allows the model to learn the characteristics and features of each class, enabling it to accurately classify images and recognize objects in the future. By carefully and accurately labeling the images in the labeling queue, we can ensure that the model is well-trained and capable of performing effectively.

2. Impulse Design

To optimize the performance of FOMO for our use case, we are setting the image dimensions to 96px, as FOMO performs optimally with 96x96 pixel images. To implement FOMO in our project, we are adding an Image processing block and an Object Detection (Images) learning block to the impulse, with the Resize Mode set to Fit shortest axis. By leveraging FOMO in conjunction with these blocks, we can effectively detect driver drowsiness in real-time with a high level of accuracy and efficiency.

3. Feature Generation

In the next stage of our project, we will focus on generating features. To do this, we will go to the Image tab and select the desired color depth. In our case, we have chosen to use RGB and now we will initiate the feature generation process.

While it is not strictly essential that the generated features be well split, it is generally a good indication that the resulting model will perform well. A well-split set of features typically leads to a model that performs well, as it indicates that there is a clear distinction between the two classes being used. Once the features have been generated, we can move on to the training phase of our project.

4. Model Training

With the necessary impulse design complete, we can now move on to the process of training our machine learning model. The specific settings that we have chosen for model training are shown below. It is important to note that these settings can be adjusted in order to improve the accuracy of the trained model, but care must be taken to avoid overfitting.

By carefully adjusting the model training settings and employing appropriate techniques to prevent overfitting, we can optimize the performance of our machine learning model and achieve a high level of accuracy. After carefully selecting and preparing a sufficient amount of training data, we have been able to achieve an impressive level of accuracy with our machine learning model. Using the specified training settings, we were able to achieve a training accuracy of 100%, which is a very good result.

5. Model Testing

Now that we have trained our machine learning model, it is time to evaluate its performance on unseen test data. To do this, we will move on to the Model Testing tab and use the Classify All function. This will allow us to see how well the model performs on the test data and gain insight into its generalization capabilities.

We have got 100% testing accuracy also, which rules out any possibility of overfitting and our model is working very well. It is important to test the performance of a machine learning model on unseen data in order to get a realistic assessment of its capabilities. Testing on the training data alone can lead to over-optimistic results, as the model has already seen and learned from this data. By testing on unseen data, we can more accurately gauge the model's ability to generalize and make predictions on new, unknown input.

6. Live Classification

It is now time to move on to the final phase of testing or rather a mock deployment of our machine-learning model. During this phase, we will simulate the use of the model in a real-world setting and evaluate its performance under these conditions. This will allow us to see how well the model performs in a more realistic environment and ensure that it is ready for deployment.

It is now time to proceed to the Live Classification tab and acquire a sample from the device. Once we have acquired the sample, we will classify it and observe the results. If our model is able to accurately distinguish between closed and open eyes, we can confidently move forward with deployment.

Our machine learning model has demonstrated its capabilities and we are prepared to deploy it in a real-world setting.

Deployment

In order to deploy our machine-learning model, we will need to create an Arduino library. This library will contain all of the necessary code and resources required to run the model on the Arduino Nicla Vision.

To build the library, we will need to navigate to the Deployment tab and follow the steps outlined there. Once we have completed this process, we will have a fully functional library that is ready for use on the Arduino platform. One optional step that we can take is to enable optimizations using the EON Compiler. This compiler is designed to optimize the code in our library, making it faster and more efficient.

Once we have completed the build process, we will be provided with a .zip file that contains our model and a set of examples. To use this library on the Arduino platform, we will need to add it to the Arduino Integrated Development Environment (IDE).

To do this, we will need to open the Arduino IDE and navigate to Sketch > Include Library > Add .ZIP library. From here, we will be able to browse the zip file that we created earlier and add it to the IDE. Once we have added the library to the Arduino IDE, we will be able to use it to run our machine-learning model on the Arduino platform.

Modify the code located at File > Examples > Your Project Name > nicla_vision > nicla_vision_camera incorporating your additions.

Final Product

After deployment, we developed a device integrating a Nicla Vision, a buzzer, and an LED. The device is enclosed in a neat 3D-printed case which can be easily attached to your car's dashboard.

Code

If you are unfamiliar with the process of setting up the Nicla Vision for use with Edge Impulse and haven't yet connected the device to the Edge Impulse dashboard, we recommend following a to guide you through the setup process.

For our project, we require a high-performing model with a reliable level of accuracy. To meet these requirements, we are utilizing (Faster Objects, More Objects), a machine learning algorithm specifically designed for object detection on highly constrained devices. FOMO generates efficient, faster models that are well-suited for applications where processing power and memory are limited.

If you are interested in replicating this project, download the code and other required assets from this .

Arduino Nicla Vision
Edge Impulse
Arduino IDE
quick tutorial
Edge Impulse FOMO
GitHub Repository
https://studio.edgeimpulse.com/public/168098/latest
https://github.com/CodersCafeTech/Driver-Drowsiness-Detection-With-FOMO