Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +21 -0
- LICENSE +202 -0
- README.md +177 -0
- README.zh-CN.md +177 -0
- docs/assets/pipeline.png +3 -0
- examples/edits.json +3 -0
- examples/english_case/details/e01_input.png +0 -0
- examples/english_case/details/e01_meanflow.png +0 -0
- examples/english_case/details/e01_teacher.png +0 -0
- examples/english_case/details/e02_input.png +0 -0
- examples/english_case/details/e02_meanflow.png +0 -0
- examples/english_case/details/e02_teacher.png +0 -0
- examples/english_case/details/e03_input.png +0 -0
- examples/english_case/details/e03_meanflow.png +0 -0
- examples/english_case/details/e03_teacher.png +0 -0
- examples/english_case/details/excellence_input.png +0 -0
- examples/english_case/details/excellence_meanflow.png +0 -0
- examples/english_case/details/excellence_teacher.png +0 -0
- examples/english_case/details/quality_input.png +0 -0
- examples/english_case/details/quality_meanflow.png +0 -0
- examples/english_case/details/quality_teacher.png +0 -0
- examples/english_case/details/worldwide_input.png +0 -0
- examples/english_case/details/worldwide_meanflow.png +0 -0
- examples/english_case/details/worldwide_teacher.png +0 -0
- examples/english_case/edits.json +29 -0
- examples/english_case/input.png +3 -0
- examples/english_case/input_boxed.png +3 -0
- examples/english_case/meanflow_output.json +47 -0
- examples/english_case/meanflow_output.png +3 -0
- examples/english_case/meanflow_output_boxed.png +3 -0
- examples/english_case/source.json +7 -0
- examples/english_case/teacher_output.json +47 -0
- examples/english_case/teacher_output.png +3 -0
- examples/english_case/teacher_output_boxed.png +3 -0
- examples/pipeline_case/details/p01_input.png +0 -0
- examples/pipeline_case/details/p01_meanflow.png +0 -0
- examples/pipeline_case/details/p01_teacher.png +0 -0
- examples/pipeline_case/details/p02_input.png +0 -0
- examples/pipeline_case/details/p02_meanflow.png +0 -0
- examples/pipeline_case/details/p02_teacher.png +0 -0
- examples/pipeline_case/details/p03_input.png +0 -0
- examples/pipeline_case/details/p03_meanflow.png +0 -0
- examples/pipeline_case/details/p03_teacher.png +0 -0
- examples/pipeline_case/details/p04_input.png +0 -0
- examples/pipeline_case/details/p04_meanflow.png +0 -0
- examples/pipeline_case/details/p04_teacher.png +0 -0
- examples/pipeline_case/details/p05_input.png +0 -0
- examples/pipeline_case/details/p05_meanflow.png +0 -0
- examples/pipeline_case/details/p05_teacher.png +0 -0
- examples/pipeline_case/details/p06_input.png +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,24 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
docs/assets/pipeline.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
examples/english_case/input.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
examples/english_case/input_boxed.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
examples/english_case/meanflow_output.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
examples/english_case/meanflow_output_boxed.png filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
examples/english_case/teacher_output.png filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
examples/english_case/teacher_output_boxed.png filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
examples/pipeline_case/input.png filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
examples/pipeline_case/input_boxed.png filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
examples/pipeline_case/input_preview.png filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
examples/pipeline_case/meanflow_output.png filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
examples/pipeline_case/meanflow_output_boxed.png filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
examples/pipeline_case/meanflow_output_preview.png filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
examples/pipeline_case/paper_reference.png filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
examples/pipeline_case/teacher_output.png filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
examples/pipeline_case/teacher_output_boxed.png filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
examples/pipeline_case/teacher_output_preview.png filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
models/PixText-MeanFlow/fonts/AlibabaPuHuiTi-3-55-Regular.ttf filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
models/PixText-MeanFlow/fonts/GoNotoCJKCore-v7.0.ttf filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
models/PixText-Teacher/fonts/AlibabaPuHuiTi-3-55-Regular.ttf filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
models/PixText-Teacher/fonts/GoNotoCJKCore-v7.0.ttf filter=lfs diff=lfs merge=lfs -text
|
LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Apache License
|
| 3 |
+
Version 2.0, January 2004
|
| 4 |
+
http://www.apache.org/licenses/
|
| 5 |
+
|
| 6 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 7 |
+
|
| 8 |
+
1. Definitions.
|
| 9 |
+
|
| 10 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 11 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 12 |
+
|
| 13 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 14 |
+
the copyright owner that is granting the License.
|
| 15 |
+
|
| 16 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 17 |
+
other entities that control, are controlled by, or are under common
|
| 18 |
+
control with that entity. For the purposes of this definition,
|
| 19 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 20 |
+
direction or management of such entity, whether by contract or
|
| 21 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 22 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 23 |
+
|
| 24 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 25 |
+
exercising permissions granted by this License.
|
| 26 |
+
|
| 27 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 28 |
+
including but not limited to software source code, documentation
|
| 29 |
+
source, and configuration files.
|
| 30 |
+
|
| 31 |
+
"Object" form shall mean any form resulting from mechanical
|
| 32 |
+
transformation or translation of a Source form, including but
|
| 33 |
+
not limited to compiled object code, generated documentation,
|
| 34 |
+
and conversions to other media types.
|
| 35 |
+
|
| 36 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 37 |
+
Object form, made available under the License, as indicated by a
|
| 38 |
+
copyright notice that is included in or attached to the work
|
| 39 |
+
(an example is provided in the Appendix below).
|
| 40 |
+
|
| 41 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 42 |
+
form, that is based on (or derived from) the Work and for which the
|
| 43 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 44 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 45 |
+
of this License, Derivative Works shall not include works that remain
|
| 46 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 47 |
+
the Work and Derivative Works thereof.
|
| 48 |
+
|
| 49 |
+
"Contribution" shall mean any work of authorship, including
|
| 50 |
+
the original version of the Work and any modifications or additions
|
| 51 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 52 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 53 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 54 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 55 |
+
means any form of electronic, verbal, or written communication sent
|
| 56 |
+
to the Licensor or its representatives, including but not limited to
|
| 57 |
+
communication on electronic mailing lists, source code control systems,
|
| 58 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 59 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 60 |
+
excluding communication that is conspicuously marked or otherwise
|
| 61 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 62 |
+
|
| 63 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 64 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 65 |
+
subsequently incorporated within the Work.
|
| 66 |
+
|
| 67 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 68 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 69 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 70 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 71 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 72 |
+
Work and such Derivative Works in Source or Object form.
|
| 73 |
+
|
| 74 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 75 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 76 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 77 |
+
(except as stated in this section) patent license to make, have made,
|
| 78 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 79 |
+
where such license applies only to those patent claims licensable
|
| 80 |
+
by such Contributor that are necessarily infringed by their
|
| 81 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 82 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 83 |
+
institute patent litigation against any entity (including a
|
| 84 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 85 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 86 |
+
or contributory patent infringement, then any patent licenses
|
| 87 |
+
granted to You under this License for that Work shall terminate
|
| 88 |
+
as of the date such litigation is filed.
|
| 89 |
+
|
| 90 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 91 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 92 |
+
modifications, and in Source or Object form, provided that You
|
| 93 |
+
meet the following conditions:
|
| 94 |
+
|
| 95 |
+
(a) You must give any other recipients of the Work or
|
| 96 |
+
Derivative Works a copy of this License; and
|
| 97 |
+
|
| 98 |
+
(b) You must cause any modified files to carry prominent notices
|
| 99 |
+
stating that You changed the files; and
|
| 100 |
+
|
| 101 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 102 |
+
that You distribute, all copyright, patent, trademark, and
|
| 103 |
+
attribution notices from the Source form of the Work,
|
| 104 |
+
excluding those notices that do not pertain to any part of
|
| 105 |
+
the Derivative Works; and
|
| 106 |
+
|
| 107 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 108 |
+
distribution, then any Derivative Works that You distribute must
|
| 109 |
+
include a readable copy of the attribution notices contained
|
| 110 |
+
within such NOTICE file, excluding those notices that do not
|
| 111 |
+
pertain to any part of the Derivative Works, in at least one
|
| 112 |
+
of the following places: within a NOTICE text file distributed
|
| 113 |
+
as part of the Derivative Works; within the Source form or
|
| 114 |
+
documentation, if provided along with the Derivative Works; or,
|
| 115 |
+
within a display generated by the Derivative Works, if and
|
| 116 |
+
wherever such third-party notices normally appear. The contents
|
| 117 |
+
of the NOTICE file are for informational purposes only and
|
| 118 |
+
do not modify the License. You may add Your own attribution
|
| 119 |
+
notices within Derivative Works that You distribute, alongside
|
| 120 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 121 |
+
that such additional attribution notices cannot be construed
|
| 122 |
+
as modifying the License.
|
| 123 |
+
|
| 124 |
+
You may add Your own copyright statement to Your modifications and
|
| 125 |
+
may provide additional or different license terms and conditions
|
| 126 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 127 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 128 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 129 |
+
the conditions stated in this License.
|
| 130 |
+
|
| 131 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 132 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 133 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 134 |
+
this License, without any additional terms or conditions.
|
| 135 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 136 |
+
the terms of any separate license agreement you may have executed
|
| 137 |
+
with Licensor regarding such Contributions.
|
| 138 |
+
|
| 139 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 140 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 141 |
+
except as required for reasonable and customary use in describing the
|
| 142 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 143 |
+
|
| 144 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 145 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 146 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 147 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 148 |
+
implied, including, without limitation, any warranties or conditions
|
| 149 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 150 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 151 |
+
appropriateness of using or redistributing the Work and assume any
|
| 152 |
+
risks associated with Your exercise of permissions under this License.
|
| 153 |
+
|
| 154 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 155 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 156 |
+
unless required by applicable law (such as deliberate and grossly
|
| 157 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 158 |
+
liable to You for damages, including any direct, indirect, special,
|
| 159 |
+
incidental, or consequential damages of any character arising as a
|
| 160 |
+
result of this License or out of the use or inability to use the
|
| 161 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 162 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 163 |
+
other commercial damages or losses), even if such Contributor
|
| 164 |
+
has been advised of the possibility of such damages.
|
| 165 |
+
|
| 166 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 167 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 168 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 169 |
+
or other liability obligations and/or rights consistent with this
|
| 170 |
+
License. However, in accepting such obligations, You may act only
|
| 171 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 172 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 173 |
+
defend, and hold each Contributor harmless for any liability
|
| 174 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 175 |
+
of your accepting any such warranty or additional liability.
|
| 176 |
+
|
| 177 |
+
END OF TERMS AND CONDITIONS
|
| 178 |
+
|
| 179 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 180 |
+
|
| 181 |
+
To apply the Apache License to your work, attach the following
|
| 182 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 183 |
+
replaced with your own identifying information. (Don't include
|
| 184 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 185 |
+
comment syntax for the file format. We also recommend that a
|
| 186 |
+
file or class name and description of purpose be included on the
|
| 187 |
+
same "printed page" as the copyright notice for easier
|
| 188 |
+
identification within third-party archives.
|
| 189 |
+
|
| 190 |
+
Copyright 2026 PixText Authors
|
| 191 |
+
|
| 192 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 193 |
+
you may not use this file except in compliance with the License.
|
| 194 |
+
You may obtain a copy of the License at
|
| 195 |
+
|
| 196 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 197 |
+
|
| 198 |
+
Unless required by applicable law or agreed to in writing, software
|
| 199 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 200 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 201 |
+
See the License for the specific language governing permissions and
|
| 202 |
+
limitations under the License.
|
README.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div align="center">
|
| 2 |
+
|
| 3 |
+
# PixText
|
| 4 |
+
|
| 5 |
+
[](https://arxiv.org/abs/2610.18284)
|
| 6 |
+
[](https://github.com/ATH-MaaS/PixText)
|
| 7 |
+
[](LICENSE)
|
| 8 |
+
|
| 9 |
+
**English** | [简体中文](README.zh-CN.md)
|
| 10 |
+
|
| 11 |
+
</div>
|
| 12 |
+
|
| 13 |
+
PixText refines local text in pixel space. Provide an image, the regions to edit, and the target text. The model generates those regions using the image as context and preserves pixels outside the actual edited footprints. Multiple targets are generated jointly.
|
| 14 |
+
|
| 15 |
+
| Model | Default sampling | Glyph guidance |
|
| 16 |
+
| --- | --- | --- |
|
| 17 |
+
| PixText-Teacher | 25-step Euler | 3.3 |
|
| 18 |
+
| PixText-MeanFlow | 4-step interval Euler | 3.3 |
|
| 19 |
+
|
| 20 |
+
MeanFlow is the default quick-start choice. Each model package contains its weights, configuration, fonts and SHA-256 checksums. MeanFlow needs no additional text encoder, OCR model, VAE, or teacher.
|
| 21 |
+
|
| 22 |
+
## Example
|
| 23 |
+
|
| 24 |
+
Two input images and their targets are bundled in [`examples/`](examples). Cyan boxes mark the edited regions. Click an image to enlarge it.
|
| 25 |
+
|
| 26 |
+
| Input | MeanFlow · 4 steps | Teacher · 25 steps |
|
| 27 |
+
| --- | --- | --- |
|
| 28 |
+
| [<img src="examples/pipeline_case/input_boxed.png" width="220" alt="Input with edit regions">](examples/pipeline_case/input_boxed.png) | [<img src="examples/pipeline_case/meanflow_output_boxed.png" width="220" alt="MeanFlow output with edit regions">](examples/pipeline_case/meanflow_output_boxed.png) | [<img src="examples/pipeline_case/teacher_output_boxed.png" width="220" alt="Teacher output with edit regions">](examples/pipeline_case/teacher_output_boxed.png) |
|
| 29 |
+
|
| 30 |
+
Each row pairs two targets; every target shows input, MeanFlow output and Teacher output.
|
| 31 |
+
|
| 32 |
+
| # | Input | MeanFlow · 4 steps | Teacher · 25 steps | # | Input | MeanFlow · 4 steps | Teacher · 25 steps |
|
| 33 |
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
| 34 |
+
| 1 喜 | <img src="examples/pipeline_case/details/p01_input.png" width="82" alt="喜 input"> | <img src="examples/pipeline_case/details/p01_meanflow.png" width="82" alt="喜 meanflow"> | <img src="examples/pipeline_case/details/p01_teacher.png" width="82" alt="喜 teacher"> | 8 给 | <img src="examples/pipeline_case/details/p08_input.png" width="82" alt="给 input"> | <img src="examples/pipeline_case/details/p08_meanflow.png" width="82" alt="给 meanflow"> | <img src="examples/pipeline_case/details/p08_teacher.png" width="82" alt="给 teacher"> |
|
| 35 |
+
| 2 发 | <img src="examples/pipeline_case/details/p02_input.png" width="82" alt="发 input"> | <img src="examples/pipeline_case/details/p02_meanflow.png" width="82" alt="发 meanflow"> | <img src="examples/pipeline_case/details/p02_teacher.png" width="82" alt="发 teacher"> | 9 解 | <img src="examples/pipeline_case/details/p09_input.png" width="82" alt="解 input"> | <img src="examples/pipeline_case/details/p09_meanflow.png" width="82" alt="解 meanflow"> | <img src="examples/pipeline_case/details/p09_teacher.png" width="82" alt="解 teacher"> |
|
| 36 |
+
| 3 甜 | <img src="examples/pipeline_case/details/p03_input.png" width="82" alt="甜 input"> | <img src="examples/pipeline_case/details/p03_meanflow.png" width="82" alt="甜 meanflow"> | <img src="examples/pipeline_case/details/p03_teacher.png" width="82" alt="甜 teacher"> | 10 馋 | <img src="examples/pipeline_case/details/p10_input.png" width="82" alt="馋 input"> | <img src="examples/pipeline_case/details/p10_meanflow.png" width="82" alt="馋 meanflow"> | <img src="examples/pipeline_case/details/p10_teacher.png" width="82" alt="馋 teacher"> |
|
| 37 |
+
| 4 初 | <img src="examples/pipeline_case/details/p04_input.png" width="82" alt="初 input"> | <img src="examples/pipeline_case/details/p04_meanflow.png" width="82" alt="初 meanflow"> | <img src="examples/pipeline_case/details/p04_teacher.png" width="82" alt="初 teacher"> | 11 满 | <img src="examples/pipeline_case/details/p11_input.png" width="82" alt="满 input"> | <img src="examples/pipeline_case/details/p11_meanflow.png" width="82" alt="满 meanflow"> | <img src="examples/pipeline_case/details/p11_teacher.png" width="82" alt="满 teacher"> |
|
| 38 |
+
| 5 恋 | <img src="examples/pipeline_case/details/p05_input.png" width="82" alt="恋 input"> | <img src="examples/pipeline_case/details/p05_meanflow.png" width="82" alt="恋 meanflow"> | <img src="examples/pipeline_case/details/p05_teacher.png" width="82" alt="恋 teacher"> | 12 满 | <img src="examples/pipeline_case/details/p12_input.png" width="82" alt="满 input"> | <img src="examples/pipeline_case/details/p12_meanflow.png" width="82" alt="满 meanflow"> | <img src="examples/pipeline_case/details/p12_teacher.png" width="82" alt="满 teacher"> |
|
| 39 |
+
| 6 鞭 | <img src="examples/pipeline_case/details/p06_input.png" width="82" alt="鞭 input"> | <img src="examples/pipeline_case/details/p06_meanflow.png" width="82" alt="鞭 meanflow"> | <img src="examples/pipeline_case/details/p06_teacher.png" width="82" alt="鞭 teacher"> | 13 畜 | <img src="examples/pipeline_case/details/p13_input.png" width="82" alt="畜 input"> | <img src="examples/pipeline_case/details/p13_meanflow.png" width="82" alt="畜 meanflow"> | <img src="examples/pipeline_case/details/p13_teacher.png" width="82" alt="畜 teacher"> |
|
| 40 |
+
| 7 炮 | <img src="examples/pipeline_case/details/p07_input.png" width="82" alt="炮 input"> | <img src="examples/pipeline_case/details/p07_meanflow.png" width="82" alt="炮 meanflow"> | <img src="examples/pipeline_case/details/p07_teacher.png" width="82" alt="炮 teacher"> | | | | |
|
| 41 |
+
|
| 42 |
+
**English tagline repair.** [`examples/english_case`](examples/english_case) repairs three damaged spots in a printed tagline: a broken letter plus two words, leaving the surrounding logo untouched.
|
| 43 |
+
|
| 44 |
+
| Input | MeanFlow · 4 steps | Teacher · 25 steps |
|
| 45 |
+
| --- | --- | --- |
|
| 46 |
+
| [<img src="examples/english_case/input_boxed.png" width="220" alt="Tagline input with edit region">](examples/english_case/input_boxed.png) | [<img src="examples/english_case/meanflow_output_boxed.png" width="220" alt="Tagline MeanFlow output with edit region">](examples/english_case/meanflow_output_boxed.png) | [<img src="examples/english_case/teacher_output_boxed.png" width="220" alt="Tagline Teacher output with edit region">](examples/english_case/teacher_output_boxed.png) |
|
| 47 |
+
|
| 48 |
+
Each row shows one repaired region: input, MeanFlow output and Teacher output.
|
| 49 |
+
|
| 50 |
+
| Region | Input | MeanFlow · 4 steps | Teacher · 25 steps |
|
| 51 |
+
| --- | --- | --- | --- |
|
| 52 |
+
| Worldwide | <img src="examples/english_case/details/worldwide_input.png" width="180" alt="Worldwide input"> | <img src="examples/english_case/details/worldwide_meanflow.png" width="180" alt="Worldwide MeanFlow"> | <img src="examples/english_case/details/worldwide_teacher.png" width="180" alt="Worldwide Teacher"> |
|
| 53 |
+
| Excellence | <img src="examples/english_case/details/excellence_input.png" width="180" alt="Excellence input"> | <img src="examples/english_case/details/excellence_meanflow.png" width="180" alt="Excellence MeanFlow"> | <img src="examples/english_case/details/excellence_teacher.png" width="180" alt="Excellence Teacher"> |
|
| 54 |
+
| Quality | <img src="examples/english_case/details/quality_input.png" width="180" alt="Quality input"> | <img src="examples/english_case/details/quality_meanflow.png" width="180" alt="Quality MeanFlow"> | <img src="examples/english_case/details/quality_teacher.png" width="180" alt="Quality Teacher"> |
|
| 55 |
+
|
| 56 |
+
Both cases use seed 42, and the adjacent JSON files record the reproduction metadata. To reproduce them, run the code from [ATH-MaaS/PixText](https://github.com/ATH-MaaS/PixText) with `--model` pointing at the packages in `models/`.
|
| 57 |
+
|
| 58 |
+
Full-resolution images: [pipeline input](examples/pipeline_case/input.png), [MeanFlow](examples/pipeline_case/meanflow_output.png), [Teacher](examples/pipeline_case/teacher_output.png); [tagline input](examples/english_case/input.png), [MeanFlow](examples/english_case/meanflow_output.png), [Teacher](examples/english_case/teacher_output.png).
|
| 59 |
+
|
| 60 |
+
## Method
|
| 61 |
+
|
| 62 |
+

|
| 63 |
+
|
| 64 |
+
## Installation
|
| 65 |
+
|
| 66 |
+
The inference code is at [github.com/ATH-MaaS/PixText](https://github.com/ATH-MaaS/PixText). Use Python 3.11 or newer and a CUDA GPU. Install a CUDA build of PyTorch and torchvision appropriate for your machine, then install the package:
|
| 67 |
+
|
| 68 |
+
```bash
|
| 69 |
+
pip install "git+https://github.com/ATH-MaaS/PixText.git"
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
Pillow must support RAQM. The system must provide HarfBuzz (`libharfbuzz0` on Debian/Ubuntu). Font files are loaded from the model packages in this directory; no system font installation is required.
|
| 73 |
+
|
| 74 |
+
## What is in this release
|
| 75 |
+
|
| 76 |
+
This directory contains both model packages, their fonts, example images and checksums. The inference code lives at [github.com/ATH-MaaS/PixText](https://github.com/ATH-MaaS/PixText).
|
| 77 |
+
|
| 78 |
+
| Path | Contents |
|
| 79 |
+
| --- | --- |
|
| 80 |
+
| `models/PixText-Teacher/` | 25-step teacher weights, configuration, and bundled fonts. |
|
| 81 |
+
| `models/PixText-MeanFlow/` | 4-step MeanFlow weights, configuration, and bundled fonts. |
|
| 82 |
+
| `examples/` | Input and output images for both cases, with reproduction metadata. |
|
| 83 |
+
| `docs/assets/` | Pipeline figure. |
|
| 84 |
+
| `model_index.json` | Model identifiers and weight checksums. |
|
| 85 |
+
| `manifest.sha256` | SHA-256 checksums for every model file, configuration file, and font. |
|
| 86 |
+
|
| 87 |
+
Verify the release from its root:
|
| 88 |
+
|
| 89 |
+
```bash
|
| 90 |
+
sha256sum -c manifest.sha256
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
The benchmark for this model, TextRefinementBench, ships as a separate dataset package with its own card.
|
| 94 |
+
|
| 95 |
+
## Model packages
|
| 96 |
+
|
| 97 |
+
Both packages are included under `models/`, laid out as follows:
|
| 98 |
+
|
| 99 |
+
```text
|
| 100 |
+
models/
|
| 101 |
+
PixText-Teacher/
|
| 102 |
+
PixText-MeanFlow/
|
| 103 |
+
model.safetensors
|
| 104 |
+
config.json
|
| 105 |
+
inference_config.json
|
| 106 |
+
manifest.json
|
| 107 |
+
README.md
|
| 108 |
+
fonts/
|
| 109 |
+
AlibabaPuHuiTi-3-55-Regular.ttf
|
| 110 |
+
GoNotoCJKCore-v7.0.ttf
|
| 111 |
+
OFL-GoNoto.txt
|
| 112 |
+
README.md
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
Teacher uses the same package layout. [`model_index.json`](model_index.json) lists the model identifiers and weight checksums. `from_pretrained` loads a local directory and checks the files listed in its manifest, including the weights, configuration and fonts. A missing or modified bundled font is reported before weights are loaded. Complete packages can be moved without changing their configuration.
|
| 116 |
+
|
| 117 |
+
## Python
|
| 118 |
+
|
| 119 |
+
```python
|
| 120 |
+
from pixtext import PixTextPipeline, TextEdit
|
| 121 |
+
|
| 122 |
+
pipeline = PixTextPipeline.from_pretrained("models/PixText-MeanFlow")
|
| 123 |
+
result = pipeline.edit(
|
| 124 |
+
"input.png",
|
| 125 |
+
edits=[TextEdit(bbox=(120, 80, 160, 125), text="鹿")],
|
| 126 |
+
seed=42,
|
| 127 |
+
)
|
| 128 |
+
result.image.save("output.png")
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
Use `models/PixText-Teacher` to load Teacher. Both variants can coexist in one process. Results contain `image` and `metadata`, including model identity, seed, sample identity, sampling settings, and crop geometry.
|
| 132 |
+
|
| 133 |
+
## Command line
|
| 134 |
+
|
| 135 |
+
Create `edits.json`:
|
| 136 |
+
|
| 137 |
+
```json
|
| 138 |
+
[{"bbox": [120, 80, 160, 125], "text": "鹿"}]
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
```bash
|
| 142 |
+
pixtext --model models/PixText-MeanFlow \
|
| 143 |
+
--image input.png --edits edits.json --output output.png --seed 42
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
The CLI saves a PNG and a matching JSON metadata file. `python -m pixtext` provides the same command. `--steps` and `--guidance-scale` override the package defaults.
|
| 147 |
+
|
| 148 |
+
## Batch editing
|
| 149 |
+
|
| 150 |
+
```python
|
| 151 |
+
results = pipeline.edit_batch(
|
| 152 |
+
["first.png", "second.png"],
|
| 153 |
+
[
|
| 154 |
+
[TextEdit((120, 80, 160, 125), "鹿")],
|
| 155 |
+
[TextEdit((20, 30, 100, 70), "PixText")],
|
| 156 |
+
],
|
| 157 |
+
seeds=[42, 43],
|
| 158 |
+
sample_ids=["first", "second"],
|
| 159 |
+
)
|
| 160 |
+
```
|
| 161 |
+
|
| 162 |
+
## Inputs and pixel preservation
|
| 163 |
+
|
| 164 |
+
- Inputs are Pillow images or local image paths, converted to upright RGB using EXIF orientation. Coordinates refer to that upright image.
|
| 165 |
+
- Boxes use original-image pixel coordinates `(x0, y0, x1, y1)` and half-open intervals. Invalid or out-of-image boxes are rejected.
|
| 166 |
+
- Supply one character or a text line per target.
|
| 167 |
+
- Crops align to 16-pixel patches. Pixels outside those footprints remain identical to the original RGB image.
|
| 168 |
+
- Arbitrary image dimensions are supported.
|
| 169 |
+
- Targets are processed in input order, up to 12 per pass. For overlapping aligned crops, the last target written wins. An empty edit list returns the original RGB image.
|
| 170 |
+
- The renderer selects the first bundled font covering the entire target string, using PuHuiTi then Go Noto. Unsupported text produces a coverage error instead of missing-glyph squares.
|
| 171 |
+
- Editing requires CUDA FlexAttention.
|
| 172 |
+
|
| 173 |
+
Glyph-present and glyph-absent predictions provide guidance on the open interval `(0.1, 1.0)`. At the default guidance setting, four MeanFlow updates use seven model forwards. Initial execution also includes compilation overhead.
|
| 174 |
+
|
| 175 |
+
## License
|
| 176 |
+
|
| 177 |
+
Model weights and documentation are released under the Apache License 2.0; see [LICENSE](LICENSE). The inference code is at [ATH-MaaS/PixText](https://github.com/ATH-MaaS/PixText). Bundled fonts keep their own terms, described in each model package's `fonts/` directory.
|
README.zh-CN.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div align="center">
|
| 2 |
+
|
| 3 |
+
# PixText
|
| 4 |
+
|
| 5 |
+
[](https://arxiv.org/abs/2610.18284)
|
| 6 |
+
[](https://github.com/ATH-MaaS/PixText)
|
| 7 |
+
[](LICENSE)
|
| 8 |
+
|
| 9 |
+
[English](README.md) | **简体中文**
|
| 10 |
+
|
| 11 |
+
</div>
|
| 12 |
+
|
| 13 |
+
PixText 在像素空间中修复图像中的局部文字。提供图像、待编辑区域和目标文字后,模型会结合图像上下文生成这些区域,并保持实际编辑范围之外的像素不变。多个目标可以联合生成。
|
| 14 |
+
|
| 15 |
+
| 模型 | 默认采样方式 | 字形引导强度 |
|
| 16 |
+
| --- | --- | --- |
|
| 17 |
+
| PixText-Teacher | 25 步 Euler | 3.3 |
|
| 18 |
+
| PixText-MeanFlow | 4 步区间 Euler | 3.3 |
|
| 19 |
+
|
| 20 |
+
快速体验默认使用 MeanFlow。每个模型包包含权重、配置、字体和 SHA-256 校验信息。运行 MeanFlow 不需要额外的文本编码器、OCR 模型、VAE 或 Teacher。
|
| 21 |
+
|
| 22 |
+
## 示例
|
| 23 |
+
|
| 24 |
+
两个内置示例的输入与目标均位于 [`examples/`](examples)。青色方框标出编辑区域,点击图片可查看大图。
|
| 25 |
+
|
| 26 |
+
| 输入 | MeanFlow · 4 步 | Teacher · 25 步 |
|
| 27 |
+
| --- | --- | --- |
|
| 28 |
+
| [<img src="examples/pipeline_case/input_boxed.png" width="220" alt="输入图像及编辑区域">](examples/pipeline_case/input_boxed.png) | [<img src="examples/pipeline_case/meanflow_output_boxed.png" width="220" alt="MeanFlow 输出及编辑区域">](examples/pipeline_case/meanflow_output_boxed.png) | [<img src="examples/pipeline_case/teacher_output_boxed.png" width="220" alt="Teacher 输出及编辑区域">](examples/pipeline_case/teacher_output_boxed.png) |
|
| 29 |
+
|
| 30 |
+
每行并排两个目标,每个目标展示输入、MeanFlow 输出与 Teacher 输出。
|
| 31 |
+
|
| 32 |
+
| # | Input | MeanFlow · 4 steps | Teacher · 25 steps | # | Input | MeanFlow · 4 steps | Teacher · 25 steps |
|
| 33 |
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
| 34 |
+
| 1 喜 | <img src="examples/pipeline_case/details/p01_input.png" width="82" alt="喜 input"> | <img src="examples/pipeline_case/details/p01_meanflow.png" width="82" alt="喜 meanflow"> | <img src="examples/pipeline_case/details/p01_teacher.png" width="82" alt="喜 teacher"> | 8 给 | <img src="examples/pipeline_case/details/p08_input.png" width="82" alt="给 input"> | <img src="examples/pipeline_case/details/p08_meanflow.png" width="82" alt="给 meanflow"> | <img src="examples/pipeline_case/details/p08_teacher.png" width="82" alt="给 teacher"> |
|
| 35 |
+
| 2 发 | <img src="examples/pipeline_case/details/p02_input.png" width="82" alt="发 input"> | <img src="examples/pipeline_case/details/p02_meanflow.png" width="82" alt="发 meanflow"> | <img src="examples/pipeline_case/details/p02_teacher.png" width="82" alt="发 teacher"> | 9 解 | <img src="examples/pipeline_case/details/p09_input.png" width="82" alt="解 input"> | <img src="examples/pipeline_case/details/p09_meanflow.png" width="82" alt="解 meanflow"> | <img src="examples/pipeline_case/details/p09_teacher.png" width="82" alt="解 teacher"> |
|
| 36 |
+
| 3 甜 | <img src="examples/pipeline_case/details/p03_input.png" width="82" alt="甜 input"> | <img src="examples/pipeline_case/details/p03_meanflow.png" width="82" alt="甜 meanflow"> | <img src="examples/pipeline_case/details/p03_teacher.png" width="82" alt="甜 teacher"> | 10 馋 | <img src="examples/pipeline_case/details/p10_input.png" width="82" alt="馋 input"> | <img src="examples/pipeline_case/details/p10_meanflow.png" width="82" alt="馋 meanflow"> | <img src="examples/pipeline_case/details/p10_teacher.png" width="82" alt="馋 teacher"> |
|
| 37 |
+
| 4 初 | <img src="examples/pipeline_case/details/p04_input.png" width="82" alt="初 input"> | <img src="examples/pipeline_case/details/p04_meanflow.png" width="82" alt="初 meanflow"> | <img src="examples/pipeline_case/details/p04_teacher.png" width="82" alt="初 teacher"> | 11 满 | <img src="examples/pipeline_case/details/p11_input.png" width="82" alt="满 input"> | <img src="examples/pipeline_case/details/p11_meanflow.png" width="82" alt="满 meanflow"> | <img src="examples/pipeline_case/details/p11_teacher.png" width="82" alt="满 teacher"> |
|
| 38 |
+
| 5 恋 | <img src="examples/pipeline_case/details/p05_input.png" width="82" alt="恋 input"> | <img src="examples/pipeline_case/details/p05_meanflow.png" width="82" alt="恋 meanflow"> | <img src="examples/pipeline_case/details/p05_teacher.png" width="82" alt="恋 teacher"> | 12 满 | <img src="examples/pipeline_case/details/p12_input.png" width="82" alt="满 input"> | <img src="examples/pipeline_case/details/p12_meanflow.png" width="82" alt="满 meanflow"> | <img src="examples/pipeline_case/details/p12_teacher.png" width="82" alt="满 teacher"> |
|
| 39 |
+
| 6 鞭 | <img src="examples/pipeline_case/details/p06_input.png" width="82" alt="鞭 input"> | <img src="examples/pipeline_case/details/p06_meanflow.png" width="82" alt="鞭 meanflow"> | <img src="examples/pipeline_case/details/p06_teacher.png" width="82" alt="鞭 teacher"> | 13 畜 | <img src="examples/pipeline_case/details/p13_input.png" width="82" alt="畜 input"> | <img src="examples/pipeline_case/details/p13_meanflow.png" width="82" alt="畜 meanflow"> | <img src="examples/pipeline_case/details/p13_teacher.png" width="82" alt="畜 teacher"> |
|
| 40 |
+
| 7 炮 | <img src="examples/pipeline_case/details/p07_input.png" width="82" alt="炮 input"> | <img src="examples/pipeline_case/details/p07_meanflow.png" width="82" alt="炮 meanflow"> | <img src="examples/pipeline_case/details/p07_teacher.png" width="82" alt="炮 teacher"> | | | | |
|
| 41 |
+
|
| 42 |
+
**英文标语修复。** [`examples/english_case`](examples/english_case) 修复印刷标语中的三处损坏:一个断裂字母和两个单词,周围 logo 保持不变。
|
| 43 |
+
|
| 44 |
+
| 输入 | MeanFlow · 4 步 | Teacher · 25 步 |
|
| 45 |
+
| --- | --- | --- |
|
| 46 |
+
| [<img src="examples/english_case/input_boxed.png" width="220" alt="标语输入及编辑区域">](examples/english_case/input_boxed.png) | [<img src="examples/english_case/meanflow_output_boxed.png" width="220" alt="标语 MeanFlow 输出及编辑区域">](examples/english_case/meanflow_output_boxed.png) | [<img src="examples/english_case/teacher_output_boxed.png" width="220" alt="标语 Teacher 输出及编辑区域">](examples/english_case/teacher_output_boxed.png) |
|
| 47 |
+
|
| 48 |
+
每个修复位置一行:输入、MeanFlow 输出与 Teacher 输出。
|
| 49 |
+
|
| 50 |
+
| 位置 | 输入 | MeanFlow · 4 步 | Teacher · 25 步 |
|
| 51 |
+
| --- | --- | --- | --- |
|
| 52 |
+
| Worldwide | <img src="examples/english_case/details/worldwide_input.png" width="180" alt="Worldwide input"> | <img src="examples/english_case/details/worldwide_meanflow.png" width="180" alt="Worldwide MeanFlow"> | <img src="examples/english_case/details/worldwide_teacher.png" width="180" alt="Worldwide Teacher"> |
|
| 53 |
+
| Excellence | <img src="examples/english_case/details/excellence_input.png" width="180" alt="Excellence input"> | <img src="examples/english_case/details/excellence_meanflow.png" width="180" alt="Excellence MeanFlow"> | <img src="examples/english_case/details/excellence_teacher.png" width="180" alt="Excellence Teacher"> |
|
| 54 |
+
| Quality | <img src="examples/english_case/details/quality_input.png" width="180" alt="Quality input"> | <img src="examples/english_case/details/quality_meanflow.png" width="180" alt="Quality MeanFlow"> | <img src="examples/english_case/details/quality_teacher.png" width="180" alt="Quality Teacher"> |
|
| 55 |
+
|
| 56 |
+
两个示例均使用随机种子 42,同目录的 JSON 文件记录复现信息。要复现这些结果,请使用 [ATH-MaaS/PixText](https://github.com/ATH-MaaS/PixText) 的代码,并将 `--model` 指向本目录下的模型包。
|
| 57 |
+
|
| 58 |
+
原始分辨率图片:[pipeline 输入](examples/pipeline_case/input.png)、[MeanFlow 输出](examples/pipeline_case/meanflow_output.png)、[Teacher 输出](examples/pipeline_case/teacher_output.png);[标语输入](examples/english_case/input.png)、[MeanFlow 输出](examples/english_case/meanflow_output.png)、[Teacher 输出](examples/english_case/teacher_output.png)。
|
| 59 |
+
|
| 60 |
+
## 方法
|
| 61 |
+
|
| 62 |
+

|
| 63 |
+
|
| 64 |
+
## 安装
|
| 65 |
+
|
| 66 |
+
推理代码位于 [github.com/ATH-MaaS/PixText](https://github.com/ATH-MaaS/PixText)。需要 Python 3.11 或更高版本,以及支持 CUDA 的 GPU。先安装适合本机 CUDA 环境的 PyTorch 和 torchvision,再安装该代码包:
|
| 67 |
+
|
| 68 |
+
```bash
|
| 69 |
+
pip install "git+https://github.com/ATH-MaaS/PixText.git"
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
Pillow 需要支持 RAQM,系统需要提供 HarfBuzz(Debian/Ubuntu 中为 `libharfbuzz0`)。字体从本目录的模型包加载,无需单独安装到系统。
|
| 73 |
+
|
| 74 |
+
## 本发布包含什么
|
| 75 |
+
|
| 76 |
+
本目录包含两个模型包、模型所需字体、示例图片和校验值。推理代码位于 [github.com/ATH-MaaS/PixText](https://github.com/ATH-MaaS/PixText)。
|
| 77 |
+
|
| 78 |
+
| 路径 | 内容 |
|
| 79 |
+
| --- | --- |
|
| 80 |
+
| `models/PixText-Teacher/` | 25 步 Teacher 权重、配置和内置字体。 |
|
| 81 |
+
| `models/PixText-MeanFlow/` | 4 步 MeanFlow 权重、配置和内置字体。 |
|
| 82 |
+
| `examples/` | 两个示例的输入、输出图片和复现元数据。 |
|
| 83 |
+
| `docs/assets/` | 流程图。 |
|
| 84 |
+
| `model_index.json` | 模型标识与权重校验值。 |
|
| 85 |
+
| `manifest.sha256` | 每个模型文件、配置文件和字体的 SHA-256 校验值。 |
|
| 86 |
+
|
| 87 |
+
在发布根目录执行校验:
|
| 88 |
+
|
| 89 |
+
```bash
|
| 90 |
+
sha256sum -c manifest.sha256
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
本模型使用的评测集 TextRefinementBench 作为独立数据集包发布,自带数据卡。
|
| 94 |
+
|
| 95 |
+
## 模型包
|
| 96 |
+
|
| 97 |
+
两个模型包已内置在 `models/` 下,结构如下:
|
| 98 |
+
|
| 99 |
+
```text
|
| 100 |
+
models/
|
| 101 |
+
PixText-Teacher/
|
| 102 |
+
PixText-MeanFlow/
|
| 103 |
+
model.safetensors
|
| 104 |
+
config.json
|
| 105 |
+
inference_config.json
|
| 106 |
+
manifest.json
|
| 107 |
+
README.md
|
| 108 |
+
fonts/
|
| 109 |
+
AlibabaPuHuiTi-3-55-Regular.ttf
|
| 110 |
+
GoNotoCJKCore-v7.0.ttf
|
| 111 |
+
OFL-GoNoto.txt
|
| 112 |
+
README.md
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
Teacher 使用相同的模型包结构。[`model_index.json`](model_index.json) 列出了模型标识和权重校验值。`from_pretrained` 从本地目录加载模型,检查清单中列出的权重、配置和字体。字体缺失或被修改时,会在加载权重前报错。完整模型包可以移动位置,无需修改配置。
|
| 116 |
+
|
| 117 |
+
## Python 接口
|
| 118 |
+
|
| 119 |
+
```python
|
| 120 |
+
from pixtext import PixTextPipeline, TextEdit
|
| 121 |
+
|
| 122 |
+
pipeline = PixTextPipeline.from_pretrained("models/PixText-MeanFlow")
|
| 123 |
+
result = pipeline.edit(
|
| 124 |
+
"input.png",
|
| 125 |
+
edits=[TextEdit(bbox=(120, 80, 160, 125), text="鹿")],
|
| 126 |
+
seed=42,
|
| 127 |
+
)
|
| 128 |
+
result.image.save("output.png")
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
加载 Teacher 时,将路径替换为 `models/PixText-Teacher`。两种模型可以在同一进程中使用。返回结果包含 `image` 和 `metadata`,记录模型标识、随机种子、样本标识、采样设置及裁剪区域。
|
| 132 |
+
|
| 133 |
+
## 命令行
|
| 134 |
+
|
| 135 |
+
创建 `edits.json`:
|
| 136 |
+
|
| 137 |
+
```json
|
| 138 |
+
[{"bbox": [120, 80, 160, 125], "text": "鹿"}]
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
```bash
|
| 142 |
+
pixtext --model models/PixText-MeanFlow \
|
| 143 |
+
--image input.png --edits edits.json --output output.png --seed 42
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
命令行会保存 PNG 图片及同名 JSON 元数据文件,也可以使用 `python -m pixtext` 调用。`--steps` 和 `--guidance-scale` 可覆盖模型包的默认设置。
|
| 147 |
+
|
| 148 |
+
## 批量编辑
|
| 149 |
+
|
| 150 |
+
```python
|
| 151 |
+
results = pipeline.edit_batch(
|
| 152 |
+
["first.png", "second.png"],
|
| 153 |
+
[
|
| 154 |
+
[TextEdit((120, 80, 160, 125), "鹿")],
|
| 155 |
+
[TextEdit((20, 30, 100, 70), "PixText")],
|
| 156 |
+
],
|
| 157 |
+
seeds=[42, 43],
|
| 158 |
+
sample_ids=["first", "second"],
|
| 159 |
+
)
|
| 160 |
+
```
|
| 161 |
+
|
| 162 |
+
## 输入与像素保留规则
|
| 163 |
+
|
| 164 |
+
- 输入可以是 Pillow 图片或本地图片路径,会根据 EXIF 方向转为正向 RGB。编辑坐标以转正后的图片为准。
|
| 165 |
+
- 编辑框使用原图像素坐标 `(x0, y0, x1, y1)`,采用左闭右开的区间。无效或超出图片边界的编辑框会被拒绝。
|
| 166 |
+
- 每个目标可以是一个字符或一行文字。
|
| 167 |
+
- 裁剪区域按 16 像素的 patch 对齐。实际编辑范围之外的像素与原始 RGB 图片完全一致。
|
| 168 |
+
- 支持任意图片尺寸。
|
| 169 |
+
- 按输入顺序处理目标,每轮最多 12 个。对齐后的裁剪区域重叠时,后写入的目标生效。编辑列表为空时返回原始 RGB 图片。
|
| 170 |
+
- 字体按普惠体、Go Noto 的顺序选择,要求单个字体覆盖整条目标文字。不支持的文字会报覆盖错误,不会静默绘制缺字方框。
|
| 171 |
+
- 编辑依赖 CUDA FlexAttention。
|
| 172 |
+
|
| 173 |
+
字形引导在开区间 `(0.1, 1.0)` 内组合有字形和无字形条件的预测。默认引导设置下,MeanFlow 的 4 次更新需要 7 次模型前向计算。首次执行还包含编译开销。
|
| 174 |
+
|
| 175 |
+
## 许可
|
| 176 |
+
|
| 177 |
+
模型权重与文档以 Apache License 2.0 发布,见 [LICENSE](LICENSE)。推理代码位于 [ATH-MaaS/PixText](https://github.com/ATH-MaaS/PixText)。内置字体沿用各自条款,详见各模型包的 `fonts/` 目录。
|
docs/assets/pipeline.png
ADDED
|
Git LFS Details
|
examples/edits.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{"bbox": [120, 80, 160, 125], "text": "鹿"}
|
| 3 |
+
]
|
examples/english_case/details/e01_input.png
ADDED
|
examples/english_case/details/e01_meanflow.png
ADDED
|
examples/english_case/details/e01_teacher.png
ADDED
|
examples/english_case/details/e02_input.png
ADDED
|
examples/english_case/details/e02_meanflow.png
ADDED
|
examples/english_case/details/e02_teacher.png
ADDED
|
examples/english_case/details/e03_input.png
ADDED
|
examples/english_case/details/e03_meanflow.png
ADDED
|
examples/english_case/details/e03_teacher.png
ADDED
|
examples/english_case/details/excellence_input.png
ADDED
|
examples/english_case/details/excellence_meanflow.png
ADDED
|
examples/english_case/details/excellence_teacher.png
ADDED
|
examples/english_case/details/quality_input.png
ADDED
|
examples/english_case/details/quality_meanflow.png
ADDED
|
examples/english_case/details/quality_teacher.png
ADDED
|
examples/english_case/details/worldwide_input.png
ADDED
|
examples/english_case/details/worldwide_meanflow.png
ADDED
|
examples/english_case/details/worldwide_teacher.png
ADDED
|
examples/english_case/edits.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"bbox": [
|
| 4 |
+
382,
|
| 5 |
+
405,
|
| 6 |
+
396,
|
| 7 |
+
431
|
| 8 |
+
],
|
| 9 |
+
"text": "d"
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"bbox": [
|
| 13 |
+
449,
|
| 14 |
+
410,
|
| 15 |
+
574,
|
| 16 |
+
444
|
| 17 |
+
],
|
| 18 |
+
"text": "Excellence"
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"bbox": [
|
| 22 |
+
595,
|
| 23 |
+
396,
|
| 24 |
+
680,
|
| 25 |
+
439
|
| 26 |
+
],
|
| 27 |
+
"text": "Quality"
|
| 28 |
+
}
|
| 29 |
+
]
|
examples/english_case/input.png
ADDED
|
Git LFS Details
|
examples/english_case/input_boxed.png
ADDED
|
Git LFS Details
|
examples/english_case/meanflow_output.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_id": "PixText-MeanFlow",
|
| 3 |
+
"variant": "meanflow",
|
| 4 |
+
"seed": 42,
|
| 5 |
+
"sample_id": "image",
|
| 6 |
+
"steps": 4,
|
| 7 |
+
"guidance_scale": 3.3,
|
| 8 |
+
"guidance_interval": [
|
| 9 |
+
0.1,
|
| 10 |
+
1.0
|
| 11 |
+
],
|
| 12 |
+
"precision": "torch.bfloat16",
|
| 13 |
+
"geometry": [
|
| 14 |
+
{
|
| 15 |
+
"offset": 0,
|
| 16 |
+
"selected_font_indices": [
|
| 17 |
+
0,
|
| 18 |
+
0,
|
| 19 |
+
0
|
| 20 |
+
],
|
| 21 |
+
"reference_size": [
|
| 22 |
+
1024,
|
| 23 |
+
1024
|
| 24 |
+
],
|
| 25 |
+
"crops": [
|
| 26 |
+
[
|
| 27 |
+
381,
|
| 28 |
+
402,
|
| 29 |
+
16,
|
| 30 |
+
32
|
| 31 |
+
],
|
| 32 |
+
[
|
| 33 |
+
448,
|
| 34 |
+
403,
|
| 35 |
+
128,
|
| 36 |
+
48
|
| 37 |
+
],
|
| 38 |
+
[
|
| 39 |
+
590,
|
| 40 |
+
394,
|
| 41 |
+
96,
|
| 42 |
+
48
|
| 43 |
+
]
|
| 44 |
+
]
|
| 45 |
+
}
|
| 46 |
+
]
|
| 47 |
+
}
|
examples/english_case/meanflow_output.png
ADDED
|
Git LFS Details
|
examples/english_case/meanflow_output_boxed.png
ADDED
|
Git LFS Details
|
examples/english_case/source.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"sample_id": "english-tagline",
|
| 3 |
+
"source_image_sha256": "8e5bea2f9d3590ea34a9ca4e2c1db94c3f9a5f7c52e1267237ab58ce9953c4e2",
|
| 4 |
+
"target_count": 3,
|
| 5 |
+
"target_coordinates": "original-image pixel coordinates (x0,y0,x1,y1)",
|
| 6 |
+
"seed": 42
|
| 7 |
+
}
|
examples/english_case/teacher_output.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_id": "PixText-Teacher",
|
| 3 |
+
"variant": "teacher",
|
| 4 |
+
"seed": 42,
|
| 5 |
+
"sample_id": "image",
|
| 6 |
+
"steps": 25,
|
| 7 |
+
"guidance_scale": 3.3,
|
| 8 |
+
"guidance_interval": [
|
| 9 |
+
0.1,
|
| 10 |
+
1.0
|
| 11 |
+
],
|
| 12 |
+
"precision": "torch.bfloat16",
|
| 13 |
+
"geometry": [
|
| 14 |
+
{
|
| 15 |
+
"offset": 0,
|
| 16 |
+
"selected_font_indices": [
|
| 17 |
+
0,
|
| 18 |
+
0,
|
| 19 |
+
0
|
| 20 |
+
],
|
| 21 |
+
"reference_size": [
|
| 22 |
+
1024,
|
| 23 |
+
1024
|
| 24 |
+
],
|
| 25 |
+
"crops": [
|
| 26 |
+
[
|
| 27 |
+
381,
|
| 28 |
+
402,
|
| 29 |
+
16,
|
| 30 |
+
32
|
| 31 |
+
],
|
| 32 |
+
[
|
| 33 |
+
448,
|
| 34 |
+
403,
|
| 35 |
+
128,
|
| 36 |
+
48
|
| 37 |
+
],
|
| 38 |
+
[
|
| 39 |
+
590,
|
| 40 |
+
394,
|
| 41 |
+
96,
|
| 42 |
+
48
|
| 43 |
+
]
|
| 44 |
+
]
|
| 45 |
+
}
|
| 46 |
+
]
|
| 47 |
+
}
|
examples/english_case/teacher_output.png
ADDED
|
Git LFS Details
|
examples/english_case/teacher_output_boxed.png
ADDED
|
Git LFS Details
|
examples/pipeline_case/details/p01_input.png
ADDED
|
examples/pipeline_case/details/p01_meanflow.png
ADDED
|
examples/pipeline_case/details/p01_teacher.png
ADDED
|
examples/pipeline_case/details/p02_input.png
ADDED
|
examples/pipeline_case/details/p02_meanflow.png
ADDED
|
examples/pipeline_case/details/p02_teacher.png
ADDED
|
examples/pipeline_case/details/p03_input.png
ADDED
|
examples/pipeline_case/details/p03_meanflow.png
ADDED
|
examples/pipeline_case/details/p03_teacher.png
ADDED
|
examples/pipeline_case/details/p04_input.png
ADDED
|
examples/pipeline_case/details/p04_meanflow.png
ADDED
|
examples/pipeline_case/details/p04_teacher.png
ADDED
|
examples/pipeline_case/details/p05_input.png
ADDED
|
examples/pipeline_case/details/p05_meanflow.png
ADDED
|
examples/pipeline_case/details/p05_teacher.png
ADDED
|
examples/pipeline_case/details/p06_input.png
ADDED
|