A moving target detection method based on frame difference method and twin network and application thereof

By combining frame difference and twin networks, this method utilizes the correlation between images to detect moving targets, solving the problems of high real-time performance and high equipment performance requirements in existing technologies. It achieves high-precision, low-complexity target recognition, which is suitable for video surveillance, intelligent security and traffic monitoring.

CN117809210BActive Publication Date: 2026-11-24SHANGHAI UNIV OF ENG SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310422125.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-19
Publication Date
2026-11-24
Estimated Expiration
2043-04-19

AI Technical Summary

Technical Problem

Existing image target detection methods based on deep neural networks suffer from insufficient real-time performance, high computational load, and high equipment performance requirements in scenarios with fixed viewpoints and continuous shooting. They cannot simultaneously meet the requirements of accuracy and efficiency, and do not fully utilize the correlation between images.

Method used

A moving target detection method based on frame difference and Siamese network is adopted. The moving target position is located by three-frame image difference method, and the Siamese neural network is used for feature matching. The feature library is expanded by deep convolutional generative adversarial network to achieve fast and accurate moving target recognition.

Benefits of technology

It improves the accuracy and real-time performance of moving target detection, reduces equipment performance requirements, enhances the practicality of the algorithm, and is suitable for application in video surveillance, intelligent security, and traffic monitoring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117809210B_ABST
    Figure CN117809210B_ABST
Patent Text Reader

Abstract

The application belongs to the field of image processing, and particularly relates to a moving target detection method based on frame difference method and twin network and application thereof.The method is as follows: S1: using DCGAN to perform data expansion on initial sample images to form a feature library; S2: collecting video stream data and performing frame processing to obtain continuous sequence images; S3: using a three-frame image difference method to process the sequence images to obtain position information of the moving target; S4: performing image segmentation on the current frame image to obtain a target image; S5: constructing a twin neural network for similarity analysis of the target image and the sample image; S6: performing similarity analysis on the target image and the samples in the feature library, and outputting category information with the maximum similarity value; and S7: labeling the recognized category information and the similarity value in the video stream data.The application solves the problem that the existing image target detection method based on a deep neural network cannot simultaneously consider real-time performance, precision and hardware cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image processing, specifically relating to a moving target detection method based on frame difference and Siamese networks and its application. Background Technology

[0002] The Skynet Project is a solution for security and urban management using video surveillance systems. It is an effective means of improving social governance efficiency. The solution consists of a series of related devices with image acquisition, transmission, control, display, and monitoring capabilities, enabling real-time monitoring and information recording of fixed areas. The widespread distribution of surveillance cameras creates significant data storage demands and increases the workload of surveillance video management personnel; for example, in handling certain social emergencies, relevant personnel often need to review a large amount of surveillance footage to effectively search for targets.

[0003] With the continuous advancement of image processing technology, tasks such as object recognition and tracking based on video stream data can be performed by computers, greatly reducing the workload of monitoring and management personnel. Simultaneously, effective object recognition and tracking can also reduce data storage costs in data centers, allowing them to store video data containing monitored targets in segments instead of storing all monitoring data.

[0004] The underlying technology for object recognition and tracking based on video stream data is image-based object detection. The task of object detection is to find all objects of interest in an image, determine their category and location, which is one of the core problems in the field of computer vision. Compared with traditional manual feature extraction methods, deep learning technology has significant advantages in this field. It has strong capabilities in representing vehicle targets and can autonomously learn from large amounts of data to improve its feature extraction capabilities.

[0005] Currently, deep learning-based object detection methods are mainly divided into two categories: single-stage and two-stage detection methods. Single-stage methods directly generate object class probabilities and location coordinates from the fused feature map, represented by SSD and YOLO series. These schemes have relatively high detection accuracy and efficiency, but because the model parameters are numerous and complex, training is difficult, and the computational load during operation is large, they have high requirements for the data processing performance of the device and have high deployment costs. Two-stage methods first focus on finding the location of the target object in a large number of prior bounding boxes to obtain suggestion boxes, and then classify the targets in the boxes. These schemes have high computational accuracy but slower processing speed and poorer real-time performance.

[0006] The two target detection schemes described above are designed for target recognition in general scenarios, where there is no specific connection between individual images. For images captured from a fixed perspective and continuously (such as video surveillance), the correlation between images is not fully utilized, even though this information is very helpful for locating moving objects within the image. Therefore, developing a scheme that can combine information from multiple images to improve the detection speed of moving targets in scenarios with fixed perspectives and continuous shooting, thereby improving the accuracy, efficiency, and real-time performance of target detection, has become a pressing technical challenge for those skilled in the art. Summary of the Invention

[0007] To address the shortcomings of existing deep neural network-based image target detection methods, such as insufficient real-time performance, high computational requirements, and inability to simultaneously meet accuracy and efficiency requirements, this invention provides a moving target detection method based on frame difference and Siamese networks, and its application.

[0008] This invention is achieved using the following technical solution:

[0009] A moving target detection method based on frame difference and Siamese networks is disclosed, which is used to detect and identify moving targets contained in video stream data acquired from a fixed viewpoint. The moving target detection method includes the following steps:

[0010] S1: Using trained convolutional generative adversarial networks of different depths, the initial sample images of different categories of target objects are augmented with data, and a category label is added to each newly added sample image to form the required feature library.

[0011] S2: Acquire the video stream data to be identified and perform frame segmentation to obtain a continuous sequence of images.

[0012] S3: The sequence of images is processed using a three-frame image difference method to obtain the position information of moving targets contained in the current frame image. The position information extraction process is as follows:

[0013] S31: Calculate the pixel difference between two adjacent images Fn-1 or Fn to obtain the frame difference image Dn: Dn = Fn - Fn-1.

[0014] S32: Perform pixel AND operation on adjacent frame difference images Dn and Dn-1 to obtain the fused image En with enhanced region of interest: En = Dn & Dn-1.

[0015] S33: Perform grayscale processing on the fused image to obtain a grayscale image.

[0016] S34: Apply Gaussian filtering to the grayscale image using a 3×3 kernel to obtain the denoised image.

[0017] S35: Perform binarization on the denoised image to obtain a binary image.

[0018] S36: Use 1×1 and 3×3 kernels respectively to perform erosion and dilation on the binary images to complete the morphological opening operation.

[0019] S37: Perform corner detection on the image after morphological opening operation, and output the coordinates of the smallest detection box surrounding the moving target as the required position information.

[0020] S4: Use the extracted location information to segment the region containing the moving target in the current frame image to obtain the target image of the moving target to be detected, and unify the size of the target image.

[0021] S5: Construct a Siamese neural network for similarity analysis of target and sample images, and pre-train it. The Siamese neural network consists of a backbone network composed of two VGG16 feature extraction modules with shared parameters, and a comparison network composed of three fully connected layers and a Euclidean distance calculation module.

[0022] S6: Using a trained Siamese neural network, perform similarity analysis on the target image segmented in step S4 and each sample image in the feature library in turn, and output the category information of the sample image with the highest similarity value.

[0023] S7: Mark and display the category information and similarity value identified by the Siamese neural network at the corresponding positions on each frame of the output video stream data.

[0024] As a further improvement of the present invention, the datasets used in the training phase of the deep convolutional generative adversarial network in step S1 and the Siamese neural network in step S5 are prepared as follows:

[0025] S01: Collect real video stream data in typical scenes and identify frame-by-frame images of various moving targets contained therein.

[0026] S02: Segment the regions containing each moving target in each frame of the image to obtain the corresponding initial sample images.

[0027] S03: Adjust the size of the segmented initial sample images to match the size of the Siamese neural network input.

[0028] S04: Manually add corresponding category labels to each initial sample image.

[0029] S05: Use the image dataset containing all sample images of the same category as the dataset required to train the various deep convolutional generative adversarial networks.

[0030] S06: Use an image dataset containing sample images of all categories as the dataset required to train the Siamese neural network.

[0031] S07: Expand the dataset for training each network model using data augmentation techniques, and divide it into training, testing, and validation sets in a 7:2:1 ratio.

[0032] As a further improvement of the present invention, in step S07, one or more of the following methods are used as data augmentation methods to process the original sample image: random rotation, cropping, stretching and optical transformation; in order to expand the dataset required for the training stage of the Siamese neural network and various deep convolutional generative adversarial networks.

[0033] As a further improvement of the present invention, the backbone network of the Siamese neural network includes five Conv modules: the first Conv module includes two 3x3 convolutional networks and one 2x2 max pooling, with an output feature layer of 64 channels; the second Conv module includes two 3x3 convolutional networks and one 2x2 max pooling, with an output feature layer of 128 channels; the third Conv module includes three 3x3 convolutional networks and one 2x2 max pooling, with an output feature layer of 256 channels; the fourth Conv module includes three 3x3 convolutional networks and one 2x2 max pooling, with an output feature layer of 512 channels; and the fifth Conv module includes three 3x3 convolutional networks and one 2x2 max pooling, with an output feature layer of 512 channels.

[0034] As a further improvement of the present invention, the similarity analysis process of the Siamese neural network in step S6 is as follows:

[0035] S61: Use the two VGG16 feature extraction modules in the backbone network to extract feature information from the target image and the sample image respectively, and obtain the corresponding multidimensional feature vectors.

[0036] S62: Two multidimensional feature vectors are mapped to the same feature space by comparing two fully connected layers in the network.

[0037] S63: The Flatten method is used to reduce the dimensionality of two feature vectors mapped to the same feature space to obtain two corresponding one-dimensional vectors.

[0038] S64: Calculate the Euclidean distance between two one-dimensional vectors using the distance calculation module.

[0039] S65: By comparing the third fully connected layer in the network, the Euclidean distance calculated in the previous step is mapped to the interval [0, 1] as the required similarity value.

[0040] As a further improvement of this invention, in the comparison network of the Siamese neural network, the two outputs of the backbone network and the two inputs of the Euclidean distance calculation module are connected by two fully connected layers. The output of the Euclidean distance calculation module is processed by a third fully connected layer and becomes the final output of the Siamese neural network.

[0041] As a further improvement of this invention, all three fully connected layers in the comparison network use the sigmoid function as the activation function to map variables to the range of 0 and 1. The Euclidean distance calculation module obtains the Euclidean distance between feature vectors by calculating the absolute value of the difference between two one-dimensional vectors.

[0042] This invention also includes a moving target detection system based on frame difference and Siamese networks. This system processes the input video stream data using the aforementioned moving target detection method based on frame difference and Siamese networks, identifies and labels the moving targets contained within it, and outputs video stream data containing the labeled information. The moving target detection system based on frame difference and Siamese networks includes: a video framing unit, a feature library, a target localization module, a target image preprocessing module, a target classification model, an automatic image labeling tool, and a video synthesis unit.

[0043] The video framing unit acquires video stream data captured by the front-end camera and performs real-time frame-by-frame processing to obtain a sequence of images. The feature library contains multiple template images corresponding to all types of target objects; each template image in the feature library is pre-labeled with corresponding category information.

[0044] The target localization module uses a three-frame image difference method to continuously process the sequence of images, thereby obtaining the position information of the moving target contained in the current frame image. The target image preprocessing module crops the current frame image based on the position information of the moving target obtained by the target localization module, and uniformly adjusts the size of the cropped image to 32×32 pixels, which is then used as the target image to be identified.

[0045] The target classification model comprises a backbone network consisting of two VGG16 feature extraction modules with shared parameters, and a comparison network consisting of three fully connected layers and a Euclidean distance calculation module. The backbone network extracts feature information from the two input images. The comparison network calculates the similarity value between the two images input to the backbone network based on their feature information. The target classification model then performs similarity analysis on the target image to be identified against each template image in the feature library and outputs the corresponding similarity value.

[0046] An automatic image annotation tool is used to obtain the output of the target localization module and the target classification model, and extract the category information of the template image with the highest similarity value to the target image. Then, the target object is labeled according to its location information, and the corresponding category information and similarity value are labeled near the target object.

[0047] The video synthesis unit is used to synthesize and output video stream data from consecutive sequence images containing annotation information.

[0048] As a further improvement of the present invention, the target localization module includes an image fusion unit, a grayscale processing unit, a noise reduction unit, a binarization processing unit, an opening operation unit, and a coordinate output unit.

[0049] The system comprises the following components: an image fusion unit acquires a sequence of three consecutive frames, calculates the frame difference between two adjacent frames, and then performs a pixel AND operation on the adjacent frame difference images to obtain the desired fused image. A grayscale processing unit processes the fused image to obtain a grayscale image. A denoising unit applies a 3×3 kernel to the grayscale image using Gaussian filtering to obtain a denoised image. A binarization unit binarizes the denoised image to obtain a binary image. An opening operation unit performs morphological opening operations on the binary image using 1×1 and 3×3 kernels, respectively, first eroding and then dilating. A coordinate output unit performs corner detection on the image after the morphological opening operation and outputs the coordinates of the smallest detection box enclosing the moving target.

[0050] The present invention also includes the application of the aforementioned moving target detection method based on frame difference and twin network in video surveillance, intelligent security and traffic monitoring.

[0051] The technical solution provided by this invention has the following beneficial effects:

[0052] This invention designs a method for rapid localization and recognition of moving targets by utilizing the information correlation between consecutive images captured by a fixed-view camera. It employs a three-frame image difference method for rapid target localization, eliminating the need for large-scale convolution operations, resulting in high computational efficiency and enhanced real-time performance. Furthermore, this invention utilizes a Siamese neural network for feature matching of images from different sources, and uses a VGG16 network for feature extraction, ensuring both accuracy and real-time performance. Ultimately, the solution provided by this invention achieves high-precision recognition of moving targets in video images, reduces the performance requirements of data processing equipment during the recognition process, and improves the real-time performance of target recognition. Therefore, it has high practical value and is highly suitable for widespread application in scenarios such as video surveillance, intelligent security, and traffic monitoring.

[0053] Furthermore, the solution provided by this invention utilizes a deep convolutional neural network to expand a limited sample library to obtain a richer feature library. It performs 25 enhancement operations on a single sample, ensuring the accuracy of classification, making the algorithm more robust, and increasing the model's generalization ability. Attached Figure Description

[0054] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:

[0055] Figure 1 This is a flowchart of the steps of a moving target detection method based on frame difference and Siamese network provided in Embodiment 1 of the present invention.

[0056] Figure 2 This is a flowchart illustrating the extraction of the position information of a moving target in an image using the three-frame image difference method in Embodiment 1 of the present invention.

[0057] Figure 3 This is an architecture diagram of the Siamese neural network constructed in Embodiment 1 of the present invention.

[0058] Figure 4 This is a network model diagram of VGG16 used in Embodiment 1 of the present invention.

[0059] Figure 5 This is a flowchart of the steps for similarity analysis between a target image and a feature library using a twin neural network in Embodiment 1 of the present invention.

[0060] Figure 6 This is a schematic diagram of the moving target detection method based on frame difference and Siamese network provided in Embodiment 1 of the present invention.

[0061] Figure 7 This is a network architecture diagram of the deep convolutional generative adversarial network used in Embodiment 1 of the present invention.

[0062] Figure 8 This is a flowchart illustrating the method for creating the dataset used in the training phase of the deep convolutional generative adversarial network and the Siamese neural network in Embodiment 1 of the present invention.

[0063] Figure 9 This is a system topology diagram of the moving target detection system based on frame difference method and twin network provided in Embodiment 2 of the present invention.

[0064] Figure 10 This is a functional block diagram of the target positioning module provided in Embodiment 2 of the present invention.

[0065] Figure 11 This is a flowchart illustrating the data collection method for model training in simulation experiments.

[0066] Figure 12 This is a flowchart of the training methods for Siamese neural networks and deep convolutional generative adversarial networks in simulation experiments.

[0067] Figure 13 This is the curve showing the change of the loss function of the twin neural network during the training phase in the simulation experiment.

[0068] Figure 14 This is the curve showing the change of the loss function of a deep convolutional generative adversarial network during the training phase in a simulation experiment.

[0069] Figure 15 A flowchart illustrating the steps involved in generating an adversarial network feature library for deep convolution.

[0070] Figure 16 This is the target detection and labeling result of a typical surveillance image obtained from a simulation experiment. Detailed Implementation

[0071] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0072] Example 1

[0073] This embodiment provides a moving target detection method based on frame difference and Siamese networks, which is used to detect and identify moving targets contained in video stream data acquired from a fixed viewpoint. Figure 1 As shown, the moving target detection method includes the following steps:

[0074] S1: Use trained convolutional generative adversarial networks (DCGANs) of different depths to augment the initial sample images of different categories of targets, and add a category label to each newly added sample image to form the required feature library.

[0075] S2: Acquire the video stream data to be identified and perform frame segmentation to obtain a continuous sequence of images.

[0076] S3: The sequence of images is processed using a three-frame image difference method to obtain the position information of moving targets contained in the current frame image. For example, Figure 2 As shown, the location information extraction process is as follows:

[0077] S31: Calculate the pixel difference between two adjacent images Fn-1 or Fn to obtain the frame difference image Dn: Dn = Fn - Fn-1.

[0078] S32: Perform pixel AND operation on adjacent frame difference images Dn and Dn-1 to obtain the fused image En with enhanced region of interest: En = Dn & Dn-1.

[0079] S33: Perform grayscale processing on the fused image to obtain a grayscale image.

[0080] S34: Apply Gaussian filtering to the grayscale image using a 3×3 kernel to obtain the denoised image.

[0081] S35: Perform binarization on the denoised image to obtain a binary image.

[0082] S36: Use 1×1 and 3×3 kernels respectively to perform erosion and dilation on the binary images to complete the morphological opening operation.

[0083] S37: Perform corner detection on the image after morphological opening operation, and output the coordinates of the smallest detection box surrounding the moving target as the required position information.

[0084] S4: Use the extracted location information to segment the region containing the moving target in the current frame image to obtain the target image of the moving target to be detected, and unify the size of the target image. In this embodiment, the size of the target image is 32×32.

[0085] S5: Construct a Siamese neural network for similarity analysis between the target image and sample images, and pre-train it. For example... Figure 3 As shown, the Siamese neural network consists of a backbone network composed of two VGG16 feature extraction modules with shared parameters, and a comparison network composed of three fully connected layers and a Euclidean distance calculation module.

[0086] The architecture of the VGG16 network model is as follows: Figure 4 As shown, the backbone network of the Siamese neural network in this embodiment adopts the feature extraction module in VGG16, specifically including five Conv modules: the first Conv module includes two 3x3 convolutional networks and one 2x2 max pooling, with an output feature layer of 64 channels; the second Conv module includes two 3x3 convolutional networks and one 2x2 max pooling, with an output feature layer of 128 channels; the third Conv module includes three 3x3 convolutional networks and one 2x2 max pooling, with an output feature layer of 256 channels; the fourth Conv module includes three 3x3 convolutional networks and one 2x2 max pooling, with an output feature layer of 512 channels; and the fifth Conv module includes three 3x3 convolutional networks and one 2x2 max pooling, with an output feature layer of 512 channels.

[0087] In the comparison network of the Siamese neural network, two fully connected layers connect the two outputs of the backbone network to the two inputs of the Euclidean distance calculation module. The output of the Euclidean distance calculation module is processed by a third fully connected layer and becomes the final output of the Siamese neural network. All three fully connected layers in the comparison network use the sigmoid function as the activation function to map variables to the range of 0 and 1. The Euclidean distance calculation module calculates the Euclidean distance between feature vectors by calculating the absolute value of the difference between two one-dimensional vectors.

[0088] S6: Using a trained Siamese neural network, perform similarity analysis on the target image segmented in step S4 and each sample image in the feature library in turn, and output the category information of the sample image with the highest similarity value.

[0089] like Figure 5 As shown, the similarity analysis process of the Siamese neural network is as follows:

[0090] S61: Use the two VGG16 feature extraction modules in the backbone network to extract feature information from the target image and the sample image respectively, and obtain the corresponding multidimensional feature vectors.

[0091] S62: Two multidimensional feature vectors are mapped to the same feature space by comparing two fully connected layers in the network.

[0092] S63: The Flatten method is used to reduce the dimensionality of two feature vectors mapped to the same feature space to obtain two corresponding one-dimensional vectors.

[0093] S64: Calculate the Euclidean distance between two one-dimensional vectors using the distance calculation module.

[0094] S65: By comparing the third fully connected layer in the network, the Euclidean distance calculated in the previous step is mapped to the interval [0, 1] as the required similarity value.

[0095] S7: Mark and display the category information and similarity value identified by the Siamese neural network at the corresponding positions on each frame of the output video stream data.

[0096] like Figure 6 As shown, the moving target detection method based on frame difference and Siamese network provided in this embodiment divides the moving target detection task into two sub-tasks. One sub-task is to achieve accurate target localization by combining the correlation in multiple frames of images. This task is mainly completed by a classifier. The second sub-task is to identify the type of the localized moving target through template matching. This sub-task is completed by a classifier, which is the aforementioned Siamese neural network.

[0097] To improve the accuracy of moving target type recognition, it is necessary to ensure that all types of moving targets in the feature database have a sufficient number of sample data. Considering the insufficient sample data for certain niche moving target types, this embodiment also utilizes a deep convolutional generative adversarial network (DGAN) to expand the sample data for some categories in the feature database. The network architecture of the DGAN used in this embodiment is as follows: Figure 7 As shown. Specifically, in practical applications, since the types of sample data that need to be expanded may be more than one, it is necessary to train a corresponding deep convolutional generative adversarial network separately for each type of moving target.

[0098] In the practical application of the method in this embodiment, the Siamese neural network is a newly constructed network model by technicians for the corresponding problem. Therefore, the constructed network model needs to be pre-trained to ensure that it can achieve high recognition accuracy. Meanwhile, considering that the network parameters of the deep convolutional generative adversarial networks for different categories of sample images in the expanded feature library are also different, each deep convolutional generative adversarial network also needs to be trained separately. Finally, this embodiment needs to prepare the data required for the training phase for each network model and formulate corresponding network model training schemes.

[0099] Specifically, such as Figure 8 As shown, the dataset creation method used by the deep convolutional generative adversarial network and Siamese neural network in this embodiment during the training phase is as follows:

[0100] S01: Collect real video stream data in typical scenes and identify frame-by-frame images of various moving targets contained therein.

[0101] S02: Segment the regions containing each moving target in each frame of the image to obtain the corresponding initial sample images.

[0102] S03: Adjust the size of the segmented initial sample images to match the size of the Siamese neural network input.

[0103] S04: Manually add corresponding category labels to each initial sample image.

[0104] S05: Use the image dataset containing all sample images of the same category as the dataset required to train the various deep convolutional generative adversarial networks.

[0105] S06: Use an image dataset containing sample images of all categories as the dataset required to train the Siamese neural network.

[0106] S07: Expand the dataset for training each network model using data augmentation techniques, and divide it into training, testing, and validation sets in a 7:2:1 ratio.

[0107] Specifically, in this embodiment, one or more of the following methods are used as data augmentation techniques: random rotation, cropping, stretching, and optical transformation. These methods are used to process the original sample images to expand the datasets required for the training stages of the Siamese neural network and various deep convolutional generative adversarial networks.

[0108] The moving target detection method based on frame difference and Siamese networks provided in this embodiment needs to be able to efficiently and quickly detect moving targets contained in video stream data and identify the type of moving targets. Therefore, this solution can be effectively applied to typical scenarios such as video surveillance, intelligent security, and traffic monitoring.

[0109] For example, applying the technical solution of this embodiment to video surveillance for target tracking can effectively locate targets appearing in the surveillance video and track and analyze relevant data such as the movement status of the moving target's trajectory. Applying the technical solution of this embodiment to intelligent security can extract features from people or other moving targets appearing in the video footage, identify their identities, and so on. Applying the technical solution of this embodiment to traffic monitoring can help collect statistics on vehicle driving status data or traffic flow information at intersections, and so on.

[0110] Example 2

[0111] Based on the embodiments described above, this embodiment further provides a moving target detection system based on frame difference and Siamese networks. It uses the moving target detection method based on frame difference and Siamese networks as described in Embodiment 1 to process the input video stream data, identify and label the moving targets contained therein, and output video stream data containing the labeled information. Figure 9 As shown, the moving target detection system based on frame difference method and Siamese network includes: video framing unit, feature library, target localization module, target image preprocessing module, target classification model, automatic image annotation tool, and video synthesis unit.

[0112] The video framing unit is used to acquire video stream data captured by the front-end camera and perform real-time frame-segmentation processing to obtain a sequence of images frame by frame. The feature library contains multiple template images corresponding to all types of target objects; each template image in the feature library is pre-labeled with corresponding category information; specifically, in this embodiment, the size of each template image in the feature library is uniformly set to 32×32.

[0113] The target localization module is used to continuously process a sequence of images using a three-frame image difference method, thereby obtaining the position information of moving targets contained in the current frame image. For example... Figure 10As shown, the target localization module includes an image fusion unit, a grayscale processing unit, a noise reduction unit, a binarization processing unit, an opening operation unit, and a coordinate output unit.

[0114] The system comprises the following components: an image fusion unit acquires a sequence of three consecutive frames, calculates the frame difference between two adjacent frames, and then performs a pixel AND operation on the adjacent frame difference images to obtain the desired fused image. A grayscale processing unit processes the fused image to obtain a grayscale image. A denoising unit applies a 3×3 kernel to the grayscale image using Gaussian filtering to obtain a denoised image. A binarization unit binarizes the denoised image to obtain a binary image. An opening operation unit performs morphological opening operations on the binary image using 1×1 and 3×3 kernels, respectively, first eroding and then dilating. A coordinate output unit performs corner detection on the image after the morphological opening operation and outputs the coordinates of the smallest detection box enclosing the moving target.

[0115] The target image preprocessing module is used to crop the current frame image based on the position information of the moving target obtained by the target localization module, and adjust the size of the cropped image to 32×32 as the target image to be identified.

[0116] The target classification model comprises a backbone network consisting of two VGG16 feature extraction modules with shared parameters, and a comparison network consisting of three fully connected layers and a Euclidean distance calculation module. The backbone network extracts feature information from the two input images. The comparison network calculates the similarity value between the two images input to the backbone network based on their feature information. The target classification model then performs similarity analysis on the target image to be identified against each template image in the feature library and outputs the corresponding similarity value.

[0117] An automatic image annotation tool is used to acquire the output of the target localization module and the target classification model, and extract the category information of the template image with the highest similarity value to the target image. Then, the target object is labeled according to its location information, and corresponding category information and similarity values ​​are labeled near the target object. The video synthesis unit is used to synthesize and output video stream data from consecutive sequences of images containing annotation information.

[0118] Furthermore, in the moving target detection system based on frame difference and Siamese network provided in this embodiment, when the number of different types of sample images in the feature library is small, it can be expanded by a trained deep convolutional generative adversarial network.

[0119] In practical applications, the motion target detection system based on frame difference and Siamese networks in this embodiment can be a data processing system running a specific computer program. The data processing system includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the corresponding computer program, it implements the steps of the motion target detection method based on frame difference and Siamese networks as described in Embodiment 1, thereby detecting and identifying the corresponding motion targets in the input real-time video stream data in real time, and labeling the type information of the identified targets in the source video.

[0120] This data processing device is actually a type of computer device. In this embodiment, the computer device can be an embedded terminal capable of executing programs, a tablet computer, a laptop computer, a desktop computer, a rack server, a blade server, a tower server, or a cabinet server (including standalone servers or server clusters composed of multiple servers), etc. The computer device in this embodiment includes, but is not limited to, a memory and a processor that can communicate with each other via a system bus.

[0121] In this embodiment, the memory (i.e., the readable storage medium) includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory can be an internal storage unit of a computer device, such as the hard disk or RAM of the computer device. In other embodiments, the memory can also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the computer device. Of course, the memory can also include both internal storage units and external storage devices of the computer device. In this embodiment, the memory is typically used to store the operating system and various application software installed on the computer device. In addition, the memory can also be used to temporarily store various types of data that have been output or will be output.

[0122] In some embodiments, the processor may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor is typically used to control the overall operation of a computer device.

[0123] Simulation Experiment

[0124] To verify the effectiveness of the solution provided in this embodiment, technicians also used video surveillance analysis of traffic flow as an application scenario and conducted simulation experiments on the solutions in Embodiments 1 and 2. During the experiments, technicians constructed the corresponding Siamese neural network and deep convolutional generative adversarial network. Then, they used... Figure 11 The method is to prepare the training dataset.

[0125] Then, the two networks and pre-trained weight files are packaged and transferred to a cloud server. Python code is used to encode the code, and it is deployed on an Alibaba Cloud server to accelerate network training. The training process is as follows: Figure 12 As shown, the system configuration for training the network model is as follows: Ubuntu 18.04 64-bit system; CUDA version 11.0.2; GPU NVIDIA T4; using AIACC training acceleration and AIACC inference acceleration architecture. During training, the batch size was set to 32, the optimizer was Adam, and the learning rate descent strategy was adjusted to cosine annealing. After training, the weight file was downloaded. As the number of iterations increases, the changes in the loss function of the two network models during training are as follows: Figure 13 and Figure 14 As shown in the figure, the Siamese neural network basically converges after 15 iterations, achieving optimal training results after 100 iterations. The deep convolutional generative adversarial network, on the other hand, converges after approximately 370 iterations. In actual testing, as shown... Figure 15 As shown, in this embodiment, for any sample image, DCGAN is used to augment it by 25 times to obtain a feature library constituting the corresponding type of sample. The actual target recognition and data annotation results are as follows. Figure 16 As shown in the figure, the method provided in this embodiment can accurately identify and process all vehicles (cars) in the image and add corresponding annotation information to the video image. Therefore, the solution in this embodiment is entirely feasible.

[0126] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A moving target detection method based on frame difference method and Siamese network, characterized in that: It is used to detect and identify moving targets contained in video stream data acquired from a fixed viewpoint; the moving target detection method includes the following steps: S1: Use trained convolutional generative adversarial networks of different depths to augment the initial sample images of different categories of target objects, and add a category label to each newly added sample image to form the required feature library; S2: Acquire the video stream data to be identified and perform frame segmentation to obtain a continuous sequence of images; S3: The sequence of images is processed using a three-frame image difference method to obtain the position information of the moving targets contained in the current frame image. The position information extraction process is as follows: S31: Calculate the pixel difference between two adjacent images Fn-1 and Fn to obtain the frame difference image Dn: Dn=Fn-Fn-1; S32: Perform pixel AND operation on adjacent frame difference images Dn and Dn-1 to obtain the fused image En with enhanced region of interest: En = Dn & Dn-1; S33: Perform grayscale processing on the fused image to obtain a grayscale image; S34: Apply Gaussian filtering to the grayscale image using a 3×3 kernel to obtain the denoised image; S35: Perform binarization on the denoised image to obtain a binarized image; S36: The binarized images are eroded and then dilated using 1×1 and 3×3 kernels respectively to complete the morphological opening operation; S37: Perform corner detection on the image after morphological opening operation, and output the coordinates of the smallest detection box surrounding the moving target as the required position information; S4: Use the extracted position information to segment the region containing the moving target in the current frame image to obtain the target image of the moving target to be detected, and unify the size of the target image; S5: Construct a Siamese neural network for similarity analysis of target images and sample images, and pre-train it; the Siamese neural network includes a backbone network consisting of two VGG16 feature extraction modules with shared parameters, and a comparison network consisting of three fully connected layers and a Euclidean distance calculation module; the backbone network of the Siamese neural network includes five Conv modules: the first Conv module includes two 3x3 convolutional networks and one 2x2 max pooling, with an output feature layer of 64 channels; the second Conv module includes two 3x3 convolutional networks and one 2x2 max pooling, with an output feature layer of 128 channels; the third Conv module includes three 3x3 convolutional networks and one 2x2 max pooling, with an output feature layer of 256 channels; the fourth Conv module includes three 3x3 convolutional networks and one 2x2 max pooling, with an output feature layer of 512 channels; the fifth Conv module includes three 3x3 convolutional networks and one 2x2 max pooling, with an output feature layer of 512 channels. S6: Using a trained Siamese neural network, perform similarity analysis on the target image segmented in step S4 and each sample image in the feature library in turn, and output the category information of the sample image with the highest similarity value. S7: Mark and display the category information and similarity value identified by the Siamese neural network at the corresponding positions on each frame of the output video stream data.

2. The moving target detection method based on frame difference and Siamese network as described in claim 1, characterized in that: The datasets used in the training phase for the deep convolutional generative adversarial network in step S1 and the Siamese neural network in step S5 are prepared as follows: S01: Collect real video stream data in typical scenes and identify frame-by-frame images of various moving targets contained therein; S02: Segment the regions containing each moving target in each frame of the image to obtain the corresponding initial sample images; S03: Adjust the size of the segmented initial sample images to match the size of the Siamese neural network input; S04: Manually add corresponding category labels to each initial sample image; S05: Use the image dataset containing all sample images of the same category as the dataset required to train each deep convolutional generative adversarial network; S06: Use an image dataset containing sample images of all categories as the dataset required for training the Siamese neural network; S07: Expand the dataset for training each network model using data augmentation techniques, and divide it into training, testing, and validation sets in a 7:2:1 ratio.

3. The moving target detection method based on frame difference and Siamese network as described in claim 2, characterized in that: In step S07, one or more of the following methods are used as data augmentation techniques: random rotation, cropping, stretching, and optical transformation. These techniques are used to process the initial sample image to expand the dataset required for the training phase of the Siamese neural network and various deep convolutional generative adversarial networks.

4. The moving target detection method based on frame difference and Siamese network as described in claim 1, characterized in that: In step S6, the similarity analysis process of the Siamese neural network is as follows: S61: Use the two VGG16 feature extraction modules in the backbone network to extract the feature information of the target image and the sample image respectively, and obtain the corresponding multi-dimensional feature vectors; S62: Two multidimensional feature vectors are mapped to the same feature space by comparing two fully connected layers in the network; S63: The Flatten method is used to reduce the dimensionality of two feature vectors mapped to the same feature space to obtain two corresponding one-dimensional vectors. S64: Calculate the Euclidean distance between two one-dimensional vectors using the distance calculation module; S65: By comparing the third fully connected layer in the network, the Euclidean distance calculated in the previous step is mapped to the interval [0, 1] as the required similarity value.

5. The moving target detection method based on frame difference method and Siamese network as described in claim 1, characterized in that: In the comparison network of the twin neural network, the two outputs of the backbone network and the two inputs of the Euclidean distance calculation module are connected by two fully connected layers; the output of the Euclidean distance calculation module is processed by a third fully connected layer and becomes the final output of the twin neural network.

6. The moving target detection method based on frame difference and Siamese network as described in claim 5, characterized in that: The three fully connected layers in the comparison network all use the sigmoid function as the activation function to map variables to the range of 0 and 1; the Euclidean distance calculation module obtains the Euclidean distance between feature vectors by calculating the absolute value of the difference between two one-dimensional vectors.

7. A moving target detection system based on frame difference method and Siamese network, characterized in that, It uses the motion target detection method based on frame difference and Siamese network as described in any one of claims 1-6 to process the input video stream data, identify and label the motion targets contained therein, and output video stream data containing labeling information; The moving target detection system based on frame difference method and Siamese network includes: The video framing unit is used to acquire video stream data captured by the front-end camera and perform real-time frame-segmentation processing to obtain a sequence of images frame by frame. The feature library contains multiple template images corresponding to all types of target objects; each template image in the feature library is pre-labeled with corresponding category information. The target localization module is used to continuously process the sequence of images using the three-frame image difference method, thereby obtaining the position information of the moving target contained in the current frame image; The target image preprocessing module is used to crop the current frame image based on the position information of the moving target obtained by the target localization module, and to uniformly adjust the size of the cropped image to 32×32 as the target image to be identified. The target classification model includes a backbone network consisting of two VGG16 feature extraction modules with shared parameters, and a comparison network consisting of three fully connected layers and a Euclidean distance calculation module. The backbone network is used to extract feature information corresponding to the two input images. The comparison network is used to calculate the similarity value between the two images input to the backbone network based on the feature information of the two input images. The target classification model is used to perform similarity analysis between the target image to be identified and each template image in the feature library in turn, and output the corresponding similarity value. An automatic image annotation tool is used to obtain the output of the target localization module and the target classification model, and extract the category information of the template image with the highest similarity value to the target image; then, it annotates the target object according to the location information, and annotates the corresponding category information and similarity value near the target object; The video synthesis unit is used to synthesize and output video stream data from consecutive sequence images containing annotation information.

8. The moving target detection system based on frame difference method and Siamese network as described in claim 7, characterized in that: The target localization module includes an image fusion unit, a grayscale processing unit, a noise reduction unit, a binarization processing unit, an opening operation unit, and a coordinate output unit. The image fusion unit acquires a sequence of three consecutive frames, calculates the frame difference between two adjacent frames, and then performs a pixel AND operation on the adjacent frame difference images to obtain the desired fused image. The grayscale processing unit processes the fused image to obtain a grayscale image. The denoising unit performs Gaussian filtering on the grayscale image using a 3×3 kernel to obtain a denoised image. The binarization processing unit performs binarization processing on the denoised image to obtain a binarized image. The opening operation unit performs erosion followed by dilation on the binarized image using 1×1 and 3×3 kernels respectively to complete the morphological opening operation. The coordinate output unit performs corner detection on the image after the morphological opening operation and outputs the coordinates of the minimum detection box surrounding the moving target.

9. The application of a moving target detection method based on frame difference and twin network as described in any one of claims 1-6 in video surveillance, intelligent security and traffic monitoring.

Citation Information

Patent Citations

  • Moving target detection method and device based on motion frame difference image

    CN115147450A

  • Vehicle-mounted video target detection method based on deep learning

    WO2020181685A1