首页 理论 架构 工程 文档 白皮书 著作 研究 案例 下载 博客 关于 开始使用 →

第36章 Perception

第36章 Perception

本章大纲

  1. 感知定义
  2. 感知与信息接收
  3. 感知与场景采集
  4. 感知元素
  5. 感知对象
  6. 感知属性
  7. 感知关系
  8. 感知状态
  9. 感知结果

36.1 感知定义

**Perception(感知)**是 SAI Framework 中负责对已经进入系统的信息和已经采集形成的场景进行识别、提取、组织和状态判断,并形成可供后续认知处理的感知结果的核心过程。

简单来说:

感知就是 SAI 从已经获取的信息中识别“现在有什么、在哪里、是什么状态、彼此有什么可识别联系”。

感知并不是简单地“接收信息”。

它位于:

外部世界
   ↓
InformationSource
   ↓
InformationReceiver
   ↓
Information
   ↓
SceneCollector
   ↓
Scene
   ↓
Perception
   ↓
Element / Object / Property / Relation / State
   ↓
Cognition

因此,Perception 是从:

“获取到的信息”

进入:

“已经识别出的世界结构”

的重要环节。


36.2 感知与信息接收

InformationReceiver 与 Perception 是两个不同层次。

InformationReceiver
        ↓
“信息进来了”

Perception
        ↓
“信息中识别出了什么”

例如温度传感器发送:

32℃

InformationReceiver 负责:

接收
 ↓
验证
 ↓
形成 Information

得到:

Information
{
    source = temperature-001
    type   = temperature
    value  = 32
}

Perception 再处理:

Information
   ↓
识别
   ↓
Element

例如:

Element
{
    type  = temperature
    value = 32
}

所以:

InformationReceiver = 接收

Perception = 感知

二者不能混为一谈。


36.3 感知与场景采集

SceneCollector 的主要职责是:

从多个信息源持续获取信息,并组织形成 Scene。

Perception 的职责则是:

对 Scene 进行识别和提取。

因此:

SceneCollector
    ↓
Scene
    ↓
Perception

例如外部环境:

温度传感器 → 32℃
摄像设备   → 检测到人
设备状态   → 风扇关闭
位置系统   → 客厅

SceneCollector 把它们组织成:

Scene
├── Space
│   └── living-room
│
├── Environment
│   └── temperature = 32
│
├── Objects
│   ├── person
│   └── fan
│
└── States
    ├── person = present
    └── fan = off

然后 Perception 处理 Scene:

Scene
   ↓
Perception
   ↓
识别元素
   ↓
识别对象
   ↓
识别属性
   ↓
识别关系
   ↓
识别状态

36.3.1 SceneCollector 与 Perception 的区别

模块 主要任务
InformationReceiver 接收信息
SceneCollector 采集并组织场景
Perception 感知和识别场景
Cognition 理解感知结果

可以形成:

获取
 ↓
采集
 ↓
感知
 ↓
认知

也就是:

Information
   ↓
Scene
   ↓
Perception
   ↓
Cognition

36.4 感知元素

Perception 首先需要从 Information 或 Scene 中识别 Element。

例如:

客厅温度32℃,有人,风扇关闭。

感知结果可以提取:

Element
├── living-room
├── temperature
├── 32
├── person
├── present
├── fan
└── off

这些 Element 是后续对象建立的基础。


36.4.1 Element 感知过程

可以表示为:

Scene
 ↓
信息解析
 ↓
候选元素
 ↓
元素类型识别
 ↓
元素值识别
 ↓
元素来源确定
 ↓
Element

例如:

温度32℃

感知得到:

Element
type  = property
value = temperature

以及:

Element
type  = value
value = 32

36.4.2 感知元素不是理解元素

例如 Perception 得到:

temperature = 32

这表示:

系统识别出了温度元素

但还没有进行复杂理解。

例如:

32℃ 是否属于高温?
是否需要开启风扇?
是否适合人员活动?

这些属于后续 Cognition、Reasoning 和 Decision。

因此:

Perception → 识别
Cognition  → 理解
Reasoning  → 推导
Decision   → 选择

36.5 感知对象

Element 被识别以后,Perception 可以进一步识别 Object。

例如:

fan
off
speed
0
living-room

Perception 可以识别:

Object Candidate
type = fan

如果已经存在:

fan-001

则感知过程可以把新的 Element 与已有 Object 进行匹配。

Element
   ↓
Object Matching
   ↓
fan-001

如果不存在:

Element
   ↓
Object Identification
   ↓
Create Object
   ↓
fan-001

因此 Perception 可以参与:

识别对象
 ↓
查找已有对象
 ↓
匹配
 ↓
建立新对象或更新已有对象

36.5.1 感知对象不是完整认知

Perception 发现:

fan-001

表示:

当前感知结果中存在一个 Fan 对象。

但 Cognition 进一步处理:

这个 Fan 当前是什么状态?
它与谁有关?
它是否与当前任务有关?

所以:

Perception → 发现对象
Cognition  → 理解对象

36.6 感知属性

Object 被识别以后,Perception 可以进一步识别其 Property。

例如:

fan
speed = 1200
location = living-room

形成:

Fan
├── speed = 1200
└── location = living-room

36.6.1 属性感知

基本过程:

Object
   ↓
识别相关 Element
   ↓
属性名称
   ↓
属性值
   ↓
属性来源
   ↓
Property

例如:

temperature = 32

形成:

Property
{
    name   = temperature
    value  = 32
    source = temperature-001
}

36.6.2 属性变化

如果之前:

speed = 0

当前感知:

speed = 1200

Perception 可以识别:

PropertyChanged
speed
0 → 1200

这样后续系统就能够知道:

当前值
+
变化
+
变化来源
+
变化时间

36.7 感知关系

Perception 不仅识别对象,还需要识别对象之间已经存在于场景中的关系。

例如:

客厅中有一个人和一个风扇。

可以形成:

person-001
    ↓
located_at
    ↓
room-001

以及:

fan-001
    ↓
located_at
    ↓
room-001

36.7.1 关系感知过程

Scene
 ↓
识别对象
 ↓
识别对象之间联系
 ↓
确定 Relation Type
 ↓
建立 Relation

例如:

Fan
Room

如果场景信息明确:

Fan is in Living Room

则建立:

fan-001
→ located_at
→ room-001

36.7.2 感知关系不是因果推理

例如 Perception 感知到:

fan-001
located_at
room-001

它只表示:

风扇位于客厅。

不能直接变成:

fan-001 causes room-cooling

更不能直接推出:

应该打开风扇

后面的因果判断、规则推理和行为选择属于:

Cognition
 ↓
Reasoning
 ↓
Decision

36.8 感知状态

State 是 Perception 的另一个重要输出。

例如:

Fan
state = off

Perception 可以得到:

Object State
fan-001 = off

也可以识别:

Person
state = present

以及:

Room
state = occupied

36.8.1 状态感知

基本过程:

Information / Scene
        ↓
识别对象
        ↓
识别状态元素
        ↓
确定状态
        ↓
Object State

例如:

Element
type  = state
value = off
source = fan-001

形成:

Fan
state = off

36.8.2 状态变化

如果上一时刻:

Fan
state = off

当前感知:

Fan
state = on

则可以得到:

StateChanged
off → on

这类变化信息可以进入:

Memory
Feedback
Reasoning
Decision
Learning

具体进入哪个模块,由 Central、Dispatcher 和 Coordinator 根据系统流程负责。


36.9 感知结果

Perception 最终不是只返回一个“true/false”。

它应该形成结构化的 PerceptionResult(感知结果)

例如:

PerceptionResult
{
    scene
    elements
    objects
    properties
    relations
    states
    changes
    time
    source
}

36.9.1 感知结果结构

可以展开为:

PerceptionResult
│
├── Scene
│
├── Elements
│
├── Objects
│
├── Properties
│
├── Relations
│
├── States
│
├── Changes
│
├── Time
│
└── Source

例如:

PerceptionResult
{
    scene: "scene-001",

    elements:
    [
        "living-room",
        "temperature",
        32,
        "person",
        "present",
        "fan",
        "off"
    ],

    objects:
    [
        "room-001",
        "person-001",
        "fan-001"
    ],

    properties:
    [
        "temperature = 32",
        "location = living-room",
        "speed = 0"
    ],

    relations:
    [
        "person-001 located_at room-001",
        "fan-001 located_at room-001"
    ],

    states:
    [
        "room-001 = occupied",
        "person-001 = present",
        "fan-001 = off"
    ]
}

36.10 Perception 的核心工作流程

把本章九个部分统一起来:

Information
      ↓
Scene
      ↓
Perception
      │
      ├── Element Recognition
      │
      ├── Object Recognition
      │
      ├── Property Recognition
      │
      ├── Relation Recognition
      │
      └── State Recognition
      │
      ↓
PerceptionResult
      ↓
Cognition

可以进一步表示:

              Perception
                   │
        ┌──────────┼──────────┐
        ↓          ↓          ↓
     Element     Object     State
                   │
              ┌────┴────┐
              ↓         ↓
          Property   Relation
              │         │
              └────┬────┘
                   ↓
          PerceptionResult

36.11 Perception 与 EOM

第34、35章已经建立 EOM:

Element
   ↓
Object
   ├── Property
   ├── State
   ├── Relation
   └── Method

第36章的 Perception 就是进入 EOM 的重要入口。

Scene
 ↓
Perception
 ↓
Element
 ↓
Object
 ↓
Property
 ↓
State
 ↓
Relation
 ↓
EOM

这里需要注意:

Perception 不等于 EOM。

Perception 是:

感知过程

EOM 是:

对象组织结构

因此:

Perception → 产生和更新感知结构

EOM → 保存和组织对象结构

36.12 PerceptionEngine

在工程实现上,可以使用 PerceptionEngine 承担主要感知处理。

基本结构:

Perception
    ↓
PerceptionEngine
    ├── ElementRecognizer
    ├── ObjectRecognizer
    ├── PropertyRecognizer
    ├── RelationRecognizer
    └── StateRecognizer

例如:

namespace SAI\Perception;

class PerceptionEngine
{
    public function process($scene)
    {
        $result = array();

        $result['elements'] =
            $this->recognizeElements($scene);

        $result['objects'] =
            $this->recognizeObjects(
                $result['elements']
            );

        $result['properties'] =
            $this->recognizeProperties(
                $result['objects'],
                $result['elements']
            );

        $result['relations'] =
            $this->recognizeRelations(
                $scene,
                $result['objects']
            );

        $result['states'] =
            $this->recognizeStates(
                $scene,
                $result['objects']
            );

        return $result;
    }

    protected function recognizeElements($scene)
    {
        return array();
    }

    protected function recognizeObjects($elements)
    {
        return array();
    }

    protected function recognizeProperties(
        $objects,
        $elements
    ) {
        return array();
    }

    protected function recognizeRelations(
        $scene,
        $objects
    ) {
        return array();
    }

    protected function recognizeStates(
        $scene,
        $objects
    ) {
        return array();
    }
}

这个结构体现了:

Scene
 ↓
PerceptionEngine
 ↓
Elements
 ↓
Objects
 ↓
Properties
 ↓
Relations
 ↓
States
 ↓
PerceptionResult

以上 PHP 代码是本章的设计示例,用于说明 SAI Framework 的 OOP 结构,未作为实际项目代码执行验证。


36.13 实际运行案例

继续使用前面客厅案例。

输入:

客厅温度 32℃,有人,风扇关闭。


第一步:Scene 输入

Scene
├── location = living-room
├── temperature = 32
├── person = present
└── fan = off

第二步:Perception 识别 Element

Elements
├── living-room
├── temperature
├── 32
├── person
├── present
├── fan
└── off

第三步:Perception 识别 Object

Objects
├── room-001
├── person-001
└── fan-001

第四步:Perception 识别 Property

room-001
└── temperature = 32

person-001
└── location = living-room

fan-001
└── location = living-room

第五步:Perception 识别 State

room-001
└── occupied

person-001
└── present

fan-001
└── off

第六步:Perception 识别 Relation

person-001
→ located_at
→ room-001

fan-001
→ located_at
→ room-001

第七步:形成 PerceptionResult

PerceptionResult
│
├── Elements
│   ├── living-room
│   ├── temperature
│   ├── 32
│   ├── person
│   ├── present
│   ├── fan
│   └── off
│
├── Objects
│   ├── room-001
│   ├── person-001
│   └── fan-001
│
├── Properties
│   ├── room.temperature = 32
│   ├── person.location = living-room
│   └── fan.location = living-room
│
├── States
│   ├── room = occupied
│   ├── person = present
│   └── fan = off
│
└── Relations
    ├── person → located_at → room
    └── fan → located_at → room

然后:

PerceptionResult
        ↓
Cognition

Cognition 才开始处理:

这些对象之间是什么关系?
当前状态意味着什么?
哪些信息与当前任务相关?

36.14 Perception 的边界

为了保证 SAI Framework 的层次清晰,Perception 不应该承担以下职责:

Perception
├── 不负责最终理解
├── 不负责复杂推理
├── 不负责最终决策
├── 不负责执行行为
├── 不负责学习
└── 不负责长期记忆

它主要负责:

获取后的识别
+
结构提取
+
对象发现
+
属性识别
+
关系识别
+
状态识别
+
变化识别

因此:

InformationReceiver
→ 接收

SceneCollector
→ 采集

Perception
→ 感知

Cognition
→ 认知

Reasoning
→ 推理

Decision
→ 决策

Behavior
→ 行为

本章小结

第36章建立了 SAI Framework 的 Perception(感知)层

核心定义:

Perception 是 SAI 对已经接收到的信息和已经形成的场景进行识别、提取、组织,并形成元素、对象、属性、关系和状态等感知结果的过程。

完整流程:

外部世界
   ↓
InformationSource
   ↓
InformationReceiver
   ↓
Information
   ↓
SceneCollector
   ↓
Scene
   ↓
Perception
   ↓
Element
   ↓
Object
   ├── Property
   ├── State
   └── Relation
   ↓
PerceptionResult
   ↓
Cognition

本章最重要的层次关系:

InformationReceiver
    = 信息进入

SceneCollector
    = 场景形成

Perception
    = 识别场景

EOM
    = 组织对象

Cognition
    = 理解对象

因此,SAI 的感知过程可以概括为:

Scene
 ↓
发现 Element
 ↓
识别 Object
 ↓
识别 Property
 ↓
识别 Relation
 ↓
识别 State
 ↓
形成 PerceptionResult
 ↓
进入 Cognition

Perception 解决的是“看到了什么、识别出了什么”,而不是“这些东西最终意味着什么”。

这一区分非常重要。只有保持:

感知 ≠ 认知
识别 ≠ 理解
关系识别 ≠ 因果推理
状态识别 ≠ 决策

SAI Framework 后面的 Cognition(认知) 才能建立在清晰、结构化的感知结果之上。

Leave a Reply

Your email address will not be published. Required fields are marked *