Add FastSAM-based oyster counting & measurement pipeline - #1
Open
sr320 wants to merge 1 commit into
Open
Conversation
Automates the manual ImageJ workflow (point per oyster + caliper measurement) for overhead tray photos. Pipeline (scripts/oyster_vision.py): - Segment every object with pretrained FastSAM (no task-specific training, suits a single labelled image) - Filter masks to oyster instances by size/solidity/extent/aspect within a board ROI, de-duplicate with mask-IoU NMS - Measure length = max Feret diameter, width = min-area-rect short side - Convert px->mm with a single calibration constant CLIs: - calibrate.py derives px/mm and validation metrics from the ImageJ-annotated reference image (POINT overlay + mm table) - detect.py runs image -> predictions CSV + annotated overlay Reference image (bag380, 84 oysters): counted 80, detection P/R/F1 0.90/0.86/0.88, length MAE 4.6mm (r 0.82), width MAE 4.7mm (r 0.73), calibration 2.435 px/mm. Metrics and outputs written to outputs/. Docs in README.md and METHODS.md, including the scene-specific calibration caveat and next steps for recall/false-positive improvements. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Adds a vision pipeline that counts oysters and measures each one's length and width in mm from overhead tray photos, automating the manual ImageJ workflow (place a point per oyster, measure with calipers) captured in the reference data.
Because the dataset is a single labelled image, the pipeline uses a pretrained FastSAM "segment everything" model (no task-specific training) plus a domain-specific filter, measurement, and calibration layer.
How it works (
scripts/oyster_vision.py)CLIs
scripts/calibrate.py— extracts ground truth from the ImageJ TIFF (POINT overlay = 84 human crosshairs), matches detections, fitspx_per_mm, writesoutputs/calibration.json+outputs/metrics.json.scripts/detect.py— runs any image → per-oyster predictions CSV + annotated overlay.Results — reference image
bag380(84 oysters)Reviewer notes
models/on first run and are git-ignored.METHODS.md).380tag). Improvement paths documented inMETHODS.md..DS_Storefrom tracking and added it to.gitignore.🤖 Generated with Claude Code