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

Add inference API and task for all BioImage.IO Model Zoo models #338

Merged
merged 35 commits into from
Dec 20, 2024

Conversation

qin-yu
Copy link
Collaborator

@qin-yu qin-yu commented Sep 26, 2024

Add inference API and task for all BioImage.IO Model Zoo models

PlantSeg v2 supports training of our models and inference of all BioImage.IO models. This PR turns v2.0.0aX to v2.0.0b0.

Main features

I integrated support for bioimageio.core inference with BioImage.IO Model Zoo models into the PlantSeg API, tasks, and widgets.

To ensure functionality, I conducted the following manual tests:
1. 2D Input (YX): Tested with the pioneering-rhino PlantSeg model, resulting in a 2D image output.
2. 3D Input (ZYX): Tested with the emotional-cricket PlantSeg model, resulting in a 3D image output.
3. 4D Input (CZYX): Tested with the philosophical-panda Cellpose model, resulting in a sequence of 4D image outputs.

The bioimageio.core Python package has multiple versions, requiring careful handling of format compatibility and extensive validation. Ongoing development of the library introduces additional complexity, but I believe this implementation addresses most use cases and version-specific challenges.

Screenshot

Multiple outputs of different sizes from Cellpose network:

CleanShot 2024-12-19 at 18 33 56@2x

List of BioImage.IO Model Zoo models:

CleanShot 2024-12-19 at 18 35 09@2x

@qin-yu qin-yu self-assigned this Sep 26, 2024
@qin-yu qin-yu added enhancement New feature or request BioImage.IO Related to BioImage.IO and AI4Life GUI Napari GUI related labels Sep 26, 2024
Copy link

codecov bot commented Dec 3, 2024

Codecov Report

Attention: Patch coverage is 83.88889% with 29 lines in your changes missing coverage. Please review.

Project coverage is 63.45%. Comparing base (f7e8e4b) to head (fabae0a).
Report is 36 commits behind head on master.

Files with missing lines Patch % Lines
plantseg/core/zoo.py 78.26% 10 Missing ⚠️
plantseg/functionals/prediction/prediction.py 89.65% 6 Missing ⚠️
plantseg/viewer_napari/widgets/prediction.py 14.28% 6 Missing ⚠️
plantseg/viewer_napari/widgets/dataprocessing.py 25.00% 3 Missing ⚠️
plantseg/viewer_napari/widgets/segmentation.py 25.00% 3 Missing ⚠️
plantseg/viewer_napari/widgets/io.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #338      +/-   ##
==========================================
- Coverage   65.25%   63.45%   -1.81%     
==========================================
  Files          72       73       +1     
  Lines        5301     5442     +141     
==========================================
- Hits         3459     3453       -6     
- Misses       1842     1989     +147     

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

@qin-yu qin-yu force-pushed the qy/unify-prediction branch from 316aa91 to cf0e69b Compare December 16, 2024 21:43
@qin-yu
Copy link
Collaborator Author

qin-yu commented Dec 16, 2024

2024-12-16 22 33 06

@lorenzocerrone
Copy link
Collaborator

@qin-yu the ci seems to be stuck

@qin-yu
Copy link
Collaborator Author

qin-yu commented Dec 17, 2024

@qin-yu the ci seems to be stuck

PyTest finishes without error on macOS and Linux for me. Checking the CI now.

@qin-yu
Copy link
Collaborator Author

qin-yu commented Dec 17, 2024

For the record, starting with Python 3.13, pip will no longer have setuptools and wheel as dependencies by default. So I put setuptools in the meta.yaml. [*ref]

@qin-yu
Copy link
Collaborator Author

qin-yu commented Dec 17, 2024

I rerun the CI for main branch and it got stuck as well:

@qin-yu
Copy link
Collaborator Author

qin-yu commented Dec 17, 2024

Tried some solutions but none works:

CleanShot 2024-12-17 at 23 29 17@2x

Now not only axes with `.id` and `.size` attributes but also string axes such as 'bcyx' coming with `shape` at the same level.

These are due to the legacy of bioimage.io and complexity of versioning.

Tested with `pioneering-rhino`
@qin-yu qin-yu marked this pull request as ready for review December 18, 2024 02:12
@qin-yu qin-yu changed the title Unify prediction Add inference API and task for all BioImage.IO Model Zoo models Dec 18, 2024
@qin-yu qin-yu linked an issue Dec 18, 2024 that may be closed by this pull request
qin-yu added a commit that referenced this pull request Dec 19, 2024
@qin-yu qin-yu force-pushed the qy/unify-prediction branch from 469aa6c to fabae0a Compare December 19, 2024 17:42
@qin-yu qin-yu merged commit f22e0c1 into master Dec 20, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BioImage.IO Related to BioImage.IO and AI4Life enhancement New feature or request GUI Napari GUI related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow direct search and download from BioImage Model Zoo
2 participants