메인 콘텐츠로 건너뛰기
GitHub source

function box3d

box3d(
    center: 'npt.ArrayLike',
    size: 'npt.ArrayLike',
    orientation: 'npt.ArrayLike',
    color: 'RGBColor',
    label: 'Optional[str]' = None,
    score: 'Optional[numeric]' = None
) → Box3D
3D 바운딩 박스입니다. 박스는 중심(center), 크기(size), 방향(orientation)에 의해 정의됩니다. Args:
  • center: 박스의 중심점을 나타내는 길이가 3인 ndarray.
  • size: 박스의 X, Y, Z 차원 크기를 나타내는 길이가 3인 ndarray.
  • orientation: 전역 XYZ 좌표를 박스의 로컬 XYZ 좌표로 변환하는 회전 값으로, 0이 아닌 쿼터니언 r + xi + yj + zk에 대응하는 길이가 4인 ndarray [r, x, y, z]로 주어집니다.
  • color: 0 <= r,g,b <= 1 범위의 (r, g, b) 튜플로 표현된 박스의 색상.
  • label: 박스에 대한 선택적 라벨.
  • score: 박스에 대한 선택적 점수. 일반적으로 탐지(detection)의 신뢰도를 나타내는 데 사용됩니다.
Returns: Box3D object. 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(
                 # -5에서 5 사이의 균등 분포에서 100x3 포인트 생성
                 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)
                 ],
             ),
         }
    )