/forest_guard_mobile

The mobile app client for the Forest Guard AI model built for the AI4Good Hackathon organized by AICommons and moderated by Superfluid.io.

Primary LanguageDartCreative Commons Zero v1.0 UniversalCC0-1.0

Forest Guard

Forest Guard Client

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

Set Up (Firebase for Flutter)

  1. Follow this to set up Firebase for Flutter. Remember to add your google-services.json (for android) and GoogleService-Info.plist for (iOS).
  2. Replace android:value of this meta tag within the <application> tag inside the android/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)

  1. 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)
  2. 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, run cd functions && sudo npm install.
  3. 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)

  1. After setting up a firebase project, set up Cloud Firestore.
  2. 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 the lib/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