Feat/mlflow inference - #60
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request introduces segmentation annotation support for 2D images and 3D volumes, refactors caching to use lazy initialization for better memory efficiency, and simplifies the MLflow flavor integration by removing unused parameters and improving error handling.
- Added
ImageSegmentationandVolumeSegmentationclasses with factory methods for creating segmentation annotations from numpy arrays and NIfTI images - Refactored
_cacheinAnnotationandResourceclasses to use lazy property-based initialization - Updated MLflow flavor API to remove unused parameters (
example_no_conversion,conda_env,streamable) and renamedartifact_pathtoname
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| datamint/entities/annotations/image_segmentation.py | New 2D segmentation annotation class with mask validation and utility methods |
| datamint/entities/annotations/volume_segmentation.py | New 3D volume segmentation annotation class supporting semantic segmentation with class maps |
| datamint/entities/annotations/init.py | Exports new segmentation annotation classes |
| datamint/entities/annotations/annotation.py | Refactored _cache to use lazy property initialization instead of eager initialization |
| datamint/entities/resource.py | Refactored _cache to use lazy property and removed redundant _cache = None assignments |
| datamint/mlflow/flavors/datamint_flavor.py | Removed unused parameters and changed artifact_path to name, updated import for Python 3.10+ compatibility |
| datamint/mlflow/flavors/model.py | Refactored cached attributes cleanup to use a centralized list pattern |
| datamint/mlflow/lightning/callbacks/modelcheckpoint.py | Improved model URI restoration with search_logged_models, added error handling for signature updates, removed debug logs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request introduces two new annotation entity classes for segmentation tasks (2D and 3D), refactors caching to use lazy initialization for resource and annotation entities, and cleans up the MLflow flavor integration by removing unused or redundant arguments. These changes improve support for segmentation workflows and enhance code maintainability.
Segmentation annotation support:
ImageSegmentationclass for 2D image segmentation annotations, including methods for mask validation, conversion, and area calculation (datamint/entities/annotations/image_segmentation.py,datamint/entities/annotations/__init__.py). [1] [2]VolumeSegmentationclass for 3D volume segmentation annotations, supporting both semantic and instance segmentation with class mapping and validation (datamint/entities/annotations/volume_segmentation.py,datamint/entities/annotations/__init__.py). [1] [2]Caching improvements:
_cacheinitialization in bothAnnotationandResourceclasses to use a property with lazy instantiation, improving memory usage and avoiding unnecessary cache creation (datamint/entities/annotations/annotation.py,datamint/entities/resource.py). [1] [2]_cachetoNonein various code paths inResourceto simplify logic (datamint/entities/resource.py). [1] [2] [3]MLflow flavor integration cleanup:
example_no_conversion,conda_env, andstreamablefrom MLflow flavor API, and refactored argument names for clarity (e.g.,artifact_pathtoname) (datamint/mlflow/flavors/datamint_flavor.py). [1] [2] [3] [4]Sequenceto usecollections.abcfor Python 3.10+ compatibility (datamint/mlflow/flavors/datamint_flavor.py).Minor cleanup:
model.py(datamint/mlflow/flavors/model.py).