Add MASt3R-SLAM runs for I12X Video1_T3 and Video2_T3, each without and with ARCore intrinsics
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +4 -0
- I12X/MasterSlam1_ScanVideo1/compare_t3.py +68 -0
- I12X/MasterSlam1_ScanVideo1/config.yaml +58 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/0.0.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/1.1666666269302368.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/1.7333333492279053.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/10.600000381469727.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/11.733333587646484.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/12.533333778381348.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/12.899999618530273.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/13.433333396911621.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/14.199999809265137.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/14.566666603088379.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/14.966666221618652.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/15.533333778381348.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/16.066667556762695.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/16.33333396911621.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/17.566667556762695.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/17.899999618530273.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/18.799999237060547.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/19.100000381469727.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/19.53333282470703.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/19.933332443237305.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/2.299999952316284.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/20.399999618530273.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/21.133333206176758.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/21.399999618530273.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/21.866666793823242.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/22.100000381469727.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/22.299999237060547.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/22.433332443237305.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/22.53333282470703.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/22.899999618530273.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/24.066667556762695.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/24.433332443237305.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/25.200000762939453.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/26.600000381469727.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/27.03333282470703.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/27.233333587646484.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/27.399999618530273.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/27.53333282470703.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/27.83333396911621.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/28.03333282470703.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/28.16666603088379.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/28.366666793823242.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/28.700000762939453.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/29.066667556762695.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/29.5.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/3.2666666507720947.png +3 -0
- I12X/MasterSlam1_ScanVideo1/keyframes/scan/3.7666666507720947.png +3 -0
.gitattributes
CHANGED
|
@@ -1338,3 +1338,7 @@ P63/Spatiallm1_MasterSlam1/room_with_scan_preview.glb filter=lfs diff=lfs merge=
|
|
| 1338 |
P64/Spatiallm1_MasterSlam1/room_with_scan_preview.glb filter=lfs diff=lfs merge=lfs -text
|
| 1339 |
I87X/Spatiallm1_MasterSlam1/room_with_scan_preview.glb filter=lfs diff=lfs merge=lfs -text
|
| 1340 |
I87X/Spatiallm1_MasterSlam2/room_with_scan_preview.glb filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1338 |
P64/Spatiallm1_MasterSlam1/room_with_scan_preview.glb filter=lfs diff=lfs merge=lfs -text
|
| 1339 |
I87X/Spatiallm1_MasterSlam1/room_with_scan_preview.glb filter=lfs diff=lfs merge=lfs -text
|
| 1340 |
I87X/Spatiallm1_MasterSlam2/room_with_scan_preview.glb filter=lfs diff=lfs merge=lfs -text
|
| 1341 |
+
I12X/MasterSlam1_ScanVideo1/scan.ply filter=lfs diff=lfs merge=lfs -text
|
| 1342 |
+
I12X/MasterSlam2_ScanVideo1/scan.ply filter=lfs diff=lfs merge=lfs -text
|
| 1343 |
+
I12X/MasterSlam3_ScanVideo2/scan.ply filter=lfs diff=lfs merge=lfs -text
|
| 1344 |
+
I12X/MasterSlam4_ScanVideo2/scan.ply filter=lfs diff=lfs merge=lfs -text
|
I12X/MasterSlam1_ScanVideo1/compare_t3.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json, sys
|
| 2 |
+
import numpy as np
|
| 3 |
+
from scipy.spatial.transform import Rotation as R
|
| 4 |
+
from scipy.spatial import cKDTree
|
| 5 |
+
|
| 6 |
+
root, video, names = sys.argv[1], sys.argv[2], sys.argv[3:] # room dir, T3 capture name, MasterSlam folders
|
| 7 |
+
gt = {}
|
| 8 |
+
for line in open(f"{root}/ScanVideos/{video}/poses.jsonl"):
|
| 9 |
+
d = json.loads(line)
|
| 10 |
+
if d["state"] == "TRACKING":
|
| 11 |
+
gt[d["i"]] = (np.array(d["p"]), np.array(d["q"])) # q = x,y,z,w (ARCore)
|
| 12 |
+
|
| 13 |
+
def umeyama(src, dst):
|
| 14 |
+
mu_s, mu_d = src.mean(0), dst.mean(0)
|
| 15 |
+
xs, xd = src - mu_s, dst - mu_d
|
| 16 |
+
U, D, Vt = np.linalg.svd(xd.T @ xs / len(src))
|
| 17 |
+
S = np.eye(3); S[2, 2] = np.sign(np.linalg.det(U @ Vt))
|
| 18 |
+
Rm = U @ S @ Vt
|
| 19 |
+
s = np.trace(np.diag(D) @ S) / xs.var(0).sum()
|
| 20 |
+
return s, Rm, mu_d - s * Rm @ mu_s
|
| 21 |
+
|
| 22 |
+
res = {}
|
| 23 |
+
C = R.from_matrix(np.diag([1.0, -1.0, -1.0])) # OpenGL (ARCore) camera -> OpenCV camera
|
| 24 |
+
for name in names:
|
| 25 |
+
T = np.loadtxt(f"{root}/{name}/scan.txt")
|
| 26 |
+
idx = np.round(T[:, 0] * 30).astype(int)
|
| 27 |
+
keep = [k for k, i in enumerate(idx) if i in gt]
|
| 28 |
+
P = T[keep, 1:4]; Q = T[keep, 4:8]
|
| 29 |
+
G = np.array([gt[idx[k]][0] for k in keep]); GQ = np.array([gt[idx[k]][1] for k in keep])
|
| 30 |
+
s, Rm, t = umeyama(P, G)
|
| 31 |
+
Pa = (s * (Rm @ P.T)).T + t
|
| 32 |
+
ate = np.linalg.norm(Pa - G, axis=1)
|
| 33 |
+
# relative rotation error between consecutive keyframes (alignment-free)
|
| 34 |
+
rre = []
|
| 35 |
+
for a, b in zip(range(len(keep) - 1), range(1, len(keep))):
|
| 36 |
+
de = (R.from_quat(Q[a]).inv() * R.from_quat(Q[b]))
|
| 37 |
+
dg = C.inv() * R.from_quat(GQ[a]).inv() * R.from_quat(GQ[b]) * C
|
| 38 |
+
rre.append(np.degrees((de.inv() * dg).magnitude()))
|
| 39 |
+
path_gt = np.linalg.norm(np.diff(G, axis=0), axis=1).sum()
|
| 40 |
+
print(f"{name}: {len(keep)} kf matched | Sim3 scale {s:.3f} | ATE rmse {np.sqrt((ate**2).mean())*100:.1f} cm "
|
| 41 |
+
f"(max {ate.max()*100:.1f}) | RPE-rot mean {np.mean(rre):.2f} deg (max {np.max(rre):.2f}) | ARCore path {path_gt:.2f} m")
|
| 42 |
+
res[name] = (s, Rm, t)
|
| 43 |
+
|
| 44 |
+
# point clouds in ARCore frame (metric), compare each other
|
| 45 |
+
def load_ply(p):
|
| 46 |
+
with open(p, "rb") as f:
|
| 47 |
+
hdr = b""
|
| 48 |
+
while not hdr.endswith(b"end_header\n"):
|
| 49 |
+
hdr += f.readline()
|
| 50 |
+
h = hdr.decode()
|
| 51 |
+
n = int([l for l in h.splitlines() if l.startswith("element vertex")][0].split()[-1])
|
| 52 |
+
props = [l.split() for l in h.splitlines() if l.startswith("property")]
|
| 53 |
+
dt = np.dtype([(p[2], {"float": "<f4", "double": "<f8", "uchar": "u1", "float32": "<f4", "uint8": "u1"}[p[1]]) for p in props])
|
| 54 |
+
a = np.frombuffer(f.read(n * dt.itemsize), dt, n) if "binary" in h else np.loadtxt(f, max_rows=n)
|
| 55 |
+
return np.stack([a["x"], a["y"], a["z"]], 1).astype(np.float64)
|
| 56 |
+
|
| 57 |
+
rng = np.random.default_rng(0)
|
| 58 |
+
clouds = {}
|
| 59 |
+
for name, (s, Rm, t) in res.items():
|
| 60 |
+
X = load_ply(f"{root}/{name}/scan.ply")
|
| 61 |
+
X = X[rng.choice(len(X), min(len(X), 300_000), replace=False)]
|
| 62 |
+
clouds[name] = (s * (Rm @ X.T)).T + t
|
| 63 |
+
lo, hi = np.percentile(clouds[name], [2, 98], axis=0)
|
| 64 |
+
print(f"{name}: extent (2-98 pct, ARCore metres) {np.round(hi - lo, 2)}")
|
| 65 |
+
a, b = clouds.values()
|
| 66 |
+
d_ab = cKDTree(b).query(a)[0]; d_ba = cKDTree(a).query(b)[0]
|
| 67 |
+
print(f"cloud-to-cloud (after each aligned to ARCore): median {np.median(np.r_[d_ab, d_ba])*100:.1f} cm, "
|
| 68 |
+
f"90th pct {np.percentile(np.r_[d_ab, d_ba], 90)*100:.1f} cm")
|
I12X/MasterSlam1_ScanVideo1/config.yaml
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
use_calib: False
|
| 2 |
+
single_thread: False
|
| 3 |
+
dataset:
|
| 4 |
+
subsample: 1
|
| 5 |
+
img_downsample: 1
|
| 6 |
+
center_principle_point: True
|
| 7 |
+
|
| 8 |
+
matching:
|
| 9 |
+
max_iter: 10
|
| 10 |
+
lambda_init: 1e-8
|
| 11 |
+
convergence_thresh: 1e-6
|
| 12 |
+
dist_thresh: 1e-1 # distance in 3D space
|
| 13 |
+
radius: 3
|
| 14 |
+
dilation_max: 5 # Right now starts from max and iteratively decreases until 1
|
| 15 |
+
|
| 16 |
+
tracking:
|
| 17 |
+
min_match_frac: 0.05
|
| 18 |
+
max_iters: 50
|
| 19 |
+
C_conf: 0.0
|
| 20 |
+
Q_conf: 1.5
|
| 21 |
+
rel_error: 1e-3
|
| 22 |
+
delta_norm: 1e-3
|
| 23 |
+
huber: 1.345
|
| 24 |
+
match_frac_thresh: 0.333
|
| 25 |
+
sigma_ray: 0.003
|
| 26 |
+
sigma_dist: 1e+1
|
| 27 |
+
sigma_pixel: 1.0
|
| 28 |
+
sigma_depth: 1e+1 # NOTE: log-depth!
|
| 29 |
+
sigma_point: 0.05
|
| 30 |
+
pixel_border: -10 # Only in calib (negative means allow pixels outside image up to that distance)
|
| 31 |
+
depth_eps: 1e-6 # Only in calib case
|
| 32 |
+
filtering_mode: weighted_pointmap # recent, first, best_score, weighted_pointmap, weighted_spherical, indep_conf
|
| 33 |
+
filtering_score: median # median, mean (only used for filtering_mode=best_score)
|
| 34 |
+
|
| 35 |
+
local_opt:
|
| 36 |
+
pin: 1
|
| 37 |
+
window_size: 1e+6
|
| 38 |
+
C_conf: 0.0
|
| 39 |
+
Q_conf: 1.5
|
| 40 |
+
min_match_frac: 0.1
|
| 41 |
+
pixel_border: -10 # Only in calib (negative means allow pixels outside image up to that distance)
|
| 42 |
+
depth_eps: 1e-6 # Only in calib case
|
| 43 |
+
max_iters: 10
|
| 44 |
+
sigma_ray: 0.003
|
| 45 |
+
sigma_dist: 1e+1
|
| 46 |
+
sigma_pixel: 1.0
|
| 47 |
+
sigma_depth: 1e+1 # NOTE: log-depth!
|
| 48 |
+
sigma_point: 0.05
|
| 49 |
+
delta_norm: 1e-8
|
| 50 |
+
use_cuda: True
|
| 51 |
+
|
| 52 |
+
retrieval:
|
| 53 |
+
k: 3
|
| 54 |
+
min_thresh: 5e-3
|
| 55 |
+
|
| 56 |
+
reloc:
|
| 57 |
+
min_match_frac: 0.3
|
| 58 |
+
strict: True
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/0.0.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/1.1666666269302368.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/1.7333333492279053.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/10.600000381469727.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/11.733333587646484.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/12.533333778381348.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/12.899999618530273.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/13.433333396911621.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/14.199999809265137.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/14.566666603088379.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/14.966666221618652.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/15.533333778381348.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/16.066667556762695.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/16.33333396911621.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/17.566667556762695.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/17.899999618530273.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/18.799999237060547.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/19.100000381469727.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/19.53333282470703.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/19.933332443237305.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/2.299999952316284.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/20.399999618530273.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/21.133333206176758.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/21.399999618530273.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/21.866666793823242.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/22.100000381469727.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/22.299999237060547.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/22.433332443237305.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/22.53333282470703.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/22.899999618530273.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/24.066667556762695.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/24.433332443237305.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/25.200000762939453.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/26.600000381469727.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/27.03333282470703.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/27.233333587646484.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/27.399999618530273.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/27.53333282470703.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/27.83333396911621.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/28.03333282470703.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/28.16666603088379.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/28.366666793823242.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/28.700000762939453.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/29.066667556762695.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/29.5.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/3.2666666507720947.png
ADDED
|
Git LFS Details
|
I12X/MasterSlam1_ScanVideo1/keyframes/scan/3.7666666507720947.png
ADDED
|
Git LFS Details
|