Forest Guard
The mobile app client for the Forest Guard AI Model built and deployed by Team LISA for the AI4Good Hackathon organized by AI Commons and moderated by Superfluid.io.
The purpose of the app is to receive notifications triggered by the cloud functions upon data sent to Firestore by the Raspberry Pi running the AI Model.
How It Works
The Keras model deployed on the Raspberry Pi detects audio and make predictions. It sends the data ({type: "1"}
) for a Firestore collection (activities
). The cloud function is then triggered with either sends notification to the mobile devices or does nothing based on the type
.
"1" => Illegal Activity (Chainsaw, etc)
"2" => Human Activities
"<any other number>" => Irrelevant activity (birds chipping, wind, etc)
Requirements
- Flutter for building the application.
- Google Maps API Key to the Map.
- Tomtom API Key for Map routes.
- Firebase Project for the database and hosting cloud functions.
- Firebase CLI for setting up, testing and deploying the cloud functions (which trigger notifications).
Set Up (Firebase for Flutter)
- Follow this to set up Firebase for Flutter. Remember to add your
google-services.json
(for android) andGoogleService-Info.plist
for (iOS). - Replace
android:value
of this meta tag within the<application>
tag inside theandroid/app/src/main/AndroidManifest.xml
with your Google Maps API Key.
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="your_long_random_maps_api_key"/>
Set Up (Cloud Functions)
- Run
firebase login
to connect your google account with the Firebase CLI. (Be sure to use the same account used for the Firebase Project as they will be sharing the same database) - After installing the Firebase CLI, run
firebase init functions
from the project root. Follow the instructions to complete the initialization. (Note: the function script was written in JavaScript not TypeScript). If you get an NPM permission or access denied error, runcd functions && sudo npm install
. - Run
firebase deploy --only functions
to deploy the script to Firebase. Upon smooth sailing, you will see a success message like✔ Deploy complete! in the console.
Set Up (Firebase Firestore)
- After setting up a firebase project, set up Cloud Firestore.
- Set up a collection
agents
and add a document with:
{
"agent_id": "1234",
"forest_id": "1"
}
Note: You should allow read in your firebase rules for non-authenticated calls to this
agents
collection. The document existence is checked before performing the anonymous login. You can change this before in thelib/auth_service.dart
.
Sample Firestore Rules
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
match /agents/{id} {
allow read;
allow write: if false;
}
}
}
Team Members
Name | Role | Profile |
---|---|---|
Appau Ernest (Lead) | AI Model Development/Deployment/I-IoT | Github / LinkedIn |
Debrah Kwesi Buabeng | Mobile Developer | Github / LinkedIn |
Akpalu Larry | Data Collection and Annotation | Github / LinkedIn |
Kpene Godsway Edem | Documentation | Github / LinkedIn |
Baidoo Mabel | Data Collection and Annotation | Github / LinkedIn |
Appau Roberta | UI/UX Designer | N/A |