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.
- Free Expo account
- Laravel for backend development
- React Native and Expo for mobile app development
- 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.
Install the necessary tools:
- Any IDE (Webstorm is preferred but you can also use Atom and VS Code)
- Install Nodejs
- Install Expo
- Install Expo Go in IOS/Android
- Install Git
Follow the following steps to get set up:
- Clone this repository
git clone https://github.com/mlab817/ridemap-face-scanner.git
- Change directory to ridemap-counter
cd ridemap-counter
- Install dependencies
npm install
- Update the API endpoint in utils.js file
export const api = axios.create({
baseURL: 'https://ridemap-php.herokuapp.com/api'
})
- 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.
To build the app, install the Expo Application Services.
- Create a free account in Expo.
- Install eas-cli to use eas in command prompt and/or terminal.
npm i -g eas-cli
- 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.
To use this app, devices must be registered in the server. To do this, follow the instructions below:
- Download the app
- Open the app to connect to the server for the first time
- 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
- Open app
- Device connects to server
- Server verifies that device is registered
- 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.
- If device is registered, proceed
- Prompt user to select station where it is located
- Place the smartphone in the best position
- Start scanning
The app will send data for every batch of faces detected.
Stores data of users of the system
Attribute | Type | Description |
---|---|---|
id | int autoincrement | Primary key of the table |
name | varchar | Name of the user |
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 |
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 |
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 |
- Screen 1 - Splash screen
- Screen 2 - QR Code for the Device ID which can be scanned to easily copy the device ID
- Screen 3 - Request permission to use camera
- Screen 4 - Select station where device is located
- Screen 5 - Camera
The app submits data every after detection of new face ids.
The accuracy of this app will depend on at least the following factors:
- Camera quality of the device
- Quality of the environment (placement of the device, lighting)
- 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.
This app is developed by Mark Lester Bolotaolo.