|
@@ -1,17 +1,70 @@
|
|
|
-# palm_oil_mobile
|
|
|
|
|
|
|
+# Palm Oil Ripeness AI - Mobile App
|
|
|
|
|
|
|
|
-A new Flutter project.
|
|
|
|
|
|
|
+This Flutter application ports the AI-driven palm oil ripeness detection system to mobile devices. It allows for gallery-based analysis with local history storage and health alerts.
|
|
|
|
|
|
|
|
-## Getting Started
|
|
|
|
|
|
|
+## 🛠 Features
|
|
|
|
|
+- **AI Inference**: On-device TFLite processing for ripeness classification.
|
|
|
|
|
+- **Gallery Analysis**: Pick photos directly from the device gallery.
|
|
|
|
|
+- **History Vault**: Local storage of detection results using SQFlite.
|
|
|
|
|
+- **Health Alerts**: Immediate UI feedback for abnormal bunches.
|
|
|
|
|
|
|
|
-This project is a starting point for a Flutter application.
|
|
|
|
|
|
|
+## 🚀 Setup & Installation
|
|
|
|
|
|
|
|
-A few resources to get you started if this is your first Flutter project:
|
|
|
|
|
|
|
+### Prerequisites
|
|
|
|
|
+- [Flutter SDK](https://docs.flutter.dev/get-started/install) installed and added to your PATH.
|
|
|
|
|
+- Android Studio or VS Code with Flutter extension.
|
|
|
|
|
+- A physical Android device connected via USB with "Developer Options" and "USB Debugging" enabled.
|
|
|
|
|
|
|
|
-- [Learn Flutter](https://docs.flutter.dev/get-started/learn-flutter)
|
|
|
|
|
-- [Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
|
|
|
|
-- [Flutter learning resources](https://docs.flutter.dev/reference/learning-resources)
|
|
|
|
|
|
|
+### 1. Initialize Project
|
|
|
|
|
+Navigate to the mobile project directory and fetch dependencies:
|
|
|
|
|
+```bash
|
|
|
|
|
+cd palm_oil_mobile
|
|
|
|
|
+flutter pub get
|
|
|
|
|
+```
|
|
|
|
|
|
|
|
-For help getting started with Flutter development, view the
|
|
|
|
|
-[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
|
|
|
|
-samples, guidance on mobile development, and a full API reference.
|
|
|
|
|
|
|
+### 2. Run the App
|
|
|
|
|
+To test the app with full AI performance, run it in **Release Mode**:
|
|
|
|
|
+```bash
|
|
|
|
|
+flutter run --release
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+## 🧪 Testing Instructions
|
|
|
|
|
+
|
|
|
|
|
+1. **Launch the App**: Open the app on your device.
|
|
|
|
|
+2. **Select Gallery Analysis**: Tap on the **Analyze Gallery** card.
|
|
|
|
|
+3. **Pick a Photo**: Grant gallery permissions and select a photo of a palm oil bunch.
|
|
|
|
|
+4. **Observe Results**:
|
|
|
|
|
+ * The app will display "Initializing AI..." while processing.
|
|
|
|
|
+ * The detected grade and confidence score will appear.
|
|
|
|
|
+ * 🔴 **Health Alert**: If "Empty_Bunch" or "Abnormal" is detected, a red warning box will show.
|
|
|
|
|
+5. **Check History**: Navigate back to the Home screen and select **History Vault** to see your past detections.
|
|
|
|
|
+6. **Re-examine**: Tap on any history card to view the detailed summary.
|
|
|
|
|
+
|
|
|
|
|
+## 🏗 Project Structure (Flutter Beginner's Guide)
|
|
|
|
|
+
|
|
|
|
|
+As you're new to Flutter, here’s a map of where the important logic lives. All your custom code is inside the `lib/` folder:
|
|
|
|
|
+
|
|
|
|
|
+### 1. `lib/main.dart`
|
|
|
|
|
+The **entry point** of the application. This is where the app theme is defined and the first screen (`HomeScreen`) is launched.
|
|
|
|
|
+
|
|
|
|
|
+### 2. `lib/models/`
|
|
|
|
|
+* **`palm_record.dart`**: Defines the "blueprint" for a detection result. If you want to store more data (like GPS coordinates or weather), you'd add fields here.
|
|
|
|
|
+
|
|
|
|
|
+### 3. `lib/services/`
|
|
|
|
|
+This folder contains "behind-the-scenes" logic:
|
|
|
|
|
+* **`yolo_service.dart`**: Wraps the AI model. This is where the TFLite model is initialized and where image inference happens.
|
|
|
|
|
+* **`database_helper.dart`**: Manages the local SQLite database (`palm_oil_history.db`). Change this if you need to update the database schema.
|
|
|
|
|
+
|
|
|
|
|
+### 4. `lib/screens/`
|
|
|
|
|
+This is where the **UI** lives:
|
|
|
|
|
+* **`home_screen.dart`**: The main dashboard.
|
|
|
|
|
+* **`analysis_screen.dart`**: The UI for image selection, showing the loading spinner, and displaying the AI results.
|
|
|
|
|
+* **`history_screen.dart`**: The list view for previous records and the detail modal.
|
|
|
|
|
+
|
|
|
|
|
+### 5. `assets/`
|
|
|
|
|
+Located at the root of the project. This contains your non-code files:
|
|
|
|
|
+* `models/best.tflite`: The trained brain of the app.
|
|
|
|
|
+* `labels/labels.txt`: The names of the classes the model can recognize.
|
|
|
|
|
+
|
|
|
|
|
+## ⚙️ Configuration
|
|
|
|
|
+* **`pubspec.yaml`**: The project's manifest. This is where you add new dependencies (like camera or GPS plugins) and register new assets.
|