|
Download code/PYTHON.md from changh95/METEOR-2-p150: direct link, hf CLI and curl.
- Browser
- Download file 1.65 kB
-
https://huggingface.co/changh95/METEOR-2-p150/resolve/main/code/PYTHON.md
- Command line
-
hf download hf://changh95/METEOR-2-p150/code/PYTHON.md
-
curl -L -o PYTHON.md https://huggingface.co/changh95/METEOR-2-p150/resolve/main/code/PYTHON.md
1.65 kB
| # Python API of METEOR-2-p150 | |
| ```python | |
| from tt_meteor2 import METEOR2, load_sample | |
| with METEOR2.from_pretrained(variant="gather") as model: # or variant="npu"; weights -> HF cache, device, traces | |
| out = model(**load_sample("code/tt_meteor2/samples/synthetic_8cam.json")) | |
| body = out.to_dict() # the same JSON as POST /predict | |
| ``` | |
| `model(images=..., calibration=..., ego_speed=..., acc=..., ego_hist=..., route=..., **params)`: | |
| - `images`: the eight cameras (`CAM_FRONT_WIDE`, `CAM_FRONT_LEFT`, `CAM_FRONT_RIGHT`, `CAM_BACK_WIDE`, | |
| `CAM_BACK_LEFT`, `CAM_BACK_RIGHT`, `CAM_FRONT_NARROW`, `CAM_BACK_NARROW`) as `{name: path | bytes | RGB array}` | |
| or a list of `{"camera", "image" | "path" | "data", "intrinsics", "T_ref_from_camera"}`; 16:9, any size. | |
| - `calibration`: `{"cameras": {name: {"intrinsics": 3x3, "T_ref_from_camera": 4x4}}}` or `{"preset": name}`; | |
| required by `gather`, ignored by `npu`. | |
| - `ego_speed` (m/s), `acc` (m/s^2), `ego_hist` (32 values), `route` (13 values): METEOR 2's ego inputs | |
| (`tt-autoware/scripts/autoware/meteor2_lib.py` computes them from poses); zeros when absent. | |
| - params: `box_threshold` (0.30), `box_topk` (64), `occ_gate` (0.55), `occ_gate_strict` (0.92), `heads` (False). | |
| The result (`tt_meteor2.host.outputs.Meteor2Output`) holds `boxes` (`host.postprocess.Boxes`), `ego` [42], | |
| `ego_path_6s` [3, 12, 2], `tl` [4], `lane` [800, 500], `occ_cls` / `occ_p` / `occ_argmax` [16, 200, 200], | |
| `timing_ms`. Load-time knobs: `METEOR2_*` (`tt_meteor2.api.KNOBS`). Running it outside the container needs a | |
| tt-metal build at 44d6650 with the two patches in `patches/`. | |