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

第五章 视频感知元素模型 Video Perception Element Model

第五章

视频感知元素结构理论

Video Perception Element Structure Theory


5.1 视频在视觉认知中的作用

视频是视觉信息在时间维度上的连续表现形式。

图片描述:

某一个时间点的空间状态。

视频描述:

一个对象或环境随时间产生的变化过程。

例如:

一张图片:

门

只能表示:

Door Exists

而视频:

门关闭

↓

门移动

↓

门打开

表示:

Door State Change

因此,WSaiOS认为:

视频不是图片的简单集合,而是由时间关系连接起来的连续视觉元素结构。


视频感知过程:

视频输入

↓

连续视觉帧

↓

视频元素

↓

对象状态变化

↓

事件元素

↓

认知元素

5.2 视频感知元素概念

Video Perception Element

定义:

视频感知元素是 WSaiOS 对连续视觉信息中的对象、状态、变化和时间关系进行结构化表达后形成的信息单元。

视频感知元素包含:

  • 对象存在;
  • 对象运动;
  • 状态变化;
  • 时间关系;
  • 事件过程。

基本结构:

Video Element

{

Object

State

Motion

Time

Change

Event

}

5.3 视频与图片的区别

图片:

关注:

空间结构

视频:

关注:

时间变化

二者关系:

图片

↓

描述状态


视频

↓

描述状态变化

例如:

图片:

机器

只能知道:

Machine Exists

视频:

机器运行

↓

速度下降

↓

停止

可以形成:

Machine State Change

5.4 视频时间元素

视频区别于图片的核心:

是时间。

WSaiOS引入:

Time Element

时间元素。

结构:

Time Element

{

Timestamp

Sequence

Duration

Order

}

例如:

视频:

第一阶段:

Time 01

Machine Running

第二阶段:

Time 02

Machine Slow

第三阶段:

Time 03

Machine Stop

形成:

Running

↓

Slow

↓

Stop

时间元素使视觉系统能够理解:

过程。


5.5 视频对象元素

视频中的对象与图片对象一致。

但是增加:

动态属性。

结构:

Video Object Element

{

Entity

Attribute

Position

State

Motion

}

例如:

人员:

Entity:

Person


Attribute:

Uniform


Position:

Entrance Area


State:

Walking

车辆:

Entity:

Vehicle


State:

Moving


Motion:

Forward

5.6 视频运动元素

运动是视频的重要信息。

WSaiOS定义:

Motion Element

运动元素。

描述:

对象位置随时间的变化。

结构:

Motion Element

{

Object

Direction

Distance

Speed

Path

}

例如:

车辆:

初始位置:

A Point

之后:

B Point

形成:

Vehicle

Moving_To

B Point

运动元素不是动作识别。

它描述:

空间变化过程。


5.7 视频状态变化元素

视频理解的核心:

不是动作。

而是:

状态变化。

State Change Element

结构:

State Change

{

Object

Previous State

Current State

Time

}

例如:

设备:

原状态:

Normal

变化:

Temperature Increase

新状态:

Warning

形成:

Normal

↓

Warning

5.8 视频事件元素

多个状态变化组合后:

形成事件。

Event Element

定义:

事件元素是由对象状态变化、时间关系和环境关系共同形成的动态认知单元。

结构:

Event Element

{

Object

Action

Change

Time

Environment

}

例如:

监控视频:

视觉变化:

Person Appears

↓

Person Moves

↓

Person Leaves

形成:

Person Enter Room Event

工业场景:

Machine Temperature Increase

↓

Machine Stop

形成:

Equipment Failure Event

5.9 视频关系元素

视频中的对象关系会随着时间变化。

例如:

开始:

Person

Far_From

Machine

之后:

Person

Near

Machine

最后:

Person

Operating

Machine

因此:

视频关系具有:

动态性。

结构:

Dynamic Relation

{

Object A

Relation

Object B

Time

}

5.10 视频场景元素

多个视频元素组合:

形成动态场景。

结构:

Video Scene Element

{

Environment

Objects

Relations

Events

State Changes

}

例如:

智能工厂视频:

对象:

Worker

Robot

Machine

关系:

Worker Operating Machine

状态:

Machine Running

变化:

Machine Stop

最终:

形成:

Factory Operation Scene

5.11 视频元素到认知元素转换

视频感知最终目标:

不是记录变化。

而是形成理解。

转换:

Video Element

↓

State Analysis

↓

Event Organization

↓

Semantic Mapping

↓

Cognitive Element

例如:

视频:

Person

Walking

Entering

Building

转换:

人员进入建筑事件

视频:

Machine

Temperature Rising

Stopping

转换:

设备异常风险

5.12 视频感知在 WSaiOS 中的位置

WSaiOS视频感知属于:

动态感知层。

完整链路:

视频输入

↓

视频感知元素

↓

状态变化元素

↓

事件元素

↓

认知元素

↓

知识网络

↓

推理系统

↓

决策系统

5.13 图片与视频统一视觉结构

WSaiOS统一视觉体系:

视觉输入

        |

        |

 -----------------

 |               |

图片             视频

 |               |

静态元素         动态元素

 |               |

场景元素         事件元素

 |               |

认知元素

图片:

回答:

是什么?

视频:

回答:

发生了什么?

5.14 本章总结

本章建立 WSaiOS 视频感知元素结构理论。

核心观点:

  1. 视频是时间连续的视觉信息;
  2. 视频不是图片简单堆叠,而是状态变化过程;
  3. 视频元素由对象、状态、运动、时间、变化和事件组成;
  4. 视频理解核心是状态变化,而不是动作分类;
  5. 状态变化通过时间组织形成事件;
  6. 视频元素最终转换为认知元素,为推理和决策提供基础。

最终结构:

Video

↓

Video Element

↓

Object Element

↓

State Change Element

↓

Event Element

↓

Cognitive Element

下一章:

第六章

视觉元素与认知系统连接理论

Visual Element Cognitive Integration Theory

重点:

  • 视觉元素如何进入认知系统;
  • 感知到认知的转换机制;
  • 视觉知识结构;
  • 视觉推理基础;
  • WSaiOS视觉认知闭环。

第五章

视频感知元素模型——MVC、Smarty、PHP OOP 工程实现

Video Perception Element Model

第五章开始从静态视觉对象进入动态视觉对象。

第四章解决的是:

Image
 ↓
ImageElement
 ↓
VisualObject
 ↓
Relation
 ↓
SceneElement

第五章进一步增加一个核心维度:

Time(时间)

因此视频感知的核心不是“很多张图片”,而是:

ImageElement
     ↓
FrameElement
     ↓
Time Sequence
     ↓
Motion
     ↓
State Change
     ↓
Event
     ↓
Behavior
     ↓
Cognitive Element

5.1 视频感知元素的工程定义

WSaiOS 将视频定义为:

由具有时间顺序的视觉帧以及帧之间的对象状态变化、运动关系和事件关系共同构成的动态感知对象。

因此:

Video ≠ Image × N

更准确的工程模型是:

Video
 =
Frame Sequence
 +
Time
 +
Object Tracking
 +
Motion
 +
State Change
 +
Event

5.2 视频对象的 OOP 分层

视频系统不能设计成一个巨大的 Video.php。

应该进行对象拆分。

VideoElement
    │
    ├── FrameElement
    │
    ├── VisualObject
    │
    ├── MotionElement
    │
    ├── StateElement
    │
    ├── EventElement
    │
    └── TimeSequence

这符合 PHP OOP 的核心思想:

一个 Class 负责一个相对明确的对象职责。


5.3 VideoElement总体结构

建议目录:

wsaios/
│
├── core/
│   │
│   ├── Element/
│   │   ├── AbstractElement.php
│   │   ├── VisualElement.php
│   │   ├── FrameElement.php
│   │   ├── MotionElement.php
│   │   ├── StateElement.php
│   │   └── EventElement.php
│   │
│   └── Video/
│       └── VideoElement.php
│
├── app/
│   │
│   ├── Controllers/
│   │   └── VideoController.php
│   │
│   ├── Services/
│   │   └── VideoAnalysisService.php
│   │
│   ├── Models/
│   │   └── VideoModel.php
│   │
│   └── Repositories/
│       └── VideoRepository.php
│
└── views/
    └── templates/
        └── video/
            ├── index.tpl
            ├── detail.tpl
            └── event.tpl

这样:

Core负责对象能力,App负责业务流程,View负责展示。


5.4 FrameElement帧对象

视频最基础的动态视觉对象:

FrameElement

一帧实际上就是:

某一个时间点上的 ImageElement。

因此:

FrameElement
    ↓
ImageElement
    ↓
VisualObject

FrameElement.php

<?php

class FrameElement extends VisualElement
{
    protected $frameNumber;

    protected $timestamp;

    protected $objects = [];

    public function __construct(
        $frameNumber,
        $timestamp
    ) {
        $this->frameNumber = $frameNumber;
        $this->timestamp = $timestamp;
    }

    public function addObject($object)
    {
        $this->objects[] = $object;
    }

    public function getFrameNumber()
    {
        return $this->frameNumber;
    }

    public function getTimestamp()
    {
        return $this->timestamp;
    }

    public function getObjects()
    {
        return $this->objects;
    }

    public function analyze()
    {
        return [
            'frame_number' => $this->frameNumber,
            'timestamp'    => $this->timestamp,
            'objects'      => $this->objects
        ];
    }
}

这样:

Frame 001
Frame 002
Frame 003
Frame 004

都成为独立对象。


5.5 TimeSequence时间序列对象

Frame本身还不够。

必须知道:

Frame1
 ↓
Frame2
 ↓
Frame3
 ↓
Frame4

因此建立:

TimeSequence

<?php

class TimeSequence
{
    protected $frames = [];

    public function addFrame(FrameElement $frame)
    {
        $this->frames[] = $frame;
    }

    public function getFrames()
    {
        return $this->frames;
    }

    public function count()
    {
        return count($this->frames);
    }
}

形成:

TimeSequence

├ FrameElement 001
├ FrameElement 002
├ FrameElement 003
└ FrameElement 004

5.6 VideoElement

现在可以建立视频核心对象。

<?php

class VideoElement extends VisualElement
{
    protected $source;

    protected $duration;

    protected $frames;

    protected $events = [];

    protected $motions = [];

    protected $stateChanges = [];

    public function __construct($source)
    {
        $this->source = $source;
        $this->frames = new TimeSequence();
    }

    public function addFrame(FrameElement $frame)
    {
        $this->frames->addFrame($frame);
    }

    public function addEvent(EventElement $event)
    {
        $this->events[] = $event;
    }

    public function addMotion(MotionElement $motion)
    {
        $this->motions[] = $motion;
    }

    public function analyze()
    {
        return [
            'source' => $this->source,
            'frames' => $this->frames->count(),
            'events' => $this->events,
            'motions' => $this->motions
        ];
    }
}

此时:

VideoElement
│
├ TimeSequence
│   ├ Frame
│   ├ Frame
│   └ Frame
│
├ Motion
│
├ Event
│
└ StateChange

已经形成完整的动态对象结构。


5.7 MotionElement运动元素

视频和图片最大的区别之一:

对象发生运动。

因此建立:

MotionElement

结构:

MotionElement

├ Object
├ Direction
├ Speed
├ Distance
├ Path
├ StartTime
└ EndTime

PHP:

<?php

class MotionElement
{
    protected $objectId;

    protected $direction;

    protected $speed;

    protected $distance;

    protected $startTime;

    protected $endTime;

    public function __construct($objectId)
    {
        $this->objectId = $objectId;
    }

    public function setDirection($direction)
    {
        $this->direction = $direction;
    }

    public function setSpeed($speed)
    {
        $this->speed = $speed;
    }

    public function setTime($start, $end)
    {
        $this->startTime = $start;
        $this->endTime = $end;
    }

    public function toArray()
    {
        return [
            'object_id' => $this->objectId,
            'direction' => $this->direction,
            'speed'     => $this->speed,
            'distance'  => $this->distance,
            'start'     => $this->startTime,
            'end'       => $this->endTime
        ];
    }
}

例如:

Person

Direction = East

Speed = 1.2m/s

形成:

Person
 ↓
Moving
 ↓
East

5.8 StateElement状态变化

运动并不一定等于事件。

例如:

Machine

Running

后来:

Machine

Stopped

这属于:

状态变化。


模型:

StateElement

├ Object
├ PreviousState
├ CurrentState
├ ChangeTime
└ ChangeType

PHP:

<?php

class StateElement
{
    protected $objectId;

    protected $previousState;

    protected $currentState;

    protected $changeTime;

    public function __construct($objectId)
    {
        $this->objectId = $objectId;
    }

    public function change(
        $previous,
        $current,
        $time
    ) {
        $this->previousState = $previous;
        $this->currentState  = $current;
        $this->changeTime    = $time;
    }

    public function toArray()
    {
        return [
            'object_id'      => $this->objectId,
            'previous_state' => $this->previousState,
            'current_state'  => $this->currentState,
            'change_time'    => $this->changeTime
        ];
    }
}

形成:

Running
   ↓
Warning
   ↓
Stopped

5.9 EventElement事件对象

事件比状态变化更高一级。

例如:

Door

Closed

变化:

Door

Open

只是状态变化。

但是:

Person
 ↓
Open
 ↓
Door

可以形成:

Person Opens Door

这就是事件。


5.10 EventElement设计

EventElement

├ Subject
├ Action
├ Object
├ Time
├ Location
├ State
└ Confidence

PHP:

<?php

class EventElement
{
    protected $subject;

    protected $action;

    protected $object;

    protected $time;

    protected $location;

    public function __construct(
        $subject,
        $action,
        $object
    ) {
        $this->subject = $subject;
        $this->action  = $action;
        $this->object  = $object;
    }

    public function setTime($time)
    {
        $this->time = $time;
    }

    public function setLocation($location)
    {
        $this->location = $location;
    }

    public function toArray()
    {
        return [
            'subject'  => $this->subject,
            'action'   => $this->action,
            'object'   => $this->object,
            'time'     => $this->time,
            'location' => $this->location
        ];
    }
}

例如:

Person
 +
Enter
 +
Room

形成:

Event

Person Enter Room

5.11 视频事件生成模型

WSaiOS 不直接把:

Frame

变成:

Event

而是经过中间层。

Frame

↓

Object

↓

Object State

↓

State Change

↓

Motion

↓

Relation

↓

Event

例如:

Frame 1

Person
Outside Room

Frame 2

Person
Near Door

Frame 3

Person
Inside Room

系统形成:

Position Change

↓

Motion

↓

Spatial Relation Change

↓

Enter Event

最终:

Person Enter Room

5.12 VideoAnalysisService

Controller不应该负责视频分析。

应该增加:

VideoAnalysisService

<?php

class VideoAnalysisService
{
    public function analyze(
        VideoElement $video
    ) {
        $frames =
            $video->analyze();

        return $frames;
    }

    public function detectMotion(
        VideoElement $video
    ) {
        // Motion分析逻辑
    }

    public function detectEvent(
        VideoElement $video
    ) {
        // Event分析逻辑
    }
}

形成:

Controller
     ↓
VideoAnalysisService
     ↓
VideoElement
     ↓
FrameElement
     ↓
Motion / State / Event

5.13 VideoController

<?php

class VideoController
{
    protected $service;

    public function __construct()
    {
        $this->service =
            new VideoAnalysisService();
    }

    public function analyze()
    {
        $source =
            $_FILES['video'];

        $video =
            new VideoElement(
                $source['name']
            );

        $result =
            $this->service
                ->analyze($video);

        return $result;
    }
}

Controller只负责:

HTTP Request
 ↓
调用Service
 ↓
返回结果

而不负责具体视觉认知算法。

这正是 MVC 分层的意义。


5.14 VideoRepository

视频分析结果需要保存。

因此:

VideoRepository

负责数据库。


<?php

class VideoRepository
{
    protected $db;

    public function __construct($db)
    {
        $this->db = $db;
    }

    public function save(VideoElement $video)
    {
        // 保存VideoElement
    }

    public function find($id)
    {
        // 查询视频元素
    }
}

架构变成:

Controller
     ↓
Service
     ↓
Model / Element
     ↓
Repository
     ↓
MySQL

5.15 视频数据库设计

建议不要把所有东西都塞进一张表。

可以拆成:

videos
video_frames
video_objects
video_motions
video_states
video_events

videos

CREATE TABLE videos
(
    id INT AUTO_INCREMENT PRIMARY KEY,
    source VARCHAR(255),
    duration DECIMAL(12,3),
    created_at TIMESTAMP
);

video_frames

CREATE TABLE video_frames
(
    id INT AUTO_INCREMENT PRIMARY KEY,
    video_id INT,
    frame_number INT,
    timestamp DECIMAL(12,3),
    created_at TIMESTAMP
);

video_events

CREATE TABLE video_events
(
    id INT AUTO_INCREMENT PRIMARY KEY,
    video_id INT,
    subject VARCHAR(100),
    action VARCHAR(100),
    object VARCHAR(100),
    event_time DECIMAL(12,3),
    location VARCHAR(255),
    confidence FLOAT,
    created_at TIMESTAMP
);

这种设计比:

video_data TEXT

更加符合 WSaiOS 的对象化思想。


5.16 Smarty视频展示

目录:

views/

└── templates/

    └── video/

        ├── index.tpl
        ├── detail.tpl
        └── event.tpl

video/detail.tpl

<h2>视频感知分析</h2>

<p>
视频:{$video.source}
</p>

<p>
帧数量:{$video.frame_count}
</p>

<h3>运动</h3>

{foreach $motions as $motion}

<div>
{$motion.object_id}
-
{$motion.direction}
-
{$motion.speed}
</div>

{/foreach}

<h3>事件</h3>

{foreach $events as $event}

<div>
{$event.subject}
{$event.action}
{$event.object}
</div>

{/foreach}

Smarty的职责:

把已经完成结构化的认知结果展示出来。

而不是在模板中执行视频分析。


5.17 MVC完整调用链

最终:

Browser
   │
   │ Upload Video
   ↓
VideoController
   │
   ↓
VideoAnalysisService
   │
   ↓
VideoElement
   │
   ├── TimeSequence
   │
   ├── FrameElement
   │
   ├── VisualObject
   │
   ├── MotionElement
   │
   ├── StateElement
   │
   └── EventElement
   │
   ↓
VideoRepository
   │
   ↓
MySQL
   │
   ↓
Smarty
   │
   ↓
Browser

5.18 视频记忆模型

视频最重要的价值:

不是保存视频文件。

而是保存:

事件经验。

例如系统看到:

Machine
 ↓
Overheat
 ↓
Stop

不应该只保存视频。

应该形成:

Experience

Object:
Machine

Pattern:
Overheat → Stop

5.19 VideoMemory对象

可以增加:

VideoMemory

├ Object
├ Event
├ StateSequence
├ Pattern
├ Context
└ Time

PHP:

<?php

class VideoMemory
{
    protected $object;

    protected $events = [];

    protected $states = [];

    protected $context;

    public function addEvent(
        EventElement $event
    ) {
        $this->events[] = $event;
    }

    public function addState(
        StateElement $state
    ) {
        $this->states[] = $state;
    }

    public function recall()
    {
        return [
            'object' => $this->object,
            'events' => $this->events,
            'states' => $this->states
        ];
    }
}

5.20 视频经验学习模型

WSaiOS 可以进一步形成:

Video

↓

Event

↓

Experience

↓

Pattern

↓

Memory

↓

Future Recognition

例如第一次观察:

Machine

Temperature Rising

↓

Warning

↓

Stop

系统形成经验:

Pattern A

Temperature Rising
        +
Warning
        ↓
Possible Failure

以后再次出现类似状态:

Temperature Rising
+
Warning

Memory Engine可以召回:

Previous Experience

↓

Failure Pattern

然后交给:

Reasoning Engine

进一步判断。


5.21 视频认知的核心:时间关系

图片主要研究:

Object
Relation
Scene

视频增加:

Time

因此:

Visual Object
      +
Spatial Relation
      +
Temporal Relation
      ↓
Event

这是第五章最重要的理论扩展。


5.22 Temporal Relation时间关系

建立:

TemporalRelation

├ Before
├ After
├ During
├ Start
├ End
└ Continue

例如:

Machine Start

↓

Machine Running

↓

Machine Stop

关系:

Start

Before

Running

Before

Stop

可以建立:

class TemporalRelation
{
    protected $source;

    protected $relation;

    protected $target;

    public function __construct(
        $source,
        $relation,
        $target
    ) {
        $this->source   = $source;
        $this->relation = $relation;
        $this->target   = $target;
    }
}

这样 WSaiOS 开始具备:

时间知识结构。


5.23 视频感知元素与认知元素

最终转换:

Frame
 ↓
Object
 ↓
Motion
 ↓
State
 ↓
Relation
 ↓
Event
 ↓
Experience
 ↓
Cognitive Element

例如:

Person
 ↓
Moving
 ↓
Near Door
 ↓
Door Open
 ↓
Person Enter Room

最后:

Event:

Person Enter Room

再进一步:

Cognitive Element:

Person entered the room.

5.24 第五章最终 OOP 架构

                    VideoElement
                         │
              ┌──────────┴──────────┐
              │                     │
        TimeSequence              Event
              │                     │
        FrameElement          EventElement
              │
        VisualObject
              │
       ┌──────┴──────┐
       │             │
   Attribute      Position
       │
       └──── Relation
              │
          MotionElement
              │
         StateElement
              │
         Experience
              │
         CognitiveElement

5.25 第五章 MVC + Smarty + PHP OOP最终结构

WSaiOS
│
├── Core
│   │
│   ├── Element
│   │   ├── AbstractElement.php
│   │   ├── VisualElement.php
│   │   ├── FrameElement.php
│   │   ├── MotionElement.php
│   │   ├── StateElement.php
│   │   └── EventElement.php
│   │
│   ├── Video
│   │   ├── VideoElement.php
│   │   └── TimeSequence.php
│   │
│   └── Relation
│       └── TemporalRelation.php
│
├── App
│   │
│   ├── Controllers
│   │   └── VideoController.php
│   │
│   ├── Services
│   │   └── VideoAnalysisService.php
│   │
│   ├── Models
│   │   └── VideoModel.php
│   │
│   └── Repositories
│       └── VideoRepository.php
│
├── Memory
│   └── VideoMemory.php
│
└── Views
    └── Smarty
        └── video
            ├── index.tpl
            ├── detail.tpl
            └── event.tpl

5.26 第五章核心结论

第四章:

图片

↓

空间结构

第五章:

视频

↓

空间结构

+

时间结构

因此:

Image
    ↓
Object
    ↓
Relation
    ↓
Scene

扩展为:

Video
    ↓
Frame
    ↓
Object
    ↓
Motion
    ↓
State Change
    ↓
Temporal Relation
    ↓
Event
    ↓
Experience
    ↓
Cognitive Element

这就是 WSaiOS 从静态视觉感知进入动态视觉认知的关键一步。


下一章:第六章

音频感知元素模型

Audio Perception Element Model

下一章可以按照同样的工程路线继续:

Audio Data
    ↓
AudioElement
    ↓
SoundElement
    ↓
FrequencyElement
    ↓
VoiceElement
    ↓
SoundEvent
    ↓
AudioState
    ↓
AudioRelation
    ↓
CognitiveElement

并重点研究 PHP OOP 的 AudioElement / VoiceElement / SoundEvent 类设计、MVC Controller/Service/Repository 分层、Smarty 音频认知结果展示,以及 AudioMemory → ExperienceMemory → CognitiveMemory 的工程连接。

Leave a Reply

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

客服咨询
● 欢迎咨询与合作
您好!欢迎咨询。 我可以帮助您了解人工智能技术研发、智能软件系统开发、网站建设、搜索优化及项目定制等相关信息。 请问有什么可以帮您?
免费申请
请填写以下信息,方便我们进一步沟通。
欢迎咨询 AI 系统开发、网站建设、搜索优化、项目定制合作
电话:15089196448
邮箱:1602401899@qq.com
地址:陕西省渭南市
服务时间:周一至周五 09:00 - 18:00 | 7×24小时技术值守