A computer vision system for evaluating tilapia fish freshness
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tilapia_freshness_evaluator-1.0.0.tar.gz.
File metadata
- Download URL: tilapia_freshness_evaluator-1.0.0.tar.gz
- Upload date:
- Size: 956.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a186f81b1a08ee2f90e7bbac23e0cee097c7b6cde2ff2a28f6b403f1ba0fc54
|
|
| MD5 |
adb6fd82108a100f237078b509ea6d5a
|
|
| BLAKE2b-256 |
f9226bd927900c3deb2576566d03a25a0901c72fbc956099422e1ffe8f181f84
|
File details
Details for the file tilapia_freshness_evaluator-1.0.0-py3-none-any.whl.
File metadata
- Download URL: tilapia_freshness_evaluator-1.0.0-py3-none-any.whl
- Upload date:
- Size: 956.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46ce3c5e3e9a876a1ec01f36072bbb9ae739000b38294e2c4bd6fc5e9c014e95
|
|
| MD5 |
88ed1334eeb004108426ab6116c4d4e0
|
|
| BLAKE2b-256 |
ad93bc53edb46b9d050b11d1f79cdd374ecb5fed911bb2efdaea440b78b4aec8
|