-
Notifications
You must be signed in to change notification settings - Fork 0
Develop ML code for oyster image analysis with computer vision #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: sr320 <4442039+sr320@users.noreply.github.com>
Co-authored-by: sr320 <4442039+sr320@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a machine learning pipeline for automatically counting oysters in photographs using computer vision techniques. The solution uses adaptive thresholding, morphological operations, and contour detection to identify oysters, achieving a mean absolute error of 40.6 oysters (38.5% mean percentage error) on 8 labeled test images.
Key Changes:
- Developed core oyster detection algorithm with configurable parameters for preprocessing, thresholding, and contour filtering
- Created parameter optimization framework that tested 96 parameter combinations to identify optimal settings
- Built batch processing and evaluation utilities with JSON/CSV output formats
Reviewed Changes
Copilot reviewed 11 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| code/count-automation/requirements.txt | Specifies Python dependencies including OpenCV, NumPy, scikit-image, and pandas |
| code/count-automation/oyster_counter.py | Implements OysterCounter class with detection pipeline, evaluation framework, and CLI interface |
| code/count-automation/optimize_parameters.py | Provides grid search optimization to find best parameter combinations |
| code/count-automation/example_usage.py | Demonstrates programmatic usage of the oyster counter with various parameter configurations |
| code/count-automation/batch_process.py | Enables batch processing of multiple images with summary statistics and CSV/JSON exports |
| code/count-automation/README.md | Comprehensive documentation covering installation, usage, algorithm details, performance metrics, and improvement recommendations |
| output/count-automation/best_params.json | Contains optimal parameter values identified during optimization |
| output/count-automation/evaluation_results.json | Stores detailed evaluation metrics for each test image |
| output/count-automation/optimization_results.json | Records all 96 parameter combinations tested with their performance metrics |
| output/count-automation/batch/batch_results.json | JSON output from batch processing of test images |
| output/count-automation/batch/batch_results.csv | CSV output from batch processing of test images |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| ``` | ||
|
|
||
| Required packages: | ||
| - opencv-python-headless >= 4.8.0 |
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version requirement inconsistency: README specifies >= 4.8.0 while requirements.txt specifies >=4.8.1.78. These should match to avoid confusion.
| - opencv-python-headless >= 4.8.0 | |
| - opencv-python-headless >= 4.8.1.78 |
| - scikit-image >= 0.21.0 | ||
| - matplotlib >= 3.7.0 | ||
| - pandas >= 2.0.0 | ||
| - pillow >= 10.0.0 |
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version requirement inconsistency: README specifies >= 10.0.0 while requirements.txt specifies >=10.3.0. These should match to avoid confusion.
| - pillow >= 10.0.0 | |
| - pillow >= 10.3.0 |
Co-authored-by: sr320 <4442039+sr320@users.noreply.github.com>
Overview
This PR implements a complete machine learning pipeline for automatically counting oysters in photographs using computer vision techniques. The system was developed and optimized using the 8 labeled images in
data/images/(juvenile-99 through juvenile-116).What's New
A new
code/count-automation/directory containing a fully functional oyster counting system:Core Components
oyster_counter.py- Main counting algorithm implementing:optimize_parameters.py- Parameter optimization framework:batch_process.py- Batch processing utility:example_usage.py- Comprehensive examples demonstrating:requirements.txt- Python dependencies with security-patched versionsREADME.md- Comprehensive documentation including:Performance Results
The system was optimized through grid search testing 96 parameter combinations:
Baseline (default parameters):
Optimized:
The algorithm currently shows consistent undercounting, with performance ranging from 29-48% error across the 8 test images, indicating room for improvement with additional data and advanced techniques.
Output Files
The system generates visualization images showing detected oysters with bounding boxes and labels, along with JSON reports containing:
Future Improvements
The README documents a comprehensive improvement plan:
Security
Usage Example
This implementation provides a solid foundation for oyster counting automation and a clear path forward for improving accuracy as more labeled training data becomes available.
Original prompt
Fixes #3
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.