This commit is contained in:
maxime committed 2026-11-18 10:51:31 +01:00
1 parent 8e4ebca342
commit 58b630f2d5
112 files changed
+3172 -295

No files matched your search

@@ -1,8 +1,30 @@
# Requalification of the long labels: BREITHORN
Measured with `tools/scripts/ranges.py --columns corr_x,corr_y` (k 5, merge 12h) on each label's range, level = median of the range, noise = own noise (work/ranges_*.txt, work/ranges_all_*.txt).
Measured with `tools/scripts/ranges.py --columns corr_x,corr_y` (k 5, merge 12h) on each label's range, with level = median of the range and noise = the sensor's own noise (work/ranges_*.txt, work/ranges_all_*.txt). Parallax: `scripts/parallax.py` and `scripts/parallax_fit.py` (work/parallax.txt, work/parallax_fit.txt).
- **BREITHORN-2**: kept. The drift goes beyond the threshold. POUI19 corr_x stays above its level from 10/10 20:00 to the end of the range (14 measurements), up to +11.1 noises (12/10 12:00, +0.084 px, about +0.3 mm). COLJ19 corr_x goes up to +7.7 noises (11 measurements, 11/10 12:00 → 13/10 04:00). This is a movement of the corr, not missing points.
- **BREITHORN-13**: corrected. The drift goes beyond the threshold: COLH20 corr_x up to +12.6 noises (30/10 04:00, about +0.8 mm), +11.2 noises on 28–29/10; COLJ19 +8.2 noises; POUI19 +7.3 noises; COLI20 +6.5 noises at the end of the range. I applied the correction the period analysts found: COLI22, COLH20''', POUI22 and POUI24 are added to the description. The label loses its review field.
- **BREITHORN-2**: corrected (parallax). The drift goes beyond the threshold: on corr_x, POUI19 reaches +11.1 noises (12/10 12:00, about +0.3 mm) and COLJ19 +7.7 noises. The description now gives the parallax as the deduced cause and names POUI22 (opposite in corr_y).
- **BREITHORN-13**: corrected (parallax, plus the period analysts' correction). The drift goes beyond the threshold: on corr_x, COLH20 reaches +12.6 noises (about +0.8 mm), COLJ19 +8.2 and POUI19 +7.3. COLI22, COLH20''' and POUI24 are named, as are COLI24 and POUI22 (opposite in corr_y).
Not checked in this pass (usage limit): the rolling level under the drift (`--rolling`). It is not needed to keep these labels, since the plain level already passes 5 noises.
## Parallax (asked by the user, 2026-11-18)
`targets.csv` gives the targets' distances: COLJ19 8.9 m and POUI19 9.4 m; COLI20, POUI20, COLH20 and COLH20''' 20–23 m; POUH21 and COLI21 30 m; COLI22 and POUI22 40 m; COLI24 and POUI24 60 m. The references are at 31–50 m (mean of 1/d ≈ 1/40 m). If the camera shifts sideways by T, a point moves by f·T/d in the image. The similarity fitted on the references removes f·T/d_ref, so each target keeps a remainder ∝ p = 1/d − 1/d_ref:
- a large remainder on the near targets;
- none at the references' distance;
- a remainder of the opposite sign beyond it.
Change of corr from the start to the end of each range (median of the first 6 accepted measurements against the last 6), regressed on p:
- 03/10 → 13/10: corr_x r = +0.82, corr_y r = +0.53.
- 13/10 → 16/10 (pause and slight return, no label): corr_x r = −0.86, the same parallax with the opposite sign.
- 16/10 → 01/11: corr_x r = +0.78, corr_y r = +0.27.
Fitted model: a lateral shift (tx, ty) plus a shift along the axis (radial from the image centre), each × p. It explains 70 %, 67 % and 61 % of the drift of the targets in the three ranges (the lateral shift alone: 60 %, 66 %, 54 %). With f ≈ d / mm_per_px ≈ 2700 px, the camera would shift laterally by about 0.7 mm (x) and 0.4 mm (y) up to 13/10, and about 0.9 mm and 0.5 mm from 17/10 on. This is a rough model.
What it explains: COLJ19 and POUI19 drifting the most, the 20 m group drifting less, POUH21 (30 m, ≈ d_ref) not drifting, the far targets turning the other way, and the sign flip during the pause.
What it does not explain (remainders of several noises):
- COLI21 (30 m): +0.06/+0.04 px up to 13/10, +0.075/+0.11 px from 17/10, about 7–10 noises.
- COLH20''' in corr_x: the opposite sign of what the model gives.
- The corr_y of COLI24 and POUI22: the right sign, about four to five times stronger than the model.
- COLI20 in corr_y after 17/10.
These stay "not established" in the descriptions. A remainder of the rotation that depends on the position in the image is possible, but I did not test it.
@@ -1,2 +1,2 @@
{"start": "2026-10-03T00:00Z", "end": "2026-10-13T04:00Z", "family": "Displacement", "description": "From the start of the data to 13 October, six targets drift slowly and steadily, all in the same direction, mostly in corr_x, in corr_y too except POUI19: COLH20, COLI20, COLI21, COLJ19, POUI19 and POUI20; COLI24 drifts in the opposite direction in corr_y. Their drift follows the camera pose step by step, as the camera gradually tilts (tilt increasing, pan and rotation decreasing), while their position in the image hardly moves and their error_value stays stable; the other targets, such as POUH21, do not drift. Cause given by the expert: the camera is gradually nodding forward and the compensation of its movement is not complete, correcting some targets better than others. According to the expert, COLJ19 and POUI19, which drift the most, are much closer to the camera than the other targets; for the other drifting targets, the reason for their poorer compensation (position, angle) is not established. The temperature of the camera housing drops slightly over the range, link not established. According to the expert, BREITHORN, MICHIGAN and NEBRASKA are in the same building: the cameras of the three stations tilt together, in the same direction and on the same dates (advance until 12 October, stop and slight backward movement from 13 to 16, resumption from the 17th to the end of the month), which points to a cause common to the building rather than a fault of this camera alone; at equal housing temperature, the cameras are more tilted at the end of the month than in the middle: temperature does not explain it alone, link not established. For the customer: the targets do not move relative to each other, this is not a movement of the structure; the camera tilt is to be monitored.", "review": "2026-11-17"}
{"start": "2026-10-16T20:00Z", "end": "2026-11-01T00:00Z", "family": "Displacement", "description": "From 17 October to the end of the batch, the drift resumes, faster than at the beginning of the month until the 25th, then clearly slower without stopping: the camera tilts again (tilt increasing, pan and rotation decreasing), and COLH20, COLI20, COLI21, COLJ19, POUI19 and POUI20 drift with it, mostly in corr_x and also in corr_y, POUI19 the most; COLI24 drifts in the opposite direction in corr_y. COLI22, COLH20''', POUI22 and POUI24 drift too, more noisily, between their own rejections. Their position in the image hardly moves, their error_value stays stable, POUH21 does not drift. Cause given by the expert: the camera is nodding forward and the compensation of its movement is not complete, correcting some targets better than others. According to the expert, COLJ19 and POUI19, which drift the most, are much closer to the camera than the other targets; for the other drifting targets, the reason for their poorer compensation (position, angle) is not established. The resumption coincides with the drop in the camera housing temperature, but the drift does not come back when it rises: link not established. According to the expert, BREITHORN, MICHIGAN and NEBRASKA are in the same building: the cameras of the three stations tilt together, in the same direction and on the same dates (advance until 12 October, stop and slight backward movement from 13 to 16, resumption from the 17th to the end of the month), which points to a cause common to the building rather than a fault of this camera alone; at equal housing temperature, the cameras are more tilted at the end of the month than in the middle: temperature does not explain it alone, link not established. For the customer: the targets do not move relative to each other, this is not a movement of the structure; the camera tilt is to be monitored."}
{"start": "2026-10-03T00:00Z", "end": "2026-10-13T04:00Z", "family": "Displacement", "description": "From the start of the data to 13 October, the targets drift slowly and steadily with the camera pose, step by step, as the camera gradually tilts (tilt increasing, pan and rotation decreasing): COLJ19 and POUI19 the most, mostly in corr_x (POUI19 hardly in corr_y), COLH20, COLI20, COLI21 and POUI20 in the same direction, in corr_x and corr_y; COLI24 and POUI22 drift in the opposite direction in corr_y. Their position in the image hardly moves apart from the camera movement and their error_value stays stable. Cause given by the expert: the camera is nodding forward and the compensation of its movement is not complete. Deduced from the distances of the targets to the camera: the drift of each target grows as it is closer, a parallax. COLJ19 and POUI19, the nearest according to the expert and to their distances, drift the most; the targets at middle distance (COLH20, COLI20, POUI20) less; POUH21, at the distance of the references, does not drift; the farthest (COLI24, POUI22) go the other way in corr_y. As it nods, the camera does not only turn, it also shifts a little; a shift moves near targets much more in the image than far ones, and the compensation, fitted on references at middle distance, corrects only the targets at their distance: those nearer keep a remainder in one direction, those farther in the other. The parallax explains most of the drift, not all of it: COLI21, which drifts as much as targets much nearer, COLH20''' in corr_x, and the corr_y of COLI24 and POUI22, stronger than the parallax gives, remain not established. The temperature of the camera housing drops slightly over the range, link not established. According to the expert, BREITHORN, MICHIGAN and NEBRASKA are in the same building: the cameras of the three stations tilt together, in the same direction and on the same dates (advance until 12 October, stop and slight backward movement from 13 to 16, resumption from the 17th to the end of the month), which points to a cause common to the building rather than a fault of this camera alone; at equal housing temperature, the cameras are more tilted at the end of the month than in the middle: temperature does not explain it alone, link not established. For the customer: this is not a movement of the structure, the targets keep their places relative to each other and only their view from a camera that shifts changes; the camera tilt is to be monitored.", "review": "2026-11-18"}
{"start": "2026-10-16T20:00Z", "end": "2026-11-01T00:00Z", "family": "Displacement", "description": "From 17 October to the end of the batch, the drift resumes, faster than at the beginning of the month until the 25th, then clearly slower without stopping: the camera tilts again (tilt increasing, pan and rotation decreasing) and the targets drift with it: POUI19 and COLJ19 the most, mostly in corr_x (POUI19 hardly in corr_y), COLI20, COLI21, COLH20 and POUI20 in the same direction, in corr_x and corr_y; COLI24 and POUI22 drift in the opposite direction in corr_y; COLI22, COLH20''' and POUI24 drift too, more noisily, between their own rejections. Their position in the image hardly moves apart from the camera movement and their error_value stays stable. Cause given by the expert: the camera is nodding forward and the compensation of its movement is not complete. Deduced from the distances of the targets to the camera: the drift of each target grows as it is closer, a parallax. COLJ19 and POUI19, the nearest according to the expert and to their distances, drift the most; the targets at middle distance (COLH20, COLI20, POUI20) less; POUH21, at the distance of the references, does not drift; the farthest (COLI24, POUI22) go the other way in corr_y. As it nods, the camera does not only turn, it also shifts a little; a shift moves near targets much more in the image than far ones, and the compensation, fitted on references at middle distance, corrects only the targets at their distance: those nearer keep a remainder in one direction, those farther in the other. The parallax explains most of the drift, not all of it: COLI21, which drifts as much as targets much nearer, COLH20''' in corr_x, and the corr_y of COLI24 and POUI22, stronger than the parallax gives, remain not established. The resumption coincides with the drop in the camera housing temperature, but the drift does not come back when it rises: link not established. According to the expert, BREITHORN, MICHIGAN and NEBRASKA are in the same building: the cameras of the three stations tilt together, in the same direction and on the same dates (advance until 12 October, stop and slight backward movement from 13 to 16, resumption from the 17th to the end of the month), which points to a cause common to the building rather than a fault of this camera alone; at equal housing temperature, the cameras are more tilted at the end of the month than in the middle: temperature does not explain it alone, link not established. For the customer: this is not a movement of the structure, the targets keep their places relative to each other and only their view from a camera that shifts changes; the camera tilt is to be monitored.", "review": "2026-11-18"}
@@ -1,7 +1,13 @@
# BREITHORN long labels: requalification
2 labels: 1 kept, 1 corrected, 0 removed.
2 labels: 0 kept as they are, 2 corrected, 0 removed. Both drifts go beyond the noise.
- **BREITHORN-13** (corrected): the drift is real, beyond the noise (COLH20 up to about 0.8 mm, about 13 noises). The description now also names COLI22, COLH20''', POUI22 and POUI24, which drift too, as the period analysts found. The review field was removed.
- **BREITHORN-2** (corrected): its cause is now explained by parallax. The targets are between about 9 m and 60 m from the camera, and the references between 31 m and 50 m. As the camera nods it also shifts a little (about 0.7 mm sideways and 0.4 mm vertically from the fit). The compensation, fitted on the references, cannot correct targets at other distances:
- the nearest targets drift the most (POUI19 about 0.6 mm, COLJ19 about 0.3 mm in corr_x);
- POUH21, at the references' distance, does not drift;
- the farthest targets go the other way in corr_y (COLI24 about −1.7 mm, POUI22 about −1.3 mm).
BREITHORN-2 is kept as it is: POUI19 drifts by about 0.3 mm, about 11 noises.
Parallax explains about 60 to 70 % of the drift. COLI21 (about 0.8 mm in corr_x) and COLH20''' remain unexplained.
- **BREITHORN-13** (corrected): the same parallax (camera shift of about 0.9 mm sideways and 0.5 mm vertically). COLI22, COLH20''' and POUI24 are now named, as are COLI24 and POUI22, which go the other way in corr_y (about −1.6 and −0.9 mm). The largest movements are COLI21 (about 1.0 mm in corr_x and 1.4 mm in corr_y), COLI20 (about 0.7–0.8 mm) and POUI19 (about 0.7 mm in corr_x). COLI21, COLH20''' and the corr_y of the far targets remain unexplained.
Both labels lose their review field.
@@ -0,0 +1,28 @@
"""Drift of each target over a range against its distance: parallax check.
Drift = median of the last N accepted measurements minus median of the first N (corr_x, corr_y, px and mm)."""
import sys, statistics as st
sys.path.insert(0, "tools/scripts")
import data
F = "data/BREITHORN"
M = data.load(F); T = data.load_targets(F)
refs = [s for s in M if data.is_reference(M[s])]
inv_ref = st.mean(1000 / T[s]["distance_mm"] for s in refs if T.get(s, {}).get("distance_mm"))
print("references:", {s: T[s]["distance_mm"] / 1000 for s in refs}, "mean 1/d_ref = %.4f /m" % inv_ref)
N = 6
for a, b in [(sys.argv[i], sys.argv[i + 1]) for i in range(1, len(sys.argv), 2)]:
A, B = data.parse_time(a), data.parse_time(b)
print(f"\n== {a} -> {b} (parallax term p = 1/d - mean 1/d_ref, /m)")
print(f"{'sensor':10} {'d_m':>5} {'p':>7} {'dcx_px':>8} {'dcy_px':>8} {'dcx_mm':>7} {'dcy_mm':>7} {'n':>3}")
rows = []
for s in sorted(M, key=lambda s: T.get(s, {}).get("distance_mm") or 0):
if s in refs: continue
w = [m for m in data.filter_window(M[s], A, B) if m["corr_x"] is not None]
if len(w) < 2 * N: print(s, "too few"); continue
d = T[s]["distance_mm"] / 1000; p = 1 / d - inv_ref
dd = {c: st.median(m[c] for m in w[-N:]) - st.median(m[c] for m in w[:N]) for c in ("corr_x", "corr_y", "corr_x_mm", "corr_y_mm")}
rows.append((p, dd["corr_x"], dd["corr_y"]))
print(f"{s:10} {d:5.1f} {p:7.4f} {dd['corr_x']:+8.4f} {dd['corr_y']:+8.4f} {dd['corr_x_mm']:+7.3f} {dd['corr_y_mm']:+7.3f} {len(w):3d}")
for k, c in ((1, "corr_x"), (2, "corr_y")):
xs = [r[0] for r in rows]; ys = [r[k] for r in rows]
r = st.correlation(xs, ys); sl = st.linear_regression(xs, ys)
print(f"{c}: r with p = {r:+.2f}, slope {sl.slope:+.3f} px*m, intercept {sl.intercept:+.4f} px")
@@ -0,0 +1,44 @@
"""Fit of the target drifts by a camera translation: lateral (tx, ty) and along the optical axis (tz, radial from the
image centre), each scaled by p = 1/d - mean 1/d_ref (what the similarity fitted on the references leaves)."""
import sys, statistics as st
sys.path.insert(0, "tools/scripts")
import data
F = "data/BREITHORN"; M = data.load(F); T = data.load_targets(F)
refs = [s for s in M if data.is_reference(M[s])]
inv_ref = st.mean(1000 / T[s]["distance_mm"] for s in refs)
allx = [m["x"] for s in M for m in M[s] if m["x"] is not None]; ally = [m["y"] for s in M for m in M[s] if m["y"] is not None]
print("image x range %.0f-%.0f, y range %.0f-%.0f" % (min(allx), max(allx), min(ally), max(ally)))
cx, cy = float(sys.argv[1]), float(sys.argv[2]); N = 6
def solve(A, b): # normal equations
n = len(A[0]); G = [[sum(r[i]*r[j] for r in A) for j in range(n)] for i in range(n)]; h = [sum(r[i]*y for r, y in zip(A, b)) for i in range(n)]
for i in range(n):
piv = G[i][i]
for j in range(i+1, n):
f = G[j][i]/piv; G[j] = [a - f*c for a, c in zip(G[j], G[i])]; h[j] -= f*h[i]
x = [0]*n
for i in reversed(range(n)): x[i] = (h[i] - sum(G[i][j]*x[j] for j in range(i+1, n)))/G[i][i]
return x
for a, b in [(sys.argv[i], sys.argv[i+1]) for i in range(3, len(sys.argv), 2)]:
A0, B0 = data.parse_time(a), data.parse_time(b); rows = []
for s in M:
if s in refs: continue
w = [m for m in data.filter_window(M[s], A0, B0) if m["corr_x"] is not None]
if len(w) < 2*N: continue
p = 1000/T[s]["distance_mm"] - inv_ref; x = st.median(m["x"] for m in w); y = st.median(m["y"] for m in w)
dx = st.median(m["corr_x"] for m in w[-N:]) - st.median(m["corr_x"] for m in w[:N])
dy = st.median(m["corr_y"] for m in w[-N:]) - st.median(m["corr_y"] for m in w[:N])
rows.append((s, p, x, y, dx, dy))
A = []; bb = []
for s, p, x, y, dx, dy in rows:
A.append([p, 0, p*(x-cx)]); bb.append(dx); A.append([0, p, p*(y-cy)]); bb.append(dy)
tx, ty, tz = solve(A, bb)
lat = solve([[r[0], r[1]] for r in A], bb)
print(f"\n== {a} -> {b}: tx {tx:+.3f} ty {ty:+.3f} px*m, tz {tz:+.6f} m (radial)")
print(f"{'sensor':10} {'d':>5} {'x':>6} {'y':>6} {'dcx':>8} {'fit':>8} {'dcy':>8} {'fit':>8} {'res_x':>7} {'res_y':>7}")
sr = st0 = 0
for s, p, x, y, dx, dy in sorted(rows, key=lambda r: -r[1]):
fx = p*tx + p*tz*(x-cx); fy = p*ty + p*tz*(y-cy)
sr += (dx-fx)**2 + (dy-fy)**2; st0 += dx**2 + dy**2
print(f"{s:10} {1/(p+inv_ref):5.1f} {x:6.0f} {y:6.0f} {dx:+8.4f} {fx:+8.4f} {dy:+8.4f} {fy:+8.4f} {dx-fx:+7.4f} {dy-fy:+7.4f}")
srl = sum((r[4]-r[1]*lat[0])**2 + (r[5]-r[1]*lat[1])**2 for r in rows)
print(f"share of the drift explained: lateral+axial {1-sr/st0:.2f}, lateral only {1-srl/st0:.2f}")
@@ -0,0 +1,17 @@
import json
D="labeling/auto/analyses/BREITHORN_2026-10-03T0000_2026-11-01T0000"
inp=[json.loads(l) for l in open(D+"/work/existing.jsonl")]
common=("According to the expert, BREITHORN, MICHIGAN and NEBRASKA are in the same building: the cameras of the three stations tilt together, in the same direction and on the same dates (advance until 12 October, stop and slight backward movement from 13 to 16, resumption from the 17th to the end of the month), which points to a cause common to the building rather than a fault of this camera alone; at equal housing temperature, the cameras are more tilted at the end of the month than in the middle: temperature does not explain it alone, link not established. "
"For the customer: this is not a movement of the structure, the targets keep their places relative to each other and only their view from a camera that shifts changes; the camera tilt is to be monitored.")
parallax=("Cause given by the expert: the camera is nodding forward and the compensation of its movement is not complete. "
"Deduced from the distances of the targets to the camera: the drift of each target grows as it is closer, a parallax. COLJ19 and POUI19, the nearest according to the expert and to their distances, drift the most; the targets at middle distance (COLH20, COLI20, POUI20) less; POUH21, at the distance of the references, does not drift; the farthest (COLI24, POUI22) go the other way in corr_y. "
"As it nods, the camera does not only turn, it also shifts a little; a shift moves near targets much more in the image than far ones, and the compensation, fitted on references at middle distance, corrects only the targets at their distance: those nearer keep a remainder in one direction, those farther in the other. "
"The parallax explains most of the drift, not all of it: COLI21, which drifts as much as targets much nearer, COLH20''' in corr_x, and the corr_y of COLI24 and POUI22, stronger than the parallax gives, remain not established. ")
a={k:v for k,v in inp[0].items() if k not in ("id","review")}
a["description"]=("From the start of the data to 13 October, the targets drift slowly and steadily with the camera pose, step by step, as the camera gradually tilts (tilt increasing, pan and rotation decreasing): COLJ19 and POUI19 the most, mostly in corr_x (POUI19 hardly in corr_y), COLH20, COLI20, COLI21 and POUI20 in the same direction, in corr_x and corr_y; COLI24 and POUI22 drift in the opposite direction in corr_y. Their position in the image hardly moves apart from the camera movement and their error_value stays stable. "
+ parallax + "The temperature of the camera housing drops slightly over the range, link not established. " + common)
b={k:v for k,v in inp[1].items() if k not in ("id","review")}
b["description"]=("From 17 October to the end of the batch, the drift resumes, faster than at the beginning of the month until the 25th, then clearly slower without stopping: the camera tilts again (tilt increasing, pan and rotation decreasing) and the targets drift with it: POUI19 and COLJ19 the most, mostly in corr_x (POUI19 hardly in corr_y), COLI20, COLI21, COLH20 and POUI20 in the same direction, in corr_x and corr_y; COLI24 and POUI22 drift in the opposite direction in corr_y; COLI22, COLH20''' and POUI24 drift too, more noisily, between their own rejections. Their position in the image hardly moves apart from the camera movement and their error_value stays stable. "
+ parallax + "The resumption coincides with the drop in the camera housing temperature, but the drift does not come back when it rises: link not established. " + common)
with open(D+"/labels.jsonl","w") as f:
for x in (a,b): f.write(json.dumps(x,ensure_ascii=False)+"\n")