Files
Mini-Nav/mini-nav/scenegraph/objectnode.py

25 lines
1.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from dataclasses import dataclass
import numpy as np
# --- 1. 物品节点:极其扁平,只存"当前最新/平均"状态 ---
@dataclass
class ObjectNode:
obj_id: str # 唯一ID (例如: "obj_001")
room_id: str # 所属房间的直接外键,不搞复杂的层级关系
# 位置:在 debug 阶段,一切认准全局坐标,不要搞局部坐标系
position: np.ndarray # [x, y, z] 世界坐标系下的中心点或锚点
# 特征:直接存你压缩后的 512bit 结果,不搞历史缓存
visual_hash: np.ndarray # 512bit 视觉特征 (用于外观检索)
semantic_hash: np.ndarray # 512bit 语义特征 (用于类别对齐)
# 原始图片mask处理并裁切后的图片数据二进制格式
image_bytes: bytes | None = None # numpy array.tobytes() 原始像素数据
# Debug 必备:极简的生命周期管理,防止满屏"幽灵节点"
hit_count: int = 1 # 被观测到的次数。太低的可以直接过滤掉
last_seen_frame: int = 0 # 最后一次看到的帧号或时间戳