Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/schema/v1/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,27 @@ Provenance {
"process_config_version_id": <option[int]> -- Web.Auto processing configuration version.
}
```

## Loading 0.x Datasets

`load_dataset()` reads a 0.x dataset (no `manifest.json`) by converting its tables to 1.0 records when loading, on a best-effort basis. Sensor data files stay as they are: one file per frame, and `sample_data.frame_index` is `null`.

Every 0.x frame becomes a `sample`: the files of all channels with the same frame number (e.g. `00042.jpg` and `00042.pcd.bin`, as the 0.x converter names them) form one frame. 0.x samples, which are annotated frames only, keep their tokens; 0.x samples of the same frame (one per camera image in camera-only datasets) are merged into the earliest one. A frame with a 2D label is a key frame.

Each 0.x `calibrated_sensor` row becomes a `sensor` row, keeping its token. The camera block takes its intrinsics and distortion from it, its size from `sample_data`, and the distortion model from the number of coefficients (0: `none`, 5: `plumb_bob`, 8: `rational_polynomial`). The LiDAR block is described from the first frame. Map `sha256` and `projector` are read from `map/lanelet2_map.osm` and `map/map_projector_info.yaml`.

Labels are `manual` unless 0.x marks them as autolabel (`provenance` = model names). `surface_ann` rows become `object_ann` rows without an instance, with `bbox` computed from the mask. 0.x visibility `unavailable` (or any unknown level) becomes `visibility_token: null`, and the aliases `v0-40`, `v40-60`, `v60-80`, `v80-100` map to `none`, `partial`, `most`, `full`.

1.0 requires some values that 0.x never stored. They are filled with these placeholders (`V0Converter.FALLBACKS`), which keep the dataset loadable but say nothing about it. In particular, `vehicle.model == "unknown"` means the vehicle dimensions are placeholders and must not be used, and `"unknown"` map IDs mean the map is not identified:

| Table / block | Field | Placeholder |
| --------------- | ----------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| `vehicle` | `model` | `"unknown"` |
| `vehicle` | `length`, `width`, `height`, `wheel_base` | `1.0` |
| `vehicle` | `name` | 0.x `log.vehicle`, `null` if empty |
| `map` | `map_id`, `version_id` | `"unknown"` |
| `map` | `source` | `"webauto"` |
| `ego_pose` | `source`, `frame` | `"localization"`, `"map"` |
| `sensor.camera` | `is_rectified` | `true` |
| `sensor.lidar` | `frame_id`, `is_undistorted`, `container.compression` | `"base_link"`, `true`, `"none"` |
| `sensor.lidar` | `fields` (`.bin`) | `x y z intensity channel return_type time_stamp`, cut to `num_pts_feats` (default 5), all `float32` |
4 changes: 2 additions & 2 deletions docs/schema/v1/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ attribute {

- Filename: `visibility.json`

Unchanged from 0.x.
Unknown visibility is `sample_annotation.visibility_token: null`; the 0.x level `unavailable` is dropped.

```json
visibility {
Expand Down Expand Up @@ -360,7 +360,7 @@ sample_annotation {
"sample_token": <str> -- Foreign key to the `Sample` table.
"instance_token": <str> -- Foreign key to the `Instance` table.
"attribute_tokens": <[str;N]> -- Foreign keys to the `Attribute` table.
"visibility_token": <str> -- Foreign key to the `Visibility` table.
"visibility_token": <option[str]> -- Foreign key to the `Visibility` table. `null` if unknown.
"translation": <[float;3]> -- Box center in meters.
"size": <[float;3]> -- (width, length, height) in meters.
"rotation": <[float;4]> -- Quaternion (w, x, y, z).
Expand Down
6 changes: 5 additions & 1 deletion t4_devkit/common/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
if TYPE_CHECKING:
from t4_devkit.typing import PathLike

__all__ = ("load_json", "save_json", "load_pointcloud", "load_image")
__all__ = ("load_json", "save_json", "load_pointcloud", "load_image", "V0_BIN_FIELDS")

# 0.x `.bin` layout: this list cut to `num_pts_feats`, all float32 (as written by the converter).
# `.bin` stores no names; these are the 1.0 names (0.x calls `channel` "ring"), all float32.
V0_BIN_FIELDS = ("x", "y", "z", "intensity", "channel", "return_type", "time_stamp")


def load_json(filename: PathLike) -> Any:
Expand Down
5 changes: 1 addition & 4 deletions t4_devkit/dataclass/pointcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import numpy as np
from attrs import define, field

from t4_devkit.common.io import load_json, load_pointcloud
from t4_devkit.common.io import V0_BIN_FIELDS, load_json, load_pointcloud
from t4_devkit.common.timestamp import Stamp

if TYPE_CHECKING:
Expand All @@ -31,9 +31,6 @@
# Point fields of `LidarPointCloud.points`, in row order.
XYZI = ("x", "y", "z", "intensity")

# 0.x `.bin` layout: this list cut to `num_pts_feats`, all float32 (as written by the converter).
V0_BIN_FIELDS = ("x", "y", "z", "intensity", "ring", "return_type", "time_stamp")


@define
class PointCloudSourceInfo:
Expand Down
1 change: 1 addition & 0 deletions t4_devkit/schema/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from .attribute import * # noqa
from .caption import * # noqa
from .category import * # noqa
from .convert_v0 import * # noqa
from .ego_pose import * # noqa
from .instance import * # noqa
from .keypoint import * # noqa
Expand Down
Loading
Loading