Documentation

Installation Guide

PomegradeAI — AI-Powered Pomegranate Quality Grading System | Final Year Project with Source Code

Step-by-step Setup Verified Instructions Chat Support
Back to Project
Complete Guide

Installation Guide — PomegradeAI

Prerequisites

  • Python 3.9 or higher
  • Flutter 3.0 or higher
  • Android Studio or Xcode (for device emulators)
  • Trained model files from the outputs_v2 folder

Step 1 — Set Up the Django Backend

Open a terminal and navigate to the backend directory.

cd "pomegranate quality grading/pomegranate_backend"

Create and activate a Python virtual environment.

python3 -m venv venv
source venv/bin/activate

On Windows, use:

venv\Scripts\activate

Install all required Python dependencies.

pip install -r requirements.txt

Create the models directory and copy the trained model files into it.

mkdir -p models/
cp "../outputs_v2/pomegranate_cnn_model.keras" models/
cp "../outputs_v2/pomegranate_cnn_model.h5" models/
cp "../outputs_v2/class_indices.json" models/

Apply database migrations to set up the SQLite schema.

python manage.py makemigrations
python manage.py migrate

Optionally create a Django admin superuser.

python manage.py createsuperuser

Start the development server.

python manage.py runserver 0.0.0.0:8000

The backend will be accessible at http://localhost:8000.

Step 2 — Set Up the Flutter Mobile App

In a separate terminal, navigate to the Flutter project directory.

cd "pomegranate quality grading/pomgrade_ai"

Install all Flutter dependencies.

flutter pub get

Open the file at lib/constants/api_constants.dart and set the correct backend URL for your device.

  • Android emulator: http://10.0.2.2:8000
  • iOS simulator: http://localhost:8000
  • Physical Android or iOS device: http://YOUR_LOCAL_IP:8000

Run the app on a connected device or emulator.

flutter run

To build a release APK for Android distribution.

flutter build apk --release

The APK will be available at build/app/outputs/flutter-apk/app-release.apk.

Step 3 — Optional Model Retraining

If you want to retrain the model on a new or expanded dataset, open the Jupyter notebook from the project root.

jupyter notebook pomegranate_v2_efficientnet.ipynb

The notebook covers dataset splitting, class imbalance handling, the full tf.data augmentation pipeline, two-phase EfficientNetB0 training, evaluation with confusion matrix, Grad-CAM visualization, and saving the final model to outputs_v2.

Common Issues and Fixes

  • FileNotFoundError — No model file found: Make sure pomegranate_cnn_model.keras, pomegranate_cnn_model.h5, and class_indices.json are present inside the models/ directory.
  • ModuleNotFoundError — No module named cv2: Run pip install opencv-python-headless inside your activated virtual environment.
  • Flutter SocketException — Connection refused: Ensure the Django server is running and accessible. Use the correct IP address for physical devices.
  • Table not found DB error: Run python manage.py migrate to apply all pending migrations.
  • Low accuracy results: Confirm you are using the v2 model at outputs_v2/pomegranate_cnn_model.keras, not any earlier version.

Need Help?

Our team is here to assist you with installation and setup.

Chat with Us
Chat with us