메인 콘텐츠로 건너뛰기
GitHub 소스

function box3d

box3d(
    center: 'npt.ArrayLike',
    size: 'npt.ArrayLike',
    orientation: 'npt.ArrayLike',
    color: 'RGBColor',
    label: 'str | None' = None,
    score: 'numeric | None' = 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)
                 ],
             ),
         }
    )