Commit f67b67f
Extend field converters (#1986)
This pull request introduces new converters for handling
channels-first/channels-last metadata in image and mask fields, improves
error handling for array structure issues, and expands the set of
annotation field and converter utilities. The changes also include
updates to the public API and add a new test for converter registration.
**New converters and utilities:**
* Added `ChannelsFirstConverter` for image fields and
`MaskChannelsFirstConverter` for mask fields, enabling metadata-only
conversion between channels-first and channels-last formats without
altering the actual data.
[[1]](diffhunk://#diff-370ffd190b01623b335a827152000636d5445190cd9e296694f2884649e55559R399-R449)
[[2]](diffhunk://#diff-be0e9424e00f51a63ddbe9dc5c7f01046dc343d7c335eee9ab198a031a4eaa7aR466-R514)
* Introduced the `copy_columns_with_shape` utility function to assist
converters that only need to update metadata and not the underlying
data.
* Registered new converters and utilities in the `__init__.py` files and
updated the public API to include them.
[[1]](diffhunk://#diff-000e98833d5fba9d66f82db2422b240bd02e0fde9f86af6f7ffd9a431abd5b01R8-R34)
[[2]](diffhunk://#diff-000e98833d5fba9d66f82db2422b240bd02e0fde9f86af6f7ffd9a431abd5b01R45)
[[3]](diffhunk://#diff-000e98833d5fba9d66f82db2422b240bd02e0fde9f86af6f7ffd9a431abd5b01R70-R106)
[[4]](diffhunk://#diff-000e98833d5fba9d66f82db2422b240bd02e0fde9f86af6f7ffd9a431abd5b01R119)
**Annotation fields and factory functions:**
* Added `ellipse_field` factory function and included `EllipseField` and
`CaptionField` in the annotation fields public API.
[[1]](diffhunk://#diff-bc3a3fc9d428403e8e117f703ffc69efaae506a2db15eea759c548e175698e75R382-R402)
[[2]](diffhunk://#diff-29b9ccd281e40c6b1d4f8b918075d0a3f7ba4c4e7d464d6d6f6fb7f917c80e27R14-R22)
[[3]](diffhunk://#diff-29b9ccd281e40c6b1d4f8b918075d0a3f7ba4c4e7d464d6d6f6fb7f917c80e27R59)
[[4]](diffhunk://#diff-29b9ccd281e40c6b1d4f8b918075d0a3f7ba4c4e7d464d6d6f6fb7f917c80e27R86)
**Error handling improvements:**
* Introduced a new `ArrayStructureError` exception for clearer
diagnostics when numpy arrays have improper object dtype structures
during conversion.
[[1]](diffhunk://#diff-c614e227e84e7aa9a984dd6207cc5f44aec1fc9af2032ecefb72273c64f883e3R1-R33)
[[2]](diffhunk://#diff-e324261812079d99ca2989612441e5df1dd15dabde37fb2e5e8c0c1b639dac0dR21)
[[3]](diffhunk://#diff-e324261812079d99ca2989612441e5df1dd15dabde37fb2e5e8c0c1b639dac0dR158-R182)
<!-- 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).
-->
### Checklist
<!-- Put an 'x' in all the boxes that apply -->
- [x] 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: Albert van Houten <[email protected]>
Co-authored-by: Copilot <[email protected]>1 parent 6e0f046 commit f67b67f
File tree
10 files changed
+1590
-20
lines changed- src/datumaro/experimental
- converters
- fields
- tests/unit/experimental
10 files changed
+1590
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
8 | 16 | | |
9 | 17 | | |
| 18 | + | |
10 | 19 | | |
11 | 20 | | |
| 21 | + | |
12 | 22 | | |
| 23 | + | |
13 | 24 | | |
14 | 25 | | |
15 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
16 | 33 | | |
| 34 | + | |
17 | 35 | | |
18 | 36 | | |
19 | 37 | | |
| |||
24 | 42 | | |
25 | 43 | | |
26 | 44 | | |
| 45 | + | |
27 | 46 | | |
28 | 47 | | |
29 | 48 | | |
| |||
48 | 67 | | |
49 | 68 | | |
50 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
51 | 73 | | |
52 | 74 | | |
53 | 75 | | |
54 | 76 | | |
55 | 77 | | |
56 | 78 | | |
57 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
58 | 83 | | |
59 | 84 | | |
60 | 85 | | |
61 | 86 | | |
62 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
63 | 91 | | |
64 | 92 | | |
65 | 93 | | |
66 | 94 | | |
| 95 | + | |
| 96 | + | |
67 | 97 | | |
68 | 98 | | |
69 | 99 | | |
70 | 100 | | |
71 | 101 | | |
72 | 102 | | |
73 | 103 | | |
| 104 | + | |
74 | 105 | | |
| 106 | + | |
75 | 107 | | |
76 | 108 | | |
77 | 109 | | |
| |||
84 | 116 | | |
85 | 117 | | |
86 | 118 | | |
| 119 | + | |
87 | 120 | | |
88 | 121 | | |
89 | 122 | | |
0 commit comments