第二章
感知元素分类理论
Perception Element Classification Theory
2.1 感知元素分类理论提出
上一章定义了:
感知元素是外部信息经过采集、解析、结构化后形成的信息对象。
但是现实世界的信息来源具有多样性。
人类认知系统并不是通过单一方式感知环境,而是通过:
- 视觉;
- 听觉;
- 触觉;
- 味觉;
- 空间感觉;
- 状态变化感知;
共同形成对环境的认识。
因此 WSaiOS 将感知元素按照信息来源和表现形式进行分类。
形成:
感知元素分类体系
感知元素 Perception Element
├ 文字感知元素 Text Element
├ 图片感知元素 Image Element
├ 视频感知元素 Video Element
├ 音频感知元素 Audio Element
├ 味觉感知元素 Taste Element
├ 触觉感知元素 Touch Element
├ 空间感知元素 Space Element
└ 状态感知元素 State Element
2.2 文字感知元素
Text Perception Element
2.2.1 定义
文字感知元素是:
系统通过文字、符号、数字、语言文本等信息形成的结构化感知对象。
文字是人类最重要的信息表达方式之一。
例如:
输入:
深圳今天温度30℃
经过感知处理:
形成:
{
"type":"Weather",
"attribute":{
"city":"深圳",
"temperature":30
}
}
2.2.2 文字元素组成
文字感知元素:
Text Element
├ Character
├ Word
├ Sentence
├ Entity
├ Attribute
└ Meaning
例如:
文本:
苹果公司发布新手机
解析:
Entity:
Apple
Product:
Phone
Action:
Release
形成:
文字感知元素。
2.2.3 文字元素作用
主要用于:
- 信息获取;
- 知识抽取;
- 对象描述;
- 规则表达;
- 经验记录。
2.3 图片感知元素
Image Perception Element
2.3.1 定义
图片感知元素是:
从静态图像中提取对象、属性、空间结构和视觉状态形成的信息元素。
图片提供:
静态视觉结构
例如:
图片:
办公室照片
包含:
Person
Desk
Computer
Chair
Room
形成:
{
"type":"Office Scene",
"elements":[
"Person",
"Desk",
"Computer"
]
}
2.3.2 图片元素组成
Image Element
├ Object
├ Shape
├ Color
├ Texture
├ Position
├ Size
└ Spatial Relation
例如:
一个杯子:
Object:
Cup
Attribute:
Color=White
Position:
Desk Top
2.3.3 图片元素特点
图片主要表达:
空间结构。
即:
“有什么”。
例如:
图片可以表达:
- 一个物体;
- 多个物体;
- 场景布局;
- 设备状态。
2.4 视频感知元素
Video Perception Element
2.4.1 定义
视频感知元素是:
由连续图像帧组成,用于表达对象行为、事件过程和状态变化的信息元素。
图片:
表示:
静态状态。
视频:
表示:
动态过程。
关系:
Image Element
↓
Frame Sequence
↓
Video Element
2.4.2 视频元素组成
Video Element
├ Object
├ Motion
├ Action
├ Event
├ Time
├ Change
└ Process
例如:
监控视频:
发现:
Person
↓
Walk
↓
Enter Room
形成:
事件元素。
2.4.3 视频元素作用
用于:
- 行为分析;
- 事件检测;
- 状态预测;
- 过程理解。
2.5 音频感知元素
Audio Perception Element
2.5.1 定义
音频感知元素是:
系统通过声音、语音、环境声等信息形成的听觉结构元素。
声音提供:
时间连续信息。
例如:
声音:
机器异常声音
转换:
{
"type":"Machine Sound",
"state":"Abnormal",
"confidence":0.85
}
2.5.2 音频元素组成
Audio Element
├ Voice
├ Frequency
├ Volume
├ Rhythm
├ Emotion
└ Sound Event
2.5.3 音频元素应用
包括:
- 语音理解;
- 声音识别;
- 工业异常检测;
- 环境分析。
2.6 味觉感知元素
Taste Perception Element
2.6.1 定义
味觉感知元素是:
对物质味觉特征进行结构化表达的信息元素。
例如:
食品分析:
输入:
Taste Sensor
输出:
{
"type":"Food",
"taste":{
"sweet":0.8,
"sour":0.2
}
}
2.6.2 味觉元素组成
Taste Element
├ Flavor
├ Chemical Feature
├ Intensity
├ Quality
└ Preference
2.6.3 应用
包括:
- 食品智能分析;
- 厨房机器人;
- 食品质量检测。
2.7 触觉感知元素
Touch Perception Element
2.7.1 定义
触觉感知元素是:
通过压力、温度、力度、材质等物理接触信息形成的元素。
例如:
机器人抓取:
传感器:
Pressure=20N
形成:
{
"type":"Object Contact",
"force":20,
"state":"Holding"
}
2.7.2 触觉元素组成
Touch Element
├ Pressure
├ Temperature
├ Force
├ Texture
└ Contact State
2.7.3 应用
包括:
- 机器人;
- 智能制造;
- 医疗设备。
2.8 空间感知元素
Space Perception Element
2.8.1 定义
空间感知元素是:
用于描述对象位置、距离、方向和空间关系的信息元素。
人类认识环境:
不仅知道有什么。
还知道:
在哪里。
例如:
Person
Position:
Room A
Distance:
2m
Direction:
North
2.8.2 空间元素组成
Space Element
├ Position
├ Distance
├ Direction
├ Dimension
├ Layout
└ Topology
2.8.3 应用
包括:
- 自动驾驶;
- 机器人;
- 智慧城市;
- 工业空间管理。
2.9 状态感知元素
State Perception Element
2.9.1 定义
状态感知元素是:
描述对象当前状态以及状态变化的信息元素。
任何对象都具有状态。
例如:
设备:
Running
Stopped
Warning
人员:
Standing
Walking
Working
2.9.2 状态元素组成
State Element
├ Current State
├ Previous State
├ Change
├ Time
└ Trend
2.9.3 状态变化模型
状态:
StS_tSt
经过时间:
ttt
变化:
St+1S_{t+1}St+1
形成:
动态感知。
2.10 多类型感知元素融合
现实环境不是单一信息。
例如:
智能办公室:
同时包含:
图片元素
+
视频元素
+
音频元素
+
空间元素
+
状态元素
融合:
Multi Perception Elements
↓
Scene Element
↓
Cognitive Element
例如:
摄像头看到:
Person
麦克风听到:
Speech
空间系统发现:
Meeting Room
综合:
形成:
Meeting Event
2.11 感知元素分类体系总结
WSaiOS 感知元素体系:
感知元素
├ 文字
├ 图片
├ 视频
├ 音频
├ 味觉
├ 触觉
├ 空间
└ 状态
不同元素承担不同信息表达:
| 类型 | 主要表达 |
|---|---|
| 文字元素 | 语义信息 |
| 图片元素 | 视觉结构 |
| 视频元素 | 时间过程 |
| 音频元素 | 声音变化 |
| 味觉元素 | 物质特征 |
| 触觉元素 | 物理接触 |
| 空间元素 | 位置关系 |
| 状态元素 | 变化过程 |
本章总结
WSaiOS 通过感知元素分类,将复杂现实信息转换为不同类型的结构化对象。
形成:
现实信息
↓
多类型感知元素
↓
元素融合
↓
认知元素
↓
理解与推理
下一章:
第三章
视觉感知元素理论
Visual Perception Element Theory
重点:
- 图片元素;
- 视频元素;
- 视觉对象模型;
- 静态视觉结构;
- 动态视觉过程;
- 视觉元素生成系统。
Perception Element Classification Theory Engineering Implementation
前面的章节建立了 WSaiOS 感知元素分类理论。
但是对于 WSaiOS 工程系统而言:
分类理论必须转换为可运行的软件对象体系。
因此本节研究:
如何使用 PHP OOP + MVC + Smarty 架构,实现不同类型感知元素。
2.12 感知元素分类与 OOP 映射模型
理论分类:
Perception Element
├ Text Element
├ Image Element
├ Video Element
├ Audio Element
├ Taste Element
├ Touch Element
├ Space Element
└ State Element
转换为面向对象:
AbstractElement
|
|
PerceptionElement
|
---------------------------------
TextElement
ImageElement
VideoElement
AudioElement
TasteElement
TouchElement
SpaceElement
StateElement
即:
每一种感知类型:
都是一个独立 Class。
2.13 WSaiOS Element Interface设计
ElementInterface.php
目录:
wsaios
/core
/interface
ElementInterface.php
代码:
<?php
interface ElementInterface
{
// 获取元素类型
public function getType();
// 获取元素属性
public function getAttributes();
// 获取状态
public function getState();
// 分析元素
public function analyze();
// 转换认知对象
public function toCognitive();
}
接口定义:
所有感知元素必须拥有:
- 类型;
- 属性;
- 状态;
- 分析能力;
- 认知转换能力。
2.14 AbstractElement基础类
目录:
core
/element
AbstractElement.php
代码:
<?php
abstract class AbstractElement
implements ElementInterface
{
protected $id;
protected $type;
protected $attributes=[];
protected $state;
protected $createdTime;
public function getType()
{
return $this->type;
}
public function getAttributes()
{
return $this->attributes;
}
public function getState()
{
return $this->state;
}
public function setState($state)
{
$this->state=$state;
}
abstract public function analyze();
}
作用:
提供所有元素共同能力。
2.15 TextElement工程实现
文字感知元素
应用:
WSaiOS GEO关键词分析。
例如:
输入:
electric toothbrush supplier Miami Florida
生成:
TextElement
{
keyword:
electric toothbrush supplier
entity:
Miami
intent:
business
}
Class:
<?php
class TextElement
extends AbstractElement
{
protected $content;
public function setContent($content)
{
$this->content=$content;
}
public function analyze()
{
return [
"type"=>"text",
"content"=>$this->content
];
}
}
对应:
文字
↓
TextElement
↓
语义分析
↓
Cognitive Element
2.16 ImageElement工程实现
图片元素:
保存:
视觉对象。
例如:
Product Image
↓
Object
↓
Attribute
Class:
<?php
class ImageElement
extends AbstractElement
{
protected $objects=[];
protected $position;
public function analyze()
{
return [
"objects"=>$this->objects,
"position"=>$this->position
];
}
}
应用:
- 商品识别;
- 工业检测;
- 视觉搜索。
2.17 VideoElement工程实现
视频:
本质:
连续 ImageElement。
模型:
Frame1
↓
Frame2
↓
Frame3
↓
VideoElement
Class:
<?php
class VideoElement
extends AbstractElement
{
protected $frames=[];
protected $motion;
public function analyze()
{
return [
"frame_count"=>count($this->frames),
"motion"=>$this->motion
];
}
}
视频元素增加:
时间维度。
2.18 AudioElement工程实现
声音:
转换:
Wave Data
↓
Audio Feature
↓
Audio Element
Class:
<?php
class AudioElement
extends AbstractElement
{
protected $frequency;
protected $volume;
protected $soundType;
public function analyze()
{
return [
"sound"=>$this->soundType,
"volume"=>$this->volume
];
}
}
应用:
- 语音识别;
- 设备异常检测。
2.19 SpaceElement工程实现
空间元素:
WSaiOS GEO系统核心。
例如:
USA
↓
Florida
↓
Miami
↓
Business Location
Class:
<?php
class SpaceElement
extends AbstractElement
{
protected $country;
protected $state;
protected $city;
public function analyze()
{
return [
"country"=>$this->country,
"state"=>$this->state,
"city"=>$this->city
];
}
}
对应:
WSaiOS GEO:
Keyword
↓
SpaceElement
↓
Location Cognition
2.20 StateElement工程实现
状态元素:
描述变化。
例如:
设备:
Running
↓
Warning
↓
Stopped
Class:
<?php
class StateElement
extends AbstractElement
{
protected $current;
protected $previous;
public function change($newState)
{
$this->previous=$this->current;
$this->current=$newState;
}
public function analyze()
{
return [
"from"=>$this->previous,
"to"=>$this->current
];
}
}
形成:
状态变化链。
2.21 Element Factory 工厂模式
问题:
系统不知道:
输入属于哪个元素。
例如:
text
image
geo
health
需要动态创建。
设计:
Factory
↓
Element Object
目录:
core
/factory
ElementFactory.php
代码:
<?php
class ElementFactory
{
public static function create($type)
{
switch($type)
{
case "text":
return new TextElement();
case "image":
return new ImageElement();
case "space":
return new SpaceElement();
case "state":
return new StateElement();
}
}
}
调用:
$element =
ElementFactory::create("space");
优势:
增加新元素:
不修改核心代码。
2.22 MVC架构整合
完整结构:
WSaiOS
app
├── Controller
│
│ PerceptionController.php
├── Model
│
│ TextElement.php
│ ImageElement.php
│ SpaceElement.php
├── Service
│
│ PerceptionService.php
├── Repository
│
│ ElementRepository.php
├── View
│
│ Smarty Templates
core
├── Interface
├── Abstract
└── Factory
2.23 Controller调用流程
用户输入:
electric toothbrush distributor Miami
进入:
Browser
↓
Controller
Controller:
class PerceptionController
{
public function create()
{
$type="text";
$element=
ElementFactory::create($type);
$element->analyze();
return $element;
}
}
流程:
Request
↓
Controller
↓
Factory
↓
Element Object
↓
Service
↓
Repository
↓
Smarty
2.24 数据库持久化设计
感知元素需要记忆。
数据库:
perception_elements
结构:
| 字段 | 说明 |
|---|---|
| id | 编号 |
| type | 元素类型 |
| source | 来源 |
| attributes | 属性 |
| state | 状态 |
| confidence | 可信度 |
| created_time | 时间 |
SQL:
CREATE TABLE perception_elements
(
id INT AUTO_INCREMENT PRIMARY KEY,
type VARCHAR(50),
source VARCHAR(255),
attributes TEXT,
state VARCHAR(50),
confidence FLOAT,
created_time TIMESTAMP
);
对象:
保存:
Object
↓
Repository
↓
Database
2.25 WSaiOS 感知元素扩展能力
未来行业:
无需修改核心。
例如:
增加:
餐饮元素
RestaurantElement
继承:
AbstractElement
增加:
企业元素
EnterpriseElement
增加:
产品元素
ProductElement
形成:
核心认知系统
|
|
行业Element插件
2.26 本章工程总结
第二章最终形成:
理论层
现实信息
↓
分类感知元素
软件层
Interface
↓
Abstract Class
↓
Element Class
↓
Service
↓
MVC
↓
Database
WSaiOS完整模型
External World
↓
Perception Elements
↓
Object Model
↓
Cognitive Elements
↓
Reasoning Engine
↓
Decision System
因此:
WSaiOS 感知元素分类理论,本质上对应一个面向对象的软件对象体系。
每一个感知元素:
不是简单数据表。
而是:
一个具有属性、状态、行为、生命周期和记忆能力的软件对象。
下一章:
第三章
视觉感知元素理论与 PHP OOP 实现
Visual Perception Element Theory and Engineering Implementation
重点:
- 视觉信息模型
- ImageElement对象设计
- VideoElement对象设计
- Object Detection对象模型
- Scene场景元素模型
- MVC视觉分析模块
- Smarty视觉认知展示
- WSaiOS视觉认知Engine设计
将开始进入 “人脑视觉系统 → 软件视觉对象系统” 的工程实现。