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

Update ilastik with the new bioimageio v0.5 spec #2919

Merged
merged 19 commits into from
Jan 10, 2025

Conversation

thodkatz
Copy link
Contributor

@thodkatz thodkatz commented Oct 15, 2024

This is a work in progress to update ilastik with the spec v5.

It uses a non released version of tiktorch. You can find it on this PR ilastik/tiktorch#222.

To test this, you need to manually install the PR version of tiktorch.

The only use case that I have currently tested and it works with our first v5 model is the following:

  • Local Neural Network workflow
  • Load a 2d image
  • affable-shark

Known issues:

TODO:

  • 3d
  • Fix progress bar

@thodkatz thodkatz marked this pull request as draft October 15, 2024 19:59
@thodkatz thodkatz changed the title Update tiktorch with the new v5 spec Update ilastik with the new v5 spec Oct 18, 2024
@k-dominik k-dominik changed the title Update ilastik with the new v5 spec Update ilastik with the new bioimageio v0.5 spec Dec 2, 2024
@k-dominik k-dominik force-pushed the update-tiktorch-with-v5 branch from 737127f to c444612 Compare December 11, 2024 10:16
fixed shape calculation:
 * same factor for all axes
 * fixed for shapes that are bigger than minimum shape
make sure the interface is compatible with our code usage.
(`tifffile.TiffFile` constructor)
Adapt classifier tests after tiktorch refactor (very shallow ModelSession
determining shape now happens via bioimageio.
@k-dominik k-dominik force-pushed the update-tiktorch-with-v5 branch from 768ff8b to 8c5a5aa Compare December 13, 2024 13:58
Copy link

codecov bot commented Dec 13, 2024

Codecov Report

Attention: Patch coverage is 67.20779% with 101 lines in your changes missing coverage. Please review.

Project coverage is 56.56%. Comparing base (64229ec) to head (32b5c52).
Report is 35 commits behind head on main.

Files with missing lines Patch % Lines
ilastik/utility/bioimageio_utils.py 72.50% 46 Missing and 9 partials ⚠️
ilastik/applets/neuralNetwork/bioimageiodl.py 0.00% 14 Missing ⚠️
ilastik/applets/neuralNetwork/nnClassGui.py 0.00% 11 Missing ⚠️
ilastik/applets/neuralNetwork/modelStateControl.py 0.00% 10 Missing ⚠️
...ets/trainableDomainAdaptation/modelStateControl.py 0.00% 7 Missing ⚠️
...lastik/applets/neuralNetwork/tiktorchController.py 84.61% 2 Missing ⚠️
lazyflow/operators/tiktorch/classifier.py 95.83% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2919      +/-   ##
==========================================
+ Coverage   56.51%   56.56%   +0.04%     
==========================================
  Files         535      536       +1     
  Lines       62322    62459     +137     
  Branches     7714     7727      +13     
==========================================
+ Hits        35220    35328     +108     
- Misses      25338    25356      +18     
- Partials     1764     1775      +11     

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

Upgrading bioimageio libs to v0.5 spec broke running with previous saved
projects.

* Added a test to document that breakage
* Added new project file with a v0.5 model
the next version (0.1.1) makes the object classification test time out:
TestObjectClassificationGui.test_03_select_object_features
permission errors on appveyor when removing the env.
prefer not to deal with manual removal when we can
cache only the folder that we care about. Should also
speed up our builds a bit
we relied on bioimageio functionality to expose the collection.json
previously. This functionality has been removed.
@k-dominik k-dominik force-pushed the update-tiktorch-with-v5 branch from ed2c7d5 to c275088 Compare December 14, 2024 16:48
same is done on deserialization and also on the tiktorch side with
`format_version="latest"`.
@k-dominik k-dominik marked this pull request as ready for review December 14, 2024 18:29
@k-dominik
Copy link
Contributor

k-dominik commented Dec 14, 2024

Note, there's something weird going on with the GH actions on windows - the post run takes ages (not sure about the root cause, didn't have time to investigate, but I guessed this: conda-incubator/setup-miniconda#380).

# if all sizes are fixed, factors might be empty
min_factor = min(factors) if factors else None
for k, f in size_funcs.items():
sized_axes[k] = f(min_factor)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very cool idea with the partials!

Copy link
Contributor

Choose a reason for hiding this comment

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

I had concerns about long term maintainability of this code (alternative would be to iterate twice), but if you like it I'll keep it.

@k-dominik k-dominik force-pushed the update-tiktorch-with-v5 branch from f496734 to f0dca68 Compare January 9, 2025 13:28
Copy link
Contributor

@Tomaz-Vieira Tomaz-Vieira left a comment

Choose a reason for hiding this comment

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

The *Utils and *Validator classes make me think that maybe we shouldn't be that tied to the spec in runtime after all. We could, say, just grab the spec and produce something like a IlastikPredictionPipeline instance that has all the logic and semantics it needs, without needing to keep going back to the spec. As a bonus, this would also work for spec v4 and a potential spec v6 in the future, as they might express the same concepts in different ways; all we'd need is another factory method to read the v4/v6 spec and then we'd be back to only the runtime class.

@k-dominik k-dominik force-pushed the update-tiktorch-with-v5 branch from 1d9c62e to 714de73 Compare January 9, 2025 17:39
k-dominik and others added 3 commits January 10, 2025 13:52
encountered incompatibilities with conda and boa

on win conda-build command seems not available -> conda build
cleanup there takes hours, or even times out

ref: conda-incubator/setup-miniconda#380
Improved typing in `bioimageio_utils.py`, which also lead to some code
improvements (like missed cases...).

Co-authored-by: Tomaz Vieira <[email protected]>
@k-dominik k-dominik force-pushed the update-tiktorch-with-v5 branch from 2e57b40 to 32b5c52 Compare January 10, 2025 12:53
@k-dominik k-dominik merged commit ea084f8 into ilastik:main Jan 10, 2025
16 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.

3 participants