keras
keras copied to clipboard
[Bounding Boxes] Add Support for Bounding Box Transformations during Image Resizing
This PR covers below cases:
- Add bounding box transformations: Here we require
orig_heightandorig_widthfor bounding boxes transformation as each image can have separate bounding boxes relative to the original image size. Later we can use the same to transform bounding boxes as per the ratios. - Make
convert_formatto be compatible intf.datapipeline regardless of backend.
Just a temporary file without disturbing previous implementation of convert_format
Sample notebook of using convert_format and rezie layer https://colab.research.google.com/gist/sineeli/257e4d546ed89ff64c0550712287b208/-keras3-resizing.ipynb
Codecov Report
Attention: Patch coverage is 20.81081% with 293 lines in your changes missing coverage. Please review.
Project coverage is 73.30%. Comparing base (
3d32481) to head (c5457af). Report is 8 commits behind head on master.
:exclamation: There is a different number of reports uploaded between BASE (3d32481) and HEAD (c5457af). Click for more details.
HEAD has 2 uploads less than BASE
Flag BASE (3d32481) HEAD (c5457af) keras 4 3 keras-torch 1 0
Additional details and impacted files
@@ Coverage Diff @@
## master #20368 +/- ##
==========================================
- Coverage 78.87% 73.30% -5.58%
==========================================
Files 512 516 +4
Lines 49266 49563 +297
Branches 7953 7962 +9
==========================================
- Hits 38861 36333 -2528
- Misses 8546 11420 +2874
+ Partials 1859 1810 -49
| Flag | Coverage Δ | |
|---|---|---|
| keras | 73.24% <20.81%> (-5.51%) |
:arrow_down: |
| keras-jax | 62.34% <20.81%> (-0.07%) |
:arrow_down: |
| keras-numpy | 57.42% <20.81%> (-0.01%) |
:arrow_down: |
| keras-tensorflow | 63.56% <20.81%> (-0.08%) |
:arrow_down: |
| keras-torch | ? |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Reference Colab: https://colab.research.google.com/gist/sineeli/77cdc067d0adcef0a267b00b4921e7b8/-keras3-resizing.ipynb
Can you take a look at the test failures? I think they are likely related to the fact that torch tests are running with data_format="channels_first". https://github.com/keras-team/keras/actions/runs/11469236802/job/31916066253?pr=20368
Can you take a look at the test failures? I think they are likely related to the fact that torch tests are running with
data_format="channels_first". https://github.com/keras-team/keras/actions/runs/11469236802/job/31916066253?pr=20368
Oh yes!! thanks I updated the test cases for channels_first case.
Reference:
The code looks good to me! Not sure about the max bbox layer.
A side question is whether we need "bbox" in the name of the transformations like
affine_transformetc et distinguish them fromkeras.ops.image.affine_transformand so on. No strong opinion.
I guess it should be fine as user will use keras.utils.bounding_boxes.affine_transform and it is explicit that its under bounding_boxes.