- About The Project
- Screenshots
- Features
- Architecture & Tech Stack
- Connecting to the Backend
- Project Structure
- Getting Started
- Configuration
- License
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.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
-
πΏ 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.
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.
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.
The interaction is designed to be simple and efficient:
- Image Selection: The user captures or selects an image of a maize leaf within the app.
- API Request: The app sends the image via an HTTP
multipart/form-dataPOST request to the/predictendpoint of the running backend server. - Backend Processing: The server receives the image, processes it, and performs inference using its ML model.
- JSON Response: The server returns the prediction results in a structured
JSONformat, including the predicted class, confidence score, and processing time. - 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.
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
Follow these instructions to set up the project and run it on your local machine for development and testing purposes.
- Android Studio Iguana | 2023.2.1 or later.
- JDK 11 or higher.
- A running instance of the compatible Maize Leaf Disease Classification Backend.
- Clone the Repository
git clone https://github.com/AlvaroVasquezAI/FOLIVIX.git
- Open in Android Studio
- Launch Android Studio.
- Select
File>Openand navigate to the cloned project directory. - Allow Android Studio to sync the Gradle files and download all dependencies.
- Run the Application
- Connect an Android device or start an emulator.
- Click the 'Run' button (βΆ) in Android Studio.
For the app to function correctly, it must be able to communicate with the backend server.
- Ensure your Android device/emulator and the machine running the backend server are on the same local network.
- Launch the FOLIVIX application.
- After creating a profile, navigate to the Main Screen.
- Tap the Information icon (
i) in the top-left corner to go to the Info Screen. - Under the "ConfiguraciΓ³n del servidor" section, tap "Cambiar".
- Enter the local IP address of the machine running the prediction server (e.g.,
192.168.1.10). The app will automatically connect to port5000.
This project is distributed under the MIT License. See the LICENSE file for more information.





