Skip to content

A native Android application built with Kotlin & Jetpack Compose to identify maize leaf diseases by connecting to a remote AI backend.

License

Notifications You must be signed in to change notification settings

AlvaroVasquezAI/FOLIVIX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FOLIVIX - Android Maize Leaf Disease Identifier

Platform Language UI Architecture License

Table of Contents

  1. About The Project
  2. Screenshots
  3. Features
  4. Architecture & Tech Stack
  5. Connecting to the Backend
  6. Project Structure
  7. Getting Started
  8. Configuration
  9. License

1. About The Project

FOLIVIX is a modern, native Android application designed for the rapid and accurate identification of foliar diseases in maize plants. It serves as a user-friendly mobile client that leverages a powerful, remote machine learning model (a Vision Transformer) to perform real-time image analysis.

The app allows users to capture or upload images of maize leaves and receive an instant diagnosis, complete with a confidence score. This provides an accessible and powerful tool for farmers, agronomists, and researchers to monitor crop health directly from the field.

This application is built with a focus on a clean, scalable architecture and a seamless user experience, incorporating features like multi-user profile management, detailed analysis history, and an in-app educational hub for disease information.

2. Screenshots

App Screenshot 1 App Screenshot 2 App Screenshot 3
App Screenshot 4 App Screenshot 5 App Screenshot 6

3. Features

  • 🌿 AI-Powered Disease Identification: Analyze maize leaves by taking a photo or selecting one from the gallery. The app is designed to identify 5 common diseases (Common Rust, Gray Leaf Spot, Northern Leaf Blight, Phaeosphaeria Leaf Spot, Southern Rust) and healthy leaves.

  • βœ‚οΈ In-App Image Cropping: Features an integrated image cropper (uCrop) to allow users to focus on the most relevant area of the leaf before analysis, improving prediction accuracy.

  • πŸ‘₯ Multi-User Profile Management: Supports up to 3 distinct user profiles. Each profile maintains its own separate analysis history, statistics, and personalized settings.

  • πŸ“ˆ Comprehensive Analysis History: Every saved analysis is stored locally and displayed in a filterable, chronological feed. Users can filter results by disease type, date, and prediction confidence.

  • πŸ“Š Interactive Dashboard: The home screen provides a visual summary of all analyses, including a pie chart of disease distribution, total leaves analyzed, and average prediction accuracy.

  • πŸ“š In-App Disease Information Hub: Serves as an educational resource with detailed descriptions, symptoms, and control methods for each detectable disease, complete with multiple high-quality reference images.

  • πŸ”§ Configurable Backend Server: The IP address of the backend prediction server can be easily configured within the app, allowing for flexibility in development, testing, and various network environments.

4. Architecture & Tech Stack

This project is built using modern Android development practices and a robust, scalable architecture.

  • Architecture: MVVM (Model-View-ViewModel) and the Repository Pattern to ensure a clean separation of concerns between the UI, business logic, and data layers.
  • UI: Built entirely with Jetpack Compose, Google's modern declarative UI toolkit, for a dynamic and responsive user interface.
  • Dependency Injection: Hilt is used to manage dependencies throughout the application, simplifying object creation and promoting modularity.
  • Asynchronous Programming: Kotlin Coroutines and Flow are used extensively for managing background threads and handling asynchronous data streams from the data layer to the UI.
  • Networking: Retrofit & OkHttp for making efficient and type-safe API calls to the backend. Gson is used for JSON serialization/deserialization.
  • Navigation: Jetpack Navigation for Compose handles all in-app screen transitions and the navigation graph.
  • Data Persistence:
    • Jetpack DataStore: For storing user preferences like the server IP address and the last active user ID.
    • Custom File Storage: A structured, file-based system (FileStorageManager) for storing user profiles, analysis metadata, and images locally on the device's internal storage.
  • Image Handling:
    • Coil: For loading, caching, and displaying images asynchronously in Jetpack Compose.
    • uCrop: For providing a powerful and customizable image cropping experience.

5. Connecting to the Backend

The FOLIVIX mobile app is a client designed to communicate with a remote backend server where the machine learning model is hosted. This server is expected to expose a REST API for predictions.

API-Driven Workflow

The interaction is designed to be simple and efficient:

  1. Image Selection: The user captures or selects an image of a maize leaf within the app.
  2. API Request: The app sends the image via an HTTP multipart/form-data POST request to the /predict endpoint of the running backend server.
  3. Backend Processing: The server receives the image, processes it, and performs inference using its ML model.
  4. JSON Response: The server returns the prediction results in a structured JSON format, including the predicted class, confidence score, and processing time.
  5. Display Results: The FOLIVIX app parses the JSON response and displays the diagnosis to the user in a clear, easy-to-understand interface.

This client-server architecture allows the heavy computational work to be offloaded to a more powerful machine, keeping the mobile app lightweight and fast.

6. Project Structure


FOLIVIX/
β”œβ”€β”€ .gradle/
β”œβ”€β”€ .idea/
β”œβ”€β”€ .kotlin/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ build/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ androidTest/
β”‚   β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”‚   β”œβ”€β”€ java/
β”‚   β”‚   β”‚   β”‚   └── com/
β”‚   β”‚   β”‚   β”‚       └── example/
β”‚   β”‚   β”‚   β”‚           └── folivix/
β”‚   β”‚   β”‚   β”‚               β”œβ”€β”€ data/
β”‚   β”‚   β”‚   β”‚               β”‚   β”œβ”€β”€ preferences/
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   └── AppPreferences.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”œβ”€β”€ repository/
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   β”œβ”€β”€ AnalysisRepository.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   β”œβ”€β”€ AnalysisRepositoryImpl.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   β”œβ”€β”€ DiseaseRepository.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   β”œβ”€β”€ DiseaseRepositoryImpl.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   β”œβ”€β”€ UserRepository.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   └── UserRepositoryImpl.kt
β”‚   β”‚   β”‚   β”‚               β”‚   └── storage/
β”‚   β”‚   β”‚   β”‚               β”‚       └── FileStorageManager.kt
β”‚   β”‚   β”‚   β”‚               β”œβ”€β”€ di/
β”‚   β”‚   β”‚   β”‚               β”‚   └── AppModule.kt
β”‚   β”‚   β”‚   β”‚               β”œβ”€β”€ model/
β”‚   β”‚   β”‚   β”‚               β”‚   β”œβ”€β”€ AnalysisResult.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”œβ”€β”€ DiseaseInfo.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”œβ”€β”€ DiseaseTip.kt
β”‚   β”‚   β”‚   β”‚               β”‚   └── User.kt
β”‚   β”‚   β”‚   β”‚               β”œβ”€β”€ network/
β”‚   β”‚   β”‚   β”‚               β”‚   β”œβ”€β”€ ApiService.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”œβ”€β”€ PredictionResponse.kt
β”‚   β”‚   β”‚   β”‚               β”‚   └── RetrofitClient.kt
β”‚   β”‚   β”‚   β”‚               β”œβ”€β”€ ui/
β”‚   β”‚   β”‚   β”‚               β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   └── FolivixComponents.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”œβ”€β”€ screens/
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   β”‚   β”œβ”€β”€ BackgroundScreen.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   β”‚   β”œβ”€β”€ HomeScreen.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   β”‚   β”œβ”€β”€ IdentifyScreen.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   β”‚   β”œβ”€β”€ InfoScreen.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   β”‚   β”œβ”€β”€ MainScreen.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   β”‚   β”œβ”€β”€ UserManualScreen.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   β”‚   └── UserProfileScreen.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   β”œβ”€β”€ profile/
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   β”‚   β”œβ”€β”€ CreateProfileScreen.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   β”‚   β”œβ”€β”€ ManageProfilesScreen.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   β”‚   └── ProfileSelectionScreen.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚   └── splash/
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚       β”œβ”€β”€ SplashScreen1.kt
β”‚   β”‚   β”‚   β”‚               β”‚   β”‚       └── SplashScreen2.kt
β”‚   β”‚   β”‚   β”‚               β”‚   └── theme/
β”‚   β”‚   β”‚   β”‚               β”‚       β”œβ”€β”€ Color.kt
β”‚   β”‚   β”‚   β”‚               β”‚       β”œβ”€β”€ Theme.kt
β”‚   β”‚   β”‚   β”‚               β”‚       └── Type.kt
β”‚   β”‚   β”‚   β”‚               β”œβ”€β”€ util/
β”‚   β”‚   β”‚   β”‚               └── viewmodel/
β”‚   β”‚   β”‚   β”‚                   β”œβ”€β”€ HistoryViewModel.kt
β”‚   β”‚   β”‚   β”‚                   β”œβ”€β”€ HomeViewModel.kt
β”‚   β”‚   β”‚   β”‚                   β”œβ”€β”€ IdentifyViewModel.kt
β”‚   β”‚   β”‚   β”‚                   β”œβ”€β”€ InfoViewModel.kt
β”‚   β”‚   β”‚   β”‚                   β”œβ”€β”€ MainViewModel.kt
β”‚   β”‚   β”‚   β”‚                   └── UserProfileViewModel.kt
β”‚   β”‚   β”‚   β”‚               β”œβ”€β”€ FolivixApplication.kt
β”‚   β”‚   β”‚   β”‚               └── MainActivity.kt
β”‚   β”‚   β”‚   β”œβ”€β”€ res/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ AndroidManifest.xml
β”‚   β”‚   β”‚   β”‚   └── ic_launcher-playstore.png
β”‚   β”‚   └── test/
β”‚   β”œβ”€β”€ .gitignore
β”‚   β”œβ”€β”€ build.gradle.kts
β”‚   └── proguard-rules.pro
β”œβ”€β”€ build/
β”œβ”€β”€ gradle/
β”œβ”€β”€ .gitignore
β”œβ”€β”€ build.gradle.kts
β”œβ”€β”€ gradle.properties
β”œβ”€β”€ gradlew
β”œβ”€β”€ gradlew.bat
β”œβ”€β”€ local.properties
└── settings.gradle.kts

7. Getting Started

Follow these instructions to set up the project and run it on your local machine for development and testing purposes.

Prerequisites

Installation

  1. Clone the Repository
    git clone https://github.com/AlvaroVasquezAI/FOLIVIX.git
  2. Open in Android Studio
    • Launch Android Studio.
    • Select File > Open and navigate to the cloned project directory.
    • Allow Android Studio to sync the Gradle files and download all dependencies.
  3. Run the Application
    • Connect an Android device or start an emulator.
    • Click the 'Run' button (β–Ά) in Android Studio.

8. Configuration

For the app to function correctly, it must be able to communicate with the backend server.

  1. Ensure your Android device/emulator and the machine running the backend server are on the same local network.
  2. Launch the FOLIVIX application.
  3. After creating a profile, navigate to the Main Screen.
  4. Tap the Information icon (i) in the top-left corner to go to the Info Screen.
  5. Under the "ConfiguraciΓ³n del servidor" section, tap "Cambiar".
  6. Enter the local IP address of the machine running the prediction server (e.g., 192.168.1.10). The app will automatically connect to port 5000.

9. License

This project is distributed under the MIT License. See the LICENSE file for more information.

About

A native Android application built with Kotlin & Jetpack Compose to identify maize leaf diseases by connecting to a remote AI backend.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages