Commit 6e0f046
authored
Fix RotatedBbox.wrap() by assigning correct attributes (#1993)
<!-- Contributing guide:
https://github.com/open-edge-platform/datumaro/blob/develop/contributing.md
-->
<!--
Please add a summary of changes. You may use Copilot to auto-generate
the PR description but please consider including any other relevant
facts which Copilot may be unaware of (such as design choices and
testing procedure).
Add references to the relevant issues and pull requests if any like so:
Resolves #111 and #222.
Depends on #1000 (for series of dependent commits).
-->
The `RotatedBbox.wrap()` function tries to access wrong attributes. This
causes errors in dataset transforms that include rotated bounding boxes.
See the example:
```python
"""Minimal reproducible example demonstrating the bug in RotatedBbox.wrap method.
The wrap method tries to access item.x and item.y, but RotatedBbox only has
cx and cy properties (center coordinates), not x and y.
"""
from datumaro.components.annotation import RotatedBbox
bbox = RotatedBbox(cx=100.0, cy=200.0, w=50.0, h=30.0, r=45.0, label=0)
wrapped_bbox = bbox.wrap(label=1)
```
### Checklist
<!-- Put an 'x' in all the boxes that apply -->
- [ ] I have added tests to cover my changes or documented any manual
tests.
- [ ] I have updated the
[documentation](https://github.com/open-edge-platform/datumaro/tree/develop/docs)
accordingly
---------
Signed-off-by: williamcorsel <[email protected]>1 parent 532d9e5 commit 6e0f046
File tree
2 files changed
+31
-3
lines changed- src/datumaro/components
- tests/unit
2 files changed
+31
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1280 | 1280 | | |
1281 | 1281 | | |
1282 | 1282 | | |
1283 | | - | |
| 1283 | + | |
1284 | 1284 | | |
1285 | 1285 | | |
1286 | 1286 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
59 | 87 | | |
60 | 88 | | |
61 | 89 | | |
| |||
0 commit comments