mweinbach1 commited on
Commit
b79acd1
·
verified ·
1 Parent(s): c978bf2

Upload CoreML detector package

Browse files

Add Detector224.mlpackage, conversion config, benchmark/parity evidence, checksums, license, notice, and model card. SwiftPM package: https://github.com/mweinbach/OCRCoreMLDetector

Detector224.mlpackage/Data/com.apple.CoreML/model.mlmodel ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a90489494e9d6880c8ee3d98e63f114b1c8bf7c0fb31a5b92cecfcea0d59546
3
+ size 207422
Detector224.mlpackage/Data/com.apple.CoreML/weights/weight.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:92585a57d37ec157d773b67bfbdc497d1037b947353edeaa97c54300d896c295
3
+ size 45471744
Detector224.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "34FA8F82-C97F-476C-87BB-78B9BE530514": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Specification",
7
+ "name": "model.mlmodel",
8
+ "path": "com.apple.CoreML/model.mlmodel"
9
+ },
10
+ "E548B89C-6ABA-473C-83A4-7AD37AA2B934": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Weights",
13
+ "name": "weights",
14
+ "path": "com.apple.CoreML/weights"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "34FA8F82-C97F-476C-87BB-78B9BE530514"
18
+ }
LICENSE ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ All binary model files are licensed under NVIDIA Open Model License Agreement.
2
+ All source code files are licensed under the Apache 2.0 License.
3
+
4
+ ------------
5
+ NVIDIA Open Model License Agreement
6
+ Last Modified: October 24, 2025
7
+ https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/
8
+
9
+ This NVIDIA Open Model License Agreement (the “Agreement”) is a legal agreement between the Legal Entity You represent, or if no entity is identified, You and NVIDIA Corporation and its Affiliates (“NVIDIA”) and governs Your use of the Models that NVIDIA provides to You under this Agreement. NVIDIA and You are each a “party” and collectively the “parties.”
10
+
11
+ NVIDIA models released under this Agreement are intended to be used permissively and enable the further development of AI technologies. Subject to the terms of this Agreement, NVIDIA confirms that:
12
+
13
+ - Models are commercially usable.
14
+ - You are free to create and distribute Derivative Models.
15
+ - NVIDIA does not claim ownership to any outputs generated using the Models or Derivative Models.
16
+ By using, reproducing, modifying, distributing, performing or displaying any portion or element of the Model or Derivative Model, or otherwise accepting the terms of this Agreement, you agree to be bound by this Agreement.
17
+
18
+ 1. Definitions. The following definitions apply to this Agreement:
19
+
20
+ 1.1 "Derivative Model" means all (a) modifications to the Model, (b) works based on the Model, and (c) any other derivative works of the Model. An output is not a Derivative Model.
21
+
22
+ 1.2 "Legal Entity" means the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of fifty percent (50%) or more of the outstanding shares, or (c) beneficial ownership of such entity.
23
+
24
+ 1.3 “Model” means the machine learning model, software, checkpoints, learnt weights, algorithms, parameters, configuration files and documentation shared under this Agreement.
25
+
26
+ 1.4 "NVIDIA Cosmos Model" means a multimodal Model shared under this Agreement
27
+
28
+ 1.5 "Special-Purpose Model" means a Model that is only competent in a narrow set of purpose-specific tasks and should not be used for unintended or general-purpose applications
29
+
30
+ 1.6 “You” or “Your” means an individual or Legal Entity exercising permissions granted by this Agreement.
31
+
32
+ 2. Conditions for Use, License Grant, AI Ethics and IP Ownership.
33
+
34
+ 2.1 Conditions for Use. The Model and any Derivative Model are subject to additional terms as described in Section 2 and Section 3 of this Agreement and govern Your use. If You institute copyright or patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Model or a Derivative Model constitutes direct or contributory copyright or patent infringement, then any licenses granted to You under this Agreement for that Model or Derivative Model will terminate as of the date such litigation is filed. If You bypass, disable, reduce the efficacy of, or circumvent any technical limitation, safety guardrail or associated safety guardrail hyperparameter, encryption, security, digital rights management, or authentication mechanism (collectively “Guardrail”) contained in the Model without a substantially similar Guardrail appropriate for your use case, your rights under this Agreement will automatically terminate. NVIDIA may indicate in relevant documentation that a Model is a Special-Purpose Model. NVIDIA may update this Agreement to comply with legal and regulatory requirements at any time and You agree to either comply with any updated license or cease Your copying, use, and distribution of the Model and any Derivative Model.
35
+
36
+ 2.2 License Grant. The rights granted herein are explicitly conditioned on Your full compliance with the terms of this Agreement. Subject to the terms and conditions of this Agreement, NVIDIA hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, revocable (as stated in Section 2.1) license to publicly perform, publicly display, reproduce, use, create derivative works of, make, have made, sell, offer for sale, distribute (through multiple tiers of distribution) and import the Model.
37
+
38
+ 2.3 AI Ethics. Use of the Models under the Agreement must be consistent with NVIDIA’s Trustworthy AI terms found at https://www.nvidia.com/en-us/agreements/trustworthy-ai/terms/.
39
+
40
+ 2.4 NVIDIA owns the Model and any Derivative Models created by NVIDIA. Subject to NVIDIA’s underlying ownership rights in the Model or its Derivative Models, You are and will be the owner of Your Derivative Models. NVIDIA claims no ownership rights in outputs. You are responsible for outputs and their subsequent uses. Except as expressly granted in this Agreement, (a) NVIDIA reserves all rights, interests and remedies in connection with the Model and (b) no other license or right is granted to you by implication, estoppel or otherwise.
41
+
42
+ 3. Redistribution. You may reproduce and distribute copies of the Model or Derivative Models thereof in any medium, with or without modifications, provided that You meet the following conditions:
43
+
44
+ 3.1 If you distribute the Model, You must give any other recipients of the Model a copy of this Agreement and include the following attribution notice within a “Notice” text file with such copies: “Licensed by NVIDIA Corporation under the NVIDIA Open Model License”;
45
+
46
+ 3.2 If you distribute or make available a NVIDIA Cosmos Model, or a product or service (including an AI model) that contains or uses a NVIDIA Cosmos Model, use a NVIDIA Cosmos Model to create a Derivative Model, or use a NVIDIA Cosmos Model or its outputs to create, train, fine tune, or otherwise improve an AI model, you will include “Built on NVIDIA Cosmos” on a related website, user interface, blogpost, about page, or product documentation; and
47
+
48
+ 3.3 You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Models as a whole, provided Your use, reproduction, and distribution of the Model otherwise complies with the conditions stated in this Agreement.
49
+
50
+ 4. Separate Components. The Models may include or be distributed with components provided with separate legal notices or terms that accompany the components, such as an Open Source Software License or other third-party license. The components are subject to the applicable other licenses, including any proprietary notices, disclaimers, requirements and extended use rights; except that this Agreement will prevail regarding the use of third-party Open Source Software License, unless a third-party Open Source Software License requires its license terms to prevail. “Open Source Software License” means any software, data or documentation subject to any license identified as an open source license by the Open Source Initiative (https://opensource.org), Free Software Foundation (https://www.fsf.org) or other similar open source organization or listed by the Software Package Data Exchange (SPDX) Workgroup under the Linux Foundation (https://www.spdx.org).
51
+
52
+ 5. Trademarks. This Agreement does not grant permission to use the trade names, trademarks, service marks, or product names of NVIDIA, except as required for reasonable and customary use in describing the origin of the Model and reproducing the content of the “Notice” text file.
53
+
54
+ 6. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, NVIDIA provides the Model on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for reviewing Model documentation, including any Special-Purpose Model limitations, and determining the appropriateness of using or redistributing the Model, Derivative Models and outputs. You assume any risks associated with Your exercise of permissions under this Agreement.
55
+
56
+ 7. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, will NVIDIA be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this Agreement or out of the use or inability to use the Model, Derivative Models or outputs (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if NVIDIA has been advised of the possibility of such damages.
57
+
58
+ 8. Indemnity. You will indemnify and hold harmless NVIDIA from and against any claim by any third party arising out of or related to your use or distribution of the Model, Derivative Models or outputs.
59
+
60
+ 9. Feedback. NVIDIA appreciates your feedback, and You agree that NVIDIA may use it without restriction or compensation to You.
61
+
62
+ 10. Governing Law. This Agreement will be governed in all respects by the laws of the United States and the laws of the State of Delaware, without regard to conflict of laws principles or the United Nations Convention on Contracts for the International Sale of Goods. The state and federal courts residing in Santa Clara County, California will have exclusive jurisdiction over any dispute or claim arising out of or related to this Agreement, and the parties irrevocably consent to personal jurisdiction and venue in those courts; except that, either party may apply for injunctive remedies or an equivalent type of urgent legal relief in any jurisdiction.
63
+
64
+ 11. Trade and Compliance. You agree to comply with all applicable export, import, trade and economic sanctions laws and regulations, as amended, including without limitation U.S. Export Administration Regulations and Office of Foreign Assets Control regulations. These laws include restrictions on destinations, end-users and end-use.
65
+
66
+ Version Release Date: October 24, 2025
67
+
68
+ -----------------
69
+ Apache License
70
+ Version 2.0, January 2004
71
+ http://www.apache.org/licenses/
72
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
73
+ 1. Definitions.
74
+ "License" shall mean the terms and conditions for use, reproduction,
75
+ and distribution as defined by Sections 1 through 9 of this document.
76
+ "Licensor" shall mean the copyright owner or entity authorized by
77
+ the copyright owner that is granting the License.
78
+ "Legal Entity" shall mean the union of the acting entity and all
79
+ other entities that control, are controlled by, or are under common
80
+ control with that entity. For the purposes of this definition,
81
+ "control" means (i) the power, direct or indirect, to cause the
82
+ direction or management of such entity, whether by contract or
83
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
84
+ outstanding shares, or (iii) beneficial ownership of such entity.
85
+ "You" (or "Your") shall mean an individual or Legal Entity
86
+ exercising permissions granted by this License.
87
+ "Source" form shall mean the preferred form for making modifications,
88
+ including but not limited to software source code, documentation
89
+ source, and configuration files.
90
+ "Object" form shall mean any form resulting from mechanical
91
+ transformation or translation of a Source form, including but
92
+ not limited to compiled object code, generated documentation,
93
+ and conversions to other media types.
94
+ "Work" shall mean the work of authorship, whether in Source or
95
+ Object form, made available under the License, as indicated by a
96
+ copyright notice that is included in or attached to the work
97
+ (an example is provided in the Appendix below).
98
+ "Derivative Works" shall mean any work, whether in Source or Object
99
+ form, that is based on (or derived from) the Work and for which the
100
+ editorial revisions, annotations, elaborations, or other modifications
101
+ represent, as a whole, an original work of authorship. For the purposes
102
+ of this License, Derivative Works shall not include works that remain
103
+ separable from, or merely link (or bind by name) to the interfaces of,
104
+ the Work and Derivative Works thereof.
105
+ "Contribution" shall mean any work of authorship, including
106
+ the original version of the Work and any modifications or additions
107
+ to that Work or Derivative Works thereof, that is intentionally
108
+ submitted to Licensor for inclusion in the Work by the copyright owner
109
+ or by an individual or Legal Entity authorized to submit on behalf of
110
+ the copyright owner. For the purposes of this definition, "submitted"
111
+ means any form of electronic, verbal, or written communication sent
112
+ to the Licensor or its representatives, including but not limited to
113
+ communication on electronic mailing lists, source code control systems,
114
+ and issue tracking systems that are managed by, or on behalf of, the
115
+ Licensor for the purpose of discussing and improving the Work, but
116
+ excluding communication that is conspicuously marked or otherwise
117
+ designated in writing by the copyright owner as "Not a Contribution."
118
+ "Contributor" shall mean Licensor and any individual or Legal Entity
119
+ on behalf of whom a Contribution has been received by Licensor and
120
+ subsequently incorporated within the Work.
121
+ 2. Grant of Copyright License. Subject to the terms and conditions of
122
+ this License, each Contributor hereby grants to You a perpetual,
123
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
124
+ copyright license to reproduce, prepare Derivative Works of,
125
+ publicly display, publicly perform, sublicense, and distribute the
126
+ Work and such Derivative Works in Source or Object form.
127
+ 3. Grant of Patent License. Subject to the terms and conditions of
128
+ this License, each Contributor hereby grants to You a perpetual,
129
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
130
+ (except as stated in this section) patent license to make, have made,
131
+ use, offer to sell, sell, import, and otherwise transfer the Work,
132
+ where such license applies only to those patent claims licensable
133
+ by such Contributor that are necessarily infringed by their
134
+ Contribution(s) alone or by combination of their Contribution(s)
135
+ with the Work to which such Contribution(s) was submitted. If You
136
+ institute patent litigation against any entity (including a
137
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
138
+ or a Contribution incorporated within the Work constitutes direct
139
+ or contributory patent infringement, then any patent licenses
140
+ granted to You under this License for that Work shall terminate
141
+ as of the date such litigation is filed.
142
+ 4. Redistribution. You may reproduce and distribute copies of the
143
+ Work or Derivative Works thereof in any medium, with or without
144
+ modifications, and in Source or Object form, provided that You
145
+ meet the following conditions:
146
+ (a) You must give any other recipients of the Work or
147
+ Derivative Works a copy of this License; and
148
+ (b) You must cause any modified files to carry prominent notices
149
+ stating that You changed the files; and
150
+ (c) You must retain, in the Source form of any Derivative Works
151
+ that You distribute, all copyright, patent, trademark, and
152
+ attribution notices from the Source form of the Work,
153
+ excluding those notices that do not pertain to any part of
154
+ the Derivative Works; and
155
+ (d) If the Work includes a "NOTICE" text file as part of its
156
+ distribution, then any Derivative Works that You distribute must
157
+ include a readable copy of the attribution notices contained
158
+ within such NOTICE file, excluding those notices that do not
159
+ pertain to any part of the Derivative Works, in at least one
160
+ of the following places: within a NOTICE text file distributed
161
+ as part of the Derivative Works; within the Source form or
162
+ documentation, if provided along with the Derivative Works; or,
163
+ within a display generated by the Derivative Works, if and
164
+ wherever such third-party notices normally appear. The contents
165
+ of the NOTICE file are for informational purposes only and
166
+ do not modify the License. You may add Your own attribution
167
+ notices within Derivative Works that You distribute, alongside
168
+ or as an addendum to the NOTICE text from the Work, provided
169
+ that such additional attribution notices cannot be construed
170
+ as modifying the License.
171
+ You may add Your own copyright statement to Your modifications and
172
+ may provide additional or different license terms and conditions
173
+ for use, reproduction, or distribution of Your modifications, or
174
+ for any such Derivative Works as a whole, provided Your use,
175
+ reproduction, and distribution of the Work otherwise complies with
176
+ the conditions stated in this License.
177
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
178
+ any Contribution intentionally submitted for inclusion in the Work
179
+ by You to the Licensor shall be under the terms and conditions of
180
+ this License, without any additional terms or conditions.
181
+ Notwithstanding the above, nothing herein shall supersede or modify
182
+ the terms of any separate license agreement you may have executed
183
+ with Licensor regarding such Contributions.
184
+ 6. Trademarks. This License does not grant permission to use the trade
185
+ names, trademarks, service marks, or product names of the Licensor,
186
+ except as required for reasonable and customary use in describing the
187
+ origin of the Work and reproducing the content of the NOTICE file.
188
+ 7. Disclaimer of Warranty. Unless required by applicable law or
189
+ agreed to in writing, Licensor provides the Work (and each
190
+ Contributor provides its Contributions) on an "AS IS" BASIS,
191
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
192
+ implied, including, without limitation, any warranties or conditions
193
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
194
+ PARTICULAR PURPOSE. You are solely responsible for determining the
195
+ appropriateness of using or redistributing the Work and assume any
196
+ risks associated with Your exercise of permissions under this License.
197
+ 8. Limitation of Liability. In no event and under no legal theory,
198
+ whether in tort (including negligence), contract, or otherwise,
199
+ unless required by applicable law (such as deliberate and grossly
200
+ negligent acts) or agreed to in writing, shall any Contributor be
201
+ liable to You for damages, including any direct, indirect, special,
202
+ incidental, or consequential damages of any character arising as a
203
+ result of this License or out of the use or inability to use the
204
+ Work (including but not limited to damages for loss of goodwill,
205
+ work stoppage, computer failure or malfunction, or any and all
206
+ other commercial damages or losses), even if such Contributor
207
+ has been advised of the possibility of such damages.
208
+ 9. Accepting Warranty or Additional Liability. While redistributing
209
+ the Work or Derivative Works thereof, You may choose to offer,
210
+ and charge a fee for, acceptance of support, warranty, indemnity,
211
+ or other liability obligations and/or rights consistent with this
212
+ License. However, in accepting such obligations, You may act only
213
+ on Your own behalf and on Your sole responsibility, not on behalf
214
+ of any other Contributor, and only if You agree to indemnify,
215
+ defend, and hold each Contributor harmless for any liability
216
+ incurred by, or claims asserted against, such Contributor by reason
217
+ of your accepting any such warranty or additional liability.
218
+ END OF TERMS AND CONDITIONS
219
+ APPENDIX: How to apply the Apache License to your work.
220
+ To apply the Apache License to your work, attach the following
221
+ boilerplate notice, with the fields enclosed by brackets "[]"
222
+ replaced with your own identifying information. (Don't include
223
+ the brackets!) The text should be enclosed in the appropriate
224
+ comment syntax for the file format. We also recommend that a
225
+ file or class name and description of purpose be included on the
226
+ same "printed page" as the copyright notice for easier
227
+ identification within third-party archives.
228
+
229
+ Copyright [yyyy] [name of copyright owner]
230
+
231
+ Licensed under the Apache License, Version 2.0 (the "License");
232
+ you may not use this file except in compliance with the License.
233
+ You may obtain a copy of the License at
234
+
235
+ http://www.apache.org/licenses/LICENSE-2.0
236
+
237
+ Unless required by applicable law or agreed to in writing, software
238
+ distributed under the License is distributed on an "AS IS" BASIS,
239
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
240
+ See the License for the specific language governing permissions and
241
+ limitations under the License.
242
+
243
+
NOTICE ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ Licensed by NVIDIA Corporation under the NVIDIA Open Model License.
2
+
3
+ This package includes a CoreML conversion of the detector component from
4
+ NVIDIA Nemotron OCR v2. The converted model weights inherit the NVIDIA Open
5
+ Model License. The Swift wrapper code is provided for loading and running the
6
+ converted CoreML package in Apple apps.
README.md ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: nvidia-open-model-license
4
+ license_link: https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/
5
+ base_model: nvidia/nemotron-ocr-v2
6
+ library_name: coreml
7
+ tags:
8
+ - coreml
9
+ - ocr
10
+ - text-detection
11
+ - apple-silicon
12
+ - apple-neural-engine
13
+ - swift
14
+ ---
15
+
16
+ # OCR CoreML Detector 224
17
+
18
+ `Detector224.mlpackage` is a batch-1 CoreML conversion of the detector stage
19
+ from [NVIDIA Nemotron OCR v2](https://huggingface.co/nvidia/nemotron-ocr-v2).
20
+ It is intended for Apple-device OCR pipelines that need a packaged text
21
+ detection model and will implement their own post-processing, recognition, and
22
+ layout stages.
23
+
24
+ SwiftPM package:
25
+ [github.com/mweinbach/OCRCoreMLDetector](https://github.com/mweinbach/OCRCoreMLDetector)
26
+
27
+ ## What This Is
28
+
29
+ - Source model: `nvidia/nemotron-ocr-v2`, `v2_english` detector
30
+ - CoreML artifact: `Detector224.mlpackage`
31
+ - Conversion config: `experiments/224_detector_ane_decomposed_int8_768`
32
+ - Input size: `768 x 768`
33
+ - Batch size: `1`
34
+ - Weight quantization: int8 per-channel linear symmetric
35
+ - Compute precision: fp16
36
+ - Minimum deployment target used during conversion: iOS 18
37
+
38
+ This is not a complete OCR system. The package returns detector tensors only.
39
+ Downstream code still needs thresholding, rotated-box decoding,
40
+ non-maximum suppression, crop/rectify, recognition, and reading-order/layout
41
+ logic.
42
+
43
+ ## Files
44
+
45
+ | file | purpose |
46
+ |---|---|
47
+ | `Detector224.mlpackage/` | CoreML model package |
48
+ | `conversion_config.yaml` | conversion/benchmark config used to create the artifact |
49
+ | `bench.md` | local CoreML latency results |
50
+ | `parity.json` | PyTorch-vs-CoreML parity summary |
51
+ | `checksums.sha256` | SHA-256 checksums for the CoreML package files |
52
+ | `LICENSE` | NVIDIA Open Model License plus Apache 2.0 source license text from upstream |
53
+ | `NOTICE` | redistribution attribution notice |
54
+
55
+ ## Input Contract
56
+
57
+ The model expects one CoreML input named `image`:
58
+
59
+ - shape: `Float32[1, 3, 768, 768]`
60
+ - layout: RGB planar
61
+ - normalization: pixel values in `[0, 1]`
62
+
63
+ The SwiftPM wrapper linked above includes a helper that converts a `CGImage` to
64
+ this tensor shape.
65
+
66
+ ## Output Contract
67
+
68
+ The model returns:
69
+
70
+ | output | shape | meaning |
71
+ |---|---:|---|
72
+ | `prob` | `Float32[1, 192, 192]` | text probability map |
73
+ | `rboxes` | `Float32[1, 192, 192, 5]` | rotated-box geometry |
74
+ | `features` | `Float32[1, 128, 192, 192]` | detector feature map |
75
+
76
+ ## Local Performance
77
+
78
+ Measured on the bundled sample image after warmup:
79
+
80
+ | compute units | median prediction latency |
81
+ |---|---:|
82
+ | `ALL` | 13.53 ms |
83
+ | `CPU_AND_GPU` | 13.65 ms |
84
+ | `CPU_AND_NE` | 54.51 ms |
85
+ | `CPU_ONLY` | 298.28 ms |
86
+
87
+ For lowest single-image latency in the current test environment, use GPU or
88
+ CoreML `ALL`. CPU+ANE is available but slower for this detector.
89
+
90
+ ## Use From Swift
91
+
92
+ Add the Swift package:
93
+
94
+ ```swift
95
+ .package(url: "https://github.com/mweinbach/OCRCoreMLDetector.git", from: "0.1.0")
96
+ ```
97
+
98
+ Then:
99
+
100
+ ```swift
101
+ import CoreML
102
+ import OCRCoreMLDetector
103
+
104
+ let detector = try OCRDetector(computeUnits: .cpuAndGPU)
105
+ let prediction = try detector.prediction(for: cgImage)
106
+
107
+ let prob = prediction.output.prob
108
+ let rboxes = prediction.output.rboxes
109
+ let features = prediction.output.features
110
+ ```
111
+
112
+ ## License
113
+
114
+ The converted model weights inherit the
115
+ [NVIDIA Open Model License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/).
116
+ The upstream source code and helper scripts are Apache 2.0. See `LICENSE` and
117
+ `NOTICE` for redistribution terms and attribution.
bench.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Benchmark — `model.mlpackage`
2
+
3
+ - input `image` shape = [1, 3, 768, 768]
4
+
5
+ | compute unit | mean | median | p95 | p99 | min | max | stdev |
6
+ |---|---:|---:|---:|---:|---:|---:|---:|
7
+ | `ALL` | 13.58 ms | 13.53 ms | 13.93 ms | 13.96 ms | 13.24 ms | 13.97 ms | 0.22 ms |
8
+ | `CPU_AND_GPU` | 13.68 ms | 13.65 ms | 13.90 ms | 13.92 ms | 13.45 ms | 13.93 ms | 0.14 ms |
9
+ | `CPU_AND_NE` | 54.54 ms | 54.51 ms | 54.69 ms | 54.72 ms | 54.40 ms | 54.73 ms | 0.10 ms |
10
+ | `CPU_ONLY` | 300.02 ms | 298.28 ms | 307.53 ms | 307.64 ms | 295.91 ms | 307.67 ms | 4.10 ms |
11
+
12
+ **Fastest:** `ALL` at 13.53 ms median.
checksums.sha256 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ d771fbfe0d09de4f59ee08d2b14922542b416818a830e23a17315279a90af378 Detector224.mlpackage/Manifest.json
2
+ 9a90489494e9d6880c8ee3d98e63f114b1c8bf7c0fb31a5b92cecfcea0d59546 Detector224.mlpackage/Data/com.apple.CoreML/model.mlmodel
3
+ 92585a57d37ec157d773b67bfbdc497d1037b947353edeaa97c54300d896c295 Detector224.mlpackage/Data/com.apple.CoreML/weights/weight.bin
conversion_config.yaml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: detector_ane_decomposed_int8_768
2
+ description: ANE-decomposed detector at 768 px, int8 per-channel weight quantization.
3
+ model: { module: detector, checkpoint: v2_english }
4
+ detector_input:
5
+ batch_size: 1
6
+ infer_length: 768
7
+ ane_decomposed: true
8
+ conversion:
9
+ compute_precision: fp16
10
+ compute_units: CPU_AND_NE
11
+ minimum_deployment_target: iOS18
12
+ quantize_nbits: 8
13
+ quantize_granularity: per_channel
14
+ quantize_mode: linear_symmetric
15
+ compare:
16
+ atol: 2.0e+2
17
+ rtol: 5.0e-1
18
+ num_samples: 2
19
+ seed: 0
20
+ include_real_image: true
parity.json ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "passes": true,
3
+ "outputs": [
4
+ {
5
+ "name": "prob",
6
+ "shape": [
7
+ 1,
8
+ 192,
9
+ 192
10
+ ],
11
+ "dtype": "float32",
12
+ "max_abs_diff": 0.14600548148155212,
13
+ "mean_abs_diff": 0.0017581588815068648,
14
+ "cosine_similarity": 0.9994850579560237,
15
+ "passes": true,
16
+ "finiteness_mismatches": 0
17
+ },
18
+ {
19
+ "name": "rboxes",
20
+ "shape": [
21
+ 1,
22
+ 192,
23
+ 192,
24
+ 5
25
+ ],
26
+ "dtype": "float32",
27
+ "max_abs_diff": 98.17948150634766,
28
+ "mean_abs_diff": 1.6074337492015243,
29
+ "cosine_similarity": 0.9840660942984684,
30
+ "passes": true,
31
+ "finiteness_mismatches": 0
32
+ },
33
+ {
34
+ "name": "features",
35
+ "shape": [
36
+ 1,
37
+ 128,
38
+ 192,
39
+ 192
40
+ ],
41
+ "dtype": "float32",
42
+ "max_abs_diff": 0.21888476610183716,
43
+ "mean_abs_diff": 0.004786776495214923,
44
+ "cosine_similarity": 0.997594514566145,
45
+ "passes": true,
46
+ "finiteness_mismatches": 0
47
+ },
48
+ {
49
+ "name": "prob",
50
+ "shape": [
51
+ 1,
52
+ 192,
53
+ 192
54
+ ],
55
+ "dtype": "float32",
56
+ "max_abs_diff": 0.007609771564602852,
57
+ "mean_abs_diff": 0.0006078370883086689,
58
+ "cosine_similarity": 0.9995662235296796,
59
+ "passes": true,
60
+ "finiteness_mismatches": 0
61
+ },
62
+ {
63
+ "name": "rboxes",
64
+ "shape": [
65
+ 1,
66
+ 192,
67
+ 192,
68
+ 5
69
+ ],
70
+ "dtype": "float32",
71
+ "max_abs_diff": 91.98683166503906,
72
+ "mean_abs_diff": 3.0382123672936796,
73
+ "cosine_similarity": 0.9951545361896044,
74
+ "passes": true,
75
+ "finiteness_mismatches": 0
76
+ },
77
+ {
78
+ "name": "features",
79
+ "shape": [
80
+ 1,
81
+ 128,
82
+ 192,
83
+ 192
84
+ ],
85
+ "dtype": "float32",
86
+ "max_abs_diff": 0.16782422363758087,
87
+ "mean_abs_diff": 0.00428374444223482,
88
+ "cosine_similarity": 0.9961924995170943,
89
+ "passes": true,
90
+ "finiteness_mismatches": 0
91
+ }
92
+ ]
93
+ }