メインコンテンツへスキップ
GitHub ソース

function box3d

box3d(
    center: 'npt.ArrayLike',
    size: 'npt.ArrayLike',
    orientation: 'npt.ArrayLike',
    color: 'RGBColor',
    label: 'Optional[str]' = None,
    score: 'Optional[numeric]' = None
) → Box3D
3D バウンディングボックス。ボックスは中心、サイズ、向きで指定します。 Args:
  • center: ボックスの中心点を表す長さ 3 の ndarray。
  • size: ボックスの X, Y, Z の各次元を表す長さ 3 の ndarray。
  • orientation: グローバルな XYZ 座標をボックスのローカル XYZ 座標に変換する回転を表す長さ 4 の ndarray。[r, x, y, z] は、ゼロでないクォータニオン r + xi + yj + zk に対応します。
  • color: ボックスの色を表す (r, g, b) タプル。0 <= r,g,b <= 1
  • label: ボックスに対する省略可能なラベル。
  • score: ボックスに対する省略可能なスコア。通常は検出の信頼度を示すために使用します。
Returns: Box3D オブジェクト。 Example: 次の例では、X, Y, Z 軸の周りに回転する 60 個のボックスを含む点群を作成します。
import wandb

import math
import numpy as np
from scipy.spatial.transform import Rotation


with wandb.init() as run:
    run.log(
         {
             "points": wandb.Object3D.from_point_cloud(
                 points=np.random.uniform(-5, 5, size=(100, 3)),
                 boxes=[
                     wandb.box3d(
                         center=(0.3 * t - 3, 0, 0),
                         size=(0.1, 0.1, 0.1),
                         orientation=Rotation.from_euler(
                             "xyz", [t * math.pi / 10, 0, 0]
                         ).as_quat(),
                         color=(0.5 + t / 40, 0.5, 0.5),
                         label=f"box {t}",
                         score=0.9,
                     )
                     for t in range(20)
                 ]
                 + [
                     wandb.box3d(
                         center=(0, 0.3 * t - 3, 0.3),
                         size=(0.1, 0.1, 0.1),
                         orientation=Rotation.from_euler(
                             "xyz", [0, t * math.pi / 10, 0]
                         ).as_quat(),
                         color=(0.5, 0.5 + t / 40, 0.5),
                         label=f"box {t}",
                         score=0.9,
                     )
                     for t in range(20)
                 ]
                 + [
                     wandb.box3d(
                         center=(0.3, 0.3, 0.3 * t - 3),
                         size=(0.1, 0.1, 0.1),
                         orientation=Rotation.from_euler(
                             "xyz", [0, 0, t * math.pi / 10]
                         ).as_quat(),
                         color=(0.5, 0.5, 0.5 + t / 40),
                         label=f"box {t}",
                         score=0.9,
                     )
                     for t in range(20)
                 ],
             ),
         }
    )