ffgs 0.1.0.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ffgs-0.1.0.dev0/.gitignore +8 -0
- ffgs-0.1.0.dev0/LICENSE +237 -0
- ffgs-0.1.0.dev0/PKG-INFO +320 -0
- ffgs-0.1.0.dev0/README.md +298 -0
- ffgs-0.1.0.dev0/docs/models/anysplat.md +80 -0
- ffgs-0.1.0.dev0/docs/models/index.md +14 -0
- ffgs-0.1.0.dev0/docs/models/tokengs.md +82 -0
- ffgs-0.1.0.dev0/examples/infer_nerfstudio_scene.py +120 -0
- ffgs-0.1.0.dev0/examples/infer_pose_free.py +105 -0
- ffgs-0.1.0.dev0/pyproject.toml +70 -0
- ffgs-0.1.0.dev0/src/ffgs/__init__.py +39 -0
- ffgs-0.1.0.dev0/src/ffgs/dynamic.py +239 -0
- ffgs-0.1.0.dev0/src/ffgs/geometry.py +418 -0
- ffgs-0.1.0.dev0/src/ffgs/image.py +204 -0
- ffgs-0.1.0.dev0/src/ffgs/models/__init__.py +2 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/LICENSE +1120 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/__init__.py +49 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/encoder.py +372 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/evaluation.py +98 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/gaussian_adapter.py +96 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/gs_head.py +166 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/modeling.py +95 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/processing.py +249 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/__init__.py +0 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/heads/__init__.py +0 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/heads/camera_head.py +181 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/heads/dpt_head.py +612 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/heads/head_act.py +134 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/heads/utils.py +126 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/layers/__init__.py +28 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/layers/attention.py +92 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/layers/block.py +157 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/layers/drop_path.py +42 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/layers/layer_scale.py +32 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/layers/mlp.py +45 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/layers/patch_embed.py +106 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/layers/rope.py +211 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/layers/swiglu_ffn.py +77 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/layers/vision_transformer.py +463 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/models/__init__.py +0 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/models/aggregator.py +398 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/utils/__init__.py +0 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/utils/geometry.py +230 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/utils/pose_enc.py +144 -0
- ffgs-0.1.0.dev0/src/ffgs/models/anysplat/vggt/utils/rotation.py +148 -0
- ffgs-0.1.0.dev0/src/ffgs/models/tokengs/__init__.py +43 -0
- ffgs-0.1.0.dev0/src/ffgs/models/tokengs/activations.py +135 -0
- ffgs-0.1.0.dev0/src/ffgs/models/tokengs/attention.py +189 -0
- ffgs-0.1.0.dev0/src/ffgs/models/tokengs/enc_dec.py +323 -0
- ffgs-0.1.0.dev0/src/ffgs/models/tokengs/modeling.py +173 -0
- ffgs-0.1.0.dev0/src/ffgs/models/tokengs/processing.py +339 -0
- ffgs-0.1.0.dev0/src/ffgs/pipeline.py +341 -0
- ffgs-0.1.0.dev0/src/ffgs/processor.py +236 -0
- ffgs-0.1.0.dev0/src/ffgs/registry.py +132 -0
- ffgs-0.1.0.dev0/src/ffgs/render.py +111 -0
- ffgs-0.1.0.dev0/src/ffgs/types.py +291 -0
- ffgs-0.1.0.dev0/src/ffgs/zoo/__init__.py +234 -0
- ffgs-0.1.0.dev0/src/ffgs/zoo/anysplat/default.json +34 -0
- ffgs-0.1.0.dev0/src/ffgs/zoo/tokengs/dl3dv-2v.json +29 -0
- ffgs-0.1.0.dev0/src/ffgs/zoo/tokengs/dl3dv-4v.json +29 -0
- ffgs-0.1.0.dev0/src/ffgs/zoo/tokengs/dl3dv-6v.json +29 -0
- ffgs-0.1.0.dev0/src/ffgs/zoo/tokengs/dl3dv-base.json +29 -0
- ffgs-0.1.0.dev0/src/ffgs/zoo/tokengs/dl3dv-latent-2v-lpips.json +48 -0
- ffgs-0.1.0.dev0/src/ffgs/zoo/tokengs/dl3dv-latent-2v-ssim.json +48 -0
- ffgs-0.1.0.dev0/src/ffgs/zoo/tokengs/dl3dv-latent-4v-lpips.json +48 -0
- ffgs-0.1.0.dev0/src/ffgs/zoo/tokengs/dl3dv-latent-4v-ssim.json +48 -0
- ffgs-0.1.0.dev0/src/ffgs/zoo/tokengs/dl3dv-latent-6v-lpips.json +48 -0
- ffgs-0.1.0.dev0/src/ffgs/zoo/tokengs/dl3dv-latent-6v-ssim.json +48 -0
- ffgs-0.1.0.dev0/tests/_dummy.py +164 -0
- ffgs-0.1.0.dev0/tests/_empty.py +31 -0
- ffgs-0.1.0.dev0/tests/_numeric.py +13 -0
- ffgs-0.1.0.dev0/tests/conftest.py +70 -0
- ffgs-0.1.0.dev0/tests/fixtures/anysplat_checkpoint.json +1412 -0
- ffgs-0.1.0.dev0/tests/fixtures/anysplat_reference.safetensors +0 -0
- ffgs-0.1.0.dev0/tests/fixtures/make_anysplat_reference.py +326 -0
- ffgs-0.1.0.dev0/tests/fixtures/make_tokengs_reference.py +183 -0
- ffgs-0.1.0.dev0/tests/fixtures/reference.safetensors +0 -0
- ffgs-0.1.0.dev0/tests/fixtures/tokengs_checkpoints.json +4503 -0
- ffgs-0.1.0.dev0/tests/fixtures/tokengs_reference.safetensors +0 -0
- ffgs-0.1.0.dev0/tests/test_anysplat.py +514 -0
- ffgs-0.1.0.dev0/tests/test_boundary.py +39 -0
- ffgs-0.1.0.dev0/tests/test_data_path.py +100 -0
- ffgs-0.1.0.dev0/tests/test_examples.py +170 -0
- ffgs-0.1.0.dev0/tests/test_geometry.py +357 -0
- ffgs-0.1.0.dev0/tests/test_image.py +127 -0
- ffgs-0.1.0.dev0/tests/test_pipeline.py +209 -0
- ffgs-0.1.0.dev0/tests/test_pose_free.py +201 -0
- ffgs-0.1.0.dev0/tests/test_render.py +143 -0
- ffgs-0.1.0.dev0/tests/test_third_party.py +477 -0
- ffgs-0.1.0.dev0/tests/test_tokengs.py +331 -0
- ffgs-0.1.0.dev0/tests/test_types.py +134 -0
- ffgs-0.1.0.dev0/tests/test_zoo.py +346 -0
- ffgs-0.1.0.dev0/uv.lock +1618 -0
ffgs-0.1.0.dev0/LICENSE
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 libgs contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
|
203
|
+
--------------------------------------------------------------------------------
|
|
204
|
+
Third-party code
|
|
205
|
+
--------------------------------------------------------------------------------
|
|
206
|
+
|
|
207
|
+
src/ffgs/image.py is adapted from pixelSplat
|
|
208
|
+
(https://github.com/dcharatan/pixelsplat), available under the MIT License:
|
|
209
|
+
|
|
210
|
+
MIT License
|
|
211
|
+
|
|
212
|
+
Copyright (c) 2023 David Charatan, Sizhe Li, Andrea Tagliasacchi, and Vincent
|
|
213
|
+
Sitzmann
|
|
214
|
+
|
|
215
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
216
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
217
|
+
in the Software without restriction, including without limitation the rights
|
|
218
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
219
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
220
|
+
furnished to do so, subject to the following conditions:
|
|
221
|
+
|
|
222
|
+
The above copyright notice and this permission notice shall be included in all
|
|
223
|
+
copies or substantial portions of the Software.
|
|
224
|
+
|
|
225
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
226
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
227
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
228
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
229
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
230
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
231
|
+
SOFTWARE.
|
|
232
|
+
|
|
233
|
+
src/ffgs/models/anysplat/ is vendored from AnySplat
|
|
234
|
+
(https://github.com/InternRobotics/AnySplat) and includes code licensed for
|
|
235
|
+
NON-COMMERCIAL USE ONLY (CC BY-NC 4.0 and CC BY-NC-SA 4.0), besides MIT and
|
|
236
|
+
Apache-2.0 code. Each file there keeps its licence header; the per-file licences
|
|
237
|
+
and their full texts are in src/ffgs/models/anysplat/LICENSE.
|
ffgs-0.1.0.dev0/PKG-INFO
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: ffgs
|
|
3
|
+
Version: 0.1.0.dev0
|
|
4
|
+
Summary: Standard inference for feed-forward 3D Gaussian Splatting models
|
|
5
|
+
Project-URL: Repository, https://github.com/libgs/ffgs
|
|
6
|
+
Author: libgs contributors
|
|
7
|
+
License-Expression: Apache-2.0 AND MIT AND CC-BY-NC-4.0 AND CC-BY-NC-SA-4.0
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
License-File: src/ffgs/models/anysplat/LICENSE
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Requires-Dist: huggingface-hub>=0.23
|
|
14
|
+
Requires-Dist: numpy
|
|
15
|
+
Requires-Dist: pillow
|
|
16
|
+
Requires-Dist: safetensors
|
|
17
|
+
Requires-Dist: torch>=2.2
|
|
18
|
+
Requires-Dist: torchvision>=0.17
|
|
19
|
+
Provides-Extra: render
|
|
20
|
+
Requires-Dist: gsplat; extra == 'render'
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# ffgs — standard inference for feed-forward 3D Gaussian Splatting
|
|
24
|
+
|
|
25
|
+
One way to load and run feed-forward 3D Gaussian Splatting models: posed images in,
|
|
26
|
+
Gaussians out — in the model's own frame, or in **your** world frame with one call —
|
|
27
|
+
whatever model is behind it.
|
|
28
|
+
|
|
29
|
+
> Early development: the core interface, third-party loading and the model zoo
|
|
30
|
+
> are in place; see
|
|
31
|
+
> [the models](https://github.com/libgs/ffgs/blob/main/docs/models/index.md)
|
|
32
|
+
> for those shipped so far.
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from ffgs import Cameras, GSPipeline, Views
|
|
36
|
+
|
|
37
|
+
pipe = GSPipeline.from_pretrained("<family>/<variant>", device="cuda") # or a path / Hub repo
|
|
38
|
+
out = pipe(Views(images, intrinsics, c2w)) # -> GSOutput, in the model's frame
|
|
39
|
+
images = pipe.render(out, Cameras(c2w_new, k_new, (h, w)))["images"] # cameras in your frame
|
|
40
|
+
out.to_world().gaussians.save_ply("scene.ply") # standard 3DGS ply, in the frame of c2w
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install ffgs # inference
|
|
47
|
+
pip install "ffgs[render]" # + gsplat rasterisation (CUDA)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Dependencies: torch, torchvision, numpy, pillow, huggingface_hub, safetensors;
|
|
51
|
+
gsplat (the `render` extra) is imported only when rendering.
|
|
52
|
+
|
|
53
|
+
## Example
|
|
54
|
+
|
|
55
|
+
[`examples/infer_nerfstudio_scene.py`](https://github.com/libgs/ffgs/blob/main/examples/infer_nerfstudio_scene.py)
|
|
56
|
+
reconstructs a scene in the nerfstudio / DL3DV layout (`transforms.json`, OpenGL
|
|
57
|
+
camera poses) from evenly spaced frames, writes a 3DGS ply in the scene's frame and
|
|
58
|
+
renders the frames between the inputs:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
python examples/infer_nerfstudio_scene.py <scene> --model <family>/<variant> \
|
|
62
|
+
--images-dir <scene>/images_4 --out out
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Models that predict their own cameras also run on images alone. There is no world
|
|
66
|
+
frame then: the Gaussians and the predicted input cameras are both in the model's
|
|
67
|
+
frame, and renders take cameras in that frame (see [Conventions](#conventions)):
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
pipe = GSPipeline.from_pretrained("<family>/<variant>", device="cuda") # a pose-free model
|
|
71
|
+
out = pipe(Views(images)) # no intrinsics, no c2w: out.frame is None
|
|
72
|
+
out.gaussians.save_ply("scene.ply") # in the model's frame
|
|
73
|
+
renders = pipe.render(out, out.cameras)["images"] # the inputs, at the predicted cameras
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
[`examples/infer_pose_free.py`](https://github.com/libgs/ffgs/blob/main/examples/infer_pose_free.py)
|
|
77
|
+
does this for a folder of images: it writes the ply, the predicted cameras
|
|
78
|
+
(`cameras.json`: OpenCV c2w and normalised intrinsics per input image) and the
|
|
79
|
+
inputs re-rendered at them:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
python examples/infer_pose_free.py <image dir> --model <family>/<variant> \
|
|
83
|
+
--num-views 8 --out out
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Models
|
|
87
|
+
|
|
88
|
+
The shipped models, their zoo names, licenses, usage notes and results against
|
|
89
|
+
their official code are in
|
|
90
|
+
[docs/models](https://github.com/libgs/ffgs/blob/main/docs/models/index.md),
|
|
91
|
+
one page per model.
|
|
92
|
+
Check the license of a model before use: some are for non-commercial use only.
|
|
93
|
+
|
|
94
|
+
## Conventions
|
|
95
|
+
|
|
96
|
+
| | |
|
|
97
|
+
|---|---|
|
|
98
|
+
| images | float in [0, 1] (uint8 accepted), `[V, 3, H, W]` or `[B, V, 3, H, W]`, any resolution |
|
|
99
|
+
| c2w | camera-to-world, OpenCV axes (x right, y down, z forward); optional for models that predict their own cameras |
|
|
100
|
+
| intrinsics | pixel K for the image size given, or normalised K with `normalized_intrinsics=True`; optional like c2w |
|
|
101
|
+
| output | `GSOutput`: `Gaussians` (means, scales, wxyz quats, opacities, SH or RGB colours) in the model's frame, that frame (or `None`), and the input cameras the model predicted (or `None`) |
|
|
102
|
+
|
|
103
|
+
A processor reproduces its model's training preprocessing: rescale to cover the
|
|
104
|
+
model's input size, centre crop (normalised principal point kept, as in training),
|
|
105
|
+
cameras relative to the first input view, translations times a model-specific
|
|
106
|
+
`scene_scale`. The model predicts in that normalised frame, and that is where
|
|
107
|
+
`pipe(views)` leaves the Gaussians (`out.space == "model"`), exactly as the
|
|
108
|
+
model's own code produces them.
|
|
109
|
+
|
|
110
|
+
| | Gaussians in |
|
|
111
|
+
|---|---|
|
|
112
|
+
| `out = pipe(views)` | the model's frame (`out.frame`: world → model) |
|
|
113
|
+
| `out.to_world()` | the world frame of the input c2w (fp32) |
|
|
114
|
+
| `out.gaussians.save_ply(path)` | whichever frame `out` is in: `out.to_world().gaussians.save_ply(path)` for a ply that lines up with your cameras |
|
|
115
|
+
| `pipe.render(out, cameras)` | either: `cameras` are always in the world frame of the input c2w, and are taken (with near / far) into the model's frame when needed |
|
|
116
|
+
|
|
117
|
+
`to_world()` is one similarity transform for every model — rotation, uniform scale
|
|
118
|
+
and translation — applied per attribute: means fully, scales by the scale, quats by
|
|
119
|
+
the rotation, view-dependent SH colours of any degree by an exact rotation of their
|
|
120
|
+
coefficients (3DGS / gsplat basis); opacities and RGB / degree-0 colours are
|
|
121
|
+
unchanged. Input c2w whose rotation is not orthonormal or is a reflection (det < 0)
|
|
122
|
+
are rejected.
|
|
123
|
+
|
|
124
|
+
Models that need poses raise a `ValueError` naming what is missing.
|
|
125
|
+
Models that predict their own cameras accept `Views(images)` alone, and
|
|
126
|
+
`out.cameras` holds their prediction for the input views, in the same frame as
|
|
127
|
+
`out.gaussians` (`to_world()` moves both):
|
|
128
|
+
|
|
129
|
+
| views | `out.frame` | `to_world()` | `pipe.render(out, cameras)` |
|
|
130
|
+
|---|---|---|---|
|
|
131
|
+
| without c2w | `None`: there is no world frame | raises | `cameras` in the model's frame, e.g. `out.cameras`; near / far in model units |
|
|
132
|
+
| with c2w (V ≥ 2) | fitted to the given c2w | as above | as above: `cameras` in the world frame of the input c2w |
|
|
133
|
+
|
|
134
|
+
With c2w, the frame is one closed-form fit over all input views of the predicted
|
|
135
|
+
cameras onto the given ones: the rotation is the mean of the per-view rotations
|
|
136
|
+
(SVD, det +1), then scale and translation are the least-squares fit of the camera
|
|
137
|
+
centres. The given c2w do not enter the model. `out.frame.residuals` reports how
|
|
138
|
+
well they agree, per view: rotation error in degrees, centre error in world
|
|
139
|
+
units, and centre error relative to the RMS spread of the given centres. Fewer
|
|
140
|
+
than 2 views, coincident predicted centres or a fit with negative scale raise.
|
|
141
|
+
|
|
142
|
+
Resize + crop is the default, not a requirement. Processor options (in
|
|
143
|
+
`processor_config.json` or `processor_overrides=`):
|
|
144
|
+
|
|
145
|
+
| option | |
|
|
146
|
+
|---|---|
|
|
147
|
+
| `crop_mode="crop"` | cover the input shape, centre crop — the training rule (default) |
|
|
148
|
+
| `crop_mode="pad"` | fit inside the input shape and pad with `pad_value`; nothing is cut off, K follows the content |
|
|
149
|
+
| `crop_mode="none"` | inputs are already at the model's shape; used as they are |
|
|
150
|
+
| `resize_mode` | built-in kernel: `"bilinear"` (antialiased) or `"lanczos"`; a model's processor may add its own (see its page) |
|
|
151
|
+
| `resize=fn` | your own `fn(images, (h, w)) -> images`, replacing `resize_mode` (not serialised) |
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
pipe = GSPipeline.from_pretrained(path, processor_overrides={"crop_mode": "pad"})
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Layers
|
|
158
|
+
|
|
159
|
+
| | |
|
|
160
|
+
|---|---|
|
|
161
|
+
| `types` | `Views`, `Cameras`, `Gaussians` (+ `save_ply`) |
|
|
162
|
+
| `processor` | per-model pre / post-processing, stored as `processor_config.json` |
|
|
163
|
+
| model | the model's own `nn.Module` with `PyTorchModelHubMixin` (`config.json` + safetensors) |
|
|
164
|
+
| `pipeline` | `GSPipeline`: `from_pretrained` dispatches on `config.json:model_type` |
|
|
165
|
+
| `render` | gsplat rasterisation of `Gaussians` at `Cameras` (gsplat imported on first use) |
|
|
166
|
+
| `zoo` | named checkpoints: `zoo/<family>/<variant>.json` pointers to pinned upstream weights |
|
|
167
|
+
|
|
168
|
+
A saved model is a directory (or Hub repo) with `config.json` (model config +
|
|
169
|
+
`model_type`), `model.safetensors` and `processor_config.json`;
|
|
170
|
+
`GSPipeline.save_pretrained` writes all three.
|
|
171
|
+
|
|
172
|
+
## Model zoo
|
|
173
|
+
|
|
174
|
+
The zoo names published checkpoints: one JSON file per variant in
|
|
175
|
+
`src/ffgs/zoo/<family>/<variant>.json`, shipped with the package. The weights stay
|
|
176
|
+
in their authors' Hub repos; an entry pins the file to a commit and a sha256.
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
from ffgs import GSPipeline, zoo
|
|
180
|
+
|
|
181
|
+
zoo.list_models() # ["<family>/<variant>", ...]
|
|
182
|
+
pipe = GSPipeline.from_pretrained("<family>/<variant>", device="cuda")
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
```json
|
|
186
|
+
{
|
|
187
|
+
"model_type": "my-model",
|
|
188
|
+
"description": "My model trained on X, 2 input views",
|
|
189
|
+
"weights": {"repo": "author/repo", "file": "ckpt/model.pt",
|
|
190
|
+
"revision": "<full 40-hex commit>", "sha256": "<64-hex>"},
|
|
191
|
+
"model": {"...": "model constructor arguments"},
|
|
192
|
+
"processor": {"...": "processor_config.json"},
|
|
193
|
+
"source": {"url": "https://github.com/author/code", "paper": "https://..."},
|
|
194
|
+
"license": "license of the weights"
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Loading an entry downloads the file at the pinned commit, fails if its sha256
|
|
199
|
+
differs, converts the upstream checkpoint with the model's
|
|
200
|
+
`ModelSpec.convert_state_dict` (e.g. stripping a key prefix) and loads it strictly:
|
|
201
|
+
every key must match. `.pt` checkpoints are unpickled with `weights_only=True`.
|
|
202
|
+
`save_pretrained` then writes an ordinary ffgs directory.
|
|
203
|
+
|
|
204
|
+
`from_pretrained(name)` tries, in order: an existing local directory, a zoo entry,
|
|
205
|
+
a Hub repo id. A zoo family name is reserved — `"<family>/<anything>"` never goes
|
|
206
|
+
to the Hub, and an unknown variant is an error listing the known ones. (To load a
|
|
207
|
+
Hub repo whose owner shares a family name, `huggingface_hub.snapshot_download` it
|
|
208
|
+
and pass the directory.) A zoo entry pins its own revision, so `revision=` and
|
|
209
|
+
`subfolder=` are rejected for it; `cache_dir`, `token`, `force_download` and
|
|
210
|
+
`local_files_only` apply.
|
|
211
|
+
|
|
212
|
+
Checkpoints saved with `save_pretrained` can also be published as Hub repos, one
|
|
213
|
+
per model family with variants in subfolders:
|
|
214
|
+
|
|
215
|
+
```python
|
|
216
|
+
pipe = GSPipeline.from_pretrained("owner/family-repo", subfolder="variant",
|
|
217
|
+
revision="<commit sha>")
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Adding a model
|
|
221
|
+
|
|
222
|
+
A model is a model class with `PyTorchModelHubMixin`, a `Processor` subclass
|
|
223
|
+
(`preprocess`, returning the model input and its `ModelFrame`, or `None` when the
|
|
224
|
+
model predicts its own cameras; `postprocess`, to model-frame `Gaussians`;
|
|
225
|
+
`render_planes`, near / far in world units, or in model units when the frame is
|
|
226
|
+
`None`; for models that predict cameras, `predicted_cameras`, from the model output
|
|
227
|
+
to model-frame `Cameras`, and `output_frame`, whose default fits the frame to the
|
|
228
|
+
given c2w as above; optionally `background` and `render_settings`, the model's
|
|
229
|
+
rasteriser settings such as `radius_clip`, `rasterize_mode` or `clamp`, which
|
|
230
|
+
`pipe.render` uses unless the caller passes them) and a
|
|
231
|
+
`ModelSpec(model_type, model_cls, processor_cls)`. `from_pretrained` resolves the
|
|
232
|
+
`model_type` in `config.json` in this order:
|
|
233
|
+
|
|
234
|
+
1. **In your code** — `ffgs.register_model(spec)` before loading (built-in models
|
|
235
|
+
are registered the same way, on first use).
|
|
236
|
+
2. **An installed package** — expose the spec under the `ffgs.models` entry point
|
|
237
|
+
group, named by its `model_type`; ffgs imports the package only when that
|
|
238
|
+
`model_type` is loaded:
|
|
239
|
+
|
|
240
|
+
```toml
|
|
241
|
+
# pyproject.toml of your package
|
|
242
|
+
[project.entry-points."ffgs.models"]
|
|
243
|
+
my-model = "my_package.ffgs_model:SPEC" # a ModelSpec with model_type "my-model"
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
3. **Code in the model repo** — ship the `.py` files next to `config.json` and name
|
|
247
|
+
the classes (relative imports between the files work):
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{"model_type": "my-model",
|
|
251
|
+
"auto_map": {"model": "modeling_my.MyModel", "processor": "processing_my.MyProcessor"}}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
That code runs only with `trust_remote_code=True` (off by default); read it
|
|
255
|
+
first and pin the revision:
|
|
256
|
+
|
|
257
|
+
```python
|
|
258
|
+
pipe = GSPipeline.from_pretrained("someone/my-model", trust_remote_code=True,
|
|
259
|
+
revision="<commit sha>")
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
`save_pretrained` on such a pipeline copies the code and keeps `auto_map`.
|
|
263
|
+
To publish a model whose code lives in your own (e.g. training) codebase, keep
|
|
264
|
+
the model and processor classes in one package that imports itself only
|
|
265
|
+
relatively, and export it with the weights:
|
|
266
|
+
|
|
267
|
+
```python
|
|
268
|
+
GSPipeline(model, processor, model_type="my-model").save_pretrained(
|
|
269
|
+
"export/my-model", include_code=True) # copies the package, writes auto_map
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Imports of the rest of your codebase are refused at export time, so the
|
|
273
|
+
directory loads with `trust_remote_code=True` where your codebase is not
|
|
274
|
+
installed.
|
|
275
|
+
|
|
276
|
+
An installed model wins over repo code with the same `model_type`. Hub options
|
|
277
|
+
(`revision`, `subfolder`, `cache_dir`, `token`, `force_download`,
|
|
278
|
+
`local_files_only`) apply to every file `from_pretrained` downloads.
|
|
279
|
+
|
|
280
|
+
To add a zoo entry for a model, write its JSON (compute the sha256 of the pinned
|
|
281
|
+
file), give the model's `ModelSpec` a `convert_state_dict` if the upstream keys
|
|
282
|
+
differ from the model's, and run the tests: every shipped entry is checked to
|
|
283
|
+
parse and build offline, and `uv run pytest --network` downloads each one and
|
|
284
|
+
loads it strictly.
|
|
285
|
+
|
|
286
|
+
Document a new model in `docs/models/<family>.md` (source, licenses of code and
|
|
287
|
+
weights, zoo entries, usage notes, results against the official code; the existing
|
|
288
|
+
pages are the template) and add its row to
|
|
289
|
+
[`docs/models/index.md`](https://github.com/libgs/ffgs/blob/main/docs/models/index.md).
|
|
290
|
+
|
|
291
|
+
## Development
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
uv sync
|
|
295
|
+
uv run pytest # everything; tests marked `gpu` skip without CUDA + gsplat
|
|
296
|
+
uv run pytest -m gpu # only the GPU tests (needs CUDA and `--extra render`)
|
|
297
|
+
uv run pytest --network # also the tests that download zoo weights from the Hub
|
|
298
|
+
uv run pre-commit install
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
`uv sync` installs torch from PyPI (CUDA build). CI has no GPU and installs CPU
|
|
302
|
+
torch first (see `.github/workflows/ci.yml`). `tests/fixtures/reference.safetensors`
|
|
303
|
+
holds frozen reference outputs of the default data path; change it only together
|
|
304
|
+
with a deliberate change to that path.
|
|
305
|
+
|
|
306
|
+
## License
|
|
307
|
+
|
|
308
|
+
**The ffgs package as distributed is not entirely Apache-2.0: it includes code for
|
|
309
|
+
non-commercial use only.** Its license expression is
|
|
310
|
+
`Apache-2.0 AND MIT AND CC-BY-NC-4.0 AND CC-BY-NC-SA-4.0`:
|
|
311
|
+
|
|
312
|
+
- the core library is Apache-2.0 (see `LICENSE`); `src/ffgs/image.py` is adapted
|
|
313
|
+
from pixelSplat (MIT), whose license is included at the end of `LICENSE`;
|
|
314
|
+
- vendored model code under `src/ffgs/models/<family>/` keeps its upstream license.
|
|
315
|
+
`src/ffgs/models/anysplat/` mixes MIT, Apache-2.0 and non-commercial
|
|
316
|
+
(CC-BY-NC-4.0, CC-BY-NC-SA-4.0) files; its `LICENSE` lists the license per file;
|
|
317
|
+
- model weights are not part of the package and carry their own licenses.
|
|
318
|
+
|
|
319
|
+
The code and weight licenses of each model are listed in
|
|
320
|
+
[docs/models](https://github.com/libgs/ffgs/blob/main/docs/models/index.md).
|