Skip to content
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

Speedy improvements #793

Merged
merged 2 commits into from
Nov 8, 2023
Merged

Conversation

mrariden
Copy link
Collaborator

When using the --save_png flag, the io.save_masks() method attempts to make a PNG of the original image/predicted outlines/predicted masks/cell pose. This takes a lot of time, especially for large images. I've added a default flag to disable the block in io.save_masks() that makes the matplotlib figure. I've exposed this flag to the CLI and API.

Alternatively, the image data could be reshaped manually, rather than letting matplotlib do the work. (@carsen-stringer)

Example CLI data after setting default behavior to skip matplotlib:

  • 10 Mb image, 2600x1500
    • Base runtime: 98 seconds
    • With --save_png: 105 seconds
    • With --save_png and --save_mpl: 121 seconds
  • 100 Mb image, 5700x6500
    • Base runtime:
    • With --save_png: 668 seconds
    • With --save_png and --save_mpl: 1562 seconds

This also is related to the OOM issues #735, since the memory spikes at the end of matplotlib figure creation.

@codecov
Copy link

codecov bot commented Sep 29, 2023

Codecov Report

Merging #793 (167f273) into main (5fb74fd) will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #793      +/-   ##
==========================================
+ Coverage   63.36%   63.40%   +0.04%     
==========================================
  Files          14       14              
  Lines        2964     2965       +1     
==========================================
+ Hits         1878     1880       +2     
+ Misses       1086     1085       -1     
Files Coverage Δ
cellpose/__main__.py 66.44% <ø> (ø)
cellpose/cli.py 100.00% <100.00%> (ø)
cellpose/io.py 63.25% <100.00%> (ø)

... and 1 file with indirect coverage changes

@mrariden
Copy link
Collaborator Author

mrariden commented Oct 3, 2023

Tests initially not passing due to persistent GH actions weirdness. (Environment wasn't able to be created). Passing now. @carsen-stringer

@mrariden mrariden self-assigned this Oct 11, 2023
@carsen-stringer carsen-stringer merged commit 09efe85 into MouseLand:main Nov 8, 2023
12 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