Skip to content

An Android Application to detect if the driver is sleeping based on the classification model made in PyTorch and exported in TensorFlow

Notifications You must be signed in to change notification settings

WengJunFeng/SleepDetection

Repository files navigation

SleepDetection

Requirements

  • Android Studio 4.0 (installed on a Linux, Mac or Windows machine)

  • Android device with Minimum SDK version == 21 in developer mode with USB debugging enabled

  • USB cable (to connect Android device to your computer)

Build and run

Step 1. Clone the source code

Clone the Sleep Detection GitHub repository to your computer to get the application.

git clone https://github.com/Ahwar/SleepDetection.git

To open the source code in Android Studio, open Android Studio and select Open an existing project, select the folder where you cloned source code. for example: /home/Downloads/SleepDetection/

Step 2. Build the Android Studio project

Select Build -> Make Project and check that the project builds successfully. You will need Android SDK configured in the settings. You'll need at least SDK version 21. The build.gradle file will prompt you to download any missing libraries.

Note:

`build.gradle` is configured to use TensorFlow Lite's build.

If you see a build error related to compatibility with Tensorflow Lite's Java API (for example, `method X is undefined for type Interpreter`), there has likely been a backwards compatible change to the API.

Step 3. Install and run the app

Connect the Android device to the computer and be sure to approve any ADB permission prompts that appear on your phone. Select Run -> Run app. Select the deployment target in the connected devices to the device on which the app will be installed. This will install the app on the device.

To test the app, open the app called Sleep Detection on your device. When you run the app the first time, the app will request permission to access the camera.

About

An Android Application to detect if the driver is sleeping based on the classification model made in PyTorch and exported in TensorFlow

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages