albumentations-team / albucore

A high-performance image processing library designed to optimize and extend the Albumentations library with specialized functions for advanced image transformations. Perfect for developers working in computer vision who require efficient and scalable image augmentation.
MIT License
12 stars 3 forks source link

Added decorator to show way to process data #31

Closed ternaus closed 1 month ago

ternaus commented 1 month ago

Summary by Sourcery

Add decorators to ensure consistent data types for image processing functions and optimize data type handling in conversion functions. Update tests to cover new decorators and improve pre-commit configuration.

New Features:

Enhancements:

Build:

Tests:

Chores:

sourcery-ai[bot] commented 1 month ago

Reviewer's Guide by Sourcery

This pull request introduces two new decorators for image processing functions: float32_io and uint8_io. These decorators ensure consistent input/output data types for image processing functions. The PR also includes updates to existing functions and tests to support these new decorators.

File-Level Changes

Change Details Files
Added new decorators for image processing functions
  • Implemented float32_io decorator to ensure float32 input/output
  • Implemented uint8_io decorator to ensure uint8 input/output
  • Updated to_float and from_float functions to handle float32 and float64 inputs
albucore/functions.py
Added tests for new decorators and updated functions
  • Created test cases for float32_io and uint8_io decorators
  • Added tests for intermediate dtype checks
  • Implemented tests for preserving float32 and uint8 dtypes
  • Added roundtrip tests for to_float and from_float functions
tests/test_utils.py
tests/test_to_from_float.py
Refactored existing decorators
  • Moved contiguous and preserve_channel_dim decorators to a new file
  • Removed unused imports
albucore/utils.py
albucore/decorators.py
Updated dependencies
  • Updated ruff-pre-commit from v0.6.5 to v0.6.6
.pre-commit-config.yaml

Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.
codecov-commenter commented 1 month ago

Codecov Report

Attention: Patch coverage is 96.42857% with 4 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@5f9611f). Learn more about missing BASE report.

Files with missing lines Patch % Lines
albucore/decorators.py 92.85% 2 Missing :warning:
albucore/functions.py 93.10% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #31 +/- ## ======================================= Coverage ? 59.23% ======================================= Files ? 17 Lines ? 1906 Branches ? 0 ======================================= Hits ? 1129 Misses ? 777 Partials ? 0 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.