Tilapia Fish Freshness Evaluation System
A computer vision system for evaluating tilapia fish freshness using YOLOv3 object detection, GrabCut segmentation, and advanced RGB color analysis.
Features
- Object Detection: Custom YOLOv3 model for tilapia gill identification
- Segmentation: GrabCut algorithm for precise gill area extraction
- Color Analysis: Advanced RGB analysis with brightness, saturation, and color ratios
- GUI Interface: User-friendly Tkinter-based interface with progress indicators
- Performance Optimizations: Image caching, lazy loading, and memory-based processing
- Structured Logging: Industry-standard logging with separate analysis results
- Modern Architecture: Object-oriented design with proper separation of concerns
Project Structure
├── src/tilapia_freshness/
│ ├── models/ # ML models (YOLO, GrabCut, Analyzer)
│ ├── gui/ # GUI components
│ ├── utils/ # Utility functions (caching, progress, logging)
│ ├── enums/ # Enums and constants
│ ├── config/ # Configuration management
│ ├── exceptions/ # Custom exceptions
│ └── assets/ # Application resources (icon)
├── tests/ # Unit tests
├── .github/workflows/ # CI/CD pipeline
├── images/ # Sample images
├── inputs/ # Standardized input files (auto-generated)
├── outputs/ # Generated results and logs
├── main.py # Application entry point
├── pyproject.toml # Modern Python packaging
└── requirements.txt # Dependencies
Prerequisites
- Python 3.11+
- Required packages listed in
requirements.txt
Installation
1. Clone Repository
git clone https://github.com/Evrouin/tilapia-fish-freshness-evaluation-system.git
cd tilapia-fish-freshness-evaluation-system
2. Setup Virtual Environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
3. Install Dependencies
pip install -e .
# Or for development:
pip install -e ".[dev]"
4. Download Model Files
Download the required model files from Google Drive and place them in the data/ folder:
yolov3_tilapia.weightsyolov3_tilapia.cfgobj.names
Usage
Run Application
python main.py
# Or if installed:
tilapia-freshness
Using the GUI
- Click "Select Image" to choose a tilapia fish image
- The system automatically detects gills using YOLOv3 with progress indication
- Click "Start Analysis" to perform segmentation and freshness evaluation
- Results display RGB values, confidence scores, and freshness classification
Freshness Classifications
- Fresh: Good color quality, red dominance, appropriate saturation
- Not Fresh: Moderate degradation, unclear color characteristics
- Old: Blue/gray dominance, washed out colors, high brightness
Development
Development Setup
make install-dev # Install with development dependencies
Code Quality
make format # Format code with Black and isort
make lint # Run flake8 linter
make type-check # Run mypy type checker
make test # Run tests with coverage
make check-all # Run all quality checks
Running Tests
pytest tests/ -v --cov=src/tilapia_freshness
Technical Details
Key Components
- YOLODetector: Handles gill detection with lazy loading
- GillSegmenter: Performs GrabCut segmentation
- ColorAnalyzer: Analyzes RGB values and classifies freshness
- InputFileManager: Standardized file processing with timestamp naming
- ProgressDialog: User feedback for long operations
Color Analysis Algorithm
The system uses multiple metrics for accurate freshness evaluation:
- Distance from fresh reference point (32, 19, 17)
- Color brightness and saturation analysis
- RGB ratios and dominance patterns
- Weighted mean/median filtering for noise reduction
- Configurable thresholds for different freshness levels
Authors
- @John Elway Cortez - Lead Developer
- @Dustin Uriel Obispo - Co-Developer
- @King Red Sanchez - Co-Developer
- @Briel Aldous Viola - Co-Developer
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
Metadata
Release files for tilapia-freshness-evaluator 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tilapia_freshness_evaluator-1.0.0.tar.gz | 956.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tilapia_freshness_evaluator-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.9 MB
Release files / tilapia_freshness_evaluator-1.0.0.tar.gz
| Download URL | tilapia_freshness_evaluator-1.0.0.tar.gz |
|---|---|
| Size | 956.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a186f81b1a08ee2f90e7bbac23e0cee097c7b6cde2ff2a28f6b403f1ba0fc54
|
|
BLAKE2b-256 checksum How to use checksums |
f9226bd927900c3deb2576566d03a25a0901c72fbc956099422e1ffe8f181f84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / tilapia_freshness_evaluator-1.0.0-py3-none-any.whl
| Download URL | tilapia_freshness_evaluator-1.0.0-py3-none-any.whl |
|---|---|
| Size | 956.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
46ce3c5e3e9a876a1ec01f36072bbb9ae739000b38294e2c4bd6fc5e9c014e95
|
|
BLAKE2b-256 checksum How to use checksums |
ad93bc53edb46b9d050b11d1f79cdd374ecb5fed911bb2efdaea440b78b4aec8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|