"""Build labels.jsonl from work/existing.jsonl: keep, correct, remove, add (verification of SNCF01, 14/10 -> 22/10).""" import json import pathlib HERE = pathlib.Path(__file__).resolve().parent.parent existing = [json.loads(l) for l in (HERE / "work" / "existing.jsonl").read_text().splitlines() if l.strip()] REMOVE = {"SNCF01-55", "SNCF01-58", "SNCF01-62", "SNCF01-65"} CORRECT = { "SNCF01-38": { "start": "2026-10-14T09:30Z", "end": "2026-10-14T16:30Z", "description": ( "By day (14/10), in the sun (hard shadows on the wall on the image of 13:00): the corrected curves of the low " "targets fluctuate much more than at night, from one measurement to the next, with one-measurement jumps that " "come back at once, mostly CV.4, CV.2, F4.3, CV.6, F4.2, BG.2, F4.5 and F4.6, and CV.2 and CV.4 are rejected " "at times; the night before and the evening after are calm. Deduced cause: heat shimmer from the air heated " "above the tracks (a fast noise over the scene, by sunny day only), not visible as such on the images; some " "rejections of CV.2 and CV.4, low targets, may also come from passages, not seen. Do not trust the small " "movements of these curves by day; this is not a movement of the structure." ), }, "SNCF01-40": { "description": ( "One single measurement: CV.2, CV.4 and CV.8 are rejected, their curves are missing, the recognition error of " "the reference BG.3.1 jumps strongly while staying under its threshold, and CV.6, F4.2 and F4.6 make a corr " "jump that comes back at the next measurement. Cause: a passage in front of the bottom of the scene and of " "BG.3.1, deduced from the signature (several low targets and a reference hit together for one measurement; " "no image at that minute, the station takes one per hour). The structure is not moving: point to ignore, " "nothing to do." ), }, "SNCF01-51": { "description": ( "One single measurement: the CV, F4 and P targets are rejected and their curves are missing; the references " "BG.3.1 and R1 are rejected too, the compensation retains none of them, and the targets that stayed under " "their threshold, BG.2, BG.3 and F4.5, jump strongly in corr_x and corr_y for the time of the measurement, as " "does the reference R2. Everything comes back at the next measurement. Cause: a train passing in front of the " "targets and the references, seen blurred across the whole lower scene on the 16:00 image. The structure is " "not moving: point to ignore, nothing to do." ), }, "SNCF01-57": { "start": "2026-10-18T07:45Z", }, "SNCF01-60": { "family": "Displacement", "description": ( "On 19/10, an overcast day (images of 08:00 and 13:00, no sun on the wall), the camera moves in the morning " "and does not come back: its pan and tilt drop and its scale rises, then stay at their new level in the " "afternoon and at night, until the outage of 20/10. At the same time the targets move apart from each other " "in the image (residual relative to the overall movement): corr_x of P5, P6 and P7 rises and that of P2 drops " "clearly, and corr_y of P5 rises, through the afternoon and the night, while the residual of the compensation " "rises from late morning and the recognition error of the reference R1 from the late afternoon. No return before the outage; " "after it, on 21/10, P2 and P5 are still near their new levels. Not the daily thermal cycle: no sun, the pose " "does not come back, no temperature is available. Cause not established (a camera or reference movement that " "the compensation does not follow, or a movement of the scene). Movement of the structure not established: " "to monitor; part of the month-long drift labelled separately." ), }, "SNCF01-64": { "description": ( "One single measurement: the CV, F4 and P targets are rejected and their curves are missing; the references " "BG.3.1 and R1 are rejected too, the compensation retains none of them, and the targets that stayed under " "their threshold, BG.2, BG.3, F4.5 and F4.6, jump strongly in corr_x and corr_y for the time of the " "measurement, as does the reference R2. Everything comes back at the next measurement. Cause: a passage in " "front of the targets and the references, deduced from the signature, the same as that of the train seen on " "the 16:00 image of 16/10 (no image at that minute). It falls inside the episode of the reference R1 of that " "morning, labelled separately. The structure is not moving: point to ignore, nothing to do." ), }, "SNCF01-68": { "description": ( "Daytime thermal cycle (21/10, sunny, between two measurement outages): in late morning the pan of the camera " "drops and its scale rises, then the camera comes back in the afternoon and its tilt rises in the evening. The " "compensation absorbs most of it, but not all: in the late afternoon and the evening, with the tilt rising, " "corr_x of P5 and P7 dips clearly below its level of the morning, " "then they come back at the isolated measurement after the gap. Deduced cause: the camera and its mount " "move with the heat of the day (camera pose); the structure, a masonry wall, is not supposed to move like " "that. No temperature is available to confirm it. Normal, nothing to do." ), }, } ADDED = [ { "start": "2026-10-20T04:45Z", "end": "2026-10-20T08:00Z", "family": "Visibility", "description": ( "At night on 20/10, before dawn, the reference R1 is less well seen: its recognition error rises a notch at once and " "stays high until mid-morning, and its measured position slides alone in the image (the targets do not move " "relative to the overall movement). The compensation follows it: corr_y of P7, P6 and P5 rises together " "clearly for a few hours, while the reference R2 moves the other way, then everything comes back as the " "position of R1 returns, around eight. The train passage of that morning, labelled separately, falls inside. " "Nothing in front of R1 on the night images of 05:00, 06:00 and 07:00 (its spot whole, same place); the " "night is one of poor visibility for several faint targets (CV.6 rejected all night, F4.2 at times). Cause " "deduced: the reference less well seen in the night of poor visibility, not an obstacle. Do not trust the " "small shift of these curves over the range; this is not a movement of the structure." ), }, ] out = [] for lab in existing: lid = lab["id"] if lid in REMOVE: continue new = {k: v for k, v in lab.items() if k != "id"} if lid in CORRECT: new.update(CORRECT[lid]) new.pop("review", None) out.append(new) out.extend(ADDED) out.sort(key=lambda d: (d["start"], d["end"])) (HERE / "labels.jsonl").write_text("".join(json.dumps(d, ensure_ascii=False) + "\n" for d in out)) print(len(out), "labels;", len(REMOVE), "removed;", len(CORRECT), "corrected;", len(ADDED), "added")