track-4dgs 0.1.0__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.
- track_4dgs-0.1.0/LICENSE +201 -0
- track_4dgs-0.1.0/PKG-INFO +323 -0
- track_4dgs-0.1.0/README.md +301 -0
- track_4dgs-0.1.0/setup.cfg +4 -0
- track_4dgs-0.1.0/setup.py +38 -0
- track_4dgs-0.1.0/track_4dgs/__init__.py +14 -0
- track_4dgs-0.1.0/track_4dgs/cotracker/__init__.py +9 -0
- track_4dgs-0.1.0/track_4dgs/cotracker/tracker.py +39 -0
- track_4dgs-0.1.0/track_4dgs/prepare.py +53 -0
- track_4dgs-0.1.0/track_4dgs/registry.py +26 -0
- track_4dgs-0.1.0/track_4dgs/track1v.py +103 -0
- track_4dgs-0.1.0/track_4dgs/track2d.py +119 -0
- track_4dgs-0.1.0/track_4dgs/tracker/__init__.py +17 -0
- track_4dgs-0.1.0/track_4dgs/tracker/dataset.py +82 -0
- track_4dgs-0.1.0/track_4dgs/tracker/multiview.py +57 -0
- track_4dgs-0.1.0/track_4dgs/tracker/reorder.py +58 -0
- track_4dgs-0.1.0/track_4dgs/tracker/singleview.py +75 -0
- track_4dgs-0.1.0/track_4dgs/tracker/tracker.py +178 -0
- track_4dgs-0.1.0/track_4dgs/vggt/__init__.py +9 -0
- track_4dgs-0.1.0/track_4dgs/vggt/tracker.py +158 -0
- track_4dgs-0.1.0/track_4dgs.egg-info/PKG-INFO +323 -0
- track_4dgs-0.1.0/track_4dgs.egg-info/SOURCES.txt +23 -0
- track_4dgs-0.1.0/track_4dgs.egg-info/dependency_links.txt +1 -0
- track_4dgs-0.1.0/track_4dgs.egg-info/requires.txt +2 -0
- track_4dgs-0.1.0/track_4dgs.egg-info/top_level.txt +1 -0
track_4dgs-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
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 [yyyy] [name of copyright owner]
|
|
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.
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: track_4dgs
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Packaged Python point tracking utilities for 4D Gaussian Splatting
|
|
5
|
+
Home-page: https://github.com/yindaheng98/track-4dgs
|
|
6
|
+
Author: yindaheng98
|
|
7
|
+
Author-email: yindaheng98@gmail.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: gaussian-splatting>=2.3.8
|
|
12
|
+
Requires-Dist: Pillow
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: author-email
|
|
15
|
+
Dynamic: classifier
|
|
16
|
+
Dynamic: description
|
|
17
|
+
Dynamic: description-content-type
|
|
18
|
+
Dynamic: home-page
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
Dynamic: requires-dist
|
|
21
|
+
Dynamic: summary
|
|
22
|
+
|
|
23
|
+
# Point Tracking for 4DGS
|
|
24
|
+
|
|
25
|
+
This repo is the **point tracking Python extension for 4D Gaussian Splatting**. It wraps sequence point trackers such as [CoTracker3](https://github.com/facebookresearch/co-tracker) and [VGGT](https://github.com/facebookresearch/vggt) behind one small registry, then applies them either to plain image sequences or to multi-timestep Gaussian Splatting camera datasets.
|
|
26
|
+
|
|
27
|
+
The package provides two common workflows:
|
|
28
|
+
|
|
29
|
+
* track sampled 2D points through one ordered image sequence
|
|
30
|
+
* project 3D Gaussians into a reference timestep, track those projected points across all timesteps, and attach the resulting tracks back to Gaussian Splatting camera datasets
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
* [x] Organised as a standard Python package with `pip install` support
|
|
35
|
+
* [x] Shared point tracker registry with `cotracker3` and `vggt` implementations
|
|
36
|
+
* [x] Single-view image sequence tracking and rendering
|
|
37
|
+
* [x] Multi-timestep Gaussian Splatting camera dataset tracking
|
|
38
|
+
* [x] Camera dataset reordering against a selected reference timestep
|
|
39
|
+
* [ ] Port the motion estimation workflow from [TrackerSplat](https://github.com/yindaheng98/TrackerSplat) for point-tracker-driven motion synthesis
|
|
40
|
+
* [ ] Regularize 3DGS training with point tracker trajectories
|
|
41
|
+
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
### Prerequisites
|
|
45
|
+
|
|
46
|
+
* [PyTorch](https://pytorch.org/) (CUDA build recommended)
|
|
47
|
+
* [CUDA Toolkit](https://developer.nvidia.com/cuda-toolkit) matching your PyTorch installation
|
|
48
|
+
* [`gaussian-splatting`](https://github.com/yindaheng98/gaussian-splatting)
|
|
49
|
+
* [`CoTracker`](https://github.com/facebookresearch/co-tracker)
|
|
50
|
+
* [`VGGT`](https://github.com/facebookresearch/vggt) for the optional `vggt` tracker
|
|
51
|
+
|
|
52
|
+
Install the core Gaussian Splatting dependency used by the 4DGS dataset utilities:
|
|
53
|
+
|
|
54
|
+
```shell
|
|
55
|
+
pip install wheel setuptools
|
|
56
|
+
pip install --upgrade gaussian-splatting
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
If you have trouble with `gaussian-splatting`, try installing it from source:
|
|
60
|
+
|
|
61
|
+
```shell
|
|
62
|
+
pip install wheel setuptools
|
|
63
|
+
pip install --upgrade git+https://github.com/yindaheng98/gaussian-splatting.git@master --no-build-isolation
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Install tracker dependencies used by this package:
|
|
67
|
+
|
|
68
|
+
```shell
|
|
69
|
+
pip install --upgrade git+https://github.com/facebookresearch/co-tracker.git@main
|
|
70
|
+
pip install --upgrade Pillow hydra-core omegaconf
|
|
71
|
+
pip install --upgrade git+https://github.com/facebookresearch/vggt.git@main
|
|
72
|
+
pip install --upgrade git+https://github.com/jytime/LightGlue.git#egg=lightglue
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## PyPI Install
|
|
76
|
+
|
|
77
|
+
```shell
|
|
78
|
+
pip install --upgrade track-4dgs
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
or build latest from source:
|
|
82
|
+
|
|
83
|
+
```shell
|
|
84
|
+
pip install wheel setuptools
|
|
85
|
+
pip install --upgrade git+https://github.com/yindaheng98/track-4dgs.git@master --no-build-isolation
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Development Install
|
|
89
|
+
|
|
90
|
+
```shell
|
|
91
|
+
git clone --recursive https://github.com/yindaheng98/track-4dgs.git
|
|
92
|
+
cd track-4dgs
|
|
93
|
+
pip install --target . --upgrade . --no-deps
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Download Checkpoints
|
|
97
|
+
|
|
98
|
+
CoTracker3 offline checkpoint:
|
|
99
|
+
|
|
100
|
+
```shell
|
|
101
|
+
mkdir -p checkpoints
|
|
102
|
+
wget -P checkpoints https://huggingface.co/facebook/cotracker3/resolve/main/scaled_offline.pth
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
VGGT commercial checkpoint:
|
|
106
|
+
|
|
107
|
+
```shell
|
|
108
|
+
mkdir -p checkpoints
|
|
109
|
+
wget -P checkpoints https://huggingface.co/facebook/VGGT-1B-Commercial/resolve/main/vggt_1B_commercial.pt --header="Authorization: Bearer $HF_TOKEN"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
If the VGGT checkpoint is not present, `VGGTPointTracker` falls back to `VGGT.from_pretrained("facebook/VGGT-1B")`.
|
|
113
|
+
|
|
114
|
+
## Command-Line Usage
|
|
115
|
+
|
|
116
|
+
### List Registered Point Trackers
|
|
117
|
+
|
|
118
|
+
Verify that `track_4dgs` can import and register trackers:
|
|
119
|
+
|
|
120
|
+
```shell
|
|
121
|
+
python -c "import track_4dgs; print(track_4dgs.get_available_point_trackers())"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The built-in trackers are:
|
|
125
|
+
|
|
126
|
+
* `cotracker3`: CoTracker3 offline point tracker
|
|
127
|
+
* `vggt`: VGGT TrackHead point tracker
|
|
128
|
+
|
|
129
|
+
### Track One Image Sequence
|
|
130
|
+
|
|
131
|
+
```shell
|
|
132
|
+
python -m track_4dgs.track1v \
|
|
133
|
+
-s data/frame_000.png data/frame_001.png data/frame_002.png \
|
|
134
|
+
-d output/track1v-cotracker3 \
|
|
135
|
+
--tracker cotracker3 \
|
|
136
|
+
--num-points 256
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The command samples random query points on the first image, tracks them through all source images, and saves a rendered track overlay sequence under the destination directory.
|
|
140
|
+
|
|
141
|
+
Tracker-specific options can be passed with repeated `-m/--option_tracker` values:
|
|
142
|
+
|
|
143
|
+
```shell
|
|
144
|
+
python -m track_4dgs.track1v \
|
|
145
|
+
-s data/frame_000.png data/frame_001.png data/frame_002.png \
|
|
146
|
+
-d output/track1v-vggt \
|
|
147
|
+
--tracker vggt \
|
|
148
|
+
-m checkpoint="'checkpoints/vggt_1B_commercial.pt'" \
|
|
149
|
+
-m iters=4
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Track 4DGS Camera Datasets
|
|
153
|
+
|
|
154
|
+
```shell
|
|
155
|
+
python -m track_4dgs.track2d \
|
|
156
|
+
-s data/sequence/frame_000 data/sequence/frame_001 data/sequence/frame_002 \
|
|
157
|
+
-d output/sequence \
|
|
158
|
+
-i 30000 \
|
|
159
|
+
--tracker cotracker3 \
|
|
160
|
+
--init-dataset-index 0 \
|
|
161
|
+
--num-points 256
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`track2d` loads a trained Gaussian point cloud from:
|
|
165
|
+
|
|
166
|
+
```text
|
|
167
|
+
<destination>/point_cloud/iteration_<iteration>/point_cloud.ply
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
It projects Gaussian centers into every camera of the reference timestep, tracks those projected points across the same camera views in all timesteps, and saves visualisations under:
|
|
171
|
+
|
|
172
|
+
```text
|
|
173
|
+
<destination>/ours_<iteration>/track2d-<tracker>/
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
If cameras were saved outside the source scene folders, pass one camera path per source:
|
|
177
|
+
|
|
178
|
+
```shell
|
|
179
|
+
python -m track_4dgs.track2d \
|
|
180
|
+
-s data/sequence/frame_000 data/sequence/frame_001 \
|
|
181
|
+
-d output/sequence \
|
|
182
|
+
-i 30000 \
|
|
183
|
+
--load_cameras output/frame_000/cameras.json output/frame_001/cameras.json \
|
|
184
|
+
--mode camera
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## API Usage
|
|
188
|
+
|
|
189
|
+
### Build a Tracker
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
from track_4dgs.registry import build_point_tracker, get_available_point_trackers
|
|
193
|
+
|
|
194
|
+
print(get_available_point_trackers())
|
|
195
|
+
|
|
196
|
+
tracker = build_point_tracker(
|
|
197
|
+
"cotracker3",
|
|
198
|
+
checkpoint="checkpoints/scaled_offline.pth",
|
|
199
|
+
).to("cuda")
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Track Image Tensors
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
import torch
|
|
206
|
+
|
|
207
|
+
from track_4dgs.track1v import load_image, sample_query
|
|
208
|
+
|
|
209
|
+
frames = [
|
|
210
|
+
load_image("data/frame_000.png", "cuda"),
|
|
211
|
+
load_image("data/frame_001.png", "cuda"),
|
|
212
|
+
]
|
|
213
|
+
query = sample_query(frames[0], num_points=256)
|
|
214
|
+
|
|
215
|
+
with torch.no_grad():
|
|
216
|
+
track = tracker.track_view(query, frames, [None] * len(frames))
|
|
217
|
+
|
|
218
|
+
print(track.points.shape) # [num_frames, num_points, 2]
|
|
219
|
+
print(track.visibility.shape) # [num_frames, num_points]
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Track Gaussian Splatting Camera Datasets
|
|
223
|
+
|
|
224
|
+
```python
|
|
225
|
+
from gaussian_splatting.prepare import prepare_gaussians
|
|
226
|
+
|
|
227
|
+
from track_4dgs.prepare import prepare_datasets, prepare_tracker
|
|
228
|
+
from track_4dgs.track2d import query_views_from_gaussians
|
|
229
|
+
|
|
230
|
+
sources = [
|
|
231
|
+
"data/sequence/frame_000",
|
|
232
|
+
"data/sequence/frame_001",
|
|
233
|
+
]
|
|
234
|
+
datasets = prepare_datasets(
|
|
235
|
+
sources=sources,
|
|
236
|
+
device="cuda",
|
|
237
|
+
reorder_reference_idx=0,
|
|
238
|
+
)
|
|
239
|
+
gaussians = prepare_gaussians(
|
|
240
|
+
sh_degree=3,
|
|
241
|
+
source=sources[0],
|
|
242
|
+
device="cuda",
|
|
243
|
+
load_ply="output/sequence/point_cloud/iteration_30000/point_cloud.ply",
|
|
244
|
+
)
|
|
245
|
+
dataset_tracker = prepare_tracker(
|
|
246
|
+
tracker_name="cotracker3",
|
|
247
|
+
device="cuda",
|
|
248
|
+
tracker_configs={"checkpoint": "checkpoints/scaled_offline.pth"},
|
|
249
|
+
)
|
|
250
|
+
|
|
251
|
+
queries = query_views_from_gaussians(
|
|
252
|
+
datasets=datasets,
|
|
253
|
+
gaussians=gaussians,
|
|
254
|
+
init_dataset_index=0,
|
|
255
|
+
num_points=256,
|
|
256
|
+
)
|
|
257
|
+
tracked_datasets = dataset_tracker(queries, datasets)
|
|
258
|
+
|
|
259
|
+
camera_track = tracked_datasets[0][0].custom_data["track"]
|
|
260
|
+
print(camera_track.points.shape)
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Design: Point Tracker Registry
|
|
264
|
+
|
|
265
|
+
`AbstractPointTracker.__call__` validates inputs, then calls `track`. It takes view-major queries and frame-major camera datasets, and returns one `Track` per view. `CameraDatasetTracker` attaches those tracks back onto the camera datasets:
|
|
266
|
+
|
|
267
|
+
```text
|
|
268
|
+
view_queries + frame_datasets -> validate + track -> view_tracks -> tracked camera datasets
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Single-view trackers (`AbstractViewPointTracker`, e.g. CoTracker3 / VGGT) implement `track_batch(query, frames, masks)` for one camera sequence. Their `track` loops `track_view` over views. Multi-view trackers (`AbstractMultiViewPointTracker`, e.g. MV-TAP) consume all views at once, using camera `K` / `R` / `T` when the model needs them.
|
|
272
|
+
|
|
273
|
+
```text
|
|
274
|
+
Frame 0 cameras --\
|
|
275
|
+
Frame 1 cameras ----> single-view loop, or one joint multi-view call ----> view_tracks
|
|
276
|
+
Frame 2 cameras --/
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
This keeps model-specific code isolated in tracker implementations while the 4DGS workflow can use any registered tracker by name.
|
|
280
|
+
|
|
281
|
+
## Extending: Adding a New Point Tracker
|
|
282
|
+
|
|
283
|
+
Single-view trackers return `Track(points=[D, N, 2], visibility=[D, N])` from `track_batch`:
|
|
284
|
+
|
|
285
|
+
```python
|
|
286
|
+
from collections.abc import Sequence
|
|
287
|
+
|
|
288
|
+
import torch
|
|
289
|
+
|
|
290
|
+
from track_4dgs.tracker import AbstractViewPointTracker, Query, Track
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
class MyPointTracker(AbstractViewPointTracker):
|
|
294
|
+
def to(self, device):
|
|
295
|
+
self.device = torch.device(device)
|
|
296
|
+
return self
|
|
297
|
+
|
|
298
|
+
def track_batch(
|
|
299
|
+
self,
|
|
300
|
+
query: Query,
|
|
301
|
+
frames: Sequence[torch.Tensor],
|
|
302
|
+
frame_masks: Sequence[torch.Tensor | None],
|
|
303
|
+
) -> Track:
|
|
304
|
+
...
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Register it at import time:
|
|
308
|
+
|
|
309
|
+
```python
|
|
310
|
+
from track_4dgs.registry import register_point_tracker
|
|
311
|
+
|
|
312
|
+
register_point_tracker("mytracker", MyPointTracker)
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
After registration, it is available everywhere:
|
|
316
|
+
|
|
317
|
+
```shell
|
|
318
|
+
python -m track_4dgs.track1v --tracker mytracker -s frame0.png frame1.png -d output/mytracker
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
## Acknowledgement
|
|
322
|
+
|
|
323
|
+
This repo is developed based on [CoTracker](https://github.com/facebookresearch/co-tracker), [VGGT](https://github.com/facebookresearch/vggt), [LightGlue](https://github.com/jytime/LightGlue), and [gaussian-splatting (packaged)](https://github.com/yindaheng98/gaussian-splatting). Many thanks to the authors for open-sourcing their codebases.
|