메인 콘텐츠로 건너뛰기
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: 길이 3의 ndarray로 주어진 박스의 X, Y, Z 차원.
  • orientation: 전역 XYZ 좌표계를 박스의 로컬 XYZ 좌표계로 변환하는 회전. 길이 4의 ndarray [r, x, y, z]로 주어지며, 0이 아닌 쿼터니언 r + xi + yj + zk에 해당함.
  • color: 0 <= r,g,b <= 1 범위를 갖는 (r, g, b) 튜플로 표현된 박스의 색상.
  • 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)
                 ],
             ),
         }
    )