WO2020135392A1 - Method and device for detecting abnormal behavior - Google Patents

Method and device for detecting abnormal behavior Download PDF

Info

Publication number
WO2020135392A1
WO2020135392A1 PCT/CN2019/127797 CN2019127797W WO2020135392A1 WO 2020135392 A1 WO2020135392 A1 WO 2020135392A1 CN 2019127797 W CN2019127797 W CN 2019127797W WO 2020135392 A1 WO2020135392 A1 WO 2020135392A1
Authority
WO
WIPO (PCT)
Prior art keywords
behavior data
behavior
video
normal
feature
Prior art date
Application number
PCT/CN2019/127797
Other languages
French (fr)
Chinese (zh)
Inventor
赵飞
Original Assignee
杭州海康威视数字技术股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 杭州海康威视数字技术股份有限公司 filed Critical 杭州海康威视数字技术股份有限公司
Publication of WO2020135392A1 publication Critical patent/WO2020135392A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/50Context or environment of the image
    • G06V20/52Surveillance or monitoring of activities, e.g. for recognising suspicious objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2411Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on the proximity to a decision surface, e.g. support vector machines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content
    • G06V20/46Extracting features or characteristics from the video content, e.g. video fingerprints, representative shots or key frames
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content
    • G06V20/48Matching video sequences

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Multimedia (AREA)
  • Artificial Intelligence (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

The present disclosure relates to the field of video surveillance, and disclosed thereby are a method and device for detecting abnormal behavior. The method comprises: acquiring behavior data to be detected; inputting the behavior data into a feature extraction model and outputting a behavior feature of the behavior data, wherein the feature extraction model is used to output a behavior feature within a feature space range according to normal behavior data and output a behavior feature outside of the feature space range according to abnormal behavior data, and the distance between each behavior feature within the feature space range is less than a distance threshold; according to the distance between the behavior feature of the behavior data and a normal behavior feature center and the distance threshold, acquiring a detection result of the behavior data, the detection result being used to indicate whether the behavior data is abnormal behavior data, and the normal behavior feature center being used to represent the behavior features within the feature space range. The described method for detecting abnormal behavior on the basis of distance measurement described in the present disclosure has high accuracy.

Description

异常行为检测方法及装置Abnormal behavior detection method and device
本申请要求于2018年12月24日提交的申请号为201811581954.0、发明名称为“异常行为检测方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requires the priority of the Chinese patent application with the application number 201811581954.0 and the invention titled "abnormal behavior detection method and device" filed on December 24, 2018, the entire content of which is incorporated by reference in this application.
技术领域Technical field
本公开涉及视频监控领域,尤其涉及一种异常行为检测方法及装置。The present disclosure relates to the field of video surveillance, and in particular to an abnormal behavior detection method and device.
背景技术Background technique
异常行为检测是指在视频监控场景下,计算机设备代替视频监控人员,自动检测出视频监控场景下发生的异常行为,从而可以及时进行报警。其中,异常行为一般是指场景中与其他行为有着明显不同或者在该场景中发生概率较低的行为,如危害他人、损害公共利益的行为。异常行为检测使得视频监控人员可以从海量的监控数据以及繁琐的人工操作中解脱出来,在视频监控领域有着极其广泛的应用。Abnormal behavior detection means that in the video surveillance scene, the computer equipment replaces the video surveillance personnel, and automatically detects the abnormal behavior in the video surveillance scene, so that the alarm can be promptly performed. Among them, abnormal behavior generally refers to behaviors in the scene that are significantly different from other behaviors or have a low probability of occurring in the scene, such as behaviors that endanger others or harm the public interest. Abnormal behavior detection makes video surveillance personnel free from massive monitoring data and tedious manual operations, and has extremely extensive applications in the field of video surveillance.
相关技术中,一般是使用OneClassSVM(One Class Support Vector Machine,一类支持向量机)来实现异常行为的检测。具体地,收集大量发生正常行为的监控视频,从监控视频中抽取图像序列作为正常行为数据,基于正常行为数据训练一个一类分类器。在获取到一个未知视频后,想要判断其中的行为数据是否包括异常行为,可以抽取图像序列作为行为数据,提取该行为数据的行为特征。判断该行为数据的行为特征与上述一类分类器包含的行为特征是否一致,如果该行为特征与该一类分类器包含的行为特征不一致,那么就认为该行为数据对应异常行为,即未知视频包括异常行为。其中,该一类分类器包含的行为特征通过对正常行为数据进行特征提取得到。In related technologies, OneClassSVM (One Class Support Vector Machine) is generally used to detect abnormal behavior. Specifically, a large number of surveillance videos where normal behavior occurs are collected, image sequences are extracted from the surveillance videos as normal behavior data, and a class one classifier is trained based on the normal behavior data. After acquiring an unknown video, if you want to determine whether the behavior data includes abnormal behavior, you can extract the image sequence as behavior data to extract the behavior characteristics of the behavior data. Determine whether the behavioral characteristics of the behavioral data are consistent with the behavioral characteristics included in the above-mentioned classifier. If the behavioral characteristics are inconsistent with the behavioral characteristics included in the classifier, then the behavioral data is considered to correspond to abnormal behavior, that is, the unknown video includes Abnormal behavior. Among them, the behavior features included in this class of classifier are obtained by performing feature extraction on normal behavior data.
上述技术是基于正常行为数据提取的行为特征来判断未知视频中是否存在异常行为,由于没有学习正常行为数据和异常行为数据的区别,检测结果容易出现很大偏差,异常行为检测的准确性差。The above technology is based on the behavior characteristics extracted from the normal behavior data to determine whether there is abnormal behavior in the unknown video. Since the difference between the normal behavior data and the abnormal behavior data is not learned, the detection result is prone to large deviations and the accuracy of abnormal behavior detection is poor.
发明内容Summary of the invention
本公开实施例提供了一种异常行为检测方法及装置,可以解决相关技术准确性差的问题。所述技术方案如下:The embodiments of the present disclosure provide an abnormal behavior detection method and device, which can solve the problem of poor accuracy of related technologies. The technical solution is as follows:
第一方面,提供了一种异常行为检测方法,所述方法包括:In a first aspect, a method for detecting abnormal behavior is provided. The method includes:
获取待检测的行为数据;Obtain the behavior data to be detected;
将所述行为数据输入特征提取模型,输出所述行为数据的行为特征,所述特征提取模型用于根据正常行为数据输出特征空间范围内的行为特征以及根据异常行为数据输出所述特征空间范围外的行为特征,所述特征空间范围内各个行为特征之间的距离小于距离阈值;Inputting the behavior data into a feature extraction model and outputting behavior characteristics of the behavior data, the feature extraction model is used to output behavior characteristics within the feature space range according to normal behavior data and out of the feature space range according to abnormal behavior data Behavioral characteristics, the distance between the behavioral characteristics within the feature space is less than the distance threshold;
根据所述行为数据的行为特征与正常行为特征中心的距离和所述距离阈值,获取所述行为数据的检测结果,所述检测结果用于指示所述行为数据是否为异常行为数据,所述正常行为特征中心用于代表所述特征空间范围内的行为特征。Acquiring the detection result of the behavior data according to the distance between the behavior feature of the behavior data and the center of the normal behavior feature and the distance threshold, the detection result is used to indicate whether the behavior data is abnormal behavior data, the normal The behavior feature center is used to represent behavior features within the range of the feature space.
在一种可能实现方式中,所述特征提取模型的训练过程包括:In a possible implementation manner, the training process of the feature extraction model includes:
根据正常行为数据集合和异常行为数据集合,获取多个第一行为数据对和多个第二行为数据对,每个第一行为数据对包含所述正常行为数据集合中的两个正常行为数据,每个第二行为数据对包含所述正常行为数据集合中的一个正常行为数据和所述异常行为数据集合中的一个异常行为数据;Acquiring a plurality of first behavior data pairs and a plurality of second behavior data pairs according to the normal behavior data set and the abnormal behavior data set, each first behavior data pair containing two normal behavior data in the normal behavior data set, Each second behavior data pair includes one normal behavior data in the normal behavior data set and one abnormal behavior data in the abnormal behavior data set;
提取所述多个第一行为数据对的多个第一行为特征对和所述多个第二行为数据对的多个第二行为特征对,每个第一行为特征对包含两个正常行为数据的行为特征,每个第二行为特征对包含一个正常行为数据的行为特征和一个异常行为数据的行为特征;Extracting a plurality of first behavior feature pairs of the plurality of first behavior data pairs and a plurality of second behavior feature pairs of the plurality of second behavior data pairs, each first behavior feature pair containing two normal behavior data Behavior characteristics, each second behavior characteristic pair contains a behavior characteristic of normal behavior data and a behavior characteristic of abnormal behavior data;
根据所述每个第一行为特征对包含的两个行为特征之间的距离和所述每个第二行为特征对包含的两个行为特征之间的距离,通过损失函数监督训练,得到所述特征提取模型。According to the distance between the two behavioral features included in each of the first behavioral feature pairs and the distance between the two behavioral features included in each of the second behavioral feature pairs, supervise training through a loss function to obtain the Feature extraction model.
在一种可能实现方式中,所述根据正常行为数据集合和异常行为数据集合,获取多个第一行为数据对和多个第二行为数据对之前,所述方法还包括:In a possible implementation manner, before acquiring multiple first behavior data pairs and multiple second behavior data pairs according to the normal behavior data set and the abnormal behavior data set, the method further includes:
基于多个第一视频,获取所述正常行为数据集合,所述多个第一视频为目标进行正常行为的视频;Acquiring the normal behavior data set based on a plurality of first videos, the plurality of first videos being videos of normal behavior targeted by the target;
基于多个第二视频,获取所述异常行为数据集合,所述多个第二视频为目标进行异常行为的视频。Based on the plurality of second videos, the abnormal behavior data set is acquired, and the plurality of second videos are videos of the target performing abnormal behavior.
在一种可能实现方式中,所述基于多个第一视频,获取所述正常行为数据 集合,包括:In a possible implementation manner, the acquiring the normal behavior data set based on multiple first videos includes:
对于所述多个第一视频中的每个第一视频,对所述第一视频中的目标进行检测和跟踪,获取第一时间段内所述目标的空间运动范围,所述空间运动范围为所述目标运动所覆盖的空间范围,所述第一时间段的时长小于所述第一视频的时间段的时长;For each first video in the plurality of first videos, detect and track the target in the first video to obtain the spatial motion range of the target in the first time period, the spatial motion range is The spatial range covered by the target motion, the duration of the first time period is less than the duration of the first video period;
根据所述空间运动范围和所述第一视频,在所述第一时间段对应的第一视频序列中进行图像截取,得到所述第一视频的第一图像序列,所述第一视频序列包含所述第一视频的多帧视频图像,所述第一图像序列包含所述多帧视频图像中所述空间运动范围对应的区域;According to the spatial motion range and the first video, performing image interception in a first video sequence corresponding to the first time period to obtain a first image sequence of the first video, the first video sequence including A multi-frame video image of the first video, the first image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
将所述多个第一视频的第一图像序列作为所述正常行为数据集合。The first image sequence of the plurality of first videos is used as the normal behavior data set.
在一种可能实现方式中,所述基于多个第二视频,获取所述异常行为数据集合,包括:In a possible implementation manner, the acquiring the abnormal behavior data set based on multiple second videos includes:
对于所述多个第二视频中的每个第二视频,对所述第二视频中的目标进行检测和跟踪,获取第二时间段内所述目标的空间运动范围,所述空间运动范围为所述目标运动所覆盖的空间范围,所述第二时间段的时长小于所述第二视频的时间段的时长;For each second video in the plurality of second videos, detect and track the target in the second video to obtain the spatial motion range of the target in the second time period, the spatial motion range is The spatial range covered by the target motion, the duration of the second time period is less than the duration of the second video period;
根据所述空间运动范围和所述第二视频,在所述第二时间段对应的第二视频序列中进行图像截取,得到所述第二视频的第二图像序列,所述第二视频序列包含所述第二视频的多帧视频图像,所述第二图像序列包含所述多帧视频图像中所述空间运动范围对应的区域;According to the spatial motion range and the second video, performing image interception in a second video sequence corresponding to the second time period to obtain a second image sequence of the second video, the second video sequence including A multi-frame video image of the second video, the second image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
将所述多个第二视频的第二图像序列作为所述异常行为数据集合。The second image sequence of the plurality of second videos is used as the abnormal behavior data set.
在一种可能实现方式中,所述待检测的行为数据为多个行为数据,In a possible implementation manner, the behavior data to be detected is multiple behavior data,
所述根据所述行为数据的行为特征与正常行为特征中心的距离,获取所述行为数据的检测结果之后,所述方法还包括:After obtaining the detection result of the behavior data according to the distance between the behavior characteristic of the behavior data and the center of the normal behavior characteristic, the method further includes:
根据所述多个行为数据各自的检测结果,确定所述多个行为数据中的异常行为数据;Determine abnormal behavior data among the plurality of behavior data according to respective detection results of the plurality of behavior data;
将所述多个行为数据中的异常行为数据添加至所述异常行为数据集合中;Adding abnormal behavior data from the plurality of behavior data to the abnormal behavior data set;
基于更新的异常行为数据集合,执行所述特征提取模型的训练过程,获取更新的特征提取模型。Based on the updated abnormal behavior data set, the training process of the feature extraction model is performed to obtain the updated feature extraction model.
在一种可能实现方式中,所述将所述多个行为数据中的异常行为数据添加至所述异常行为数据集合,包括:In a possible implementation manner, the adding abnormal behavior data from the plurality of behavior data to the abnormal behavior data set includes:
获取所述多个行为数据中异常行为数据的人工确认信息;Acquiring manual confirmation information of abnormal behavior data among the plurality of behavior data;
将所述人工确认信息指示的异常行为数据添加至所述异常行为数据集合中。Adding the abnormal behavior data indicated by the manual confirmation information to the abnormal behavior data set.
在一种可能的实现方式中,所述待检测的行为数据为多个行为数据;In a possible implementation manner, the behavior data to be detected is a plurality of behavior data;
所述根据所述行为数据的行为特征与正常行为特征中心的距离,获取所述行为数据的检测结果之后,所述方法还包括:After obtaining the detection result of the behavior data according to the distance between the behavior characteristic of the behavior data and the center of the normal behavior characteristic, the method further includes:
根据所述多个行为数据各自的检测结果,确定所述多个行为数据中的正常行为数据;Determine the normal behavior data among the plurality of behavior data according to the respective detection results of the plurality of behavior data;
将所述多个行为数据中的正常行为数据添加至所述正常行为数据集合中;Adding normal behavior data from the plurality of behavior data to the normal behavior data set;
所述基于更新的异常行为数据集合,执行所述特征提取模型的训练过程,获取更新的特征提取模型,包括:The updating based on the abnormal behavior data set, performing the training process of the feature extraction model, and obtaining the updated feature extraction model includes:
基于更新的异常行为数据集合和更新的正常行为数据集合,执行所述特征提取模型的训练过程,获取更新的特征提取模型。Based on the updated abnormal behavior data set and the updated normal behavior data set, the training process of the feature extraction model is performed to obtain the updated feature extraction model.
在一种可能实现方式中,所述方法还包括:In a possible implementation manner, the method further includes:
获取多个视频;Get multiple videos;
对于所述多个视频中的每个视频,对所述视频中的目标进行检测和跟踪,获取第三时间段内所述目标的空间运动范围,所述空间运动范围为所述目标运动所覆盖的空间范围,所述第三时间段的时长小于所述视频的时间段的时长;For each of the plurality of videos, detect and track the target in the video to obtain the spatial motion range of the target in the third time period, the spatial motion range is covered by the target motion The spatial range of the third time period is less than the time period of the video;
根据所述空间运动范围和所述视频,在所述第三时间段对应的视频序列中进行图像截取,得到所述视频的图像序列,所述视频序列包含所述视频的多帧视频图像,所述图像序列包含所述多帧视频图像中所述空间运动范围对应的区域;According to the spatial motion range and the video, performing image interception in the video sequence corresponding to the third time period to obtain an image sequence of the video, the video sequence including multiple frames of video images of the video, so The image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
将所述多个视频的图像序列作为所述多个行为数据。The image sequence of the multiple videos is used as the multiple behavior data.
在一种可能实现方式中,所述方法还包括:In a possible implementation manner, the method further includes:
对于所述多个行为数据中的异常行为数据,在播放所述异常行为数据所属视频的过程中,显示所述异常行为数据所属视频的图像序列。For the abnormal behavior data among the plurality of behavior data, in the process of playing the video to which the abnormal behavior data belongs, the image sequence of the video to which the abnormal behavior data belongs is displayed.
在一种可能实现方式中,所述根据所述行为数据的行为特征与正常行为特征中心的距离和所述距离阈值,获取所述行为数据的检测结果,包括:In a possible implementation manner, the acquiring the detection result of the behavior data according to the distance between the behavior feature of the behavior data and the center of the normal behavior feature and the distance threshold includes:
当所述行为数据的行为特征与所述正常行为特征中心的距离大于所述距离阈值时,确定所述行为数据为异常行为数据;When the distance between the behavior feature of the behavior data and the center of the normal behavior feature is greater than the distance threshold, it is determined that the behavior data is abnormal behavior data;
当所述行为数据的行为特征与所述正常行为特征中心的距离小于或等于所述距离阈值时,确定所述行为数据为正常行为数据。When the distance between the behavior feature of the behavior data and the center of the normal behavior feature is less than or equal to the distance threshold, it is determined that the behavior data is normal behavior data.
在一种可能实现方式中,所述正常行为特征中心的获取过程包括:In a possible implementation manner, the process of acquiring the normal behavior feature center includes:
获取多个正常行为数据;Obtain multiple normal behavior data;
对于所述多个正常行为数据中的每个正常行为数据,将所述正常行为数据输入所述特征提取模型,输出所述正常行为数据的行为特征;For each normal behavior data in the plurality of normal behavior data, input the normal behavior data into the feature extraction model, and output the behavior characteristics of the normal behavior data;
根据所述多个正常行为数据的行为特征,获取所述正常行为特征中心。Obtain the normal behavior characteristic center according to the behavior characteristic of the plurality of normal behavior data.
在一种可能实现方式中,所述多个正常行为数据中每个正常行为数据的行为特征使用一个特征向量表征;In a possible implementation manner, the behavior characteristic of each normal behavior data in the plurality of normal behavior data is characterized by a feature vector;
所述根据所述多个正常行为数据的行为特征,获取所述正常行为特征中心,包括:The obtaining the normal behavior characteristic center according to the behavior characteristics of the plurality of normal behavior data includes:
对所述多个正常行为数据的特征向量在每个维度计算平均值,获得由每个维度的平均值组成的一组平均值所表征的目标特征向量;Calculating an average value of the feature vectors of the plurality of normal behavior data in each dimension to obtain a target feature vector characterized by a set of average values consisting of the average value of each dimension;
将所述目标特征向量作为所述正常行为特征中心。Use the target feature vector as the normal behavior feature center.
第二方面,提供了一种异常行为检测装置,所述装置包括:In a second aspect, an abnormal behavior detection device is provided, the device including:
获取模块,用于获取待检测的行为数据;The acquisition module is used to acquire the behavior data to be detected;
提取模块,用于将所述行为数据输入特征提取模型,输出所述行为数据的行为特征,所述特征提取模型用于根据正常行为数据输出特征空间范围内的行为特征以及根据异常行为数据输出所述特征空间范围外的行为特征,所述特征空间范围内各个行为特征之间的距离小于距离阈值;An extraction module is used to input the behavior data into a feature extraction model and output behavior characteristics of the behavior data, and the feature extraction model is used to output behavior characteristics within a feature space range according to normal behavior data and output data based on abnormal behavior data. The behavior features outside the feature space, the distance between the behavior features in the feature space is less than the distance threshold;
所述获取模块还用于根据所述行为数据的行为特征与正常行为特征中心的距离和所述距离阈值,获取所述行为数据的检测结果,所述检测结果用于指示所述行为数据是否为异常行为数据,所述正常行为特征中心用于代表所述特征空间范围内的行为特征。The acquiring module is further configured to acquire the detection result of the behavior data according to the distance between the behavior feature of the behavior data and the center of the normal behavior feature and the distance threshold, and the detection result is used to indicate whether the behavior data is For abnormal behavior data, the normal behavior feature center is used to represent behavior features within the feature space.
在一种可能实现方式中,所述获取模块还用于:In a possible implementation manner, the obtaining module is further used to:
根据正常行为数据集合和异常行为数据集合,获取多个第一行为数据对和多个第二行为数据对,每个第一行为数据对包含所述正常行为数据集合中的两个正常行为数据,每个第二行为数据对包含所述正常行为数据集合中的一个正常行为数据和所述异常行为数据集合中的一个异常行为数据;Acquiring a plurality of first behavior data pairs and a plurality of second behavior data pairs according to the normal behavior data set and the abnormal behavior data set, each first behavior data pair containing two normal behavior data in the normal behavior data set, Each second behavior data pair includes one normal behavior data in the normal behavior data set and one abnormal behavior data in the abnormal behavior data set;
提取所述多个第一行为数据对的多个第一行为特征对和所述多个第二行为 数据对的多个第二行为特征对,每个第一行为特征对包含两个正常行为数据的行为特征,每个第二行为特征对包含一个正常行为数据的行为特征和一个异常行为数据的行为特征;Extracting a plurality of first behavior feature pairs of the plurality of first behavior data pairs and a plurality of second behavior feature pairs of the plurality of second behavior data pairs, each first behavior feature pair containing two normal behavior data Behavior characteristics, each second behavior characteristic pair contains a behavior characteristic of normal behavior data and a behavior characteristic of abnormal behavior data;
根据所述每个第一行为特征对包含的两个行为特征之间的距离和所述每个第二行为特征对包含的两个行为特征之间的距离,通过损失函数监督训练,得到所述特征提取模型。According to the distance between the two behavioral features included in each of the first behavioral feature pairs and the distance between the two behavioral features included in each of the second behavioral feature pairs, supervise training through a loss function to obtain the Feature extraction model.
在一种可能实现方式中,所述获取模块还用于:In a possible implementation manner, the obtaining module is further used to:
基于多个第一视频,获取所述正常行为数据集合,所述多个第一视频为目标进行正常行为的视频;Acquiring the normal behavior data set based on a plurality of first videos, the plurality of first videos being videos of normal behavior targeted by the target;
基于多个第二视频,获取所述异常行为数据集合,所述多个第二视频为目标进行异常行为的视频。Based on the plurality of second videos, the abnormal behavior data set is acquired, and the plurality of second videos are videos of the target performing abnormal behavior.
在一种可能实现方式中,所述获取模块用于:In a possible implementation manner, the acquisition module is used to:
对于所述多个第一视频中的每个第一视频,对所述第一视频中的目标进行检测和跟踪,获取第一时间段内所述目标的空间运动范围,所述空间运动范围为所述目标运动所覆盖的空间范围,所述第一时间段的时长小于所述第一视频的时间段的时长;For each first video in the plurality of first videos, detect and track the target in the first video to obtain the spatial motion range of the target in the first time period, the spatial motion range is The spatial range covered by the target motion, the duration of the first time period is less than the duration of the first video period;
根据所述空间运动范围和所述第一视频,在所述第一时间段对应的第一视频序列中进行图像截取,得到所述第一视频的第一图像序列,所述第一视频序列包含所述第一视频的多帧视频图像,所述第一图像序列包含所述多帧视频图像中所述空间运动范围对应的区域;According to the spatial motion range and the first video, performing image interception in a first video sequence corresponding to the first time period to obtain a first image sequence of the first video, the first video sequence including A multi-frame video image of the first video, the first image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
将所述多个第一视频的第一图像序列作为所述正常行为数据集合。The first image sequence of the plurality of first videos is used as the normal behavior data set.
在一种可能实现方式中,所述获取模块用于:In a possible implementation manner, the acquisition module is used to:
对于所述多个第二视频中的每个第二视频,对所述第二视频中的目标进行检测和跟踪,获取第二时间段内所述目标的空间运动范围,所述空间运动范围为所述目标运动所覆盖的空间范围,所述第二时间段的时长小于所述第二视频的时间段的时长;For each second video in the plurality of second videos, detect and track the target in the second video to obtain the spatial motion range of the target in the second time period, the spatial motion range is The spatial range covered by the target motion, the duration of the second time period is less than the duration of the second video period;
根据所述空间运动范围和所述第二视频,在所述第二时间段对应的第二视频序列中进行图像截取,得到所述第二视频的第二图像序列,所述第二视频序列包含所述第二视频的多帧视频图像,所述第二图像序列包含所述多帧视频图像中所述空间运动范围对应的区域;According to the spatial motion range and the second video, performing image interception in a second video sequence corresponding to the second time period to obtain a second image sequence of the second video, the second video sequence including A multi-frame video image of the second video, the second image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
将所述多个第二视频的第二图像序列作为所述异常行为数据集合。The second image sequence of the plurality of second videos is used as the abnormal behavior data set.
在一种可能实现方式中,所述待检测的行为数据为多个行为数据,In a possible implementation manner, the behavior data to be detected is multiple behavior data,
所述获取模块还用于根据所述多个行为数据各自的检测结果,确定所述多个行为数据中的异常行为数据;将所述多个行为数据中的异常行为数据添加至所述异常行为数据集合中;基于更新的异常行为数据集合,执行所述特征提取模型的训练过程,获取更新的特征提取模型。The acquiring module is further configured to determine abnormal behavior data in the plurality of behavior data according to the detection results of the plurality of behavior data; add the abnormal behavior data in the plurality of behavior data to the abnormal behavior In the data set; based on the updated abnormal behavior data set, the training process of the feature extraction model is performed to obtain the updated feature extraction model.
在一种可能实现方式中,所述待检测的行为数据为多个行为数据;In a possible implementation manner, the behavior data to be detected is multiple behavior data;
所述根据所述行为数据的行为特征与正常行为特征中心的距离,获取所述行为数据的检测结果之后,所述获取模块,还用于:After acquiring the detection result of the behavior data according to the distance between the behavior characteristic of the behavior data and the center of the normal behavior characteristic, the acquisition module is further used to:
根据所述多个行为数据各自的检测结果,确定所述多个行为数据中的正常行为数据;Determine the normal behavior data among the plurality of behavior data according to the respective detection results of the plurality of behavior data;
将所述多个行为数据中的正常行为数据添加至所述正常行为数据集合中;Adding normal behavior data from the plurality of behavior data to the normal behavior data set;
基于更新的异常行为数据集合和更新的正常行为数据集合,执行所述特征提取模型的训练过程,获取更新的特征提取模型。Based on the updated abnormal behavior data set and the updated normal behavior data set, the training process of the feature extraction model is performed to obtain the updated feature extraction model.
在一种可能实现方式中,所述获取模块用于获取所述多个行为数据中异常行为数据的人工确认信息;将所述人工确认信息指示的异常行为数据添加至所述异常行为数据集合中。In a possible implementation manner, the acquiring module is configured to acquire artificial confirmation information of abnormal behavior data among the plurality of behavior data; add abnormal behavior data indicated by the manual confirmation information to the abnormal behavior data set .
在一种可能实现方式中,所述获取模块还用于:In a possible implementation manner, the obtaining module is further used to:
获取多个视频;Get multiple videos;
对于所述多个视频中的每个视频,对所述视频中的目标进行检测和跟踪,获取第三时间段内所述目标的空间运动范围,所述空间运动范围为所述目标运动所覆盖的空间范围,所述第三时间段的时长小于所述视频的时间段的时长;For each of the plurality of videos, detect and track the target in the video to obtain the spatial motion range of the target in the third time period, the spatial motion range is covered by the target motion The spatial range of the third time period is less than the time period of the video;
根据所述空间运动范围和所述视频,在所述第三时间段对应的视频序列中进行图像截取,得到所述视频的图像序列,所述视频序列包含所述视频的多帧视频图像,所述图像序列包含所述多帧视频图像中所述空间运动范围对应的区域;According to the spatial motion range and the video, performing image interception in the video sequence corresponding to the third time period to obtain an image sequence of the video, the video sequence including multiple frames of video images of the video, so The image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
将所述多个视频的图像序列作为所述多个行为数据。The image sequence of the plurality of videos is used as the plurality of behavior data.
在一种可能实现方式中,所述装置还包括:In a possible implementation manner, the device further includes:
显示模块,用于对于所述多个行为数据中的异常行为数据,在播放所述异常行为数据所属视频的过程中,显示所述异常行为数据所属视频的图像序列。The display module is configured to display the image sequence of the video to which the abnormal behavior data belongs during the playing of the video to which the abnormal behavior data belongs to among the plurality of abnormal behavior data.
在一种可能实现方式中,所述获取模块用于:In a possible implementation manner, the acquisition module is used to:
当所述行为数据的行为特征与所述正常行为特征中心的距离大于所述距离 阈值时,确定所述行为数据为异常行为数据;When the distance between the behavior feature of the behavior data and the center of the normal behavior feature is greater than the distance threshold, it is determined that the behavior data is abnormal behavior data;
当所述行为数据的行为特征与所述正常行为特征中心的距离小于或等于所述距离阈值时,确定所述行为数据为正常行为数据。When the distance between the behavior feature of the behavior data and the center of the normal behavior feature is less than or equal to the distance threshold, it is determined that the behavior data is normal behavior data.
在一种可能实现方式中,所述获取模块还用于:In a possible implementation manner, the obtaining module is further used to:
获取多个正常行为数据;Obtain multiple normal behavior data;
对于所述多个正常行为数据中的每个正常行为数据,将所述正常行为数据输入所述特征提取模型,输出所述正常行为数据的行为特征;For each normal behavior data in the plurality of normal behavior data, input the normal behavior data into the feature extraction model, and output the behavior characteristics of the normal behavior data;
根据所述多个正常行为数据的行为特征,获取所述正常行为特征中心。Obtain the normal behavior characteristic center according to the behavior characteristic of the plurality of normal behavior data.
在一种可能实现方式中,所述多个正常行为数据中每个正常行为数据的行为特征使用一个特征向量表征;In a possible implementation manner, the behavior characteristic of each normal behavior data in the plurality of normal behavior data is characterized by a feature vector;
所述获取模块用于:The acquisition module is used to:
对所述多个正常行为数据的特征向量在每个维度计算平均值,获得由每个维度的平均值组成的一组平均值所表征的目标特征向量;Calculating an average value of the feature vectors of the plurality of normal behavior data in each dimension to obtain a target feature vector characterized by a set of average values consisting of the average value of each dimension;
将所述目标特征向量作为所述正常行为特征中心。Use the target feature vector as the normal behavior feature center.
第三方面,提供了一种计算机设备,包括处理器和存储器;所述存储器,用于存放至少一条指令;所述处理器执行所述存储器上所存放的至少一条指令,用于实现上述第一方面的异常行为检测的方法。In a third aspect, a computer device is provided, including a processor and a memory; the memory is used to store at least one instruction; the processor executes at least one instruction stored on the memory to implement the first Aspects of abnormal behavior detection methods.
第四方面,提供了一种计算机可读存储介质,所述存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现上述第一方面的异常行为检测的方法。According to a fourth aspect, a computer-readable storage medium is provided, in which a computer program is stored, and when the computer program is executed by a processor, the method for detecting abnormal behavior of the first aspect described above is implemented.
本公开实施例提供的技术方案带来的有益效果至少包括:The beneficial effects brought by the technical solutions provided by the embodiments of the present disclosure include at least:
通过特征提取模型提取行为数据的行为特征,根据提取到的行为特征与正常行为中心的距离和距离阈值,确定行为数据是否为异常行为数据,由于特征提取模型是基于距离约束的方法训练得到,正常行为数据通过该特征提取模型提取的行为特征处于一个比较小的特征空间范围内,异常行为数据通过该特征提取模型提取的行为特征处于特征空间范围外,这样保证了正常行为特征比较紧凑,异常行为特征与正常行为特征存在明显的距离间距,由于学习到了正常行为和异常行为的区别,所以这种基于距离度量的异常行为检测方法,准确性较高。Use the feature extraction model to extract the behavior features of the behavior data, and determine whether the behavior data is abnormal behavior data according to the distance and distance threshold between the extracted behavior features and the normal behavior center. Since the feature extraction model is trained based on the distance constraint method, normal The behavioral features extracted by the behavioral data through the feature extraction model are in a relatively small feature space, and the behavioral features extracted by the characteristic extraction model through the feature extraction model are outside the feature space, which ensures that the normal behavioral features are relatively compact and the abnormal behavior There is a clear distance between the feature and the normal behavior feature. Since the difference between normal behavior and abnormal behavior is learned, this method of abnormal behavior detection based on distance measurement has high accuracy.
附图说明BRIEF DESCRIPTION
为了更清楚地说明本公开实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly explain the technical solutions in the embodiments of the present disclosure, the drawings required in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present disclosure. For a person of ordinary skill in the art, without paying any creative work, other drawings can be obtained based on these drawings.
图1是本公开实施例提供的一种异常行为检测方法的流程图;1 is a flowchart of a method for detecting abnormal behavior provided by an embodiment of the present disclosure;
图2是本公开实施例提供的一种异常行为检测方法的流程图;2 is a flowchart of an abnormal behavior detection method provided by an embodiment of the present disclosure;
图3是本公开实施例提供的一种特征提取模型的训练流程图;3 is a training flowchart of a feature extraction model provided by an embodiment of the present disclosure;
图4是本公开实施例提供的一种异常行为检测的流程图;4 is a flowchart of an abnormal behavior detection provided by an embodiment of the present disclosure;
图5是本公开实施例提供的一种异常行为检测的反馈更新流程图;5 is a feedback update flowchart of abnormal behavior detection provided by an embodiment of the present disclosure;
图6是本公开实施例提供的一种异常行为检测装置的结构示意图;6 is a schematic structural diagram of an abnormal behavior detection device provided by an embodiment of the present disclosure;
图7是本公开实施例提供的一种异常行为检测装置的结构示意图;7 is a schematic structural diagram of an abnormal behavior detection device provided by an embodiment of the present disclosure;
图8是本公开实施例提供的一种计算机设备800的结构示意图。FIG. 8 is a schematic structural diagram of a computer device 800 according to an embodiment of the present disclosure.
具体实施方式detailed description
为使本公开的目的、技术方案和优点更加清楚,下面将结合附图对本公开实施方式作进一步地详细描述。To make the objectives, technical solutions, and advantages of the present disclosure more clear, the embodiments of the present disclosure will be described in further detail below in conjunction with the accompanying drawings.
图1是本公开实施例提供的一种异常行为检测方法的流程图。参见图1,该方法包括:FIG. 1 is a flowchart of an abnormal behavior detection method provided by an embodiment of the present disclosure. Referring to Figure 1, the method includes:
101、获取待检测的行为数据。101. Obtain behavior data to be detected.
102、将该行为数据输入特征提取模型,输出该行为数据的行为特征,该特征提取模型用于根据正常行为数据输出特征空间范围内的行为特征以及根据异常行为数据输出该特征空间范围外的行为特征,该特征空间范围内各个行为特征之间的距离小于距离阈值。102. Input the behavior data into a feature extraction model, and output behavior characteristics of the behavior data. The feature extraction model is used to output behavior characteristics within a characteristic space range according to normal behavior data and output behavior outside the characteristic space range according to abnormal behavior data. Feature, the distance between each behavior feature in the feature space is less than the distance threshold.
103、根据该行为数据的行为特征与正常行为特征中心的距离和该距离阈值,获取该行为数据的检测结果,该检测结果用于指示该行为数据是否为异常行为数据,该正常行为特征中心用于代表该特征空间范围内的行为特征。103. Obtain the detection result of the behavior data according to the distance between the behavior feature of the behavior data and the center of the normal behavior feature and the distance threshold, the detection result is used to indicate whether the behavior data is abnormal behavior data, and the normal behavior feature center uses Yu represents behavioral features within the range of the feature space.
本公开实施例提供的方法,通过特征提取模型提取行为数据的行为特征,根据提取到的行为特征与正常行为中心的距离和距离阈值,确定行为数据是否为异常行为数据。由于特征提取模型是基于距离约束的方法训练得到,正常行 为数据通过该特征提取模型提取的行为特征处于一个比较小的特征空间范围内,异常行为数据通过该特征提取模型提取的行为特征处于特征空间范围外,可见,正常行为特征比较紧凑,异常行为特征与正常行为特征存在明显的距离间距。这样,由于学习到了正常行为和异常行为的区别,所以可以基于该区别检测异常行为(即基于异常行为特征与正常行为特征的距离检测异常行为),使异常行为检测的准确性较高。The method provided in the embodiment of the present disclosure extracts the behavior characteristics of the behavior data through the feature extraction model, and determines whether the behavior data is abnormal behavior data according to the distance and the distance threshold between the extracted behavior characteristics and the normal behavior center. Because the feature extraction model is trained based on the distance constraint method, the behavior features extracted by the normal behavior data through the feature extraction model are in a relatively small feature space, and the behavior features extracted by the abnormal behavior data through the feature extraction model are in the feature space Outside the scope, it can be seen that the normal behavior characteristics are relatively compact, and there is a clear distance between the abnormal behavior characteristics and the normal behavior characteristics. In this way, since the difference between the normal behavior and the abnormal behavior is learned, the abnormal behavior can be detected based on the difference (that is, the abnormal behavior is detected based on the distance between the abnormal behavior characteristic and the normal behavior characteristic), so that the accuracy of the abnormal behavior detection is high.
在一种可能实现方式中,该特征提取模型的训练过程包括:In a possible implementation manner, the training process of the feature extraction model includes:
根据正常行为数据集合和异常行为数据集合,获取多个第一行为数据对和多个第二行为数据对,每个第一行为数据对包含该正常行为数据集合中的两个正常行为数据,每个第二行为数据对包含该正常行为数据集合中的一个正常行为数据和该异常行为数据集合中的一个异常行为数据;According to the normal behavior data set and the abnormal behavior data set, multiple first behavior data pairs and multiple second behavior data pairs are obtained, and each first behavior data pair includes two normal behavior data in the normal behavior data set, each A second behavior data pair includes a normal behavior data in the normal behavior data set and an abnormal behavior data in the abnormal behavior data set;
提取该多个第一行为数据对的多个第一行为特征对和该多个第二行为数据对的多个第二行为特征对,每个第一行为特征对包含两个正常行为数据的行为特征,每个第二行为特征对包含一个正常行为数据的行为特征和一个异常行为数据的行为特征;Extracting a plurality of first behavior feature pairs of the plurality of first behavior data pairs and a plurality of second behavior feature pairs of the plurality of second behavior data pairs, each first behavior feature pair containing two behaviors of normal behavior data Characteristics, each second behavior characteristic pair includes a behavior characteristic of normal behavior data and a behavior characteristic of abnormal behavior data;
根据该每个第一行为特征对包含的两个行为特征之间的距离和该每个第二行为特征对包含的两个行为特征之间的距离,通过损失函数监督训练,得到该特征提取模型。According to the distance between the two behavior features included in each first behavior feature pair and the distance between the two behavior features included in each second behavior feature pair, the feature extraction model is obtained through supervised training by a loss function .
在一种可能实现方式中,该根据正常行为数据集合和异常行为数据集合,获取多个第一行为数据对和多个第二行为数据对之前,该方法还包括:In a possible implementation manner, before acquiring multiple first behavior data pairs and multiple second behavior data pairs according to the normal behavior data set and the abnormal behavior data set, the method further includes:
基于多个第一视频,获取该正常行为数据集合,该多个第一视频为目标进行正常行为的视频;Acquiring the normal behavior data set based on a plurality of first videos, the plurality of first videos being videos of normal behavior targeted by the target;
基于多个第二视频,获取该异常行为数据集合,该多个第二视频为目标进行异常行为的视频。Based on the plurality of second videos, the abnormal behavior data set is acquired, and the plurality of second videos are videos of the target performing abnormal behavior.
在一种可能实现方式中,该基于多个第一视频,获取该正常行为数据集合,包括:In a possible implementation manner, the acquiring the normal behavior data set based on multiple first videos includes:
对于该多个第一视频中的每个第一视频,对该第一视频中的目标进行检测和跟踪,获取第一时间段内该目标的空间运动范围,该空间运动范围为该目标运动所覆盖的空间范围,该第一时间段的时长小于该第一视频的时间段的时长;For each first video in the plurality of first videos, the target in the first video is detected and tracked to obtain the spatial motion range of the target in the first time period, the spatial motion range is determined by the target motion The spatial range covered, the duration of the first time period is less than the duration of the first video period;
根据该空间运动范围和该第一视频,在该第一时间段对应的第一视频序列中进行图像截取,得到该第一视频的第一图像序列,该第一视频序列包含该第 一视频的多帧视频图像,该第一图像序列包含该多帧视频图像中该空间运动范围对应的区域;According to the spatial motion range and the first video, perform image interception in the first video sequence corresponding to the first time period to obtain a first image sequence of the first video, the first video sequence including the first video sequence A multi-frame video image, the first image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
将该多个第一视频的第一图像序列作为该正常行为数据集合。The first image sequence of the plurality of first videos is used as the normal behavior data set.
在一种可能实现方式中,该异常行为数据集合的获取过程包括:In a possible implementation manner, the process of obtaining the abnormal behavior data set includes:
对于该多个第二视频中的每个第二视频,对该第二视频中的目标进行检测和跟踪,获取第二时间段内该目标的空间运动范围,该空间运动范围为该目标运动所覆盖的空间范围,该第二时间段的时长小于该第二视频的时间段的时长;For each second video in the plurality of second videos, the target in the second video is detected and tracked to obtain the spatial motion range of the target in the second time period, the spatial motion range is the target motion range The spatial range covered, the duration of the second time period is less than the duration of the second video period;
根据该空间运动范围和该第二视频,在该第二时间段对应的第二视频序列中进行图像截取,得到该第二视频的第二图像序列,该第二视频序列包含该第二视频的多帧视频图像,该第二图像序列包含该多帧视频图像中该空间运动范围对应的区域;According to the spatial motion range and the second video, performing image interception in the second video sequence corresponding to the second time period to obtain a second image sequence of the second video, the second video sequence including the second video A multi-frame video image, the second image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
将该多个第二视频的第二图像序列作为该异常行为数据集合。The second image sequence of the plurality of second videos is used as the abnormal behavior data set.
在一种可能实现方式中,该待检测的行为数据为多个行为数据,In a possible implementation manner, the behavior data to be detected is multiple behavior data,
该根据该行为数据的行为特征与正常行为特征中心的距离,获取该行为数据的检测结果之后,该方法还包括:After obtaining the detection result of the behavior data according to the distance between the behavior characteristic of the behavior data and the center of the normal behavior characteristic, the method further includes:
根据该多个行为数据各自的检测结果,确定该多个行为数据中的异常行为数据;Determine abnormal behavior data among the plurality of behavior data according to the detection results of the plurality of behavior data;
将该多个行为数据中的异常行为数据添加至该异常行为数据集合中;Add the abnormal behavior data in the multiple behavior data to the abnormal behavior data set;
基于更新的异常行为数据集合,执行该特征提取模型的训练过程,获取更新的特征提取模型。Based on the updated abnormal behavior data set, the training process of the feature extraction model is performed to obtain the updated feature extraction model.
在一种可能实现方式中,该将该多个行为数据中的异常行为数据添加至该异常行为数据集合,包括:In a possible implementation manner, the addition of abnormal behavior data in the plurality of behavior data to the abnormal behavior data set includes:
获取该多个行为数据中异常行为数据的人工确认信息;Obtain manual confirmation information of abnormal behavior data among the multiple behavior data;
将该人工确认信息指示的异常行为数据添加至该异常行为数据集合中。The abnormal behavior data indicated by the manual confirmation information is added to the abnormal behavior data set.
在一种可能的实现方式中,该待检测的行为数据为多个行为数据;In a possible implementation manner, the behavior data to be detected is multiple behavior data;
该根据该行为数据的行为特征与正常行为特征中心的距离,获取该行为数据的检测结果之后,该方法还包括:After obtaining the detection result of the behavior data according to the distance between the behavior characteristic of the behavior data and the center of the normal behavior characteristic, the method further includes:
根据该多个行为数据各自的检测结果,确定该多个行为数据中的正常行为数据;Determine the normal behavior data among the plurality of behavior data according to the respective detection results of the plurality of behavior data;
将该多个行为数据中的正常行为数据添加至该正常行为数据集合中;Add the normal behavior data from the multiple behavior data to the normal behavior data set;
该基于更新的异常行为数据集合,执行该特征提取模型的训练过程,获取 更新的特征提取模型,包括:Based on the updated abnormal behavior data set, the training process of the feature extraction model is performed to obtain the updated feature extraction model, including:
基于更新的异常行为数据集合和更新的正常行为数据集合,执行该特征提取模型的训练过程,获取更新的特征提取模型。Based on the updated abnormal behavior data set and the updated normal behavior data set, the training process of the feature extraction model is performed to obtain the updated feature extraction model.
在一种可能实现方式中,该方法还包括:In a possible implementation manner, the method further includes:
获取多个视频;Get multiple videos;
对于该多个视频中的每个视频,对该视频中的目标进行检测和跟踪,获取第三时间段内该目标的空间运动范围,该空间运动范围为该目标运动所覆盖的空间范围,该第三时间段的时长小于该视频的时间段的时长;For each video in the plurality of videos, detect and track the target in the video to obtain the spatial motion range of the target in the third time period, the spatial motion range is the spatial range covered by the target motion, the The duration of the third time period is less than the duration of the video period;
根据该空间运动范围和该视频,在该第三时间段对应的视频序列中进行图像截取,得到该视频的图像序列,该视频序列包含该视频的多帧视频图像,该图像序列包含该多帧视频图像中该空间运动范围对应的区域;According to the spatial motion range and the video, perform image interception in the video sequence corresponding to the third time period to obtain an image sequence of the video, the video sequence includes multiple frames of the video image of the video, and the image sequence includes the multiple frames The area in the video image corresponding to the spatial motion range;
将该多个视频的图像序列作为该多个行为数据。The image sequence of the multiple videos is used as the multiple behavior data.
在一种可能实现方式中,该方法还包括:In a possible implementation manner, the method further includes:
对于该多个行为数据中的异常行为数据,在播放该异常行为数据所属视频的过程中,显示该异常行为数据所属视频的图像序列。For the abnormal behavior data in the plurality of behavior data, in the process of playing the video to which the abnormal behavior data belongs, the image sequence of the video to which the abnormal behavior data belongs is displayed.
在一种可能实现方式中,该根据该行为数据的行为特征与正常行为特征中心的距离和该距离阈值,获取该行为数据的检测结果,包括:In a possible implementation manner, obtaining the detection result of the behavior data according to the distance between the behavior feature of the behavior data and the center of the normal behavior feature and the distance threshold includes:
当该行为数据的行为特征与该正常行为特征中心的距离大于该距离阈值时,确定该行为数据为异常行为数据;When the distance between the behavior feature of the behavior data and the center of the normal behavior feature is greater than the distance threshold, the behavior data is determined to be abnormal behavior data;
当该行为数据的行为特征与该正常行为特征中心的距离小于或等于该距离阈值时,确定该行为数据为正常行为数据。When the distance between the behavior feature of the behavior data and the center of the normal behavior feature is less than or equal to the distance threshold, the behavior data is determined to be normal behavior data.
在一种可能实现方式中,该正常行为特征中心的获取过程包括:In a possible implementation manner, the process of acquiring the normal behavior feature center includes:
获取多个正常行为数据;Obtain multiple normal behavior data;
对于该多个正常行为数据中的每个正常行为数据,将该正常行为数据输入该特征提取模型,输出该正常行为数据的行为特征;For each normal behavior data in the plurality of normal behavior data, input the normal behavior data into the feature extraction model, and output the behavior characteristics of the normal behavior data;
根据该多个正常行为数据的行为特征,获取该正常行为特征中心。According to the behavior characteristics of the plurality of normal behavior data, the normal behavior characteristic center is obtained.
在一种可能实现方式中,该多个正常行为数据中每个正常行为数据的行为特征使用一个特征向量表征;In a possible implementation manner, the behavior characteristic of each normal behavior data in the plurality of normal behavior data is characterized by a feature vector;
根据该多个正常行为数据的行为特征,获取该正常行为特征中心,包括:Obtaining the normal behavior characteristic center according to the behavior characteristics of the plurality of normal behavior data includes:
对该多个正常行为数据的特征向量在每个维度计算平均值,获得由每个维度的平均值组成的一组平均值所表征的目标特征向量;Calculate the average value of the feature vectors of the multiple normal behavior data in each dimension to obtain a target feature vector characterized by a set of average values composed of the average values of each dimension;
将该目标特征向量作为该正常行为特征中心。Use the target feature vector as the normal behavior feature center.
上述所有可选技术方案,可以采用任意结合形成本公开的可选实施例,在此不再一一赘述。All of the above optional technical solutions may be combined in any combination to form optional embodiments of the present disclosure, and details are not repeated herein.
图2是本公开实施例提供的一种异常行为检测方法的流程图。该方法由计算机设备执行,参见图2,该方法包括:2 is a flowchart of an abnormal behavior detection method provided by an embodiment of the present disclosure. The method is executed by a computer device. Referring to FIG. 2, the method includes:
201、获取正常行为数据集合和异常行为数据集合。201. Acquire normal behavior data collection and abnormal behavior data collection.
其中,正常行为数据集合包含多个正常行为数据,异常行为数据集合包含多个异常行为数据。Among them, the normal behavior data set contains multiple normal behavior data, and the abnormal behavior data set contains multiple abnormal behavior data.
在一种可能实现方式中,该正常行为数据集合和异常行为数据集合中的行为数据可以基于视频得到,相应地,该步骤201可以包括:基于多个第一视频,获取该正常行为数据集合,该多个第一视频为目标进行正常行为的视频;基于多个第二视频,获取该异常行为数据集合,该多个第二视频为目标进行异常行为的视频。In a possible implementation manner, the behavior data in the normal behavior data set and the abnormal behavior data set may be obtained based on video, and accordingly, step 201 may include: acquiring the normal behavior data set based on multiple first videos, The plurality of first videos are videos of the target performing normal behavior; based on the plurality of second videos, the abnormal behavior data set is acquired, and the plurality of second videos are videos of the target performing abnormal behavior.
其中,该多个第一视频和多个第二视频可以由相关人员根据预设的正常行为类别进行收集后存储在计算机设备上。针对正常行为和异常行为,由于正常行为类别是可以预设的,因此可以根据应用场景任意指定正常行为的范畴,而与正常行为不同的行为则认为是异常行为。正常行为可以包含但不限于正常行走、静坐、与特定场景相关的一系列正常行为,异常行为可以包含但不限于暴乱、冲突、与特定场景相关的一系列行为。例如,针对日常生活场景,可以指定正常行走和静坐等行为是正常行为,而暴乱和冲突等行为是异常行为。针对银行柜台场景,可以指定直立坐姿和点钞等行为是正常行为,而打电话和向口袋放纸币等行为是异常行为。The plurality of first videos and the plurality of second videos may be collected by relevant personnel according to preset normal behavior categories and stored on the computer device. For normal behavior and abnormal behavior, since the normal behavior category can be preset, the category of normal behavior can be arbitrarily specified according to the application scenario, and behaviors different from the normal behavior are considered abnormal behaviors. Normal behaviors can include, but are not limited to, normal walking, meditation, and a series of normal behaviors related to a specific scene, and abnormal behaviors can include, but are not limited to, riots, conflicts, and a series of specific scene-related behaviors. For example, for daily life scenarios, you can specify that normal walking and meditation are normal behaviors, while behaviors such as riots and conflicts are abnormal behaviors. For the bank counter scene, it can be specified that the behavior of standing upright and counting banknotes is normal behavior, while the behavior of making calls and putting banknotes in pockets is abnormal behavior.
针对正常行为数据集合的获取过程,该基于多个第一视频,获取该正常行为数据集合的过程可以包括以下步骤a1至步骤a3:For the process of acquiring the normal behavior data set, the process of acquiring the normal behavior data set based on multiple first videos may include the following steps a1 to a3:
步骤a1、对于该多个第一视频中的每个第一视频,对该第一视频中的目标进行检测和跟踪,获取第一时间段内该目标的空间运动范围,该空间运动范围为该目标运动所覆盖的空间范围,该第一时间段的时长小于该第一视频的时间段的时长。Step a1. For each first video of the plurality of first videos, detect and track the target in the first video to obtain the spatial motion range of the target in the first time period, the spatial motion range is The spatial range covered by the target motion, the duration of the first time period is less than the duration of the first video period.
其中,该第一时间段可以是第一视频的一个视频序列的时间段,该视频序列包含第一视频的多帧视频图像,如f1、……、fn。例如,第一时间段为15秒, 第一视频为3分钟,第一时间段为第一视频的任意连续的15秒。目标指人、车、动物等。The first time period may be a time period of a video sequence of the first video, where the video sequence includes multiple frames of video images of the first video, such as f1, ..., fn. For example, the first time period is 15 seconds, the first video is 3 minutes, and the first time period is any consecutive 15 seconds of the first video. Targets refer to people, cars, animals, etc.
计算机设备可以采用目标检测和跟踪算法,对第一视频中的目标进行检测和跟踪,确定该目标在该第一时间段的各个时刻的位置,以此确定该目标的空间运动范围,目标的空间运动范围用于表征目标在第一时间段内在视频图像中的位置变化范围。其中,目标检测和跟踪算法包含但不限于DPM(Deformable Part Model,可变形的组件模型)、FRCNN(Faster Region-based Convolutional Neural Networks,基于候选区域的卷积神经网络快速检测模型)、YOLO(You Only Look Once,)、SSD(Single Shot multibox Detector,)等。该目标在各个时刻的位置可以通过在视频图像中添加目标框来表示,该目标框的形式包括但不限于外接矩形框、外接圆形框和外接多边形框。The computer device may use a target detection and tracking algorithm to detect and track the target in the first video, determine the position of the target at each moment in the first time period, and thereby determine the spatial motion range of the target and the space of the target The motion range is used to characterize the range of changes in the position of the target in the video image during the first time period. Among them, target detection and tracking algorithms include but are not limited to DPM (Deformable Part Model), FRCNN (Faster Region-based Convolutional Neural Networks, rapid detection model of convolutional neural network based on candidate regions), YOLO (You Only Look, Once,), SSD (Single Shot Multibox Detector,), etc. The position of the target at each moment can be represented by adding a target frame to the video image. The form of the target frame includes but is not limited to a circumscribed rectangular frame, a circumscribed circular frame, and a circumscribed polygonal frame.
以目标框为外接矩形框为例,在视频序列f1、……、fn中,假设计算机设备采用目标检测和跟踪算法,对该视频序列进行目标检测和跟踪,依次获取到该视频序列包含的多帧视频图像中的目标框,由此可以得到一系列目标框R1、……、Rm,其中,m和n为正整数,m<=n(在m<n时表示跟踪存在丢帧现象,在m=n时表示每帧视频图像均包括目标框)。任一目标框可以表示为:R=[left_top_x,left_top_y,right_bottom_x,right_bottom_y],其中,left_top_x和left_top_y用于描述在直角坐标系下目标框的左上角坐标,right_bottom_x和right_bottom_y用于描述在直角坐标系下目标框的右下角坐标(直角坐标系的原点可以是目标框所在图像的左上角)。计算机设备获取了一系列目标框后,可以基于目标框,得到目标的空间运动范围,目标的空间运动范围可以表示为:R tube=[min({left_top_x}),min({left_top_y}),max({right_bottom_x}),max({right_bottom_y})]。其中,min({left_top_x})表示目标框的左上角的最小横坐标,min({left_top_y})表示目标框的左上角的最小纵坐标,max({right_bottom_x})表示目标框的右下角的最大横坐标,max({right_bottom_y})表示目标框中的右下角的最大纵坐标。 Taking the target frame as an external rectangular frame as an example, in the video sequence f1, ..., fn, it is assumed that the computer device uses a target detection and tracking algorithm to perform target detection and tracking on the video sequence, and in turn obtains how many The target frame in the frame video image, from which you can get a series of target frames R1, ..., Rm, where m and n are positive integers, m<=n (when m<n indicates that there is a frame loss phenomenon in tracking, in m=n indicates that each frame of video image includes a target frame). Any target frame can be expressed as: R = [left_top_x, left_top_y, right_bottom_x, right_bottom_y], where left_top_x and left_top_y are used to describe the upper left corner coordinates of the target frame under the rectangular coordinate system, right_bottom_x and right_bottom_y are used to describe the rectangular coordinate system The coordinates of the lower right corner of the lower target frame (the origin of the rectangular coordinate system may be the upper left corner of the image where the target frame is located). After the computer device obtains a series of target frames, the spatial motion range of the target can be obtained based on the target frame. The spatial motion range of the target can be expressed as: R tube =[min({left_top_x}),min({left_top_y}),max ({right_bottom_x}),max({right_bottom_y})]. Among them, min({left_top_x}) represents the minimum horizontal coordinate of the upper left corner of the target frame, min({left_top_y}) represents the minimum vertical coordinate of the upper left corner of the target frame, and max({right_bottom_x}) represents the maximum of the lower right corner of the target frame The abscissa, max({right_bottom_y}) represents the maximum ordinate of the lower right corner of the target frame.
步骤a2、根据该空间运动范围和该第一视频,在该第一时间段对应的第一视频序列中进行图像截取,得到该第一视频的第一图像序列。该第一视频序列包含该第一视频的多帧视频图像,该第一图像序列包含该多帧视频图像中该空间运动范围对应的区域。Step a2: According to the spatial motion range and the first video, perform image interception in the first video sequence corresponding to the first time period to obtain the first image sequence of the first video. The first video sequence includes multi-frame video images of the first video, and the first image sequence includes regions corresponding to the spatial motion range in the multi-frame video images.
计算机设备可以根据步骤a1中的空间运动范围,对视频序列包含的每帧视 频图像进行图像截取,从每帧视频图像中截取该空间运动范围对应的区域,截取到的所有区域,按照视频序列的顺序即构成了第一图像序列,该第一图像序列能够反映目标在时间和空间上的运动信息。例如,使用R tube=[min({left_top_x}),min({left_top_y}),max({right_bottom_x}),max({right_bottom_y})],依次在视频序列f1、……、fn中截取左上角的坐标为(min({left_top_x}),min({left_top_y}))、右下角的坐标为(max({right_bottom_x}),max({right_bottom_y}))的矩形区域,得到视频序列中每帧视频图像中的矩形区域,依次截取的矩形区域即组成第一图像序列。这种图像序列的提取方式,在保留目标的行为不损失信息的情况下,可以大幅减少背景信息,更利于特征提取模型对目标的行为特征进行提取。 The computer device may perform image interception on each frame of the video image included in the video sequence according to the spatial motion range in step a1, and intercept the area corresponding to the spatial motion range from each frame of the video image. The sequence constitutes the first image sequence, which can reflect the motion information of the target in time and space. For example, use R tube =[min({left_top_x}),min({left_top_y}),max({right_bottom_x}),max({right_bottom_y})], and then intercept the upper left corner in the video sequence f1,...,fn The rectangular area with the coordinates of (min({left_top_x}), min({left_top_y})), and the coordinates of the bottom right corner (max({right_bottom_x}), max({right_bottom_y})) gets the video of each frame in the video sequence The rectangular area in the image, the rectangular areas sequentially intercepted constitute the first image sequence. This method of image sequence extraction can greatly reduce background information while retaining the target's behavior without losing information, and is more conducive to the feature extraction model to extract the target's behavioral features.
这样,由于存在多个第一视频,所以可以得到多个第一视频分别对应的第一图像序列,即存在多个第一图像序列。In this way, since there are multiple first videos, it is possible to obtain first image sequences corresponding to the multiple first videos, that is, there are multiple first image sequences.
步骤a3、将该多个第一视频的第一图像序列作为该正常行为数据集合。Step a3: Use the first image sequence of the plurality of first videos as the normal behavior data set.
通过步骤a1和步骤a2,计算机设备可以得到多个第一视频中每个第一视频的第一图像序列,将每个第一图像序列作为一个行为数据(或行为序列),组成正常行为数据集合。Through step a1 and step a2, the computer device can obtain the first image sequence of each first video in the plurality of first videos, and use each first image sequence as a behavior data (or behavior sequence) to form a normal behavior data set .
针对异常行为数据集合的获取过程,该基于多个第二视频,获取该异常行为数据集合的过程可以包括以下步骤b1至步骤b3:For the process of acquiring abnormal behavior data sets, the process of acquiring the abnormal behavior data sets based on multiple second videos may include the following steps b1 to b3:
步骤b1、对于该多个第二视频中的每个第二视频,计算机设备对该第二视频中的目标进行检测和跟踪,获取第二时间段内该目标的空间运动范围,该空间运动范围为该目标运动所覆盖的空间范围,该第二时间段的时长小于该第二视频的时间段的时长。Step b1: For each second video in the plurality of second videos, the computer device detects and tracks the target in the second video to obtain the spatial motion range of the target in the second time period, the spatial motion range For the spatial range covered by the target motion, the duration of the second time period is less than the duration of the second video period.
步骤b2、计算机设备根据该空间运动范围和该第二视频,在该第二时间段对应的第二视频序列中进行图像截取,得到该第二视频的第二图像序列,该第二视频序列包含该第二视频的多帧视频图像,该第二图像序列包含该多帧视频图像中该空间运动范围对应的区域。Step b2. The computer device performs image interception in the second video sequence corresponding to the second time period according to the spatial motion range and the second video to obtain a second image sequence of the second video, the second video sequence includes The multi-frame video image of the second video, and the second image sequence includes an area corresponding to the spatial motion range in the multi-frame video image.
步骤b3、将该多个第二视频的第二图像序列作为该异常行为数据集合。Step b3: Use the second image sequence of the plurality of second videos as the abnormal behavior data set.
步骤b1至步骤b3与步骤a1至步骤a3同理,具体过程不再赘述。Step b1 to step b3 are the same as step a1 to step a3, and the specific process will not be repeated here.
此处需要说明的是,第二时间段与第一时间段的时长可以相等,也可以不相等。It should be noted here that the duration of the second time period and the first time period may be equal or different.
需要说明的是,由于在任意场景下,正常行为的发生概率远大于异常行为 的发生概率,因此相比于第二视频,第一视频更容易收集。可以理解的是,由于多个第一视频的数量远大于多个第二视频的数量,所以基于多个第一视频获取的正常行为数据集合中包含大量的正常行为数据,而基于多个第二视频获取的异常行为数据集合中包含少量的异常行为数据。It should be noted that, in any scenario, the probability of normal behavior is much greater than the probability of abnormal behavior, so the first video is easier to collect than the second video. It can be understood that, since the number of multiple first videos is much larger than the number of multiple second videos, the normal behavior data set acquired based on multiple first videos contains a large amount of normal behavior data, while the number based on multiple second videos The abnormal behavior data collection obtained by the video contains a small amount of abnormal behavior data.
202、根据正常行为数据集合和异常行为数据集合,获取多个第一行为数据对和多个第二行为数据对,每个第一行为数据对包含该正常行为数据集合中的两个正常行为数据,每个第二行为数据对包含该正常行为数据集合中的一个正常行为数据和该异常行为数据集合中的一个异常行为数据。202. Acquire multiple first behavior data pairs and multiple second behavior data pairs according to the normal behavior data set and the abnormal behavior data set, and each first behavior data pair includes two normal behavior data in the normal behavior data set , Each second behavior data pair contains one normal behavior data in the normal behavior data set and one abnormal behavior data in the abnormal behavior data set.
本公开实施例中,计算机设备可以基于正常行为数据集合,构建多个第一行为数据对(“正常-正常”行为数据对),基于正常行为数据集合和异常行为数据集合,构建多个第二行为数据对(“正常-异常”行为数据对)。In the embodiment of the present disclosure, the computer device may construct a plurality of first behavior data pairs (“normal-normal” behavior data pairs) based on the normal behavior data set, and construct a plurality of second behavior data sets based on the normal behavior data set and the abnormal behavior data set Behavior data pairs ("normal-abnormal" behavior data pairs).
具体处理是:计算机设备可以将正常行为数据集合中的正常行为数据进行两两组合,得到多个第一行为数据对。对于正常行为数据集合中的每个正常行为数据,计算机设备可以将该正常行为数据与异常行为数据集合中的每个异常行为数据进行组合,得到多个第二行为数据对。The specific processing is: the computer device can combine the normal behavior data in the normal behavior data set in twos to obtain multiple first behavior data pairs. For each normal behavior data in the normal behavior data set, the computer device may combine the normal behavior data with each abnormal behavior data in the abnormal behavior data set to obtain multiple second behavior data pairs.
由于正常行为数据集合中包含大量的正常行为数据,异常行为数据集合中包含少量的异常行为数据,所以计算机设备可以基于大量的正常行为数据和少量的异常行为数据,组成大量的“正常-正常”行为数据对和大量的“正常-异常”行为数据对。Since the normal behavior data set contains a large amount of normal behavior data, and the abnormal behavior data set contains a small amount of abnormal behavior data, the computer device can form a large amount of "normal-normal" based on a large amount of normal behavior data and a small amount of abnormal behavior data Behavior data pairs and a large number of "normal-abnormal" behavior data pairs.
例如,包含正常行为数据的正常行为数据集合为SN={n 1,n 2,...,n k},SN中的每个元素n 1,n 2,...,n k分别表示一个正常行为数据;包含异常行为数据的异常行为数据集合为
Figure PCTCN2019127797-appb-000001
其中,k和p均为正整数,且k远大于p,SA中的每个元素
Figure PCTCN2019127797-appb-000002
表示一个异常行为数据,a的下标是指异常行为类别,上标用于区分同一异常行为类别下的异常行为数据。计算机设备使用SN组建“正常-正常”行为数据对NN_Pair={<n i,n j>,i≠j};使用SN和SA组建“正常-异常”行为数据对
Figure PCTCN2019127797-appb-000003
其中,sizeof(a q)是指同一异常行为类别的异常行为数据的数量。计算机设备基于NN_Pair和NA_Pair进行训练,得到特征提取模型,具体过程参见后续步骤203和步骤204。
For example, the normal behavior data set containing normal behavior data is SN={n 1 ,n 2 ,...,n k }, and each element n 1 ,n 2 ,...,n k in the SN represents a Normal behavior data; the collection of abnormal behavior data containing abnormal behavior data is
Figure PCTCN2019127797-appb-000001
Where k and p are positive integers, and k is much greater than p, each element in SA
Figure PCTCN2019127797-appb-000002
Represents an abnormal behavior data. The subscript of a refers to the abnormal behavior category. The superscript is used to distinguish the abnormal behavior data under the same abnormal behavior category. Computer equipment uses SN to form "normal-normal" behavior data pair NN_Pair = {<n i ,n j >,i≠j}; uses SN and SA to form "normal-abnormal" behavior data pair
Figure PCTCN2019127797-appb-000003
Among them, sizeof(a q ) refers to the amount of abnormal behavior data of the same abnormal behavior category. The computer device trains based on NN_Pair and NA_Pair to obtain a feature extraction model. For the specific process, see subsequent steps 203 and 204.
203、提取该多个第一行为数据对的多个第一行为特征对和该多个第二行为数据对的多个第二行为特征对,每个第一行为特征对包含两个正常行为数据的 行为特征,每个第二行为特征对包含一个正常行为数据的行为特征和一个异常行为数据的行为特征。203. Extract a plurality of first behavior feature pairs of the plurality of first behavior data pairs and a plurality of second behavior feature pairs of the plurality of second behavior data pairs, and each first behavior feature pair includes two normal behavior data Behavior characteristics, each second behavior characteristic pair contains a behavior characteristic of normal behavior data and a behavior characteristic of abnormal behavior data.
在一种可能实现方式中,计算机设备可以获取存初始提取模型,利用初始提取模型,对多个第一行为数据对中的正常行为数据进行行为特征提取,得到多个第一行为特征对(第一行为特征对包括对两个正常行为数据提取得到的行为特征)。计算机设备利用初始提取模型,对多个第二行为数据对中的正常行为数据和异常行为数据分别进行行为特征提取,得到多个第二行为特征对(第二行为特征对包括对一个正常行为数据提取得到的行为特征和对一个异常行为数据提取得到的行为特征)。其中,该初始特征提取模型具有根据输入的行为数据输出行为特征的能力,该初始特征提取模型可以由计算机设备训练得到,也可以由其他设备发送给该计算机设备。该初始特征提取模型的训练过程可以包括:基于多个样本行为数据对卷积神经网络进行训练,得到初始特征提取模型。In a possible implementation manner, the computer device may obtain the initial extraction model, and use the initial extraction model to perform behavior feature extraction on the normal behavior data in the plurality of first behavior data pairs to obtain a plurality of first behavior feature pairs (p. A behavior feature pair includes behavior features extracted from two normal behavior data). The computer device uses the initial extraction model to perform behavior feature extraction on the normal behavior data and the abnormal behavior data in the plurality of second behavior data pairs, respectively, to obtain a plurality of second behavior characteristic pairs (the second behavior characteristic pair includes one normal behavior data Behavior features extracted and behavior features extracted from an abnormal behavior data). Wherein, the initial feature extraction model has the ability to output behavior features based on the input behavior data. The initial feature extraction model can be trained by a computer device or sent to the computer device by other devices. The training process of the initial feature extraction model may include: training the convolutional neural network based on multiple sample behavior data to obtain an initial feature extraction model.
具体地,对于多个第一行为数据对中的每个第一行为数据对,计算机设备可以将该第一行为数据对中各正常行为数据分别输入初始特征提取模型,输出该第一行为数据对的行为特征对,也即是,第一行为特征对。对于多个第二行为数据对中的每个第二行为数据对,计算机设备可以将该第二行为数据对中各正常行为数据和异常行为数据分别输入初始特征提取模型,输出该第二行为数据对的行为特征对,也即是,第二行为特征对。Specifically, for each first behavior data pair in the plurality of first behavior data pairs, the computer device may separately input each normal behavior data in the first behavior data pair into an initial feature extraction model, and output the first behavior data pair The behavioral characteristic pair, that is, the first behavioral characteristic pair. For each second behavior data pair in the plurality of second behavior data pairs, the computer device may input the normal behavior data and the abnormal behavior data in the second behavior data pair into the initial feature extraction model, respectively, and output the second behavior data A pair of behavioral characteristics, that is, a pair of second behavioral characteristics.
204、计算机设备根据该每个第一行为特征对包含的两个行为特征之间的距离和该每个第二行为特征对包含的两个行为特征之间的距离,通过损失函数监督训练,得到该特征提取模型。204. According to the distance between the two behavior features included in each first behavior feature pair and the distance between the two behavior features included in each second behavior feature pair, the computer device supervises training through a loss function to obtain The feature extraction model.
其中,该特征提取模型用于将正常行为数据的行为特征映射到特征空间范围内以及将异常行为数据的行为特征映射到该特征空间范围外,该特征空间范围内各个行为特征之间的距离小于距离阈值。特征空间范围指所有正常行为数据的高维特征向量构成的高维球面空间,使得正常行为数据的行为特征总是处于该球面内部。例如,选取距离阈值为球面的直径,则所有正常行为的行为特征之间的距离均小于该距离阈值,而异常行为数据的行为特征则映射到该球面的外部,其行为特征与球心(可以称为是特征空间范围的中心,即正常行为特征中心)之间的距离大于该距离阈值。Among them, the feature extraction model is used to map the behavior features of normal behavior data into the feature space and map the behavior features of abnormal behavior data outside the feature space. The distance between the behavior features in the feature space is less than Distance threshold. The feature space range refers to a high-dimensional spherical space composed of high-dimensional feature vectors of all normal behavior data, so that the behavior features of normal behavior data are always inside the spherical surface. For example, if the distance threshold is selected as the diameter of the spherical surface, the distance between all the behavioral characteristics of normal behavior is less than the distance threshold, and the behavioral characteristics of the abnormal behavior data are mapped to the outside of the spherical surface. It is called the center of the feature space, that is, the distance between the normal behavior feature centers) is greater than the distance threshold.
本公开实施例中,对于每个第一行为特征对,计算机设备可以采用预设距离算法,计算每个第一行为特征对包含的两个行为特征之间的距离,得到每个 第一行为特征对对应的距离。对于每个第二行为特征对,计算机设备可以采用预设距离算法,计算每个第二行为特征对包含的两个行为特征之间的距离,得到每个第二行为特征对对应的距离。该距离包括但不限于欧式距离、余弦距离和汉明距离。In the embodiment of the present disclosure, for each first behavior feature pair, the computer device may use a preset distance algorithm to calculate the distance between the two behavior features contained in each first behavior feature pair to obtain each first behavior feature The corresponding distance. For each second behavior feature pair, the computer device may use a preset distance algorithm to calculate the distance between the two behavior features contained in each second behavior feature pair to obtain the distance corresponding to each second behavior feature pair. The distance includes but is not limited to Euclidean distance, cosine distance and Hamming distance.
进一步地,计算机设备可以根据计算得到的距离,通过损失函数监督训练,得到该特征提取模型,具体过程包括:计算机设备计算每个第一行为特征对对应的距离与第一距离阈值之间的误差,这样,对于多个第一行为特征对对应的距离,计算机设备可以获取到多个误差。计算机设备计算每个第二行为特征对的距离与第二距离阈值之间的误差,这样,对于多个第二行为特征对的距离,可以获取到多个误差。其中,第一距离阈值是第一行为特征对期望的距离,第二距离阈值是第二行为特征对期望的距离,第一距离阈值小于第二距离阈值,例如,该第一距离阈值可以为0,该第二距离阈值可以大于0。Further, the computer device can obtain the feature extraction model through the loss function supervised training according to the calculated distance. The specific process includes: the computer device calculates the error between the distance corresponding to each first behavior feature pair and the first distance threshold In this way, for the distances corresponding to multiple first behavior feature pairs, the computer device can obtain multiple errors. The computer device calculates the error between the distance of each second behavior feature pair and the second distance threshold, so that for the distances of multiple second behavior feature pairs, multiple errors can be acquired. The first distance threshold is the distance from the first behavior feature to the expected distance, and the second distance threshold is the distance from the second behavior feature to the expected distance. The first distance threshold is less than the second distance threshold. For example, the first distance threshold may be 0 , The second distance threshold may be greater than 0.
然后,计算机设备可以根据获取得到的所有误差,通过损失函数计算损失,如将获取到的所有误差求和,得到求和结果,计算机设备将求和结果作为监督信号回传,更新初始特征提取模型的参数,得到更新后的初始特征提取模型。然后基于第一行为特征对和第二行为特征对,继续对更新后的初始特征提取模型进行训练,直到损失满足要求,得到特征提取模型。其中,损失函数包含但不限于Contrastive Loss(对比损失)和Triplet Loss(三元组损失)等损失函数。该特征提取模型可以为3D(三维)卷积神经网络模型,包含但不限于resnet(Residual Neural Network,残差神经网络)18、resnet50、resnet101、resnet152、inception-v1和VGG(Visual Geometry Group,视觉几何群组)。计算机设备通过损失函数监督训练的方法,以缩小第一行为特征对对应的距离以及增大第二行为特征对对应的距离为约束,对初始特征提取模型进行训练,最终得到特征提取模型。Then, the computer device can calculate the loss through the loss function according to all the errors obtained, such as summing all the obtained errors to obtain the summation result, and the computer device returns the summation result as a supervised signal to update the initial feature extraction model Parameters to get the updated initial feature extraction model. Then, based on the first behavior feature pair and the second behavior feature pair, continue to train the updated initial feature extraction model until the loss meets the requirements, and the feature extraction model is obtained. Among them, the loss function includes but is not limited to Contrastive Loss (contrast loss) and Triplet Loss (triple loss) and other loss functions. The feature extraction model can be a 3D (three-dimensional) convolutional neural network model, including but not limited to resnet (Residual Neural Network, residual neural network) 18, resnet50, resnet101, resnet152, inception-v1 and VGG (Visual Geometry Group, visual Geometry group). The computer device uses the loss function to supervise the training method, with the constraints of reducing the corresponding distance of the first behavior feature pair and increasing the corresponding distance of the second behavior feature pair as constraints, training the initial feature extraction model, and finally obtaining the feature extraction model.
需要说明的是,上述步骤202至步骤204是特征提取模型的训练过程。该步骤202至步骤204为可选步骤,是对行为数据进行检测之前需要执行的步骤,并不是每次对行为数据进行检测时均需要执行该步骤,保证在对行为数据进行检测时,已经训练得到该特征提取模型即可。It should be noted that the above steps 202 to 204 are the training process of the feature extraction model. The steps 202 to 204 are optional steps, which are steps that need to be performed before the behavior data is detected, not every time the behavior data are detected, to ensure that training has been performed when the behavior data is detected The feature extraction model can be obtained.
本公开实施例可以针对特定场景,使用行为数据组建行为数据对进行训练。通过基于行为数据对的距离约束的训练方法,采取端到端的训练方案(端到端训练指从给定的输入数据开始到反向传播训练损失,中间不需要任何人为干预 的训练),提升了系统的自动化程度,对行为特征对的距离进行约束,可以保证正常行为特征更加紧凑,而异常行为特征与正常行为特征存在明显的距离间隔(异常行为特征为异常行为数据的行为特征,正常行为特征为正常行为数据的行为特征)。这种基于距离约束的训练方法,可以适应现实场景中异常行为数据种类繁多、数据不足的问题,具有检测未知异常行为的能力。Embodiments of the present disclosure may use behavior data to build behavior data pairs for specific scenarios for training. Through the distance-constrained training method based on behavioral data pairs, an end-to-end training scheme is adopted (end-to-end training refers to the training loss from the given input data to the back propagation training, without any human intervention in the middle of training), which improves The degree of automation of the system, which restricts the distance between the behavioral characteristics, can ensure that the normal behavioral characteristics are more compact, and there is a clear distance between the abnormal behavioral characteristics and the normal behavioral characteristics (abnormal behavioral characteristics are the behavioral characteristics of abnormal behavioral data, normal behavioral characteristics Behavioral characteristics of normal behavioral data). This training method based on distance constraints can adapt to the problem of a wide variety of abnormal behavior data and insufficient data in real scenes, and has the ability to detect unknown abnormal behavior.
需要说明的是,在将正常行为数据输入训练得到的特征提取模型后,可以输出特征空间范围内的行为特征,在将异常行为数据输入训练得到的特征提取模型后,可以输出该特征空间范围外的行为特征。也即是,如果输入该特征提取模型的行为数据是正常行为数据,则输出的行为特征将会处于该特征空间范围内,如果输入该特征提取模型的行为数据是异常行为数据,则输出的行为特征将会处于该特征空间范围外。其中,该特征空间范围为特征空间内一个比较小的空间范围。It should be noted that, after inputting normal behavior data into the trained feature extraction model, it can output behavior features within the feature space range, and after inputting abnormal behavior data into the trained feature extraction model, it can output out of the feature space range. Behavioral characteristics. That is, if the input behavior data of the feature extraction model is normal behavior data, the output behavior feature will be within the range of the feature space, and if the input behavior data of the feature extraction model is abnormal behavior data, the output behavior The feature will be outside the feature space. Among them, the feature space range is a relatively small space range in the feature space.
205、获取待检测的多个行为数据。205. Acquire multiple behavior data to be detected.
本公开实施例中,计算机设备可以基于海量的视频,获取多个行为数据,将该多个行为数据作为待检测的行为数据,这些视频可以由相关人员进行收集后存储在计算机设备上,这些视频中目标进行的行为类别未知的行为。In the embodiment of the present disclosure, the computer device may acquire multiple behavior data based on massive videos, and use the multiple behavior data as behavior data to be detected. These videos may be collected by relevant personnel and stored on the computer device. These videos The behavior of the target in the behavior category is unknown.
在一种可能实现方式中,该步骤205可以包括:计算机设备获取多个视频;对于该多个视频中的每个视频,对该视频中的目标进行检测和跟踪,获取第三时间段内该目标的空间运动范围,该空间运动范围为该目标运动所覆盖的空间范围,该第三时间段的时长小于该视频的时间段的时长;根据该空间运动范围和该视频,在该第三时间段对应的视频序列中进行图像截取,得到该视频的图像序列,该视频序列包含该视频的多帧视频图像,该图像序列包含该多帧视频图像中该空间运动范围对应的区域;将该多个视频的图像序列作为该多个行为数据。In a possible implementation manner, this step 205 may include: the computer device acquiring multiple videos; for each of the multiple videos, detecting and tracking the target in the video, and acquiring the video in the third time period The spatial motion range of the target, the spatial motion range is the spatial range covered by the target motion, the duration of the third time period is less than the duration of the video time period; according to the spatial motion range and the video, at the third time Perform image interception in the video sequence corresponding to the segment to obtain the image sequence of the video. The video sequence includes multi-frame video images of the video. The image sequence includes the region corresponding to the spatial motion range in the multi-frame video image; The image sequence of each video is used as the multiple behavior data.
计算机设备获取多个行为数据的过程与步骤201中获取正常行为数据集合和异常行为数据集合同理,此处不再赘述。此处需要说明的是,第三时间段与第一时间段的时长可以相等,也可以不相等,第三时间段与第二时间段的时长可以相等,也可以不相等。The process of obtaining multiple behavior data by the computer device is the same as that of obtaining the normal behavior data set and the abnormal behavior data set in step 201, and will not be repeated here. It should be noted here that the duration of the third time period and the first time period may be equal or unequal, and the duration of the third time period and the second time period may be equal or unequal.
需要说明的是,该步骤205是以待检测的行为数据为多个行为数据为例进行说明,可以理解的是,在该步骤205中,计算机设备也可以仅获取一个待检测的行为数据,本公开实施例对此不做限定。It should be noted that this step 205 takes the behavior data to be detected as multiple behavior data as an example for description. It can be understood that, in this step 205, the computer device may also obtain only one behavior data to be detected. The disclosed embodiments do not limit this.
206、对于该多个行为数据中的每个行为数据,将该行为数据输入特征提取模型,输出该行为数据的行为特征。206. For each behavior data in the plurality of behavior data, input the behavior data into a feature extraction model, and output the behavior characteristics of the behavior data.
本公开实施例中,计算机设备可以利用特征提取模型,提取多个行为数据的行为特征。对于每个行为数据,如果该行为数据为正常行为数据,则通过该特征提取模型提取到的行为特征与各个正常行为数据的行为特征之间的距离较小,如距离小于或等于距离阈值。如果该行为数据为异常行为数据,则通过该特征提取模型提取到的行为特征与各个正常行为数据的行为特征之间的距离较大,如距离大于距离阈值。In the embodiment of the present disclosure, the computer device may use the feature extraction model to extract behavior characteristics of multiple behavior data. For each behavior data, if the behavior data is normal behavior data, the distance between the behavior features extracted by the feature extraction model and the behavior features of each normal behavior data is small, for example, the distance is less than or equal to the distance threshold. If the behavior data is abnormal behavior data, the distance between the behavior features extracted by the feature extraction model and the behavior features of each normal behavior data is large, for example, the distance is greater than the distance threshold.
207、计算机设备根据该行为数据的行为特征与正常行为特征中心的距离和距离阈值,获取该行为数据的检测结果,该检测结果用于指示该行为数据是否为异常行为数据,该正常行为特征中心用于代表该特征空间范围内的行为特征。207. The computer device obtains the detection result of the behavior data according to the distance and the distance threshold of the behavior characteristic of the behavior data and the center of the normal behavior characteristic. The detection result is used to indicate whether the behavior data is abnormal behavior data. The normal behavior characteristic center It is used to represent the behavior features within the feature space.
本公开实施例中,计算机设备可以使用正常行为特征中心来代表特征空间范围内的行为特征,此处正常行为特征可以是通过上述训练得到的特征提取模型提取的多个正常行为数据的行为特征。In the embodiment of the present disclosure, the computer device may use the normal behavior feature center to represent the behavior feature within the feature space, where the normal behavior feature may be a behavior feature extracted from a plurality of normal behavior data extracted by the feature extraction model obtained by the above training.
在一种可能实现方式中,该正常行为特征中心的获取过程可以包括:获取多个正常行为数据;对于该多个正常行为数据中的每个正常行为数据,将该正常行为数据输入该特征提取模型,输出该正常行为数据的行为特征;根据该多个正常行为数据的行为特征,获取该正常行为特征中心。In a possible implementation manner, the process of acquiring the normal behavior feature center may include: acquiring multiple normal behavior data; for each normal behavior data in the multiple normal behavior data, input the normal behavior data into the feature extraction The model outputs the behavior characteristics of the normal behavior data; according to the behavior characteristics of the plurality of normal behavior data, the normal behavior characteristic center is obtained.
其中,该多个正常行为数据属于正常行为数据集合。该多个正常行为数据的行为特征可以为多个特征向量,如128维的特征向量。计算机设备可以对该多个特征向量在每个维度计算平均值,这样,对于每个维度得到一个平均值,计算机设备将特征向量的每个维度的平均值作为该正常行为特征中心。Among them, the plurality of normal behavior data belong to the normal behavior data set. The behavior features of the multiple normal behavior data may be multiple feature vectors, such as 128-dimensional feature vectors. The computer device may calculate an average value of each feature vector in each dimension. In this way, for each dimension, an average value is obtained. The computer device uses the average value of each dimension of the feature vector as the normal behavior feature center.
计算机设备可以分别计算多个行为数据的行为特征与正常行为特征中心的距离,该距离包括但不限于欧式距离、余弦距离和汉明距离。对于多个行为数据中的每个行为数据,判断该行为数据的行为特征与该正常行为特征中心的距离与距离阈值的大小,当该行为数据的行为特征与该正常行为特征中心的距离大于距离阈值时,计算机设备可以确定该行为数据为异常行为数据,也即是,该行为数据的检测结果指示该行为数据为异常行为数据。当该行为数据的行为特征与该正常行为特征中心的距离小于或等于距离阈值时,计算机设备可以确定该行为数据为正常行为数据,也即是,该行为数据的检测结果指示该行为数据为正常行为数据。The computer device can separately calculate the distance between the behavior feature of multiple behavior data and the center of the normal behavior feature, and the distance includes but is not limited to the Euclidean distance, the cosine distance, and the Hamming distance. For each behavior data in multiple behavior data, determine the distance between the behavior feature of the behavior data and the center of the normal behavior feature and the distance threshold, when the distance between the behavior feature of the behavior data and the center of the normal behavior feature is greater than the distance At the threshold, the computer device may determine that the behavior data is abnormal behavior data, that is, the detection result of the behavior data indicates that the behavior data is abnormal behavior data. When the distance between the behavior feature of the behavior data and the center of the normal behavior feature is less than or equal to the distance threshold, the computer device may determine that the behavior data is normal behavior data, that is, the detection result of the behavior data indicates that the behavior data is normal Behavioral data.
需要说明的是,本公开实施例是以计算机设备获取一个正常行为特征中心,用该一个正常行为特征中心代表所有正常行为数据的行为特征为例进行说明。当然,计算机设备也可以获取多个正常行为特征中心,每个正常行为特征中心用于代表一类或多类正常行为数据的行为特征,这样对于多个行为数据中的每个行为数据,计算机设备可以分别计算该行为数据的行为特征与该多个正常行为特征中心的距离。然后计算机设备采用预设判断算法,判断该行为数据是否为异常行为数据,从而得到该行为数据的检测结果。其中,预设判断算法包含但不限于KNN(K-Nearest Neighbor,最近邻算法)算法和聚类算法等。It should be noted that the embodiments of the present disclosure take the computer device to obtain a normal behavior feature center, and use the normal behavior feature center to represent the behavior characteristics of all normal behavior data as an example for description. Of course, the computer device can also obtain multiple normal behavior feature centers, and each normal behavior feature center is used to represent the behavior characteristics of one or more types of normal behavior data, so that for each behavior data in the multiple behavior data, the computer device The distance between the behavior feature of the behavior data and the centers of the plurality of normal behavior features can be calculated separately. Then, the computer device adopts a preset judgment algorithm to judge whether the behavior data is abnormal behavior data, thereby obtaining a detection result of the behavior data. Among them, the preset judgment algorithm includes but is not limited to KNN (K-Nearest Neighbor, nearest neighbor algorithm) algorithm and clustering algorithm.
208、根据该多个行为数据各自的检测结果,确定该多个行为数据中的异常行为数据。208. Determine abnormal behavior data among the plurality of behavior data according to respective detection results of the plurality of behavior data.
本公开实施例中,计算机设备可以确定多个行为数据中检测结果为异常行为数据的行为数据。可选地,在该多个行为数据的数量比较大时,通过对该多个行为数据进行测试,并结合简单的人工确认,有可能收集到一批异常行为数据,可以使用收集到的异常行为数据来扩充已有的异常行为数据集合。In the embodiment of the present disclosure, the computer device may determine behavior data whose detection result is abnormal behavior data among the plurality of behavior data. Optionally, when the amount of the multiple behavior data is relatively large, by testing the multiple behavior data and combining with simple manual confirmation, it is possible to collect a batch of abnormal behavior data, and the collected abnormal behavior may be used Data to expand the existing abnormal behavior data collection.
在一种可能实现方式中,对于该多个行为数据中的异常行为数据,在播放该异常行为数据所属视频的过程中,计算机设备可以显示该异常行为数据所属视频的图像序列。In a possible implementation manner, for the abnormal behavior data in the plurality of behavior data, during playback of the video to which the abnormal behavior data belongs, the computer device may display the image sequence of the video to which the abnormal behavior data belongs.
计算机设备可以在视频中突出显示图像序列(该图像序列为异常行为数据所属视频的图像序列),具体显示方式包含但不限于对目标的空间运动范围添加矩形框,也即是,将图像序列包含的区域以矩形框的形式标记出来。The computer device can highlight the image sequence in the video (the image sequence is the image sequence of the video to which the abnormal behavior data belongs), and the specific display method includes but is not limited to adding a rectangular frame to the spatial motion range of the target, that is, including the image sequence The area is marked with a rectangular frame.
该图像序列是一种时空立方图像序列,也可以称为是Tube/Tubelet(),其包含的图像能够反映目标在时间和空间上的运动信息。通过在原始视频中突出显示时空立方的序列信息的方式,来显示异常行为检测结果,在显示异常行为检测结果的同时,还可以显示异常行为的报警结果,如在添加的矩形框对应的区域内显示“异常”和“报警”文字提示信息。The image sequence is a spatiotemporal cubic image sequence, which may also be called Tube/Tubelet(), and the images it contains can reflect the motion information of the target in time and space. Display the abnormal behavior detection results by highlighting the sequence information of the space-time cube in the original video. While displaying the abnormal behavior detection results, you can also display the abnormal behavior alarm results, such as in the area corresponding to the added rectangular frame It displays "abnormal" and "alarm" text prompts.
通过显示异常行为检测结果,使得用户可以得知异常行为发生的起始时间、结束时间和空间位置,当任一视频的图像序列为异常行为数据时,可以将该视频中该图像序列包含的区域进行显示,则异常行为发生的起始时间和结束时间为该图像序列的起始时间和结束时间,也即是,该图像序列对应的多帧视频图像中第一帧视频图像和最后一帧视频图像在整个目标视频中的时间。该异常行为发生的空间位置为该图像序列包含的区域所指示的三维空间位置。这种采用 时空立方的形式进行记录和显示,可以方便用户进行查看和管理。通过显示报警结果,便于用户进行确认,由于对整个视频的图像序列进行了记录,用户还可以查看报警时间附近的其他异常行为检测结果,以便进行更全面的关联。By displaying the abnormal behavior detection result, the user can know the start time, end time and spatial position of the abnormal behavior. When the image sequence of any video is abnormal behavior data, the area included in the image sequence in the video can be For display, the start time and end time of the abnormal behavior are the start time and end time of the image sequence, that is, the first frame video image and the last frame video of the multi-frame video images corresponding to the image sequence The time the image is in the entire target video. The spatial position where the abnormal behavior occurs is the three-dimensional spatial position indicated by the area contained in the image sequence. This adopts the form of space-time cube to record and display, which can facilitate users to view and manage. By displaying the alarm result, it is convenient for the user to confirm. Since the image sequence of the entire video is recorded, the user can also view other abnormal behavior detection results near the alarm time for a more comprehensive correlation.
本公开实施例使用行为时空立方的结构进行行为测试和分析展示,采用的行为时空立方分析方法,可以有效利用目标行为的信息,大量去除背景无关信息,可以缓解目标占比过小等问题,具有稳定的识别性能,也大幅降低了系统的空间资源消耗。本公开实施例采用的实时异常检测结果展示方法,可以突出长时间视频流中发生的异常行为,能够直观观测到异常行为并进行报警,提高了智能化水平。The embodiments of the present disclosure use behavioral space-time cube structure for behavior testing and analysis and display. The behavioral space-time cube analysis method can effectively use the information of the target behavior, remove a large amount of background irrelevant information, and can alleviate the problem that the target ratio is too small. The stable recognition performance also greatly reduces the space resource consumption of the system. The real-time anomaly detection result display method adopted by the embodiment of the present disclosure can highlight the abnormal behavior that occurs in the video stream for a long time, can intuitively observe the abnormal behavior and alarm, and improve the level of intelligence.
209、将该多个行为数据中的异常行为数据添加至该异常行为数据集合中。209. Add abnormal behavior data from the plurality of behavior data to the abnormal behavior data set.
本公开实施例中,计算机设备通过步骤206至步骤208确定多个行为数据中的异常行为数据后,可以使用该多个行为数据中的异常行为数据来扩充异常行为数据集合。In the embodiment of the present disclosure, after determining abnormal behavior data in the plurality of behavior data through steps 206 to 208, the computer device may use the abnormal behavior data in the plurality of behavior data to expand the abnormal behavior data set.
步骤205至步骤208是获取多个行为数据,并利用特征提取模型,自动确定多个行为数据中的异常行为数据的过程。为了保证准确性,可以进一步由人工对检测结果进行确认,如果人工确认为异常行为数据,则计算机设备可以执行该步骤209。相应地,在一种可能实现方式中,计算机设备可以获取该多个行为数据中异常行为数据的人工确认信息(人工确认信息用于指示是否是异常行为数据);将该人工确认信息指示的异常行为数据添加至该异常行为数据集合中。Steps 205 to 208 are a process of acquiring multiple behavior data and using the feature extraction model to automatically determine abnormal behavior data among the multiple behavior data. In order to ensure accuracy, the detection result may be further confirmed manually, and if manually confirmed as abnormal behavior data, the computer device may perform this step 209. Correspondingly, in a possible implementation manner, the computer device can obtain manual confirmation information of abnormal behavior data among the plurality of behavior data (the manual confirmation information is used to indicate whether it is abnormal behavior data); the abnormality indicated by the manual confirmation information Behavior data is added to the abnormal behavior data collection.
例如,计算机设备可以将异常行为数据的检测结果进行显示,人工可以通过人工确认信息的输入界面,输入确认信息。计算机设备获取对该检测结果的人工确认信息,如果人工确认信息指示为某个异常行为数据,则将其添加至异常行为数据集合中,从而实现对异常行为数据集合的扩充。For example, the computer device can display the detection result of the abnormal behavior data, and the human can input the confirmation information through a manual confirmation information input interface. The computer device obtains the manual confirmation information of the detection result, and if the manual confirmation information indicates a certain abnormal behavior data, it is added to the abnormal behavior data set, thereby expanding the abnormal behavior data set.
需要说明的是,本公开实施例是以扩充异常行为数据集合为例进行说明,可选地,计算机设备也可以扩充正常行为数据集合。例如,计算机设备在步骤208中除了确定多个行为数据中的异常行为数据以外,还可以确定多个行为数据中的正常行为数据,计算机设备可以将其添加至正常行为数据集合中,实现对正常行为数据集合的扩充。It should be noted that the embodiment of the present disclosure takes the expansion of the abnormal behavior data set as an example for description. Optionally, the computer device may also expand the normal behavior data set. For example, in step 208, in addition to determining abnormal behavior data in the plurality of behavior data, the computer device may also determine normal behavior data in the plurality of behavior data, and the computer device may add it to the normal behavior data set to achieve normal Expansion of behavioral data collection.
当然,在正常行为数据集合中行为数据的数量比较少时(这种情况可以是预先标定的正常行为数据比较少的情况),计算设备可以将多个行为数据中的正 常行为数据添加至正常行为数据集合中,也实现正常行为数据集合的扩充。当然计算机设备将步骤208中确定出的正常行为数据集合添加至正常行为数据集合中时,可以将经过人工确认为正常行为数据的行为数据,添加至正常行为数据集合中。Of course, when the amount of behavior data in the normal behavior data set is relatively small (this case may be a case where the normal behavior data that is pre-calibrated is relatively small), the computing device may add the normal behavior data from the multiple behavior data to the normal behavior data In the collection, the normal behavior data collection is also expanded. Of course, when the computer device adds the normal behavior data set determined in step 208 to the normal behavior data set, it may add the behavior data manually confirmed as normal behavior data to the normal behavior data set.
210、执行步骤202至步骤204,获取更新的特征提取模型。210. Perform steps 202 to 204 to obtain an updated feature extraction model.
本公开实施例中,计算机设备通过步骤205至步骤209对异常行为数据进行扩充后,可以再次执行步骤202至步骤204(该特征提取模型的训练过程),得到更新的特征提取模型。In the embodiment of the present disclosure, after the computer device expands the abnormal behavior data through steps 205 to 209, it can perform steps 202 to 204 (the feature extraction model training process) again to obtain an updated feature extraction model.
计算机设备可以根据该正常行为数据集合和异常行为数据集合中新添加的异常行为数据(也即是步骤209中添加的异常行为数据),组建新的第二行为数据对。例如,对于新添加的每个异常行为数据,可以将该异常行为数据与正常行为数据集合中的每个正常行为数据进行组合,得到新的第二行为数据对。计算机设备可以保留原有的多个第一行为数据对和多个第二行为数据对不变,获取新的第二行为数据对,从而达到扩充“正常-异常”行为数据对的目的。The computer device may form a new second behavior data pair according to the newly added abnormal behavior data in the normal behavior data set and the abnormal behavior data set (that is, the abnormal behavior data added in step 209). For example, for each newly added abnormal behavior data, the abnormal behavior data may be combined with each normal behavior data in the normal behavior data set to obtain a new second behavior data pair. The computer device may retain the original multiple first behavior data pairs and the multiple second behavior data pairs unchanged, and obtain new second behavior data pairs, thereby achieving the purpose of expanding the "normal-abnormal" behavior data pairs.
另外,计算机设备可以基于更新的正常行为数据集合中的正常行为数据和更新的异常行为数据集合中的异常行为数据,确定出新的第一行为数据对和新的第二行为数据对。计算机设备可以保留原有的多个第一行为数据对和多个第二行为数据对不变,获取新的第一行为数据对和新的第二行为数据对,从而达到扩充“正常-正常”行为数据对和“正常-异常”行为数据对的目的。In addition, the computer device may determine a new first behavior data pair and a new second behavior data pair based on the normal behavior data in the updated normal behavior data set and the abnormal behavior data in the updated abnormal behavior data set. The computer device can keep the original multiple first behavior data pairs and multiple second behavior data pairs unchanged, and acquire new first behavior data pairs and new second behavior data pairs, thereby achieving expansion of "normal-normal" The purpose of behavior data pairs and "normal-abnormal" behavior data pairs.
需要说明的是,上述步骤208至步骤210为可选步骤。通过对大量的行为数据进行检测,对检测结果为异常行为数据的行为数据进行人工确认,可以使用人工确认后的异常行为数据扩充异常行为数据集合,扩充完成后,再次执行上述训练特征提取模型的流程获得更新的特征提取模型。然后,计算机设备可以使用更新的特征提取模型对任一视频进行异常行为检测,由于更新的特征提取模型学习到更多的行为特征,所以在检测行为数据时,可以获得更高的检测性能,可以检测出更丰富的异常行为。It should be noted that the above steps 208 to 210 are optional steps. By detecting a large amount of behavior data and manually confirming the behavior data whose detection result is abnormal behavior data, the abnormal behavior data set after manual confirmation can be used to expand the abnormal behavior data set. After the expansion is completed, the above training feature extraction model is executed again. The process gets an updated feature extraction model. Then, the computer device can use the updated feature extraction model to perform abnormal behavior detection on any video. Since the updated feature extraction model learns more behavior features, it can obtain higher detection performance when detecting behavior data. More abundant abnormal behaviors are detected.
需要说明的是,步骤205至步骤210是获取多个行为数据作为测试数据,收集异常行为数据,更新训练数据集,基于更新训练数据集,更新特征提取模型的过程。该过程可以循环执行,每次执行可以更新异常行为数据集合(或正常行为数据集合和异常行为数据集合),得到更新的特征提取模型,获得更佳的异常行为检测性能。It should be noted that steps 205 to 210 are processes of acquiring multiple behavior data as test data, collecting abnormal behavior data, updating the training data set, and updating the feature extraction model based on updating the training data set. This process can be executed cyclically, and the abnormal behavior data set (or the normal behavior data set and the abnormal behavior data set) can be updated for each execution, to obtain an updated feature extraction model, and to obtain better abnormal behavior detection performance.
本公开实施例提供的特征提取模型是一种端到端的深度学习模型,其获取过程可以分为训练阶段(上述步骤201至步骤204)、部署阶段(上述步骤205至步骤207)和反馈更新阶段(上述步骤208至步骤210)。The feature extraction model provided by an embodiment of the present disclosure is an end-to-end deep learning model, and its acquisition process may be divided into a training phase (steps 201 to 204 above), a deployment phase (steps 205 to step 207 above), and a feedback update phase (Steps 208 to 210 above).
参见图3,提供了一种特征提取模型的训练流程图,如图3所示,根据行为数据(或称为行为序列),组建“正常-正常”行为数据对和“正常-异常”行为数据对,训练得到特征提取模型。参见图4,提供了一种异常行为检测的流程图,如图4所示,对测试行为数据(步骤205的多个行为数据中任一行为数据)进行行为特征提取,计算与正常行为特征中心的距离,根据距离进行异常行为判断,然后进行异常行为数据收集。参见图5,提供了一种异常行为检测的反馈更新流程图,如图5所示,使用初始训练数据集(步骤202的多个第一行为数据对和多个第二行为数据对)执行图3所示训练阶段的模型训练流程,使用海量测试数据(步骤205的多个行为数据)执行图4所示的部署阶段的异常行为检测流程,然后根据收集到的异常行为数据更新训练数据集,再执行图3所示的模型训练流程,得到更新的特征提取模型,利用更新的特征提取模型对新的测试数据执行图4所示的异常行为检测流程,获得更准确的检测性能。Referring to FIG. 3, a training flowchart of a feature extraction model is provided. As shown in FIG. 3, according to behavior data (or behavior sequence), a pair of “normal-normal” behavior data and “normal-abnormal” behavior data are formed. Yes, a feature extraction model is trained. Referring to FIG. 4, a flowchart of abnormal behavior detection is provided. As shown in FIG. 4, behavior characteristic extraction is performed on the test behavior data (any of the plurality of behavior data in step 205 ). Distance, according to the distance to determine abnormal behavior, and then collect abnormal behavior data. Referring to FIG. 5, a feedback update flowchart for abnormal behavior detection is provided. As shown in FIG. 5, an initial training data set (a plurality of first behavior data pairs and a plurality of second behavior data pairs in step 202) is used to execute the diagram The model training process in the training phase shown in 3 uses massive test data (a number of behavior data in step 205) to perform the abnormal behavior detection process in the deployment phase shown in FIG. 4, and then updates the training data set according to the collected abnormal behavior data. Then execute the model training process shown in FIG. 3 to obtain an updated feature extraction model, and use the updated feature extraction model to execute the abnormal behavior detection process shown in FIG. 4 on the new test data to obtain more accurate detection performance.
根据正常行为数据和异常行为数据组建行为数据对,基于行为数据对训练得到特征提取模型,然后可以利用该特征提取模型,收集更多的异常行为数据,扩充“正常-异常”行为数据对,更新该特征提取模型。上述技术方案可以根据大量的正常行为数据和少量的异常行为数据,训练得到特征提取模型,再通过对大量的行为数据进行检测,收集到更多的异常行为数据,解决了现实场景中缺少异常行为数据的问题,基于更多的异常行为数据得到的特征提取模型具有更好的异常行为检测性能。According to the normal behavior data and abnormal behavior data, the behavior data pair is formed, and the feature extraction model is trained based on the behavior data pair, and then the feature extraction model can be used to collect more abnormal behavior data, expand the "normal-abnormal" behavior data pair, update The feature extraction model. The above technical solution can train a feature extraction model based on a large amount of normal behavior data and a small amount of abnormal behavior data, and then detect a large amount of behavior data to collect more abnormal behavior data to solve the lack of abnormal behavior in real scenes For data problems, the feature extraction model based on more abnormal behavior data has better abnormal behavior detection performance.
本公开实施例提供的方法,通过特征提取模型提取行为数据的行为特征,根据提取到的行为特征与正常行为中心的距离和距离阈值,确定行为数据是否为异常行为数据,由于特征提取模型是基于距离约束的方法训练得到,正常行为数据通过该特征提取模型提取的行为特征处于一个比较小的特征空间范围内,异常行为数据通过该特征提取模型提取的行为特征处于特征空间范围外,这样保证了正常行为特征比较紧凑,异常行为特征与正常行为特征存在明显的距离间距,由于学习到了正常行为和异常行为的区别,所以这种基于距离度量的异常行为检测方法,准确性较高。The method provided by the embodiment of the present disclosure extracts the behavior characteristics of the behavior data through the feature extraction model, and determines whether the behavior data is abnormal behavior data according to the distance and the distance threshold between the extracted behavior characteristics and the normal behavior center, because the feature extraction model is based on The distance constraint method is trained. The behavior features extracted by the normal behavior data through the feature extraction model are in a relatively small feature space range, and the behavior features extracted by the abnormal behavior data through the feature extraction model are outside the feature space range, which ensures that The normal behavior feature is relatively compact, and there is a clear distance between the abnormal behavior feature and the normal behavior feature. Since the difference between the normal behavior and the abnormal behavior is learned, the detection method of the abnormal behavior based on the distance measurement has high accuracy.
图6是本公开实施例提供的一种异常行为检测装置的结构示意图。参照图6,该装置包括:6 is a schematic structural diagram of an abnormal behavior detection device provided by an embodiment of the present disclosure. 6, the device includes:
获取模块601,用于获取待检测的行为数据;The obtaining module 601 is used to obtain behavior data to be detected;
提取模块602,用于将该行为数据输入特征提取模型,输出该行为数据的行为特征,该特征提取模型用于根据正常行为数据输出特征空间范围内的行为特征以及根据异常行为数据输出该特征空间范围外的行为特征,该特征空间范围内各个行为特征之间的距离小于距离阈值;An extraction module 602 is used to input the behavior data into a feature extraction model and output behavior characteristics of the behavior data. The feature extraction model is used to output behavior characteristics within a characteristic space range according to normal behavior data and output the characteristic space according to abnormal behavior data Behaviour features outside the range, the distance between each behavior feature within the feature space is less than the distance threshold;
该获取模块601还用于根据该行为数据的行为特征与正常行为特征中心的距离和该距离阈值,获取该行为数据的检测结果,该检测结果用于指示该行为数据是否为异常行为数据,该正常行为特征中心用于代表该特征空间范围内的行为特征。The obtaining module 601 is further used to obtain the detection result of the behavior data according to the distance between the behavior feature of the behavior data and the center of the normal behavior feature and the distance threshold, and the detection result is used to indicate whether the behavior data is abnormal behavior data. The normal behavior feature center is used to represent the behavior features within the feature space.
在一种可能实现方式中,该获取模块601还用于:In a possible implementation manner, the obtaining module 601 is further used to:
根据正常行为数据集合和异常行为数据集合,获取多个第一行为数据对和多个第二行为数据对,每个第一行为数据对包含该正常行为数据集合中的两个正常行为数据,每个第二行为数据对包含该正常行为数据集合中的一个正常行为数据和该异常行为数据集合中的一个异常行为数据;According to the normal behavior data set and the abnormal behavior data set, multiple first behavior data pairs and multiple second behavior data pairs are obtained, and each first behavior data pair includes two normal behavior data in the normal behavior data set, each A second behavior data pair includes a normal behavior data in the normal behavior data set and an abnormal behavior data in the abnormal behavior data set;
提取该多个第一行为数据对的多个第一行为特征对和该多个第二行为数据对的多个第二行为特征对,每个第一行为特征对包含两个正常行为数据的行为特征,每个第二行为特征对包含一个正常行为数据的行为特征和一个异常行为数据的行为特征;Extracting a plurality of first behavior feature pairs of the plurality of first behavior data pairs and a plurality of second behavior feature pairs of the plurality of second behavior data pairs, each first behavior feature pair containing two behaviors of normal behavior data Characteristics, each second behavior characteristic pair includes a behavior characteristic of normal behavior data and a behavior characteristic of abnormal behavior data;
根据该每个第一行为特征对包含的两个行为特征之间的距离和该每个第二行为特征对包含的两个行为特征之间的距离,通过损失函数监督训练,得到该特征提取模型。According to the distance between the two behavior features included in each first behavior feature pair and the distance between the two behavior features included in each second behavior feature pair, the feature extraction model is obtained through supervised training by a loss function .
在一种可能实现方式中,该获取模块601还用于:In a possible implementation manner, the obtaining module 601 is further used to:
基于多个第一视频,获取该正常行为数据集合,该多个第一视频为目标进行正常行为的视频;Acquiring the normal behavior data set based on a plurality of first videos, the plurality of first videos being videos of normal behavior targeted by the target;
基于多个第二视频,获取该异常行为数据集合,该多个第二视频为目标进行异常行为的视频。Based on the plurality of second videos, the abnormal behavior data set is acquired, and the plurality of second videos are videos of the target performing abnormal behavior.
在一种可能实现方式中,该获取模块601用于:In a possible implementation manner, the obtaining module 601 is used to:
对于该多个第一视频中的每个第一视频,对该第一视频中的目标进行检测和跟踪,获取第一时间段内该目标的空间运动范围,该空间运动范围为该目标 运动所覆盖的空间范围,该第一时间段的时长小于该第一视频的时间段的时长;For each first video in the plurality of first videos, the target in the first video is detected and tracked to obtain the spatial motion range of the target in the first time period, the spatial motion range is determined by the target motion The spatial range covered, the duration of the first time period is less than the duration of the first video period;
根据该空间运动范围和该第一视频,在该第一时间段对应的第一视频序列中进行图像截取,得到该第一视频的第一图像序列,该第一视频序列包含该第一视频的多帧视频图像,该第一图像序列包含该多帧视频图像中该空间运动范围对应的区域;According to the spatial motion range and the first video, perform image interception in the first video sequence corresponding to the first time period to obtain a first image sequence of the first video, the first video sequence including the first video sequence A multi-frame video image, the first image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
将该多个第一视频的第一图像序列作为该正常行为数据集合。The first image sequence of the plurality of first videos is used as the normal behavior data set.
在一种可能实现方式中,该获取模块601用于:In a possible implementation manner, the obtaining module 601 is used to:
对于该多个第二视频中的每个第二视频,对该第二视频中的目标进行检测和跟踪,获取第二时间段内该目标的空间运动范围,该空间运动范围为该目标运动所覆盖的空间范围,该第二时间段的时长小于该第二视频的时间段的时长;For each second video in the plurality of second videos, the target in the second video is detected and tracked to obtain the spatial motion range of the target in the second time period, the spatial motion range is the target motion range The spatial range covered, the duration of the second time period is less than the duration of the second video period;
根据该空间运动范围和该第二视频,在该第二时间段对应的第二视频序列中进行图像截取,得到该第二视频的第二图像序列,该第二视频序列包含该第二视频的多帧视频图像,该第二图像序列包含该多帧视频图像中该空间运动范围对应的区域;According to the spatial motion range and the second video, performing image interception in the second video sequence corresponding to the second time period to obtain a second image sequence of the second video, the second video sequence including the second video A multi-frame video image, the second image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
将该多个第二视频的第二图像序列作为该异常行为数据集合。The second image sequence of the plurality of second videos is used as the abnormal behavior data set.
在一种可能实现方式中,该待检测的行为数据为多个行为数据,In a possible implementation manner, the behavior data to be detected is multiple behavior data,
该获取模块601还用于根据该多个行为数据各自的检测结果,确定该多个行为数据中的异常行为数据;将该多个行为数据中的异常行为数据添加至该异常行为数据集合中;基于更新的异常行为数据集合,执行该特征提取模型的训练过程,获取更新的特征提取模型。The obtaining module 601 is further configured to determine abnormal behavior data in the plurality of behavior data according to the detection results of the plurality of behavior data; add the abnormal behavior data in the plurality of behavior data to the abnormal behavior data set; Based on the updated abnormal behavior data set, the training process of the feature extraction model is performed to obtain the updated feature extraction model.
在一种可能的实现方式中,该待检测的行为数据为多个行为数据;In a possible implementation manner, the behavior data to be detected is multiple behavior data;
该获取模块601还用于:The acquisition module 601 is also used to:
根据该多个行为数据各自的检测结果,确定该多个行为数据中的正常行为数据;Determine the normal behavior data among the plurality of behavior data according to the respective detection results of the plurality of behavior data;
将该多个行为数据中的正常行为数据添加至该正常行为数据集合中;Add the normal behavior data from the multiple behavior data to the normal behavior data set;
基于更新的异常行为数据集合和更新的正常行为数据集合,执行该特征提取模型的训练过程,获取更新的特征提取模型。Based on the updated abnormal behavior data set and the updated normal behavior data set, the training process of the feature extraction model is performed to obtain the updated feature extraction model.
在一种可能实现方式中,该获取模块601用于获取该多个行为数据中异常行为数据的人工确认信息;将该人工确认信息指示的异常行为数据添加至该异常行为数据集合中。In a possible implementation manner, the obtaining module 601 is configured to obtain artificial confirmation information of abnormal behavior data among the plurality of behavior data; add abnormal behavior data indicated by the manual confirmation information to the abnormal behavior data set.
在一种可能实现方式中,该获取模块601还用于:In a possible implementation manner, the obtaining module 601 is further used to:
获取多个视频;Get multiple videos;
对于该多个视频中的每个视频,对该视频中的目标进行检测和跟踪,获取第三时间段内该目标的空间运动范围,该空间运动范围为该目标运动所覆盖的空间范围,该第三时间段的时长小于该视频的时间段的时长;For each video in the plurality of videos, detect and track the target in the video to obtain the spatial motion range of the target in the third time period, the spatial motion range is the spatial range covered by the target motion, the The duration of the third time period is less than the duration of the video period;
根据该空间运动范围和该视频,在该第三时间段对应的视频序列中进行图像截取,得到该视频的图像序列,该视频序列包含该视频的多帧视频图像,该图像序列包含该多帧视频图像中该空间运动范围对应的区域;According to the spatial motion range and the video, perform image interception in the video sequence corresponding to the third time period to obtain an image sequence of the video, the video sequence includes multiple frames of the video image of the video, and the image sequence includes the multiple frames The area in the video image corresponding to the spatial motion range;
将该多个视频的图像序列作为该多个行为数据。The image sequence of the multiple videos is used as the multiple behavior data.
在一种可能实现方式中,参见图7,该装置还包括:In a possible implementation manner, referring to FIG. 7, the device further includes:
显示模块603,用于对于该多个行为数据中的异常行为数据,在播放该异常行为数据所属视频的过程中,显示该异常行为数据所属视频的图像序列。The display module 603 is configured to display the image sequence of the video to which the abnormal behavior data belongs during the process of playing the video to which the abnormal behavior data belongs.
在一种可能实现方式中,该获取模块601用于:In a possible implementation manner, the obtaining module 601 is used to:
当该行为数据的行为特征与该正常行为特征中心的距离大于该距离阈值时,确定该行为数据为异常行为数据;When the distance between the behavior feature of the behavior data and the center of the normal behavior feature is greater than the distance threshold, the behavior data is determined to be abnormal behavior data;
当该行为数据的行为特征与该正常行为特征中心的距离小于或等于该距离阈值时,确定该行为数据为正常行为数据。When the distance between the behavior feature of the behavior data and the center of the normal behavior feature is less than or equal to the distance threshold, the behavior data is determined to be normal behavior data.
在一种可能实现方式中,该获取模块601还用于:In a possible implementation manner, the obtaining module 601 is further used to:
获取多个正常行为数据;Obtain multiple normal behavior data;
对于该多个正常行为数据中的每个正常行为数据,将该正常行为数据输入该特征提取模型,输出该正常行为数据的行为特征;For each normal behavior data in the plurality of normal behavior data, input the normal behavior data into the feature extraction model, and output the behavior characteristics of the normal behavior data;
根据该多个正常行为数据的行为特征,获取该正常行为特征中心。According to the behavior characteristics of the plurality of normal behavior data, the normal behavior characteristic center is obtained.
在一种可能实现方式中,该多个正常行为数据中每个正常行为数据的行为特征使用一个特征向量表征;,In a possible implementation manner, the behavior characteristic of each normal behavior data in the plurality of normal behavior data is characterized by a feature vector;
该获取模块601用于:The acquisition module 601 is used to:
对该多个正常行为数据的特征向量在每个维度计算平均值,获得由每个维度的平均值组成的一组平均值所表征的目标特征向量;Calculate the average value of the feature vectors of the multiple normal behavior data in each dimension to obtain a target feature vector characterized by a set of average values composed of the average values of each dimension;
将该目标特征向量作为该正常行为特征中心。Use the target feature vector as the normal behavior feature center.
本公开实施例中,通过特征提取模型提取行为数据的行为特征,根据提取到的行为特征与正常行为中心的距离和距离阈值,确定行为数据是否为异常行为数据,由于特征提取模型是基于距离约束的方法训练得到,正常行为数据通过该特征提取模型提取的行为特征处于一个比较小的特征空间范围内,异常行 为数据通过该特征提取模型提取的行为特征处于特征空间范围外,这样保证了正常行为特征比较紧凑,异常行为特征与正常行为特征存在明显的距离间距,由于学习到了正常行为和异常行为的区别,所以这种基于距离度量的异常行为检测方法,准确性较高。In the embodiment of the present disclosure, the behavior feature of the behavior data is extracted through the feature extraction model, and whether the behavior data is abnormal behavior data is determined according to the distance and the distance threshold between the extracted behavior feature and the normal behavior center, because the feature extraction model is based on the distance constraint The method is trained, the behavior features extracted by the normal behavior data through the feature extraction model are in a relatively small feature space, and the behavior features extracted by the abnormal behavior data through the feature extraction model are outside the feature space, which ensures normal behavior. The features are relatively compact, and there is a clear distance between the abnormal behavior features and the normal behavior features. Since the difference between the normal behavior and the abnormal behavior is learned, this method of detecting abnormal behavior based on the distance measurement has high accuracy.
需要说明的是:上述实施例提供的异常行为检测装置在异常行为检测时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的异常行为检测装置与异常行为检测方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that the abnormal behavior detection device provided in the above embodiment only uses the division of the above functional modules as an example for the detection of abnormal behavior. In practical applications, the above functions can be allocated by different functional modules according to needs. That is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the abnormal behavior detection device and the abnormal behavior detection method embodiment provided in the above embodiments belong to the same concept. For the specific implementation process, see the method embodiment, and details are not described here.
图8是本公开实施例提供的一种计算机设备800的结构示意图,该计算机设备800可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上处理器(Central Processing Units,CPU)801和一个或一个以上的存储器802,其中,该存储器802中存储有至少一条指令,该至少一条指令由该处理器801加载并执行以实现上述各个方法实施例提供的异常行为检测方法。当然,该计算机设备800还可以具有有线或无线网络接口、键盘以及输入输出接口等部件,以便进行输入输出,该计算机设备800还可以包括其他用于实现设备功能的部件,在此不做赘述。8 is a schematic structural diagram of a computer device 800 according to an embodiment of the present disclosure. The computer device 800 may have a relatively large difference due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU). 801 and one or more memories 802, where at least one instruction is stored in the memory 802, and the at least one instruction is loaded and executed by the processor 801 to implement the abnormal behavior detection method provided by the foregoing method embodiments. Of course, the computer device 800 may also have components such as a wired or wireless network interface, a keyboard, and an input-output interface for input and output. The computer device 800 may also include other components for implementing device functions, which will not be repeated here.
在示例性实施例中,还提供了一种存储有至少一条指令的计算机可读存储介质,例如存储有至少一条指令的存储器,上述至少一条指令被处理器执行时实现上述实施例中的异常行为检测方法。例如,该计算机可读存储介质可以是ROM(Read-Only Memory,只读内存)、RAM(Random Access Memory,随机存取存储器)、CD-ROM(Compact Disc Read-Only Memory,只读光盘)、磁带、软盘和光数据存储设备等。In an exemplary embodiment, there is also provided a computer-readable storage medium storing at least one instruction, for example, a memory storing at least one instruction, where the at least one instruction is executed by a processor to implement the abnormal behavior in the above embodiment Detection method. For example, the computer-readable storage medium may be ROM (Read-Only Memory), RAM (Random Access Memory), CD-ROM (Compact Disc Read-Only Memory, CD-ROM), Magnetic tapes, floppy disks, optical data storage devices, etc.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,上述程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光 盘等。A person of ordinary skill in the art may understand that all or part of the steps for implementing the above embodiments may be completed by hardware, or may be completed by a program instructing related hardware. The above program may be stored in a computer-readable storage medium. The storage medium can be read-only memory, magnetic disk or optical disk, etc.
上述仅为本公开的较佳实施例,并不用以限制本公开,凡在本公开的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本公开的保护范围之内。The above are only preferred embodiments of the present disclosure and are not intended to limit the present disclosure. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure Inside.

Claims (29)

  1. 一种异常行为检测方法,其特征在于,所述方法包括:An abnormal behavior detection method, characterized in that the method includes:
    获取待检测的行为数据;Obtain the behavior data to be detected;
    将所述行为数据输入特征提取模型,输出所述行为数据的行为特征,所述特征提取模型用于根据正常行为数据输出特征空间范围内的行为特征以及根据异常行为数据输出所述特征空间范围外的行为特征,所述特征空间范围内各个行为特征之间的距离小于距离阈值;Inputting the behavior data into a feature extraction model and outputting behavior characteristics of the behavior data, the feature extraction model is used to output behavior characteristics within the feature space range according to normal behavior data and out of the feature space range according to abnormal behavior data Behavioral characteristics, the distance between the behavioral characteristics within the feature space is less than the distance threshold;
    根据所述行为数据的行为特征与正常行为特征中心的距离和所述距离阈值,获取所述行为数据的检测结果,所述检测结果用于指示所述行为数据是否为异常行为数据,所述正常行为特征中心用于代表所述特征空间范围内的行为特征。Acquiring the detection result of the behavior data according to the distance between the behavior feature of the behavior data and the center of the normal behavior feature and the distance threshold, the detection result is used to indicate whether the behavior data is abnormal behavior data, the normal The behavior feature center is used to represent behavior features within the range of the feature space.
  2. 根据权利要求1所述的方法,其特征在于,所述特征提取模型的训练过程包括:The method according to claim 1, wherein the training process of the feature extraction model comprises:
    根据正常行为数据集合和异常行为数据集合,获取多个第一行为数据对和多个第二行为数据对,每个第一行为数据对包含所述正常行为数据集合中的两个正常行为数据,每个第二行为数据对包含所述正常行为数据集合中的一个正常行为数据和所述异常行为数据集合中的一个异常行为数据;Acquiring a plurality of first behavior data pairs and a plurality of second behavior data pairs according to the normal behavior data set and the abnormal behavior data set, each first behavior data pair containing two normal behavior data in the normal behavior data set, Each second behavior data pair includes one normal behavior data in the normal behavior data set and one abnormal behavior data in the abnormal behavior data set;
    提取所述多个第一行为数据对的多个第一行为特征对和所述多个第二行为数据对的多个第二行为特征对,每个第一行为特征对包含两个正常行为数据的行为特征,每个第二行为特征对包含一个正常行为数据的行为特征和一个异常行为数据的行为特征;Extracting a plurality of first behavior feature pairs of the plurality of first behavior data pairs and a plurality of second behavior feature pairs of the plurality of second behavior data pairs, each first behavior feature pair containing two normal behavior data Behavior characteristics, each second behavior characteristic pair contains a behavior characteristic of normal behavior data and a behavior characteristic of abnormal behavior data;
    根据所述每个第一行为特征对包含的两个行为特征之间的距离和所述每个第二行为特征对包含的两个行为特征之间的距离,通过损失函数监督训练,得到所述特征提取模型。According to the distance between the two behavioral features included in each of the first behavioral feature pairs and the distance between the two behavioral features included in each of the second behavioral feature pairs, supervise training through a loss function to obtain the Feature extraction model.
  3. 根据权利要求2所述的方法,其特征在于,所述根据正常行为数据集合和异常行为数据集合,获取多个第一行为数据对和多个第二行为数据对之前,所述方法还包括:The method according to claim 2, wherein before acquiring a plurality of first behavior data pairs and a plurality of second behavior data pairs according to the normal behavior data set and the abnormal behavior data set, the method further comprises:
    基于多个第一视频,获取所述正常行为数据集合,所述多个第一视频为目 标进行正常行为的视频;Acquiring the normal behavior data set based on a plurality of first videos, the plurality of first videos being videos targeted for normal behavior;
    基于多个第二视频,获取所述异常行为数据集合,所述多个第二视频为所述目标进行异常行为的视频。The abnormal behavior data set is acquired based on multiple second videos, and the multiple second videos are videos of the target performing abnormal behavior.
  4. 根据权利要求3所述的方法,其特征在于,所述基于多个第一视频,获取所述正常行为数据集合,包括:The method according to claim 3, wherein the acquiring the normal behavior data set based on the plurality of first videos includes:
    对于所述多个第一视频中的每个第一视频,对所述第一视频中的目标进行检测和跟踪,获取第一时间段内所述目标的空间运动范围,所述空间运动范围为所述目标运动所覆盖的空间范围,所述第一时间段的时长小于所述第一视频的时间段的时长;For each first video in the plurality of first videos, detect and track the target in the first video to obtain the spatial motion range of the target in the first time period, the spatial motion range is The spatial range covered by the target motion, the duration of the first time period is less than the duration of the first video period;
    根据所述空间运动范围和所述第一视频,在所述第一时间段对应的第一视频序列中进行图像截取,得到所述第一视频的第一图像序列,所述第一视频序列包含所述第一视频的多帧视频图像,所述第一图像序列包含所述多帧视频图像中所述空间运动范围对应的区域;According to the spatial motion range and the first video, performing image interception in a first video sequence corresponding to the first time period to obtain a first image sequence of the first video, the first video sequence including A multi-frame video image of the first video, the first image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
    将所述多个第一视频的第一图像序列作为所述正常行为数据集合。The first image sequence of the plurality of first videos is used as the normal behavior data set.
  5. 根据权利要求3所述的方法,其特征在于,所述基于多个第二视频,获取所述异常行为数据集合,包括:The method according to claim 3, wherein the acquiring the abnormal behavior data set based on the plurality of second videos includes:
    对于所述多个第二视频中的每个第二视频,对所述第二视频中的目标进行检测和跟踪,获取第二时间段内所述目标的空间运动范围,所述空间运动范围为所述目标运动所覆盖的空间范围,所述第二时间段的时长小于所述第二视频的时间段的时长;For each second video in the plurality of second videos, detect and track the target in the second video to obtain the spatial motion range of the target in the second time period, the spatial motion range is The spatial range covered by the target motion, the duration of the second time period is less than the duration of the second video period;
    根据所述空间运动范围和所述第二视频,在所述第二时间段对应的第二视频序列中进行图像截取,得到所述第二视频的第二图像序列,所述第二视频序列包含所述第二视频的多帧视频图像,所述第二图像序列包含所述多帧视频图像中所述空间运动范围对应的区域;According to the spatial motion range and the second video, performing image interception in a second video sequence corresponding to the second time period to obtain a second image sequence of the second video, the second video sequence including A multi-frame video image of the second video, the second image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
    将所述多个第二视频的第二图像序列作为所述异常行为数据集合。The second image sequence of the plurality of second videos is used as the abnormal behavior data set.
  6. 根据权利要求2所述的方法,其特征在于,所述待检测的行为数据为多个行为数据,The method according to claim 2, wherein the behavior data to be detected is a plurality of behavior data,
    所述根据所述行为数据的行为特征与正常行为特征中心的距离,获取所述行为数据的检测结果之后,所述方法还包括:After obtaining the detection result of the behavior data according to the distance between the behavior characteristic of the behavior data and the center of the normal behavior characteristic, the method further includes:
    根据所述多个行为数据各自的检测结果,确定所述多个行为数据中的异常行为数据;Determine abnormal behavior data among the plurality of behavior data according to respective detection results of the plurality of behavior data;
    将所述多个行为数据中的异常行为数据添加至所述异常行为数据集合中;Adding abnormal behavior data from the plurality of behavior data to the abnormal behavior data set;
    基于更新的异常行为数据集合,执行所述特征提取模型的训练过程,获取更新的特征提取模型。Based on the updated abnormal behavior data set, the training process of the feature extraction model is performed to obtain the updated feature extraction model.
  7. 根据权利要求6所述的方法,其特征在于,所述待检测的行为数据为多个行为数据;The method according to claim 6, wherein the behavior data to be detected is a plurality of behavior data;
    所述根据所述行为数据的行为特征与正常行为特征中心的距离,获取所述行为数据的检测结果之后,所述方法还包括:After obtaining the detection result of the behavior data according to the distance between the behavior characteristic of the behavior data and the center of the normal behavior characteristic, the method further includes:
    根据所述多个行为数据各自的检测结果,确定所述多个行为数据中的正常行为数据;Determine the normal behavior data among the plurality of behavior data according to the respective detection results of the plurality of behavior data;
    将所述多个行为数据中的正常行为数据添加至所述正常行为数据集合中;Adding normal behavior data from the plurality of behavior data to the normal behavior data set;
    所述基于更新的异常行为数据集合,执行所述特征提取模型的训练过程,获取更新的特征提取模型,包括:The updating based on the abnormal behavior data set, performing the training process of the feature extraction model, and obtaining the updated feature extraction model includes:
    基于更新的异常行为数据集合和更新的正常行为数据集合,执行所述特征提取模型的训练过程,获取更新的特征提取模型。Based on the updated abnormal behavior data set and the updated normal behavior data set, the training process of the feature extraction model is performed to obtain the updated feature extraction model.
  8. 根据权利要求6所述的方法,其特征在于,所述方法还包括:The method according to claim 6, wherein the method further comprises:
    获取多个视频;Get multiple videos;
    对于所述多个视频中的每个视频,对所述视频中的目标进行检测和跟踪,获取第三时间段内所述目标的空间运动范围,所述空间运动范围为所述目标运动所覆盖的空间范围,所述第三时间段的时长小于所述视频的时间段的时长;For each of the plurality of videos, detect and track the target in the video to obtain the spatial motion range of the target in the third time period, the spatial motion range is covered by the target motion The spatial range of the third time period is less than the time period of the video;
    根据所述空间运动范围和所述视频,在所述第三时间段对应的视频序列中进行图像截取,得到所述视频的图像序列,所述视频序列包含所述视频的多帧视频图像,所述图像序列包含所述多帧视频图像中所述空间运动范围对应的区域;According to the spatial motion range and the video, performing image interception in the video sequence corresponding to the third time period to obtain an image sequence of the video, the video sequence including multiple frames of video images of the video, so The image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
    将所述多个视频的图像序列作为所述多个行为数据。The image sequence of the plurality of videos is used as the plurality of behavior data.
  9. 根据权利要求1所述的方法,其特征在于,所述正常行为特征中心的获取过程包括:The method according to claim 1, wherein the process of acquiring the normal behavior feature center includes:
    获取多个正常行为数据;Obtain multiple normal behavior data;
    对于所述多个正常行为数据中的每个正常行为数据,将所述正常行为数据输入所述特征提取模型,输出所述正常行为数据的行为特征;For each normal behavior data in the plurality of normal behavior data, input the normal behavior data into the feature extraction model, and output the behavior characteristics of the normal behavior data;
    根据所述多个正常行为数据的行为特征,获取所述正常行为特征中心。Obtain the normal behavior characteristic center according to the behavior characteristic of the plurality of normal behavior data.
  10. 根据权利要求9所述的方法,其特征在于,所述多个正常行为数据中每个正常行为数据的行为特征使用一个特征向量表征;The method according to claim 9, wherein the behavior characteristic of each normal behavior data in the plurality of normal behavior data is characterized by a feature vector;
    所述根据所述多个正常行为数据的行为特征,获取所述正常行为特征中心,包括:The obtaining the normal behavior characteristic center according to the behavior characteristics of the plurality of normal behavior data includes:
    对所述多个正常行为数据的特征向量在每个维度计算平均值,获得由每个维度的平均值组成的一组平均值所表征的目标特征向量;Calculating an average value of the feature vectors of the plurality of normal behavior data in each dimension to obtain a target feature vector characterized by a set of average values consisting of the average value of each dimension;
    将所述目标特征向量作为所述正常行为特征中心。Use the target feature vector as the normal behavior feature center.
  11. 一种异常行为检测装置,其特征在于,所述装置包括:An abnormal behavior detection device, characterized in that the device includes:
    获取模块,用于获取待检测的行为数据;The acquisition module is used to acquire the behavior data to be detected;
    提取模块,用于将所述行为数据输入特征提取模型,输出所述行为数据的行为特征,所述特征提取模型用于根据正常行为数据输出特征空间范围内的行为特征以及根据异常行为数据输出所述特征空间范围外的行为特征,所述特征空间范围内各个行为特征之间的距离小于距离阈值;An extraction module is used to input the behavior data into a feature extraction model and output behavior characteristics of the behavior data, and the feature extraction model is used to output behavior characteristics within a feature space range according to normal behavior data and output data based on abnormal behavior data. The behavior features outside the feature space, the distance between the behavior features in the feature space is less than the distance threshold;
    所述获取模块还用于根据所述行为数据的行为特征与正常行为特征中心的距离和所述距离阈值,获取所述行为数据的检测结果,所述检测结果用于指示所述行为数据是否为异常行为数据,所述正常行为特征中心用于代表所述特征空间范围内的行为特征。The acquiring module is further configured to acquire the detection result of the behavior data according to the distance between the behavior feature of the behavior data and the center of the normal behavior feature and the distance threshold, and the detection result is used to indicate whether the behavior data is For abnormal behavior data, the normal behavior feature center is used to represent behavior features within the feature space.
  12. 根据权利要求11所述的装置,其特征在于,所述获取模块还用于:The apparatus according to claim 11, wherein the acquisition module is further configured to:
    根据正常行为数据集合和异常行为数据集合,获取多个第一行为数据对和多个第二行为数据对,每个第一行为数据对包含所述正常行为数据集合中的两 个正常行为数据,每个第二行为数据对包含所述正常行为数据集合中的一个正常行为数据和所述异常行为数据集合中的一个异常行为数据;Acquiring a plurality of first behavior data pairs and a plurality of second behavior data pairs according to the normal behavior data set and the abnormal behavior data set, each first behavior data pair containing two normal behavior data in the normal behavior data set, Each second behavior data pair includes one normal behavior data in the normal behavior data set and one abnormal behavior data in the abnormal behavior data set;
    提取所述多个第一行为数据对的多个第一行为特征对和所述多个第二行为数据对的多个第二行为特征对,每个第一行为特征对包含两个正常行为数据的行为特征,每个第二行为特征对包含一个正常行为数据的行为特征和一个异常行为数据的行为特征;Extracting a plurality of first behavior feature pairs of the plurality of first behavior data pairs and a plurality of second behavior feature pairs of the plurality of second behavior data pairs, each first behavior feature pair containing two normal behavior data Behavior characteristics, each second behavior characteristic pair contains a behavior characteristic of normal behavior data and a behavior characteristic of abnormal behavior data;
    根据所述每个第一行为特征对包含的两个行为特征之间的距离和所述每个第二行为特征对包含的两个行为特征之间的距离,通过损失函数监督训练,获得所述特征提取模型。According to the distance between the two behavior features included in each first behavior feature pair and the distance between the two behavior features included in each second behavior feature pair, through the loss function supervised training, the Feature extraction model.
  13. 根据权利要求12所述的装置,其特征在于,所述获取模块还用于:The apparatus according to claim 12, wherein the acquisition module is further configured to:
    基于多个第一视频,获取所述正常行为数据集合,所述多个第一视频为目标进行正常行为的视频;Acquiring the normal behavior data set based on a plurality of first videos, the plurality of first videos being videos of normal behavior targeted by the target;
    基于多个第二视频,获取所述异常行为数据集合,所述多个第二视频为所述目标进行异常行为的视频。The abnormal behavior data set is acquired based on multiple second videos, and the multiple second videos are videos of the target performing abnormal behavior.
  14. 根据权利要求13所述的装置,其特征在于,所述获取模块用于:The apparatus according to claim 13, wherein the acquisition module is configured to:
    对于所述多个第一视频中的每个第一视频,对所述第一视频中的目标进行检测和跟踪,获取第一时间段内所述目标的空间运动范围,所述空间运动范围为所述目标运动所覆盖的空间范围,所述第一时间段的时长小于所述第一视频的时间段的时长;For each first video in the plurality of first videos, detect and track the target in the first video to obtain the spatial motion range of the target in the first time period, the spatial motion range is The spatial range covered by the target motion, the duration of the first time period is less than the duration of the first video period;
    根据所述空间运动范围和所述第一视频,在所述第一时间段对应的第一视频序列中进行图像截取,得到所述第一视频的第一图像序列,所述第一视频序列包含所述第一视频的多帧视频图像,所述第一图像序列包含所述多帧视频图像中所述空间运动范围对应的区域;According to the spatial motion range and the first video, performing image interception in a first video sequence corresponding to the first time period to obtain a first image sequence of the first video, the first video sequence including A multi-frame video image of the first video, the first image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
    将所述多个第一视频的第一图像序列作为所述正常行为数据集合。The first image sequence of the plurality of first videos is used as the normal behavior data set.
  15. 根据权利要求13所述的装置,其特征在于,所述获取模块用于:The apparatus according to claim 13, wherein the acquisition module is configured to:
    对于所述多个第二视频中的每个第二视频,对所述第二视频中的目标进行检测和跟踪,获取第二时间段内所述目标的空间运动范围,所述空间运动范围 为所述目标运动所覆盖的空间范围,所述第二时间段的时长小于所述第二视频的时间段的时长;For each second video in the plurality of second videos, detect and track the target in the second video to obtain the spatial motion range of the target in the second time period, the spatial motion range is The spatial range covered by the target motion, the duration of the second time period is less than the duration of the second video period;
    根据所述空间运动范围和所述第二视频,在所述第二时间段对应的第二视频序列中进行图像截取,得到所述第二视频的第二图像序列,所述第二视频序列包含所述第二视频的多帧视频图像,所述第二图像序列包含所述多帧视频图像中所述空间运动范围对应的区域;According to the spatial motion range and the second video, performing image interception in a second video sequence corresponding to the second time period to obtain a second image sequence of the second video, the second video sequence including A multi-frame video image of the second video, the second image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
    将所述多个第二视频的第二图像序列作为所述异常行为数据集合。The second image sequence of the plurality of second videos is used as the abnormal behavior data set.
  16. 根据权利要求12所述的装置,其特征在于,所述待检测的行为数据为多个行为数据;The device according to claim 12, wherein the behavior data to be detected is a plurality of behavior data;
    所述获取模块还用于根据所述多个行为数据各自的检测结果,确定所述多个行为数据中的异常行为数据;将所述多个行为数据中的异常行为数据添加至所述异常行为数据集合中;基于更新的异常行为数据集合,执行所述特征提取模型的训练过程,获取更新的特征提取模型。The acquiring module is further configured to determine abnormal behavior data in the plurality of behavior data according to the detection results of the plurality of behavior data; add the abnormal behavior data in the plurality of behavior data to the abnormal behavior In the data set; based on the updated abnormal behavior data set, the training process of the feature extraction model is performed to obtain the updated feature extraction model.
  17. 根据权利要求16所述的装置,其特征在于,所述获取模块还用于:The apparatus according to claim 16, wherein the acquisition module is further configured to:
    获取多个视频;Get multiple videos;
    对于所述多个视频中的每个视频,对所述视频中的目标进行检测和跟踪,获取第三时间段内所述目标的空间运动范围,所述空间运动范围为所述目标运动所覆盖的空间范围,所述第三时间段的时长小于所述视频的时间段的时长;For each of the plurality of videos, detect and track the target in the video to obtain the spatial motion range of the target in the third time period, the spatial motion range is covered by the target motion The spatial range of the third time period is less than the time period of the video;
    根据所述空间运动范围和所述视频,在所述第三时间段对应的视频序列中进行图像截取,得到所述视频的图像序列,所述视频序列包含所述视频的多帧视频图像,所述图像序列包含所述多帧视频图像中所述空间运动范围对应的区域;According to the spatial motion range and the video, performing image interception in the video sequence corresponding to the third time period to obtain an image sequence of the video, the video sequence including multiple frames of video images of the video, so The image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
    将所述多个视频的图像序列作为所述多个行为数据。The image sequence of the plurality of videos is used as the plurality of behavior data.
  18. 根据权利要求11所述的装置,其特征在于,所述获取模块还用于:The apparatus according to claim 11, wherein the acquisition module is further configured to:
    获取多个正常行为数据;Obtain multiple normal behavior data;
    对于所述多个正常行为数据中的每个正常行为数据,将所述正常行为数据输入所述特征提取模型,输出所述正常行为数据的行为特征;For each normal behavior data in the plurality of normal behavior data, input the normal behavior data into the feature extraction model, and output the behavior characteristics of the normal behavior data;
    根据所述多个正常行为数据的行为特征,获取所述正常行为特征中心。Obtain the normal behavior characteristic center according to the behavior characteristic of the plurality of normal behavior data.
  19. 根据权利要求18所述的装置,其特征在于,所述多个正常行为数据中每个正常行为数据的行为特征使用一个特征向量表征;The apparatus according to claim 18, wherein the behavior characteristic of each normal behavior data in the plurality of normal behavior data is characterized by a feature vector;
    所述获取模块用于:The acquisition module is used to:
    对所述多个正常行为数据的特征向量在每个维度计算平均值,获得由每个维度的平均值组成的一组平均值所表征的目标特征向量;Calculating an average value of the feature vectors of the plurality of normal behavior data in each dimension to obtain a target feature vector characterized by a set of average values consisting of the average value of each dimension;
    将所述目标特征向量作为所述正常行为特征中心。Use the target feature vector as the normal behavior feature center.
  20. 一种计算机设备,其特征在于,包括处理器和存储器;所述存储器,用于存放至少一条指令;所述处理器执行所述存储器上所存放的至少一条指令,用于实现:A computer device, comprising a processor and a memory; the memory is used to store at least one instruction; the processor executes at least one instruction stored on the memory to implement:
    获取待检测的行为数据;Obtain the behavior data to be detected;
    将所述行为数据输入特征提取模型,输出所述行为数据的行为特征,所述特征提取模型用于根据正常行为数据输出特征空间范围内的行为特征以及根据异常行为数据输出所述特征空间范围外的行为特征,所述特征空间范围内各个行为特征之间的距离小于距离阈值;Inputting the behavior data into a feature extraction model and outputting behavior characteristics of the behavior data, the feature extraction model is used to output behavior characteristics within the feature space range according to normal behavior data and out of the feature space range according to abnormal behavior data Behavioral characteristics, the distance between the behavioral characteristics within the feature space is less than the distance threshold;
    根据所述行为数据的行为特征与正常行为特征中心的距离和所述距离阈值,获取所述行为数据的检测结果,所述检测结果用于指示所述行为数据是否为异常行为数据,所述正常行为特征中心用于代表所述特征空间范围内的行为特征。Acquiring the detection result of the behavior data according to the distance between the behavior feature of the behavior data and the center of the normal behavior feature and the distance threshold, the detection result is used to indicate whether the behavior data is abnormal behavior data, the normal The behavior feature center is used to represent behavior features within the range of the feature space.
  21. 根据权利要求20所述的计算机设备,其特征在于,所述处理器执行所述存储器上所存放的至少一条指令,还用于实现:The computer device according to claim 20, wherein the processor executes at least one instruction stored on the memory, and is further used to implement:
    根据正常行为数据集合和异常行为数据集合,获取多个第一行为数据对和多个第二行为数据对,每个第一行为数据对包含所述正常行为数据集合中的两个正常行为数据,每个第二行为数据对包含所述正常行为数据集合中的一个正常行为数据和所述异常行为数据集合中的一个异常行为数据;Acquiring a plurality of first behavior data pairs and a plurality of second behavior data pairs according to the normal behavior data set and the abnormal behavior data set, each first behavior data pair containing two normal behavior data in the normal behavior data set, Each second behavior data pair includes one normal behavior data in the normal behavior data set and one abnormal behavior data in the abnormal behavior data set;
    提取所述多个第一行为数据对的多个第一行为特征对和所述多个第二行为数据对的多个第二行为特征对,每个第一行为特征对包含两个正常行为数据的 行为特征,每个第二行为特征对包含一个正常行为数据的行为特征和一个异常行为数据的行为特征;Extracting a plurality of first behavior feature pairs of the plurality of first behavior data pairs and a plurality of second behavior feature pairs of the plurality of second behavior data pairs, each first behavior feature pair containing two normal behavior data Behavior characteristics, each second behavior characteristic pair contains a behavior characteristic of normal behavior data and a behavior characteristic of abnormal behavior data;
    根据所述每个第一行为特征对包含的两个行为特征之间的距离和所述每个第二行为特征对包含的两个行为特征之间的距离,通过损失函数监督训练,得到所述特征提取模型。According to the distance between the two behavioral features included in each of the first behavioral feature pairs and the distance between the two behavioral features included in each of the second behavioral feature pairs, supervise training through a loss function to obtain the Feature extraction model.
  22. 根据权利要求21所述的计算机设备,其特征在于,所述处理器执行所述存储器上所存放的至少一条指令,还用于实现:The computer device according to claim 21, wherein the processor executes at least one instruction stored on the memory, and is further used to implement:
    基于多个第一视频,获取所述正常行为数据集合,所述多个第一视频为目标进行正常行为的视频;Acquiring the normal behavior data set based on a plurality of first videos, the plurality of first videos being videos of normal behavior targeted by the target;
    基于多个第二视频,获取所述异常行为数据集合,所述多个第二视频为所述目标进行异常行为的视频。The abnormal behavior data set is acquired based on multiple second videos, and the multiple second videos are videos of the target performing abnormal behavior.
  23. 根据权利要求22所述的计算机设备,其特征在于,所述处理器执行所述存储器上所存放的至少一条指令,还用于实现:The computer device according to claim 22, wherein the processor executes at least one instruction stored on the memory, and is further used to implement:
    对于所述多个第一视频中的每个第一视频,对所述第一视频中的目标进行检测和跟踪,获取第一时间段内所述目标的空间运动范围,所述空间运动范围为所述目标运动所覆盖的空间范围,所述第一时间段的时长小于所述第一视频的时间段的时长;For each first video in the plurality of first videos, detect and track the target in the first video to obtain the spatial motion range of the target in the first time period, the spatial motion range is The spatial range covered by the target motion, the duration of the first time period is less than the duration of the first video period;
    根据所述空间运动范围和所述第一视频,在所述第一时间段对应的第一视频序列中进行图像截取,得到所述第一视频的第一图像序列,所述第一视频序列包含所述第一视频的多帧视频图像,所述第一图像序列包含所述多帧视频图像中所述空间运动范围对应的区域;According to the spatial motion range and the first video, performing image interception in a first video sequence corresponding to the first time period to obtain a first image sequence of the first video, the first video sequence including A multi-frame video image of the first video, the first image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
    将所述多个第一视频的第一图像序列作为所述正常行为数据集合。The first image sequence of the plurality of first videos is used as the normal behavior data set.
  24. 根据权利要求22所述的计算机设备,其特征在于,所述处理器执行所述存储器上所存放的至少一条指令,还用于实现:The computer device according to claim 22, wherein the processor executes at least one instruction stored on the memory, and is further used to implement:
    对于所述多个第二视频中的每个第二视频,对所述第二视频中的目标进行检测和跟踪,获取第二时间段内所述目标的空间运动范围,所述空间运动范围为所述目标运动所覆盖的空间范围,所述第二时间段的时长小于所述第二视频 的时间段的时长;For each second video of the plurality of second videos, detect and track the target in the second video to obtain the spatial motion range of the target in the second time period, the spatial motion range is The spatial range covered by the target motion, the duration of the second time period is less than the duration of the second video period;
    根据所述空间运动范围和所述第二视频,在所述第二时间段对应的第二视频序列中进行图像截取,得到所述第二视频的第二图像序列,所述第二视频序列包含所述第二视频的多帧视频图像,所述第二图像序列包含所述多帧视频图像中所述空间运动范围对应的区域;According to the spatial motion range and the second video, performing image interception in a second video sequence corresponding to the second time period to obtain a second image sequence of the second video, the second video sequence including A multi-frame video image of the second video, the second image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
    将所述多个第二视频的第二图像序列作为所述异常行为数据集合。The second image sequence of the plurality of second videos is used as the abnormal behavior data set.
  25. 根据权利要求21所述的计算机设备,其特征在于,所述待检测的行为数据为多个行为数据;The computer device according to claim 21, wherein the behavior data to be detected is a plurality of behavior data;
    所述处理器执行所述存储器上所存放的至少一条指令,还用于实现:The processor executes at least one instruction stored on the memory, and is also used to implement:
    根据所述多个行为数据各自的检测结果,确定所述多个行为数据中的异常行为数据;将所述多个行为数据中的异常行为数据添加至所述异常行为数据集合中;基于更新的异常行为数据集合,执行所述特征提取模型的训练过程,获取更新的特征提取模型。Determine the abnormal behavior data in the plurality of behavior data according to the detection results of the plurality of behavior data; add the abnormal behavior data in the plurality of behavior data to the abnormal behavior data set; based on the updated The abnormal behavior data set performs the training process of the feature extraction model to obtain an updated feature extraction model.
  26. 根据权利要求25所述的计算机设备,其特征在于,所述处理器执行所述存储器上所存放的至少一条指令,还用于实现:The computer device according to claim 25, wherein the processor executes at least one instruction stored on the memory, and is further used to implement:
    获取多个视频;Get multiple videos;
    对于所述多个视频中的每个视频,对所述视频中的目标进行检测和跟踪,获取第三时间段内所述目标的空间运动范围,所述空间运动范围为所述目标运动所覆盖的空间范围,所述第三时间段的时长小于所述视频的时间段的时长;For each of the plurality of videos, detect and track the target in the video to obtain the spatial motion range of the target in the third time period, the spatial motion range is covered by the target motion The spatial range of the third time period is less than the time period of the video;
    根据所述空间运动范围和所述视频,在所述第三时间段对应的视频序列中进行图像截取,得到所述视频的图像序列,所述视频序列包含所述视频的多帧视频图像,所述图像序列包含所述多帧视频图像中所述空间运动范围对应的区域;According to the spatial motion range and the video, performing image interception in the video sequence corresponding to the third time period to obtain an image sequence of the video, the video sequence including multiple frames of video images of the video, so The image sequence includes an area corresponding to the spatial motion range in the multi-frame video image;
    将所述多个视频的图像序列作为所述多个行为数据。The image sequence of the plurality of videos is used as the plurality of behavior data.
  27. 根据权利要求20所述的计算机设备,其特征在于,所述处理器执行所述存储器上所存放的至少一条指令,还用于实现:The computer device according to claim 20, wherein the processor executes at least one instruction stored on the memory, and is further used to implement:
    获取多个正常行为数据;Obtain multiple normal behavior data;
    对于所述多个正常行为数据中的每个正常行为数据,将所述正常行为数据输入所述特征提取模型,输出所述正常行为数据的行为特征;For each normal behavior data in the plurality of normal behavior data, input the normal behavior data into the feature extraction model, and output the behavior characteristics of the normal behavior data;
    根据所述多个正常行为数据的行为特征,获取所述正常行为特征中心。Obtain the normal behavior characteristic center according to the behavior characteristic of the plurality of normal behavior data.
  28. 根据权利要求27所述的计算机设备,其特征在于,所述多个正常行为数据中每个正常行为数据的行为特征使用一个特征向量表征;The computer device according to claim 27, wherein the behavior characteristic of each normal behavior data in the plurality of normal behavior data is characterized by a feature vector;
    所述处理器执行所述存储器上所存放的至少一条指令,用于实现:The processor executes at least one instruction stored on the memory to implement:
    对所述多个正常行为数据的特征向量在每个维度计算平均值,获得由每个维度的平均值组成的一组平均值所表征的目标特征向量;Calculating an average value of the feature vectors of the plurality of normal behavior data in each dimension to obtain a target feature vector characterized by a set of average values consisting of the average value of each dimension;
    将所述目标特征向量作为所述正常行为特征中心。Use the target feature vector as the normal behavior feature center.
  29. 一种计算机可读存储介质,其特征在于,所述存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1-10任一项所述的方法步骤。A computer-readable storage medium, characterized in that a computer program is stored in the storage medium, and when the computer program is executed by a processor, the method steps of any one of claims 1-10 are realized.
PCT/CN2019/127797 2018-12-24 2019-12-24 Method and device for detecting abnormal behavior WO2020135392A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811581954.0A CN111353352B (en) 2018-12-24 2018-12-24 Abnormal behavior detection method and device
CN201811581954.0 2018-12-24

Publications (1)

Publication Number Publication Date
WO2020135392A1 true WO2020135392A1 (en) 2020-07-02

Family

ID=71127632

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/127797 WO2020135392A1 (en) 2018-12-24 2019-12-24 Method and device for detecting abnormal behavior

Country Status (2)

Country Link
CN (1) CN111353352B (en)
WO (1) WO2020135392A1 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111860429A (en) * 2020-07-30 2020-10-30 科大讯飞股份有限公司 Blast furnace tuyere abnormality detection method, device, electronic apparatus, and storage medium
CN111950363A (en) * 2020-07-07 2020-11-17 中国科学院大学 Video anomaly detection method based on open data filtering and domain adaptation
CN112115769A (en) * 2020-08-05 2020-12-22 西安交通大学 Unsupervised sparse population abnormal behavior detection algorithm based on video
CN112686114A (en) * 2020-12-23 2021-04-20 杭州海康威视数字技术股份有限公司 Behavior detection method, device and equipment
CN112966589A (en) * 2021-03-03 2021-06-15 中润油联天下网络科技有限公司 Behavior identification method in dangerous area
CN113673342A (en) * 2021-07-19 2021-11-19 浙江大华技术股份有限公司 Behavior detection method, electronic device, and storage medium
CN116049818A (en) * 2023-02-21 2023-05-02 吕艳娜 Big data anomaly analysis method and system for digital online service

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113295635A (en) * 2021-05-27 2021-08-24 河北先河环保科技股份有限公司 Water pollution alarm method based on dynamic update data set
CN115690658B (en) * 2022-11-04 2023-08-08 四川大学 Priori knowledge-fused semi-supervised video abnormal behavior detection method
CN116049755A (en) * 2023-03-15 2023-05-02 阿里巴巴(中国)有限公司 Time sequence detection method, electronic device and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101571914A (en) * 2008-04-28 2009-11-04 株式会社日立制作所 Abnormal behavior detection device
CN103761748A (en) * 2013-12-31 2014-04-30 北京邮电大学 Method and device for detecting abnormal behaviors
CN108809745A (en) * 2017-05-02 2018-11-13 中国移动通信集团重庆有限公司 A kind of user's anomaly detection method, apparatus and system

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160132754A1 (en) * 2012-05-25 2016-05-12 The Johns Hopkins University Integrated real-time tracking system for normal and anomaly tracking and the methods therefor
EP2867860A4 (en) * 2012-06-29 2016-07-27 Behavioral Recognition Sys Inc Unsupervised learning of feature anomalies for a video surveillance system
CN105184818B (en) * 2015-09-06 2018-05-18 山东华宇航天空间技术有限公司 A kind of video monitoring anomaly detection method and its detecting system
CN105787472B (en) * 2016-03-28 2019-02-15 电子科技大学 A kind of anomaly detection method based on the study of space-time laplacian eigenmaps
CN106101116B (en) * 2016-06-29 2019-01-08 东北大学 A kind of user behavior abnormality detection system and method based on principal component analysis
CN107590427B (en) * 2017-05-25 2020-11-24 杭州电子科技大学 Method for detecting abnormal events of surveillance video based on space-time interest point noise reduction
CN107766823B (en) * 2017-10-25 2020-06-26 中国科学技术大学 Abnormal behavior detection method in video based on key region feature learning
CN108462708B (en) * 2018-03-16 2020-12-08 西安电子科技大学 HDP-HMM-based behavior sequence detection method
CN108737410B (en) * 2018-05-14 2021-04-13 辽宁大学 Limited knowledge industrial communication protocol abnormal behavior detection method based on feature association

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101571914A (en) * 2008-04-28 2009-11-04 株式会社日立制作所 Abnormal behavior detection device
CN103761748A (en) * 2013-12-31 2014-04-30 北京邮电大学 Method and device for detecting abnormal behaviors
CN108809745A (en) * 2017-05-02 2018-11-13 中国移动通信集团重庆有限公司 A kind of user's anomaly detection method, apparatus and system

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111950363A (en) * 2020-07-07 2020-11-17 中国科学院大学 Video anomaly detection method based on open data filtering and domain adaptation
CN111950363B (en) * 2020-07-07 2022-11-29 中国科学院大学 Video anomaly detection method based on open data filtering and domain adaptation
CN111860429A (en) * 2020-07-30 2020-10-30 科大讯飞股份有限公司 Blast furnace tuyere abnormality detection method, device, electronic apparatus, and storage medium
CN111860429B (en) * 2020-07-30 2024-02-13 科大讯飞股份有限公司 Blast furnace tuyere abnormality detection method, device, electronic equipment and storage medium
CN112115769A (en) * 2020-08-05 2020-12-22 西安交通大学 Unsupervised sparse population abnormal behavior detection algorithm based on video
CN112686114A (en) * 2020-12-23 2021-04-20 杭州海康威视数字技术股份有限公司 Behavior detection method, device and equipment
CN112966589A (en) * 2021-03-03 2021-06-15 中润油联天下网络科技有限公司 Behavior identification method in dangerous area
CN113673342A (en) * 2021-07-19 2021-11-19 浙江大华技术股份有限公司 Behavior detection method, electronic device, and storage medium
CN116049818A (en) * 2023-02-21 2023-05-02 吕艳娜 Big data anomaly analysis method and system for digital online service
CN116049818B (en) * 2023-02-21 2024-03-01 天翼安全科技有限公司 Big data anomaly analysis method and system for digital online service

Also Published As

Publication number Publication date
CN111353352B (en) 2023-05-09
CN111353352A (en) 2020-06-30

Similar Documents

Publication Publication Date Title
WO2020135392A1 (en) Method and device for detecting abnormal behavior
CN111444828B (en) Model training method, target detection method, device and storage medium
US11928800B2 (en) Image coordinate system transformation method and apparatus, device, and storage medium
CN110428449A (en) Target detection tracking method, device, equipment and storage medium
CN111027442A (en) Model training method, recognition method, device and medium for pedestrian re-recognition
WO2020140723A1 (en) Method, apparatus and device for detecting dynamic facial expression, and storage medium
CN109711389B (en) Lactating sow posture conversion recognition method based on Faster R-CNN and HMM
TWI707243B (en) Method, apparatus, and system for detecting living body based on eyeball tracking
CN113963445A (en) Pedestrian falling action recognition method and device based on attitude estimation
CN111652331B (en) Image recognition method and device and computer readable storage medium
WO2022001925A1 (en) Pedestrian tracking method and device, and computer readable storage medium
JP7136500B2 (en) Pedestrian Re-identification Method for Random Occlusion Recovery Based on Noise Channel
CN108268855A (en) A kind of optimization method and device of the function model identified again towards pedestrian
CN112052771A (en) Object re-identification method and device
Haibo et al. An improved yolov3 algorithm for pulmonary nodule detection
CN105809707B (en) A kind of pedestrian tracting method based on random forests algorithm
Wu et al. Skeleton based temporal action detection with yolo
CN113723306A (en) Push-up detection method, device and computer readable medium
US20230351727A1 (en) Reducing false positive identifications during video conferencing tracking and detection
CN112686194B (en) First person visual angle action recognition method, system and storage medium
Wu et al. Loop Closure Detection for Visual SLAM Based on SuperPoint Network
Bai et al. Application Study of Area-Based and YOLOv4 Smoking Behavior Detection
CN109726691B (en) Monitoring method
CN109784240B (en) Character recognition method, device and storage device
Gupta et al. A Novel Framework for Multi-Person Temporal Gaze Following and Social Gaze Prediction

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19903122

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19903122

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19903122

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 02.02.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 19903122

Country of ref document: EP

Kind code of ref document: A1