File size: 4,314 Bytes
527fb6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# linger_loaders

Python tools for the LiNGER dataset: loaders for the ceiling-LiDAR tracklets, the recorded point-cloud segments and
the environment files (static map, furniture, study area), the experimental flicker filter, and a replay tool that turns
tracklets into a Rerun recording. The loaders need only the standard library and NumPy and return NumPy arrays in the
shared coordinate frame (meters, z up), with field names as in the paper's appendix.

## Install

    pip install -e .                  # from this directory: loaders and flicker filter (NumPy only)
    pip install -e ".[quickstart]"    # adds matplotlib for examples/quickstart.py
    pip install -e ".[replay]"        # adds rerun-sdk 0.38.1 for the replay tool (needs Python 3.10 or newer)

## Quickstart

    python examples/quickstart.py /path/to/linger busy quickstart_busy.png

This plots the busy benchmark session's offline tracks over the static map and the study area.

## Loaders

The paths below are relative to the dataset root (the folder that holds `README.md`, `CONFIG.json` and
`environment/`), as laid out in the review sample.

```python
import csv, json
from linger_loaders import (load_tracklets, track_runs, load_segment, iter_frames,
                            load_static_map, load_furniture, load_study_area)

off = load_tracklets("benchmark/busy/tracks_final_5hz.csv.gz")    # t_unix, track_id, x, y, state, coasting
win = json.load(open("benchmark/busy/window.json"))["window_unix"]  # [start, end) in Unix seconds
live = load_tracklets("track_log/tracks_day15_000000.jsonl.gz", session=win)
starts = [float(r["started_unix"]) for r in csv.DictReader(open("metadata/tracker_runs.csv"))]
run = track_runs(live["stamp"], starts)        # key live tracks by (run[i], live["id"][i])

seg = load_segment("benchmark/busy/clouds/geo_day15_080014/node1__seg033")
for t_ms, pts in iter_frames(seg):              # pts: n x 3 float32, shared coordinate frame
    ...

sm = load_static_map("environment/static_map.npz")         # points (m), node, floor_z
furn = load_furniture("environment/furniture.json")         # list of dicts: id, label, x, y, len_m, wid_m, yaw_rad, shape
area = load_study_area("environment/study_area.json")       # n x 2 polygon
```

Live track IDs restart with the tracker, so they are unique only within one run. A state ending in `~coasting`
marks a row the tracker predicted without a detection.

## Flicker filter

`linger_loaders.flicker` is the experimental flicker filter. It writes a list of flagged live tracks and never
deletes any; the rule is described at the top of `linger_loaders/flicker.py`.

    python -m linger_loaders.flicker --logs track_log/tracks_day8_000000.jsonl.gz track_log/tracks_day15_000000.jsonl.gz \
        benchmark/quiet/tracks_live_day13_120200.jsonl.gz --runs metadata/tracker_runs.csv \
        --sessions metadata/flicker/session_spans.json --out flags.json --flagged-tsv flagged.tsv

The released flags were computed on the full logs, so running this command on the sample's logs gives nearly the same
set: a track cut off at the edge of a sample log can count differently. The `tracker_run` column holds the run's
position in `metadata/tracker_runs.csv`.

`linger-flicker` is the same command once the package is installed.

## Replay

`linger_loaders.replay` writes one Rerun recording per tracklet file: the static floor map with the study area and
the node positions, each current track as a point labeled with its ID, a trail of its last 3 s, and the number of
tracks present per frame. It reads only the released files (`environment/`, `CONFIG.json` and the tracklets).

    python -m linger_loaders.replay . track_log/tracks_day15_000000.jsonl.gz -o day15.rrd --title "Day 15"
    python -m linger_loaders.replay . benchmark/busy/tracks_live_day15_133000.jsonl.gz \
        benchmark/busy/tracks_final_5hz.csv.gz -o busy.rrd --title "Busy benchmark"
    rerun day15.rrd

With several tracklet files, the live and offline recordings share one file; switch between them in the viewer's
recording list. `linger-replay` is the same command once the package is installed.

## License

The code in this package is licensed under the MIT License (see `LICENSE`). The data it reads are licensed
separately, under CC BY-NC 4.0 (see the dataset's `LICENSE`).