集約LiDARとカメラシーケンス
集約はタスク定義/アノテーション指示に移行されます。
Kognic IO v2.9.0以降、集約シーンのサポートが変更されます。
アノテーション指示(旧タスク定義)では、シーン自体が集約LiDARとカメラシーケンスでなくても、集約ビューを使用したアノテーションを要求できるようになりました。
このようなケースでは、標準のLiDARとカメラシーケンスシーンを使用できるようにしたため、以下に記載されている集約LiDARとカメラシーケンスシーンを個別に作成する必要がなくなりました。
このアプローチにより、1つのLiDARとカメラシーケンスシーンを、集約またはシーケンシャルのセットアップを組み合わせて、オプションで異なるプレアノテーションを使用しながら、複数回アノテーションすることが可能になります。
この作業方法の詳細については、Kognicまでお問い合わせください。
AggregatedLidarsAndCamerasSeqシーンは、カメラ画像とLiDAR点群のシーケンスで構成され、各フレームには1〜20枚のカメラ画像と1〜20個の点群が含まれます(点群を事前に集約している場合、最初のフレームに1〜20個の点群が含まれ、その他のフレームには点群が0個になります)。AggregatedLidarsAndCamerasSeqがLidarsAndCamerasSeqと異なる点は、アノテーション中に点群が時間的に集約され、最初のフレームの座標系における1つの大きな点群が生成されることです。そのため、このタイプのシーンでは自車両モーションデータが必須です。AggregatedLidarsAndCamerasSeqオブジェクトの各フィールドの詳細については、シーンの概要概要の関連セクションをご覧ください。
使用する座標系の詳細については、座標系座標系を参照してください。
from __future__ import absolute_import
from datetime import datetime
from typing import Optional
from uuid import uuid4
import kognic.io.model.scene.aggregated_lidars_and_cameras_seq as ALCSM
from examples.calibration.calibration import create_sensor_calibration
from kognic.io.client import KognicIOClient
from kognic.io.logger import setup_logging
from kognic.io.model import CreateSceneResponse, EgoVehiclePose, Image, PointCloud, Position, RotationQuaternion
def run(client: KognicIOClient, dryrun: bool = True, **kwargs) -> Optional[CreateSceneResponse]:
print("Creating Lidar and Camera Sequence Scene...")
lidar_sensor1 = "lidar"
cam_sensor1 = "RFC01"
cam_sensor2 = "RFC02"
metadata = {"location-lat": 27.986065, "location-long": 86.922623, "vehicle_id": "abg"}
# Create calibration
# (Please refer to the API documentation about calibration for more details)
calibration_spec = create_sensor_calibration(
f"Collection {datetime.now()}",
[lidar_sensor1],
[cam_sensor1, cam_sensor2],
)
created_calibration = client.calibration.create_calibration(calibration_spec)
scene = ALCSM.AggregatedLidarsAndCamerasSequence(
external_id=f"Aggregated-LCS-full-example-{uuid4()}",
frames=[
ALCSM.Frame(
frame_id="1",
relative_timestamp=0,
point_clouds=[
PointCloud(
filename="./examples/resources/point_cloud_RFL01.las",
sensor_name=lidar_sensor1,
),
],
images=[
Image(
filename="./examples/resources/img_RFC01.jpg",
sensor_name=cam_sensor1,
),
Image(
filename="./examples/resources/img_RFC02.jpg",
sensor_name=cam_sensor2,
),
],
metadata={"dut_status": "active"},
ego_vehicle_pose=EgoVehiclePose(
position=Position(x=1.0, y=1.0, z=1.0),
rotation=RotationQuaternion(w=0.01, x=1.01, y=1.01, z=1.01),
),
),
ALCSM.Frame(
frame_id="2",
relative_timestamp=500,
point_clouds=[
PointCloud(
filename="./examples/resources/point_cloud_RFL02.las",
sensor_name=lidar_sensor1,
),
],
images=[
Image(
filename="./examples/resources/img_RFC11.jpg",
sensor_name=cam_sensor1,
),
Image(
filename="./examples/resources/img_RFC12.jpg",
sensor_name=cam_sensor2,
),
],
ego_vehicle_pose=EgoVehiclePose(
position=Position(x=2.0, y=2.0, z=2.0),
rotation=RotationQuaternion(w=0.01, x=2.01, y=2.01, z=2.01),
),
),
ALCSM.Frame(
frame_id="3",
relative_timestamp=1000,
point_clouds=[
PointCloud(
filename="./examples/resources/point_cloud_RFL02.csv",
sensor_name=lidar_sensor1,
),
],
images=[
Image(
filename="./examples/resources/img_RFC11.jpg",
sensor_name=cam_sensor1,
),
Image(
filename="./examples/resources/img_RFC12.jpg",
sensor_name=cam_sensor2,
),
],
ego_vehicle_pose=EgoVehiclePose(
position=Position(x=3.0, y=3.0, z=3.0),
rotation=RotationQuaternion(w=0.01, x=2.01, y=2.01, z=2.01),
),
),
],
calibration_id=created_calibration.id,
metadata=metadata,
)
# Create scene
return client.aggregated_lidars_and_cameras_seq.create(scene, dryrun=dryrun, **kwargs)
if __name__ == "__main__":
setup_logging(level="INFO")
client = KognicIOClient()
# Project - Available via `client.project.get_projects()`
project = "<project-identifier>"
run(client, project=project)dryrunを使用してシーンを検証する
メソッド呼び出しでdryrunパラメータをtrueに設定すると、APIを使用してシーンが検証されますが、実際には作成されません。
キャリブレーションの再利用
可能であれば、同じキャリブレーションを複数のシーンで再利用でき、また再利用すべきです。