Dev - #7
Open
ackermanar wants to merge 18 commits into
Open
Dev#7ackermanar wants to merge 18 commits into
ackermanar wants to merge 18 commits into
Conversation
First-round edits to README, prior to attempting installation
…r for larger birefnet weights
Initial README edits, edited to resolve conflicts with dev branch
Ported from main (fbb3c09) onto dev at e7904eb. Agent instructions and docs - AGENTS.md: public agent guide, the single source of truth; CLAUDE.md imports it. docs/faq.md: human FAQ, linked from the README. - .gitignore: commit CLAUDE.md and AGENTS.md; ignore *.local.md. - README, FAQ, AGENTS: Git LFS is an install prerequisite (a clone made without it yields a 134-byte pointer stub, not the model), RF-DETR arrives with the clone, and `mats fetch-weights` is the repair path. Repair uses `git lfs pull --exclude=weights/birefnet_leaf.pth`, which stays RF-DETR-only whether or not .lfsconfig's fetchexclude is active. - README: reconciled with the restructure from PR #2; its headings and TOC are kept, and the hand-edited doctor/fetch paragraph is preserved verbatim. Also carried over from fbb3c09 (app work, unrelated to the docs) - src/mats/app/Home.py, branding.py, src/mats/core.py, pyproject.toml, tests/test_home_app.py Known and not addressed here - .lfsconfig has fetchexclude commented out on dev, so a clone now fetches BiRefNet (2.65 GB) as well as RF-DETR. - tests/test_weights.py::test_status_missing_for_excluded_checkout_pointer already fails on dev before this commit (message reworded in PR #2). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
CLI validation gaps, output-collision risk, a preview race, misleading documentation, and skipped CI coverage remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (8)
Case-sensitive duplicate check allows output filename collisions · New Stale cleaned-image load overwrites newer clean-size preview · New Explicit selected pre-cleanup method bypasses export dependency check · New Explicit default cleanup values bypass dependent-flag validation · New Dependency-heavy CI gates skip dual-method test coverage · New Pre-cleanup integration suite is skipped in dependency-free CI · New Unreleased entry references removed Results view · New Description omits mandatory clean_raw_mask filtering · New
What changed in this PR
Overhauls thresholding, mask cleanup, dual-method analysis, exports, adjustment workflows, and related documentation.
Changes:
- Adds configurable pre-cleanup measurement and dual Otsu/BiRefNet execution.
- Expands CLI and Streamlit controls, previews, exports, and specimen adjustment.
- Adds supporting tests and revises weight-delivery documentation.
| File | Description |
|---|---|
.gitattributes |
Updates BiRefNet LFS instructions. |
.lfsconfig |
Enables default BiRefNet exclusion. |
AGENTS.md |
Documents new workflows and safeguards. |
CHANGELOG.md |
Records UI and pipeline changes. |
README.md |
Documents methods, cleanup, and exports. |
deploy/ondemand/mats/README.md |
Revises shared-weight staging. |
docs/cli.md |
Documents new CLI options. |
docs/faq.md |
Updates usage and troubleshooting. |
docs/gui.md |
Documents redesigned workbench. |
docs/hpc.md |
Revises HPC weight provisioning. |
docs/weights.md |
Clarifies LFS behavior. |
src/mats/app/compute.py |
Reads checkbox-based method selection. |
src/mats/app/output_adjustment.py |
Adds atomic specimen remeasurement. |
src/mats/app/pages/0_Diagnostics.py |
Adds diagnostics page. |
src/mats/app/pages/2_BiRefNet_Setup.py |
Updates LFS command. |
src/mats/app/pages/3_CPU_Options.py |
Reports combined method selection. |
src/mats/app/pages/5_Help.py |
Updates in-app guidance. |
src/mats/app/specimen_table.py |
Adds interactive specimen table. |
src/mats/app/threshold_preview.py |
Adds live threshold/cleanup preview. |
src/mats/cli.py |
Adds method, cleanup, and export flags. |
src/mats/core.py |
Implements dual-method processing and artifacts. |
src/mats/mask_cleanup.py |
Implements raw-mask cleanup. |
src/mats/mask_settings.py |
Defines cleanup validation and defaults. |
src/mats/thresholds.py |
Centralizes threshold parsing. |
src/mats/weights.py |
Refines checkpoint-specific LFS handling. |
tests/test_cli_args.py |
Expands CLI coverage. |
tests/test_dual_method.py |
Tests dual-method orchestration. |
tests/test_mask_cleanup.py |
Tests cleanup behavior. |
tests/test_pre_cleanup_exports.py |
Tests exports and adjustment. |
tests/test_threshold_preview.py |
Tests preview consistency. |
tests/test_thresholds.py |
Tests threshold parsing. |
tests/test_weights.py |
Tests checkpoint instructions and pulls. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.



("Overhaul of threshing features and UI") changes 26 files, adding 6,347 lines and removing 663. You made the commit while I was reading. It holds exactly the set of uncommitted changes that was on
devwhen we started.Pipeline (
core.py)Both methods in one run.
mask_methodnow accepts"both"or a list of methods. Markers are detected once per image, and then each method segments and measures on its own. Each method writes its own results CSV and failure log, and its masks and QC images get a_thresholdor_birefnetsuffix. Target boxes are shared. A single-method run keeps the old file names.Measuring before cleanup. With
measurement_source="pre-cleanup", the run measures the raw mask afterclean_raw_maskhas done three things:In this mode, width and length span every remaining foreground pixel, not just the largest contour.
Default measurements are unchanged.
clean_leaf_mask(fill_holes=True)is still the old code.segment_leaf()now returns the raw mask and the cleaned mask, andcreate_leaf_maskwraps it.New image exports:
A failed write is now recorded as an
EXPORT:warning instead of being lost silently.New sidecar file. Every results CSV now gets a
.meta.jsonfile recording the measurement source, method, unit and schema. This happens on default runs too.Batch return shape. New keys:
methods,by_method,artifacts,preview_artifacts,measurement_source,clean_margin,stray_gap. The top-levelresults_pathandresult_rowskeys now appear only on single-method runs.Other behaviour changes:
execution_device == "cpu".thresholdquietly ran BiRefNet.New modules
thresholds.pycore(still re-exported there), plus parsing of a custom1–255cutoff. Standard library onlymask_settings.pymask_cleanup.pyapp/threshold_preview.pyapp/specimen_table.pyapp/output_adjustment.pyapp/pages/0_Diagnostics.pyCLI (
cli.py)--mask-method both--threshold-levelnow also takes1–255--measure-pre-cleanup,--clean-margin,--stray-gap--export {pre-cleanup,overlay,cutout,axes}(repeatable) and--pre-cleanup-methods--no-target-boxes,--no-masks,--no-failure-logGUI
Home.py, about 1,700 lines changed) is reorganized into four tabs: Setup, Analyze, Adjust and Export. There is a new Go to Export button in the sidebar.compute.pyand the CPU Options page read the new checkbox state.Docs and tests
Docs: new CHANGELOG "Unreleased" entries, and updates to
README.md,docs/cli.md,docs/faq.md,docs/gui.md,AGENTS.mdand the Help page.Tests: 5 new test files with 57 tests in all:
test_cli_args.pyandtest_home_app.pyalso grew by 180 and 1,377 lines. I didn't run the suite.The commit message has a typo: "threshing" should be "thresholding". If you haven't pushed yet,
git commit --amendwill fix it.