Git Product home page Git Product logo

ridemap-face-scanner's Introduction

RIDEMAP: Passenger Count through Face Detection using Smartphone Camera

Description

This mobile app allows registered smartphones to upload data of passengers' faces counted through face detection.

Note: This app does not collect data on faces of passengers, it relies instead upon the faceID created when a face is detected by the app's camera.

Requirements

  1. Free Expo account
  2. Laravel for backend development
  3. React Native and Expo for mobile app development
  4. Smartphones with camera

The Laravel backend for the Ridemap already supports this app. The endpoint for submission of face detection is /api/faces. The backend accepts an array of faces with the following attributes: face_id, station_id, and scanned_at. user_id is extracted from a token used to authenticate the device.

Getting Started

Install the necessary tools:

  1. Any IDE (Webstorm is preferred but you can also use Atom and VS Code)
  2. Install Nodejs
  3. Install Expo
  4. Install Expo Go in IOS/Android
  5. Install Git

Follow the following steps to get set up:

  1. Clone this repository
git clone https://github.com/mlab817/ridemap-face-scanner.git
  1. Change directory to ridemap-counter
cd ridemap-counter
  1. Install dependencies
npm install
  1. Update the API endpoint in utils.js file
export const api = axios.create({
   baseURL: 'https://ridemap-php.herokuapp.com/api'
})
  1. Start expo dev server
expo start

Or

expo r -c

The second command is used when you cannot connect your device to the webserver.

Follow the instructions in the CLI message to connect your simulator or physical device.

Building and Distributing the App

To build the app, install the Expo Application Services.

  1. Create a free account in Expo.
  2. Install eas-cli to use eas in command prompt and/or terminal.
npm i -g eas-cli
  1. From the root directory, run:
eas build

Follow the on-screen instructions. You will find the android/ios bundles in your Expo account under Build menu, e.g. https://expo.dev/accounts/{accountName}/projects/ridemap-counter/builds. You may also integrate submission to Play Store and App Store.

Note: Unfortunately, to build IOS applications, you will need to apply and register to Apple Developer Program which costs $99 yearly. Android build is free and can be downloaded for distribution.

Workflow

Device Authentication

To use this app, devices must be registered in the server. To do this, follow the instructions below:

  1. Download the app
  2. Open the app to connect to the server for the first time
  3. The app will show an invalid device message along with the device ID. Use this device ID to register the device in the server.

Note: The device ID does not refer to the actual device ID of the device but rather the device ID of the app tied to the server. This is unique for every app that is installed in the device.

Read more here: Android and iOS

Using the App

  1. Open app
  2. Device connects to server
  3. Server verifies that device is registered
    1. If device is not registered, display invalid device message along with the device ID. Note that the device ID is not the actual device ID but rather the ID of the device tied with the app.
    2. If device is registered, proceed
  4. Prompt user to select station where it is located
  5. Place the smartphone in the best position
  6. Start scanning

The app will send data for every batch of faces detected.

Table Structure

- users

Stores data of users of the system

Attribute Type Description
id int autoincrement Primary key of the table
name varchar Name of the user
email varchar Email of the user
email_verified_at timestamp Timestamp when the user validated their email
password varchar Hashed password of the user
device_id varchar Device ID of the user
created_at timestamp Timestamp when the record was saved in the database
updated_at timestamp Timestamp when the record was updated in the database

- stations

Stores data of stations in EDSA Busway

Attribute Type Description
id int autoincrement Primary key of the table
name varchar Name of the station
created_at timestamp Timestamp when the record was saved in the database
updated_at timestamp Timestamp when the record was updated in the database

- faces

Stores data on scanned QR codes

Attribute Type Description
id int autoincrement Primary key of the table
face_id int Face ID auto-generated by the device when the face was detected
station_id int Foreign key referencing stations table
scanned_at timestamp Timestamp when the entry was generated
user_id int Foreign key referencing users table (user that submitted the data)
created_at timestamp Timestamp when the record was saved in the database
updated_at timestamp Timestamp when the record was updated in the database

Screenshots

Splash Screen Device ID
Request Permission Select Station
Scan Faces
  1. Screen 1 - Splash screen
  2. Screen 2 - QR Code for the Device ID which can be scanned to easily copy the device ID
  3. Screen 3 - Request permission to use camera
  4. Screen 4 - Select station where device is located
  5. Screen 5 - Camera

The app submits data every after detection of new face ids.

Limitations

The accuracy of this app will depend on at least the following factors:

  1. Camera quality of the device
  2. Quality of the environment (placement of the device, lighting)
  3. Quality of targets (angle of the face, obstructions such as face masks/caps)

There is also the issue of duplication since the app does not use a backend to analyze facial features and eliminate duplicates. So if a person takes too long in the queueing line, they can be scanned more than once.

Author

This app is developed by Mark Lester Bolotaolo.

ridemap-face-scanner's People

Contributors

mlab817 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.