Skip to content

Correct file-filter condition in train_Cellpose-SAM.ipynb#1159

Merged
mrariden merged 1 commit intoMouseLand:mainfrom
unikill066:main
May 8, 2025
Merged

Correct file-filter condition in train_Cellpose-SAM.ipynb#1159
mrariden merged 1 commit intoMouseLand:mainfrom
unikill066:main

Conversation

@unikill066
Copy link
Copy Markdown
Contributor

@unikill066 unikill066 commented May 7, 2025

What’s changed

The loop was previously using f.name (which does not exist) instead of the proper loop variable name. This change prevents runtime errors and ensures that each filename is handled correctly during dataset assembly.

Original

# list all files
files = [f for f in Path(train_dir).glob("*") if "_masks" not in f.name and "_flows" not in f.nameand "_seg" not in name]

Fixed

# list all files
files = [f for f in Path(train_dir).glob("*") if "_masks" not in f.name and "_flows" not in f.name and "_seg" not in f.name]

Why this matters

  • Bug: The undefined name variable meant the "_seg" filter never ran.
  • Correct behavior: Now any file whose filename contains "_seg" is properly excluded.

Testing

Ran the script on a directory with mixed filenames (image1.png, image1_seg.png, image1_masks.png, etc.)

No regressions or new errors.

Copy link
Copy Markdown
Collaborator

@mrariden mrariden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@codecov
Copy link
Copy Markdown

codecov bot commented May 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.13%. Comparing base (f976bd1) to head (682a1de).
Report is 159 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (f976bd1) and HEAD (682a1de). Click for more details.

HEAD has 3 uploads less than BASE
Flag BASE (f976bd1) HEAD (682a1de)
9 6
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1159      +/-   ##
==========================================
- Coverage   52.69%   47.13%   -5.57%     
==========================================
  Files          18       16       -2     
  Lines        4342     3711     -631     
==========================================
- Hits         2288     1749     -539     
+ Misses       2054     1962      -92     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mrariden mrariden merged commit 7000f95 into MouseLand:main May 8, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants