Skip to content

BapDaGreat/CatchGrade

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐟 CatchGrade β€” Skipjack Tuna Defect Classification App

An Android mobile application that uses on-device machine learning to classify skipjack tuna quality in real-time, helping fishery inspectors and processors identify defects instantly from a camera photo or gallery image.

Android Kotlin TensorFlow Lite License


πŸ“‹ Table of Contents


Overview

CatchGrade was developed as a capstone research project to address quality control challenges at the General Santos City Fish Port Complex β€” the largest tuna landing port in the Philippines. Manual visual inspection of skipjack tuna is time-consuming and prone to human error. CatchGrade automates this process using a trained TensorFlow Lite image classification model deployed directly on-device for instant, offline-capable results.

Problem Statement

Traditional tuna quality assessment relies on manual visual inspection by trained personnel, which is:

  • Slow β€” inspectors can only process a limited number of fish per hour
  • Subjective β€” results vary between inspectors
  • Error-prone β€” fatigue leads to missed defects

Solution

CatchGrade provides a mobile, camera-based classification tool that delivers consistent, instant results β€” reducing inspection time and improving accuracy for fishery quality control operations.


Features

  • πŸ“Έ Real-Time Camera Capture β€” Use CameraX back-camera preview to photograph tuna specimens directly
  • πŸ–ΌοΈ Gallery Upload β€” Import existing images from device gallery for classification
  • 🧠 On-Device ML Inference β€” TensorFlow Lite model runs entirely on-device (no internet required)
  • πŸ“Š Instant Classification β€” Results displayed in under 1 second with confidence scoring
  • πŸ“œ Scan History β€” Horizontal scrollable history reel showing all previous scans with thumbnails
  • πŸ”„ Re-Review Scans β€” Tap any history thumbnail to re-display the image and its classification result
  • πŸ“± Optimized for Field Use β€” Designed for use in processing plants and port facilities

Classification Categories

Category Description
βœ… Healthy Tuna specimen shows no visible defects β€” passes quality inspection
⚠️ Skin Discoloration Abnormal coloring on the skin surface indicating potential quality degradation
πŸ”΄ Eye Deterioration Visible deterioration of the eye area, a key freshness indicator

The TFLite model accepts 224Γ—224 RGB images and outputs probability scores across all three classes.


Tech Stack

Layer Technology
Language Kotlin 2.0
Platform Android (minSdk 24 / Android 7.0+)
ML Framework TensorFlow Lite + TFLite Support Library
Camera CameraX 1.3.1 (camera-core, camera2, lifecycle, view)
UI XML Views, ConstraintLayout, Material Design 3
Build Gradle 8.9.2 (Kotlin DSL), AGP 8.9.2
IDE Android Studio

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 MainActivity                β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ CameraX  β”‚  β”‚ Gallery  β”‚  β”‚  History   β”‚ β”‚
β”‚  β”‚ Preview  β”‚  β”‚ Picker   β”‚  β”‚  Adapter   β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚       β”‚              β”‚                       β”‚
β”‚       β–Ό              β–Ό                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                β”‚
β”‚  β”‚    Bitmap Processing    β”‚                β”‚
β”‚  β”‚  (resize to 224Γ—224)    β”‚                β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β”‚
β”‚              β–Ό                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                β”‚
β”‚  β”‚    TunaClassifier       β”‚                β”‚
β”‚  β”‚  (TFLite Interpreter)   β”‚                β”‚
β”‚  β”‚  tuna_model.tflite      β”‚                β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β”‚
β”‚              β–Ό                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                β”‚
β”‚  β”‚  Classification Result  β”‚                β”‚
β”‚  β”‚  + Confidence Score     β”‚                β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Screenshots

πŸ“Œ Screenshots coming soon β€” run the app in Android Studio to preview the UI.


Getting Started

Prerequisites

  • Android Studio Arctic Fox or later (recommended: latest stable)
  • JDK 11 or higher
  • Android SDK with API Level 24+ installed
  • A physical Android device or emulator (camera features work best on a real device)

Installation

  1. Clone the repository

    git clone https://github.com/YOUR_USERNAME/CatchGrade.git
    cd CatchGrade
  2. Open in Android Studio

    • File β†’ Open β†’ select the cloned CatchGrade directory
    • Wait for Gradle sync to complete
  3. Build and Run

    • Connect an Android device (USB debugging enabled) or start an emulator
    • Click Run β–Ά or press Shift + F10
    • Grant camera permission when prompted

Testing with Sample Images

If you don't have access to tuna specimens, you can test by:

  1. Tap "Upload Picture"
  2. Select any fish image from your gallery
  3. The model will classify it based on visual features

Project Structure

CatchGrade/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ build.gradle.kts              # App-level build config
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”‚   β”œβ”€β”€ AndroidManifest.xml   # Permissions & activity config
β”‚   β”‚   β”‚   β”œβ”€β”€ assets/
β”‚   β”‚   β”‚   β”‚   └── tuna_model.tflite # Trained ML model (2.5 MB)
β”‚   β”‚   β”‚   β”œβ”€β”€ java/com/example/catchgrade/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ MainActivity.kt   # Camera, gallery, UI logic
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ TunaClassifier.kt # TFLite inference engine
β”‚   β”‚   β”‚   β”‚   └── HistoryAdapter.kt # Scan history RecyclerView
β”‚   β”‚   β”‚   └── res/
β”‚   β”‚   β”‚       β”œβ”€β”€ layout/
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ activity_main.xml  # Main UI layout
β”‚   β”‚   β”‚       β”‚   └── item_history.xml   # History thumbnail item
β”‚   β”‚   β”‚       β”œβ”€β”€ values/
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ colors.xml
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ strings.xml
β”‚   β”‚   β”‚       β”‚   └── themes.xml
β”‚   β”‚   β”‚       └── mipmap-*/         # App launcher icons
β”‚   β”‚   └── test/                     # Unit tests
β”‚   └── proguard-rules.pro
β”œβ”€β”€ build.gradle.kts                  # Root build config
β”œβ”€β”€ settings.gradle.kts
β”œβ”€β”€ gradle.properties
β”œβ”€β”€ gradlew / gradlew.bat            # Gradle wrapper
β”œβ”€β”€ LICENSE
└── README.md

How It Works

1. Image Capture

The app uses CameraX to provide a live back-camera preview. When the user taps "Take Picture," an in-memory image is captured and auto-rotated to correct orientation.

2. Preprocessing

The captured or uploaded bitmap is:

  • Decoded safely using Software rendering (avoiding Hardware Bitmap crashes)
  • Resized to 224Γ—224 pixels (the model's expected input size)
  • Normalized from 0–255 to 0.0–1.0 float values per RGB channel

3. Inference

The TunaClassifier loads tuna_model.tflite from the app's assets directory and runs inference using the TensorFlow Lite Interpreter. The model outputs a probability array across 3 classes.

4. Result Display

The class with the highest probability is displayed on a blue banner at the top of the screen. The image and result are also added to the scan history reel for later review.


Model Details

Property Value
Format TensorFlow Lite (.tflite)
Input 224Γ—224Γ—3 (RGB float32, normalized 0–1)
Output 1Γ—3 probability array
Classes Skin Discoloration, Healthy, Eye Deterioration
Size ~2.5 MB
Training Transfer learning (trained offline, exported to TFLite)

Contributing

Contributions are welcome! If you'd like to improve CatchGrade:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -m 'feat: add your feature')
  4. Push to the branch (git push origin feature/your-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License β€” see the LICENSE file for details.


Author

Dayle Angelo PeΓ±a

  • πŸ“§ daylepena@gmail.com
  • πŸŽ“ B.S. Computer Science β€” Notre Dame of Dadiangas University
  • πŸ“ General Santos City, Philippines

Acknowledgments

  • General Santos City Fish Port Complex β€” domain expertise and research support
  • Notre Dame of Dadiangas University β€” academic guidance
  • TensorFlow β€” open-source ML framework
  • CameraX β€” modern Android camera API

About

Android app for classifying skipjack tuna defects using on-device TensorFlow Lite machine learning

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages