Behavior detection method, device, equipment and storage medium
The edge computing system and image recognition model are used to process preset scene video data, which solves the problem of high resource consumption and insufficient timeliness in monitoring violations in the existing technology, achieves efficient identification and early warning of violations, and improves supervision efficiency. .
Patent Information
- Application Number
- CN202110835686.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-23
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2041-07-23
AI Technical Summary
Existing technologies rely on human labor and cloud computing when monitoring violations, resulting in high resource consumption and inability to guarantee timeliness, making it impossible to effectively improve supervision efficiency.
The preset scene video data is stored and processed through the edge computing system, and the image recognition model is used to perform behavior detection and early warning of target objects, including collecting video streams, extracting historical video images, annotating target objects, generating facial recognition models, and conducting real-time video Image recognition and behavior detection based on edge computing rules.
It improves supervision efficiency, reduces resource consumption, enables timely identification and early warning of violations, and improves the timeliness and accuracy of supervision.
Smart Images

Figure CN114596532B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a behavior detection method, device, equipment and storage medium. Background Art
[0002] As the times continue to develop, my country's economy and people's living standards continue to improve, and the hard work of the people has brought better conditions to society and more abundant personal resources to individuals. At a time when living standards are improving, the diversity of lifestyles has spawned various bad habits, among which the increasingly serious violations of regulations in related places are one of them. Including but not limited to eating, smoking, and sitting in illegal postures in certain specific scenes. These behaviors may not only affect their own life safety and health, but also cause pollution in preset scenes and even reduce the efficiency of public transportation. These violations not only affect the environment and others, but are more likely to cause bad behaviors that are not in line with the environment.
[0003] At present, the relevant departments with control plans mainly control and stop violations through manpower and monitoring systems. However, manpower control requires a lot of resources and takes a long time, and is not a feasible control plan. The possibility of violations still exists. In view of the computing power requirements of various artificial intelligence recognition models, cloud computing solutions are a must for most systems, and cloud computing solutions have very strict requirements for various data streams. The huge network pressure and maintenance costs generated by the process of uploading real-time data to the relevant database will exceed the benefits obtained by the relevant departments in controlling violations. Stopping violations requires timeliness, and the delay caused by the network will make its timeliness unable to be guaranteed. Summary of the invention
[0004] The main purpose of the present invention is to store the preset scene video data through the edge computing system, and at the same time identify, detect and warn the behavior of the target object in the preset scene according to the image recognition model, thereby improving the efficiency of supervision.
[0005] The first aspect of the present invention provides a behavior detection method, comprising: collecting a video stream of a preset scene, extracting historical video images from the video stream, and storing the historical video images in an edge hardware device group of an edge computing platform, wherein the video stream includes at least two frames of historical video images containing a target object; identifying the target object in the historical video image, and annotating the target object to obtain an annotated image containing the target object and save it as annotated data; generating a model training sample image according to the annotated image, and inputting the model training sample image into a preset YOLO model for training to obtain a facial recognition model; obtaining at least two frames of real-time video images containing the target object, and inputting the real-time video image into the facial recognition model to output a face recognition result, and obtaining the area range of each target object in the real-time video image according to the face recognition result; according to the area range of each target object, extracting a hand image and a facial image corresponding to each target object from the real-time video image, and determining the image type corresponding to the hand image and the facial image; based on the preset edge computing rules and the image type, respectively calling the image processing model corresponding to the image type from the preset model database to perform behavior detection on the target object.
[0006] Optionally, in a first implementation method of the first aspect of the present invention, the identifying the target object in the historical video image, annotating the target object, obtaining the annotated image containing the target object and saving it as annotated data includes: circling the area range of the workstations in the historical video image, extracting the first workstation image corresponding to each workstation from the historical video image; inputting the first workstation image into a preset workstation recognition model to obtain a second workstation image; performing instance segmentation and annotation on the second workstation image to obtain an annotated image containing the target object; storing the annotated image in a blank file of a preset format to obtain annotated data.
[0007] Optionally, in a second implementation manner of the first aspect of the present invention, generating a model training sample image according to the annotated image, and inputting the model training sample image into a preset YOLO model for training to obtain a facial recognition model includes: inputting the training sample image into a feature extraction network of the YOLO model, and performing feature extraction on the training sample image through the feature extraction network to obtain a first feature image of the training sample image; inputting the first feature image into an RPN network of the YOLO model, and predicting the first feature image through the RPN network to generate a prediction box corresponding to the first feature image; inputting the first feature image and the prediction box into an ROI Align layer of the YOLO model, and fusing the prediction box and the first feature image through the ROI Align layer to obtain a second feature image containing the prediction box; inputting the second feature image into a classification network of the YOLO model, and generating a prediction result corresponding to the second feature image through the classification network; adjusting the parameters of the YOLO model according to the prediction result and the annotated data until the YOLO model converges to obtain a facial recognition model.
[0008] Optionally, in a third implementation manner of the first aspect of the present invention, the RPN network includes a first classifier, and the first feature image is input into the RPN network of the YOLO model, and the first feature image is predicted through the RPN network to generate a prediction box corresponding to the first feature image, including: inputting the first feature image into the RPN network of the YOLO model and obtaining preset anchor box information; generating an anchor box of the first feature image according to the anchor box information; judging whether there is a target object in the anchor box according to the first classifier; if so, performing border regression on the anchor box to obtain a prediction box corresponding to the first feature image.
[0009] Optionally, in a fourth implementation method of the first aspect of the present invention, extracting hand images and facial images corresponding to each target object from the real-time video image according to the area range of each target object, and determining the image types corresponding to the hand images and the facial images include: extracting hand images and facial images corresponding to each target object from the real-time video image according to the area range of each target object; respectively identifying the hand images and the facial images, and determining the image types of the hand images and the facial images according to the identification results.
[0010] Optionally, in a fifth implementation manner of the first aspect of the present invention, based on the preset edge computing rules and the image type, calling the image processing model corresponding to the image type from the preset model database to perform behavior detection on the target object includes: according to the image type, screening out all first images containing hands and all second images containing faces from the real-time video image; inputting the first image into a preset hand detection model, and identifying the first image respectively through the hand detection model to obtain a recognition result; inputting the second image into a preset facial recognition model, and parsing the blocks and video frames in the second image through the facial recognition model; based on the preset edge computing rules and the recognition results, the blocks and the video frames, performing edge computing on the first image and the second image, and performing behavior detection on the target object according to the calculation results.
[0011] Optionally, in a sixth implementation method of the first aspect of the present invention, after performing edge computing on the first image and the second image based on the preset edge computing rules and the recognition results, the blocks and the video frames, and performing behavior detection on the target object according to the calculation results, it also includes: if the behavior detection result of the target object is abnormal, triggering an alarm message to a preset monitoring center and generating a monitoring report; and reminding the target object according to the monitoring report.
[0012] The second aspect of the present invention provides a behavior detection device, including: an acquisition module, used to acquire a video stream of a preset scene, extract historical video images in the video stream, and store the historical video images in an edge hardware device group of an edge computing platform, wherein the video stream includes at least two frames of historical video images containing a target object; a labeling module, used to identify the target object in the historical video image, and label the target object to obtain a labeled image containing the target object and save it as labeled data; a training module, used to generate a model training sample image according to the labeled image, and input the model training sample image into a preset YOLO model for training to obtain a facial recognition model ; an identification module, used to obtain at least two frames of real-time video images containing target objects, and input the real-time video images into the facial recognition model to output facial recognition results, and obtain the area range of each target object in the real-time video image according to the facial recognition results; a first determination module, used to extract the hand image and facial image corresponding to each target object from the real-time video image according to the area range of each target object, and determine the image type corresponding to the hand image and the facial image; a detection module, used to call the image processing model corresponding to the image type from the preset model database based on the preset edge computing rules and the image type to perform behavior detection on the target object.
[0013] Optionally, in a first implementation method of the second aspect of the present invention, the labeling module is specifically used to: circle the area range of the workstations in the historical video image, and extract the first workstation image corresponding to each workstation from the historical video image; input the first workstation image into a preset workstation recognition model to obtain a second workstation image; perform instance segmentation and labeling on the second workstation image to obtain a labeled image containing a target object; store the labeled image in a blank file in a preset format to obtain labeling data.
[0014] Optionally, in a second implementation of the second aspect of the present invention, the training module includes: a feature extraction unit, used to input the training sample image into the feature extraction network of the YOLO model, and perform feature extraction on the training sample image through the feature extraction network to obtain a first feature image of the training sample image; a prediction unit, used to input the first feature image into the RPN network of the YOLO model, and predict the first feature image through the RPN network to generate a prediction box corresponding to the first feature image; a fusion unit, used to input the first feature image and the prediction box into the ROI Align layer of the YOLO model, and fuse the prediction box and the first feature image through the ROI Align layer to obtain a second feature image containing the prediction box; a classification unit, used to input the second feature image into the classification network of the YOLO model, and generate a prediction result corresponding to the second feature image through the classification network; an adjustment unit, used to adjust the parameters of the YOLO model according to the prediction result and the annotation data until the YOLO model converges to obtain a facial recognition model.
[0015] Optionally, in a third implementation method of the second aspect of the present invention, the prediction unit is specifically used to: input the first feature image into the RPN network of the YOLO model, and obtain preset anchor frame information; generate an anchor frame of the first feature image according to the anchor frame information; determine whether there is a target object in the anchor frame according to the first classifier; if so, perform border regression on the anchor frame to obtain a prediction frame corresponding to the first feature image.
[0016] Optionally, in a fourth implementation method of the second aspect of the present invention, the first determination module is specifically used to: extract a hand image and a facial image corresponding to each target object from the real-time video image according to the area range of each target object; respectively identify the hand image and the facial image, and determine the image type of the hand image and the facial image according to the identification results.
[0017] Optionally, in a fifth implementation manner of the second aspect of the present invention, the detection module also includes: according to the image type, screening out all first images containing hands and all second images containing faces from the real-time video image; inputting the first image into a preset hand detection model, and identifying the first image respectively through the hand detection model to obtain a recognition result; inputting the second image into a preset facial recognition model, and parsing the blocks and video frames in the second image through the facial recognition model; performing edge computing on the first image and the second image based on the preset edge computing rules and the recognition results, the blocks and the video frames, and performing behavior detection on the target object according to the calculation results.
[0018] Optionally, in a sixth implementation of the second aspect of the present invention, the behavior detection device further includes: a generation module, which is used to trigger an alarm message to a preset monitoring center and generate a monitoring report if the behavior detection result of the target object is abnormal; and a second determination module, which is used to remind the target object according to the monitoring report.
[0019] A third aspect of the present invention provides a behavior detection device, comprising: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via a line;
[0020] The at least one processor calls the instructions in the memory to enable the behavior detection device to execute the above-mentioned behavior detection method.
[0021] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned behavior detection method.
[0022] In the technical solution provided by the present invention, historical video images are obtained by extracting the video stream of the collected preset scene; the target object in the historical video image is identified, and the target object is annotated to obtain an annotated image containing the target object and save it as annotated data; a model training sample image is generated according to the annotated image, and the model training sample image is input into the YOLO model for training to obtain a facial recognition model; at least two frames of real-time video images containing the target object are obtained, and the real-time video images are input into the facial recognition model for identification and detection to determine whether there is any violation in the real-time video image. This solution uses an image recognition model to identify, detect and warn the preset scene video data, thereby improving the efficiency of supervision. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is a schematic diagram of a first embodiment of the behavior detection method of the present invention;
[0024] Figure 2 A schematic diagram of a second embodiment of the behavior detection method of the present invention;
[0025] Figure 3 Schematic diagram of a third embodiment of the behavior detection method of the present invention;
[0026] Figure 4 Schematic diagram of a fourth embodiment of the behavior detection method of the present invention;
[0027] Figure 5 is a schematic diagram of a fifth embodiment of the behavior detection method of the present invention;
[0028] Figure 6 It is a schematic diagram of a first embodiment of a behavior detection device of the present invention;
[0029] Figure 7 is a schematic diagram of a second embodiment of a behavior detection device of the present invention;
[0030] Figure 8 It is a schematic diagram of an embodiment of the behavior detection device of the present invention. DETAILED DESCRIPTION
[0031] The embodiment of the present invention provides a behavior detection method, device, equipment and storage medium. In the technical solution of the present invention, firstly, a historical video image is obtained by extracting the video stream of the preset scene collected; the target object in the historical video image is identified, and the target object is annotated to obtain an annotated image containing the target object and save it as annotated data; a model training sample image is generated according to the annotated image, and the model training sample image is input into the YOLO model for training to obtain a facial recognition model; at least two frames of real-time video images containing the target object are obtained, and the real-time video images are input into the facial recognition model for identification and detection to determine whether there is any violation in the real-time video image. This solution improves the efficiency of supervision by using the image recognition model to identify, detect and warn the preset scene video data.
[0032] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0033] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , a first embodiment of the behavior detection method in the embodiment of the present invention includes:
[0034] 101. Collect the video stream of the preset scene, extract the historical video images in the video stream, and store the historical video images in the edge hardware device group of the edge computing platform;
[0035] In this embodiment, the video of the preset scene refers to the video stream of the area corresponding to a specific scene within a preset time period. The preset scene may be a road freight transportation scene or a logistics package sorting scene. Video data of the logistics vehicle loading scene is captured by a camera or other device. For example, all surveillance videos are connected to a local area network, so all cameras can be accessed through the DSS platform. The DSS has a screenshot function that saves the historical video images captured in the form of bmp. Take about 900 (or more) sample images, and perform image recognition detection on the area range of the workstation to be identified according to the range of the workstation to be identified in the image to determine whether there is any violation in the scene.
[0036] 102. Identify the target object in the historical video image, and mark the target object, obtain the marked image containing the target object and save it as marked data;
[0037] In this embodiment, the video image is identified to obtain the workstation information in the video image, and the video image is input into the preset image annotation software for display. Labelme software is preferably used as the image annotation software. In a manual manner, the target object in the image is selected by using the first connected closed line through an interactive device. The server delineates the target object area in the workstation information corresponding to the video image according to the position coordinates corresponding to the closed line, and obtains an image containing the range of the annotated target object area, that is, the annotation information. Finally, the annotation information is written into a blank file in a preset JSON format to obtain the annotation data in JSON format.
[0038] 103. Generate a model training sample image according to the labeled image, and input the model training sample image into a preset YOLO model for training to obtain a facial recognition model;
[0039] In this embodiment, the YOLO model is an instance segmentation model, which can be used for "target detection", "target instance segmentation", and "target key point detection".
[0040] In this embodiment, the YOLO model is composed of a feature extraction network, an RPN network, a ROI Align layer, and a classification network. Feature extraction is a member of the ResNet series of convolutional neural networks. In addition to learning feature extraction, ResNet also learns the loss between the features of the previous layer and the features of the next layer, so that more features can be extracted. After the training sample image is input into the feature extraction network, the features therein are extracted through the convolution layer to obtain the first feature map.
[0041] RPN (Regin Proposal Network), "Regin Proposal" means "region selection". Through the preset anchor box information, the RPN network generates anchor boxes for each pixel in the first feature map, and then selects the anchor box containing the target object through certain rules, and obtains the pre-selected box through bounding box regression.
[0042] ROI Align (Region of Interest Align) is a regional feature aggregation method used to accurately fuse the pre-selected box with the feature map.
[0043] The classification network includes a fully connected network, a fully convolutional network and a classifier. The fully connected network and the classifier are used to classify the pre-selected box to determine whether it contains the target object. The fully convolutional network is used to generate a target mask corresponding to the target object.
[0044] 104. Acquire at least two frames of real-time video images containing target objects, input the real-time video images into a facial recognition model to output face recognition results, and obtain the area range of each target object in the real-time video image according to the face recognition results;
[0045] In this embodiment, after the image recognition model is trained, a historical video image containing the target object in the current preset scene is obtained by taking snapshots, and the historical video image contains the target object in operation. The historical video image is then input into the image recognition model.
[0046] The image recognition model can identify the target objects in the historical video images through the human body parts such as face, hands and feet, and obtain the area range of each target object in the historical video images.
[0047] 105. Extracting a hand image and a facial image corresponding to each target object from the real-time video image according to the area range of each target object, and determining the image type corresponding to the hand image and the facial image;
[0048] In this embodiment, hand images and facial images corresponding to each target object are extracted from the real-time video image based on the area range of each target object, and the image types corresponding to the hand images and facial images are determined. The image types include facial images including the face of the target object, hand images including the hands of the target object, and full-body images (body posture images) of the target object.
[0049] 106. Based on the preset edge computing rules and image types, the image processing models corresponding to the image types are respectively called from the preset model database to perform behavior detection on the target object.
[0050] In this embodiment, two basic recognition models are used, namely the YOLO-v3 hand recognition algorithm and the face recognition model algorithm. This system uses the face recognition algorithm to extract various objects that may detect violations.
[0051] In the embodiment of the present invention, historical video images are obtained by extracting the collected video stream of the preset scene; the target object in the historical video image is identified, and the target object is annotated to obtain an annotated image containing the target object and save it as annotated data; a model training sample image is generated according to the annotated image, and the model training sample image is input into the YOLO model for training to obtain a facial recognition model; at least two frames of real-time video images containing the target object are obtained, and the real-time video images are input into the facial recognition model for identification and detection to determine whether there is any violation in the real-time video image. This solution improves the efficiency of supervision by using the image recognition model to identify, detect and warn the preset scene video data.
[0052] See also Figure 2 , a second embodiment of the behavior detection method in the embodiment of the present invention includes:
[0053] 201. Collect a video stream of a preset scene, extract historical video images from the video stream, and store the historical video images in an edge hardware device group of an edge computing platform;
[0054] 202. Delineate the regional range of the workstations in the historical video image, and extract the first workstation image corresponding to each workstation from the historical video image;
[0055] In this embodiment, there are generally two ways to annotate the training sample images, one is model annotation and the other is manual annotation. Since there is currently a lack of models that can accurately annotate workstations, this step uses manual annotation.
[0056] The training sample image is input into the preset image annotation software for display. In the present embodiment, Labelme software is preferably used as the image annotation software. Labelme software is an image annotation tool, which can be used to create customized annotation tasks or perform image annotation. In a manual manner, through an interactive device, the workstation in the image is selected using the first connected closed line. The interactive device then sends the position coordinates corresponding to the closed line to the server. The server delineates the workstation area in the training sample image according to the position coordinates, and obtains an image containing the range of the annotated workstation area, thereby realizing instance segmentation and annotation of the training sample image. The image containing the range of the annotated workstation area is the required annotation information.
[0057] 203. Input the first workstation image into a preset workstation recognition model to obtain a second workstation image;
[0058] In this embodiment, face recognition is performed on the obtained workstation image through a facial (human face) recognition model, the workstation image containing the target object is screened out, and the person (target object) in the workstation image is marked to obtain a second workstation image containing the target object.
[0059] 204. Perform instance segmentation and annotation on the second workstation image to obtain an annotated image containing the target object;
[0060] In this embodiment, instance segmentation annotation is one of the data annotation methods. Object detection or localization is a gradual process from coarse to fine for digital images. It not only provides the class of the image object, but also provides the location of the object in the classified image. The location is given in the form of a border or a center. Semantic segmentation gives better reasoning by predicting the label of each pixel in the input image. Each pixel is labeled according to the object class it belongs to. To go further, instance segmentation provides different labels for separate instances of objects belonging to the same class. Therefore, instance segmentation can be defined as a technique that solves both the object detection problem and the semantic segmentation problem.
[0061] In this embodiment, an image annotation tool can be used to create a customized annotation task or perform image annotation. In a manual manner, through an interactive device, a person in the image is selected using the first connected closed line. The interactive device then sends the position coordinates corresponding to the closed line to the server. The server delineates the target object area in the first workstation image based on the position coordinates, and obtains a second workstation image containing the range of the annotated target object area, thereby realizing instance segmentation and annotation of the second workstation image. The image containing the range of the annotated target object area is the required annotation information.
[0062] 205. Store the annotation information into a blank file of a preset format to obtain annotation data;
[0063] In this embodiment, the annotation information can be written into a blank file in a preset JSON format, wherein the JSON format is a lightweight data exchange format that is easy to parse and generate by machines and can effectively improve network transmission efficiency.
[0064] 206. Generate a model training sample image according to the labeled image, and input the model training sample image into a preset YOLO model for training to obtain a facial recognition model;
[0065] 207. Acquire at least two frames of real-time video images containing target objects, input the real-time video images into a facial recognition model to output face recognition results, and obtain the area range of each target object in the real-time video image according to the face recognition results;
[0066] 208. Extracting a hand image and a facial image corresponding to each target object from the real-time video image according to the area range of each target object, and determining the image type corresponding to the hand image and the facial image;
[0067] 209. Based on the preset edge computing rules and image types, the image processing models corresponding to the image types are respectively called from the preset model database to perform behavior detection on the target object.
[0068] Steps 201, 206-209 in this embodiment are similar to steps 101, 103-106 in the first embodiment, and are not described again here.
[0069] In the embodiment of the present invention, historical video images are obtained by extracting the collected video stream of the preset scene; the target object in the historical video image is identified, and the target object is annotated to obtain an annotated image containing the target object and save it as annotated data; a model training sample image is generated according to the annotated image, and the model training sample image is input into the YOLO model for training to obtain a facial recognition model; at least two frames of real-time video images containing the target object are obtained, and the real-time video images are input into the facial recognition model for identification and detection to determine whether there is any violation in the real-time video image. This solution improves the efficiency of supervision by using the image recognition model to identify, detect and warn the preset scene video data.
[0070] See also Figure 3 , a third embodiment of the behavior detection method in the embodiment of the present invention includes:
[0071] 301. Collect a video stream of a preset scene, extract historical video images from the video stream, and store the historical video images in an edge hardware device group of an edge computing platform;
[0072] 302. Identify a target object in a historical video image, and annotate the target object, obtain an annotated image containing the target object, and save it as annotated data;
[0073] 303. Input the training sample image into the feature extraction network of the YOLO model, and perform feature extraction on the training sample image through the feature extraction network to obtain a first feature image of the training sample image;
[0074] In this embodiment, there are many commonly used feature extraction networks, such as Resnett-101, and feature extraction is a member of the ResNet series of convolutional neural networks. ResNet, by adding an identical shortcut link, not only learns feature extraction, but also learns the loss between the previous layer of features and the next layer of features, that is, the residual, so that the stacking layer can learn new features based on the input features, thereby being able to extract more features. The depth of feature extraction is 101 layers, so the extracted features are more detailed and more accurate in instance segmentation.
[0075] After the training sample image is input into the feature extraction network, the feature extraction network will extract the features through convolution to obtain the first feature map. Since the image is composed of pixels, and each pixel can be represented by a numerical value, such as an RGB type image, it can be represented by three numerical values of the three channels R, G, and B, so it can be represented as a 3xaxb mathematical matrix. The essence of feature extraction is to use a convolution kernel of a certain size, such as cxd, to convolve the numerical value of each pixel. Therefore, the first feature map can also be represented by an mxk matrix.
[0076] 304. Input the first feature image into the RPN network of the YOLO model, and obtain preset anchor frame information;
[0077] In this embodiment, sliding windows are used for target recognition in the past, but one window can only detect one target and there is a multi-size problem. Therefore, anchor boxes are proposed. Anchor box information is pre-set, such as the number of anchor boxes is 9, including nine specifications such as 3x1 and 3x2.
[0078] Object detection algorithms usually sample a large number of regions in the input image, then determine whether these regions contain the object of interest, and adjust the region edges to more accurately predict the ground-truth bounding box of the object. Different models may use different region sampling methods. Here we introduce one of the methods: it generates multiple bounding boxes of different sizes and aspect ratios centered on each pixel. These bounding boxes are called anchor boxes. 305. Generate an anchor box for the first feature image based on the anchor box information;
[0079] 305. Generate an anchor frame of the first feature image according to the anchor frame information;
[0080] In this embodiment, since the first feature map obtained after convolution can be represented by an mxk matrix, 9 corresponding anchor frames can be generated for each value in the matrix according to the anchor frame information, and the specifications are 3x1, 3x2 and other nine specifications.
[0081] 306. Determine whether there is a target object in the anchor frame according to the first classifier;
[0082] In this embodiment, the RPN network includes a first classifier, and this embodiment preferably uses softmax as the first classifier for judgment. Softmax is also called the normalized exponential function, which is obtained by normalizing the gradient logarithm of the wired discrete probability distribution to obtain the corresponding probability value. The score of each anchor frame containing the target object is calculated and normalized to obtain the probability that it contains the target object. If the probability is greater than the preset threshold, it is determined that the target object exists. If it is less than, it is determined that the anchor frame does not have the target object.
[0083] 307. When it is determined whether the target object exists in the anchor frame, a bounding box regression is performed on the anchor frame to obtain a prediction box corresponding to the first feature image;
[0084] In this embodiment, bounding box regression refers to the process of approximating the candidate box generated during the target detection process with the marked real box as the target. Since the box on an image can be uniquely determined by the center point coordinates (Xc, Yc) and the width W and height H, this approximation process can be modeled as a regression problem. By performing bounding box regression on the candidate box, the final detected target positioning can be made closer to the true value, thereby improving the positioning accuracy.
[0085] Furthermore, bounding box regression, also called BB regression, refers to fine-tuning the position of the retained anchor box through regression analysis. The classifier can filter out the anchor box containing the target object, but since the size of the anchor box is fixed by the preset anchor box information, it may not accurately contain the target object, so it needs to be fine-tuned.
[0086] The commonly used fine-tuning methods are translation and resizing. Since both methods can be completed through simple linear mapping, the linear transformation formula can be set in advance and then learned through training. If there is a target object in the anchor frame, the anchor frame containing the target object is retained, and the retained anchor frame is fine-tuned through bounding box regression to obtain the pre-selected frame corresponding to the first feature map.
[0087] 308. Input the first feature image and the prediction box into the ROI Align layer of the YOLO model, and fuse the prediction box and the first feature image through the ROI Align layer to obtain a second feature image including the prediction box;
[0088] In this embodiment, ROI Align is a regional feature aggregation method. Since the grid size required by the subsequent network is generally smaller than the feature map, two quantizations are used in the ROI Pooling layer, so there may be decimal points in their positions, and the number of values in the feature map is an integer, so the rounding method is used for matching. However, this match is not completely consistent, so there is a mismatch phenomenon. ROI Align can solve this problem.
[0089] First, traverse the area corresponding to each pre-selected box in the first feature map, keep the floating point boundary unquantized, then divide the area into kxk units, and finally calculate four fixed position coordinates in each unit, use bilinear interpolation to calculate the values of these four positions, and then perform the maximum pooling operation. In this way, the second feature image containing the pre-selected box is obtained.
[0090] 309. Input the second feature image into the classification network of the YOLO model, and generate a prediction result corresponding to the second feature image through the classification network;
[0091] In this embodiment, the second feature map is input into the fully connected layer to obtain the target vector corresponding to the second feature map through the fully connected layer, wherein the classification network includes the fully connected layer and the second classifier. Each node in the fully connected layer (FC) is connected to all nodes in the previous layer, thereby integrating all the features extracted previously.
[0092] In this embodiment, the fully connected layer is a one-dimensional vector. All the previous feature extractions are integrated, and then an activation function is added for nonlinear mapping, so that all features are mapped to this one-dimensional vector to obtain the target vector corresponding to the second feature map.
[0093] In this embodiment, the preferred second classifier is a softmax classifier. After obtaining the target vector, the probability value of each pre-selected box containing the target object or not containing the target object is obtained through the softmax classifier. If the probability value of containing the target object is greater than the preset threshold value of containing the target object, it is determined that the pre-selected box contains the target object. Then the area range corresponding to the prediction box is used as the prediction area where the target object exists, and the prediction area is output as the prediction result.
[0094] 310. According to the prediction results and the labeled data, the parameters of the YOLO model are adjusted until the YOLO model converges to obtain a facial recognition model;
[0095] In this embodiment, the YOLO algorithm model draws on the GoogLeNet algorithm network structure. First, the input image is divided into several grids, and each grid is responsible for detecting the target object whose center position coordinates are located in the grid, including predicting the bounding box information containing the target object and the probability information of the target object category. Therefore, as long as the input image is detected once, the position of all objects in the image and the probability of their category will be obtained. Since each grid can only predict two border information and one object category, it will cause the accuracy of detection between adjacent targets to decrease. The detection speed of the basic version of the YOLO algorithm can reach 45FPS real-time detection, and the detection speed of the fast version can be as high as 155FPS, and the background error rate is low.
[0096] Compared with other target detection and recognition methods that divide target detection into multiple processes such as region prediction and category prediction, YOLO integrates region prediction and category prediction in one network to improve the detection rate. The network structure of YOLO is similar to Google Net. The convolution layer in the network is used for feature extraction, and the fully connected layer is used to output the category score and the location of the target. The network system can read images of any size and feed them back to the network.
[0097] In this embodiment, YOLO divides the input image into grids, and each grid predicts whether the center position coordinates of an object fall within the grid. If the center position coordinates of an object fall within a grid, then the grid is responsible for identifying the object.
[0098] Through back propagation, the loss value is passed back to the YOLO model, and the parameters of each network are adjusted according to the stochastic gradient descent method. If the YOLO model converges, the YOLO model at this time is used as the image recognition model.
[0099] 311. Acquire at least two frames of real-time video images containing target objects, input the real-time video images into a facial recognition model to output face recognition results, and obtain the area range of each target object in the real-time video image according to the face recognition results;
[0100] 312. Extracting a hand image and a facial image corresponding to each target object from the real-time video image according to the area range of each target object, and determining the image type corresponding to the hand image and the facial image;
[0101] 313. Based on the preset edge computing rules and image types, the image processing models corresponding to the image types are called from the preset model database to perform behavior detection on the target object.
[0102] Steps 301 - 302 and 311 - 313 in this embodiment are similar to steps 101 - 102 and 104 - 106 in the first embodiment, and are not described again here.
[0103] In the embodiment of the present invention, historical video images are obtained by extracting the collected video stream of the preset scene; the target object in the historical video image is identified, and the target object is annotated to obtain an annotated image containing the target object and save it as annotated data; a model training sample image is generated according to the annotated image, and the model training sample image is input into the YOLO model for training to obtain a facial recognition model; at least two frames of real-time video images containing the target object are obtained, and the real-time video images are input into the facial recognition model for identification and detection to determine whether there is any violation in the real-time video image. This solution improves the efficiency of supervision by using the image recognition model to identify, detect and warn the preset scene video data.
[0104] See also Figure 4 , a fourth embodiment of the behavior detection method in the embodiment of the present invention includes:
[0105] 401. Collect a video stream of a preset scene, extract historical video images from the video stream, and store the historical video images in an edge hardware device group of an edge computing platform;
[0106] 402. Identify a target object in a historical video image, and annotate the target object, obtain an annotated image containing the target object, and save it as annotated data;
[0107] 403. Generate a model training sample image according to the labeled image, and input the model training sample image into a preset YOLO model for training to obtain a facial recognition model;
[0108] 404. Acquire at least two frames of real-time video images containing target objects, input the real-time video images into a facial recognition model to output face recognition results, and obtain the area range of each target object in the real-time video image according to the face recognition results;
[0109] 405. Extracting a hand image and a facial image corresponding to each target object from the real-time video image according to the area range of each target object;
[0110] In this embodiment, the area range of each person in the second workstation image is cropped out from the second workstation image, so as to extract the target object behavior image corresponding to each target object in the corresponding preset scene.
[0111] 406. Recognize the hand image and the facial image respectively, and determine the image types of the hand image and the facial image according to the recognition results;
[0112] In this embodiment, the collected behavior images are identified to determine the image type corresponding to the target object in each image. The image types here mainly include facial images, hand images and body postures.
[0113] 407. Based on the preset edge computing rules and image types, image processing models corresponding to the image types are respectively called from the preset model database to perform behavior detection on the target object.
[0114] Steps 401-404 and 407 in this embodiment are similar to steps 101-106 in the first embodiment and are not described again here.
[0115] In the embodiment of the present invention, historical video images are obtained by extracting the collected video stream of the preset scene; the target object in the historical video image is identified, and the target object is annotated to obtain an annotated image containing the target object and save it as annotated data; a model training sample image is generated according to the annotated image, and the model training sample image is input into the YOLO model for training to obtain a facial recognition model; at least two frames of real-time video images containing the target object are obtained, and the real-time video images are input into the facial recognition model for identification and detection to determine whether there is any violation in the real-time video image. This solution improves the efficiency of supervision by using the image recognition model to identify, detect and warn the preset scene video data.
[0116] See also Figure 5 , a fifth embodiment of the behavior detection method in the embodiment of the present invention includes:
[0117] 501. Collect a video stream of a preset scene, extract historical video images from the video stream, and store the historical video images in an edge hardware device group of an edge computing platform;
[0118] 502. Identify a target object in a historical video image, and mark the target object, obtain a marked image containing the target object, and save it as marked data;
[0119] 503. Generate a model training sample image according to the labeled image, and input the model training sample image into a preset YOLO model for training to obtain a facial recognition model;
[0120] 504. Acquire at least two frames of real-time video images containing target objects, input the real-time video images into a facial recognition model to output face recognition results, and obtain the area range of each target object in the real-time video image according to the face recognition results;
[0121] 505. Extracting a hand image and a facial image corresponding to each target object from the real-time video image according to the area range of each target object, and determining the image type corresponding to the hand image and the facial image;
[0122] 506. Filter out all first images containing hands and all second images containing faces from the real-time video image according to the image type;
[0123] In this embodiment, the real-time video image is recognized by the image recognition model, and the facial image, hand image and the whole body posture image of the person in the image can be obtained. According to the different types of these images, all real-time video images are classified to obtain all hand images containing hands and all facial images containing faces, as well as the whole body posture image of the person in the image. Further, according to the difference of the image, the image processing model corresponding to the image type is called to perform behavior detection and recognition on the image.
[0124] 507. Input the first image into a preset hand detection model, and recognize the first image using the hand detection model to obtain a recognition result;
[0125] In this embodiment, a resnet-32 consisting of 31 convolutional layers, 1 pooling layer and 2 fully connected layers is used as a hand recognition model (Hand). The hand image is input into the hand recognition model (Hand). The bounding box of this model displays the upper left corner coordinates with x1, y1, and the lower right corner coordinates with x2, y2. The specific formula is:
[0126] BBox Hk =(x1,y1,x2,y2)
[0127] 508. Input the second image into a preset facial recognition model, and parse the blocks and video frames in the second image through the facial recognition model;
[0128] In this embodiment, when the image type is a facial image, the facial recognition model is called from the preset model library. Among them, the facial recognition model (Faced) provides recognition result data for the target object of the video data in the preset scene, which is divided into 17 convolutional layers, 1 pooling layer and 2 fully connected layers. The facial recognition algorithm will locate the center point Cx, Cy of the part of interest, and the width and height w, h of the bounding box:
[0129] BBox Fk = (c x , c y , w, h)
[0130] 509. Based on the preset edge computing rules and the recognition results, the blocks and the video frames, edge computing is performed on the first image and the second image, and behavior detection is performed on the target object according to the computing results;
[0131] In this embodiment, the algorithm will first identify the hand posture, and the model will match the hand posture with the sleeping posture and return the confidence value; then, the facial recognition model will be matched with the sleeping posture. If the hand recognition confidence reaches the threshold, the model will assign a value for not recognizing the face (the face is generally not recognized when sleeping on the table), and the final results of the two annotations will be weighted, and the target object will be subjected to behavioral detection based on the calculation results.
[0132] 510. When the behavior detection result of the target object is abnormal, an alarm message is triggered to the preset monitoring center and a monitoring report is generated;
[0133] In this embodiment, in the administrator's port, if it is displayed that no abnormal behavior of the target object is detected and a green frame is displayed, it means that the target object in the preset scene has no illegal behavior. If the object is displayed with a red frame, it means that illegal behavior is detected, and the illegal behavior will be marked outside the frame, which can be one or more, and trigger an alarm information to the preset monitoring center to generate a monitoring report.
[0134] 511. Remind the target object based on the monitoring report.
[0135] In this embodiment, when the system detects a violation, it will trigger a warning box and mark the violator, prompting the manager to dissuade the violator. In addition, since all devices in the preset scenes are part of the edge computing device, the system can directly pop up a prompt on the specific device in the scene where the violation is detected to remind the target object.
[0136] Steps 501-504 and 509 in this embodiment are similar to steps 101-104 and 106 in the first embodiment and are not described again here.
[0137] In an embodiment of the present invention, historical video images are obtained by extracting the collected video stream of the preset scene; the target object in the historical video image is identified, and the target object is annotated to obtain an annotated image containing the target object and save it as annotated data; a model training sample image is generated according to the annotated image, and the model training sample image is input into the YOLO model for training to obtain a facial recognition model; at least two frames of real-time video images containing the target object are obtained, and the real-time video images are input into the facial recognition model for identification and detection to determine whether there is any violation in the real-time video image. This solution improves the efficiency of supervision by using the image recognition model to identify, detect and warn the preset scene video data.
[0138] The above describes the behavior detection method in the embodiment of the present invention. The following describes the behavior detection device in the embodiment of the present invention. Figure 6 , a first embodiment of the behavior detection device in the embodiment of the present invention includes:
[0139] The acquisition module 601 is used to acquire a video stream of a preset scene, extract historical video images in the video stream, and store the historical video images in an edge hardware device group of an edge computing platform, wherein the video stream includes at least two frames of historical video images containing a target object;
[0140] The marking module 602 is used to identify the target object in the historical video image, mark the target object, obtain the marked image containing the target object and save it as marked data;
[0141] A training module 603 is used to generate a model training sample image according to the annotated image, and input the model training sample image into a preset YOLO model for training to obtain a facial recognition model;
[0142] The recognition module 604 is used to obtain at least two frames of real-time video images containing target objects, input the real-time video images into the face recognition model to output face recognition results, and obtain the area range of each target object in the real-time video image according to the face recognition results;
[0143] A first determination module 605 is used to extract the hand image and the facial image corresponding to each target object from the real-time video image according to the area range of each target object, and determine the image type corresponding to the hand image and the facial image;
[0144] The detection module 606 is used to call the image processing model corresponding to the image type from the preset model database to perform behavior detection on the target object based on the preset edge computing rules and the image type.
[0145] In the embodiment of the present invention, historical video images are obtained by extracting the collected video stream of the preset scene; the target object in the historical video image is identified, and the target object is annotated to obtain an annotated image containing the target object and save it as annotated data; a model training sample image is generated according to the annotated image, and the model training sample image is input into the YOLO model for training to obtain a facial recognition model; at least two frames of real-time video images containing the target object are obtained, and the real-time video images are input into the facial recognition model for identification and detection to determine whether there is any violation in the real-time video image. This solution improves the efficiency of supervision by using the image recognition model to identify, detect and warn the preset scene video data.
[0146] See also Figure 7 , a second embodiment of the behavior detection device in the embodiment of the present invention, the behavior detection device specifically comprises:
[0147] The acquisition module 601 is used to acquire a video stream of a preset scene, extract historical video images in the video stream, and store the historical video images in an edge hardware device group of an edge computing platform, wherein the video stream includes at least two frames of historical video images containing a target object;
[0148] The marking module 602 is used to identify the target object in the historical video image, mark the target object, obtain the marked image containing the target object and save it as marked data;
[0149] A training module 603 is used to generate a model training sample image according to the annotated image, and input the model training sample image into a preset YOLO model for training to obtain a facial recognition model;
[0150] The recognition module 604 is used to obtain at least two frames of real-time video images containing target objects, input the real-time video images into the face recognition model to output face recognition results, and obtain the area range of each target object in the real-time video image according to the face recognition results;
[0151] A first determination module 605 is used to extract the hand image and the facial image corresponding to each target object from the real-time video image according to the area range of each target object, and determine the image type corresponding to the hand image and the facial image;
[0152] The detection module 606 is used to call the image processing model corresponding to the image type from the preset model database to perform behavior detection on the target object based on the preset edge computing rules and the image type.
[0153] In this embodiment, the marking module 602 is specifically used for:
[0154] Delimiting the area of the workstations in the historical video image, and extracting the first workstation image corresponding to each workstation from the historical video image;
[0155] Inputting the first workstation image into a preset facial recognition model to obtain a second workstation image containing the target object;
[0156] Perform instance segmentation and annotation on the second workstation image to obtain corresponding annotation information; store the annotation information in a blank file in a preset format to obtain annotation data.
[0157] In this embodiment, the training module 603 includes:
[0158] A feature extraction unit 6031 is used to input the training sample image into the feature extraction network, and perform feature extraction on the training sample image through the feature extraction network to obtain a first feature image of the training sample image;
[0159] A prediction unit 6032 is used to input the first feature image into the RPN network, and predict the first feature image through the RPN network to generate a prediction box corresponding to the first feature image;
[0160] A fusion unit 6033 is used to input the first feature image and the prediction box into the ROI Align layer, and fuse the prediction box and the first feature image through the ROI Align layer to obtain a second feature image including the prediction box;
[0161] A classification unit 6034, configured to input the second feature image into the classification network, and generate a prediction result corresponding to the second feature image through the classification network;
[0162] The adjustment unit 6035 is used to adjust the parameters of the YOLO model according to the prediction result and the labeled data until the YOLO model converges to obtain the image recognition model.
[0163] In this embodiment, the prediction unit 6032 is specifically used for:
[0164] Inputting the first feature image into the RPN network and obtaining preset anchor frame information; generating an anchor frame of the first feature image according to the anchor frame information;
[0165] Determine whether a target object exists in the anchor frame according to the first classifier;
[0166] If so, perform border regression on the anchor frame to obtain a predicted frame corresponding to the first feature image.
[0167] In this embodiment, the first determining module 605 is specifically used for:
[0168] Extracting a hand image and a facial image corresponding to each target object from the real-time video image according to the area range of each target object;
[0169] The hand image and the facial image are recognized respectively, and the image types of the hand image and the facial image are determined according to the recognition results.
[0170] In this embodiment, the detection module 606 further includes:
[0171] According to the image type, all first images containing hands and all second images containing faces are screened out from the real-time video image;
[0172] Inputting the first image into a preset hand detection model, and using the hand detection model to respectively recognize the first image to obtain a recognition result;
[0173] Inputting the second image into a preset facial recognition model, and parsing blocks and video frames in the second image by using the facial recognition model;
[0174] Based on preset edge computing rules and the recognition result, the block and the video frame, edge computing is performed on the first image and the second image, and behavior detection is performed on the target object according to the computing result.
[0175] In this embodiment, the behavior detection device further includes:
[0176] A generating module 607 is used to trigger an alarm message to a preset monitoring center and generate a monitoring report if the behavior detection result of the target object is abnormal;
[0177] The second determining module 608 is configured to remind the target object according to the monitoring report.
[0178] In the embodiment of the present invention, historical video images are obtained by extracting the collected video stream of the preset scene; the target object in the historical video image is identified, and the target object is annotated to obtain an annotated image containing the target object and save it as annotated data; a model training sample image is generated according to the annotated image, and the model training sample image is input into the YOLO model for training to obtain a facial recognition model; at least two frames of real-time video images containing the target object are obtained, and the real-time video images are input into the facial recognition model for identification and detection to determine whether there is any violation in the real-time video image. This solution improves the efficiency of supervision by using the image recognition model to identify, detect and warn the preset scene video data.
[0179] above Figure 6 and Figure 7 The behavior detection device in the embodiment of the present invention is described in detail from the perspective of modular functional entities. The behavior detection device in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0180] Figure 88 is a structural diagram of a behavior detection device provided by an embodiment of the present invention. The behavior detection device 800 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 810 (for example, one or more processors) and a memory 820, and one or more storage media 830 (for example, one or more mass storage devices) storing application programs 833 or data 832. Among them, the memory 820 and the storage medium 830 can be short-term storage or permanent storage. The program stored in the storage medium 830 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the behavior detection device 800. Furthermore, the processor 810 may be configured to communicate with the storage medium 830, and execute a series of instruction operations in the storage medium 830 on the behavior detection device 800 to implement the steps of the behavior detection method provided in the above-mentioned method embodiments.
[0181] The behavior detection device 800 may also include one or more power supplies 840, one or more wired or wireless network interfaces 850, one or more input and output interfaces 860, and / or one or more operating systems 831, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. It will be appreciated by those skilled in the art that Figure 8 The structure of the behavior detection device shown does not constitute a limitation on the behavior detection device provided in the present application, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0182] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the above-mentioned behavior detection method.
[0183] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0184] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0185] It should be further explained that the privacy data such as video images, faces, etc. used in this application are obtained with the authorization of the identified user, and the technical solutions provided by this application are implemented legally.
[0186] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A behavior detection method, characterized in that: The behavior detection method comprises: Collecting a video stream of a preset scene, extracting historical video images from the video stream, and storing the historical video images in an edge hardware device group of an edge computing platform, wherein the video stream includes at least two frames of historical video images containing a target object; Identify the target object in the historical video image, and mark the target object to obtain a marked image containing the target object and save it as marked data; Generate a model training sample image according to the labeled image, and input the model training sample image into a preset YOLO model for training to obtain a facial recognition model; Acquire at least two frames of real-time video images containing target objects, input the real-time video images into the facial recognition model to output face recognition results, and obtain the area range of each target object in the real-time video image according to the face recognition results; Extracting a hand image and a facial image corresponding to each target object from the real-time video image according to the area range of each target object, and determining the image type corresponding to the hand image and the facial image; Based on the preset edge computing rules and the image type, respectively calling the image processing model corresponding to the image type from the preset model database to perform behavior detection on the target object; The performing behavior detection on the target object by calling the image processing model corresponding to the image type from the preset model database based on the preset edge computing rule and the image type comprises: According to the image type, all first images containing hands and all second images containing faces are screened out from the real-time video image; Inputting the first image into a preset hand detection model, and using the hand detection model to respectively recognize the first image to obtain a recognition result, wherein the recognition result includes a hand recognition confidence; Inputting the second image into a preset facial recognition model, and parsing blocks and video frames in the second image by using the facial recognition model; Based on a preset edge computing rule and the recognition result, the block and the video frame, edge computing is performed on the first image and the second image, and behavior detection is performed on the target object according to the computing result; The performing edge computing on the first image and the second image based on the preset edge computing rule and the recognition result, the block and the video frame includes: If the hand recognition confidence reaches a threshold, a value is assigned to the face that is not recognized, and the hand recognition confidence and the value assignment result of the face that is not recognized are weighted to obtain a calculation result.
2. The behavior detection method according to claim 1, characterized in that: The step of identifying the target object in the historical video image, annotating the target object, obtaining an annotated image containing the target object, and saving the image as annotated data includes: Delimiting the area of the workstations in the historical video image, and extracting the first workstation image corresponding to each workstation from the video image; Inputting the first workstation image into a preset workstation recognition model to obtain a second workstation image; Performing instance segmentation and annotation on the second workstation image to obtain an annotated image containing the target object; The annotated image is stored in a blank file of a preset format to obtain annotated data.
3. The behavior detection method according to claim 1, characterized in that: Generating a model training sample image according to the labeled image, and inputting the model training sample image into a preset YOLO model for training to obtain a facial recognition model comprises: Inputting the training sample image into the feature extraction network of the YOLO model, and performing feature extraction on the training sample image through the feature extraction network to obtain a first feature image of the training sample image; Inputting the first feature image into the RPN network of the YOLO model, and predicting the first feature image through the RPN network to generate a prediction box corresponding to the first feature image; Inputting the first feature image and the prediction box into the ROI Align layer of the YOLO model, and fusing the prediction box and the first feature image through the ROIAlign layer to obtain a second feature image including the prediction box; Inputting the second feature image into the classification network of the YOLO model, and generating a prediction result corresponding to the second feature image through the classification network; According to the prediction result and the labeled data, the parameters of the YOLO model are adjusted until the YOLO model converges to obtain a facial recognition model.
4. The behavior detection method according to claim 3, characterized in that: The RPN network includes a first classifier, and the inputting the first feature image into the RPN network of the YOLO model, and predicting the first feature image through the RPN network, and generating a prediction box corresponding to the first feature image includes: Input the first feature image into the RPN network of the YOLO model, and obtain preset anchor frame information; generating an anchor frame of the first feature image according to the anchor frame information; Determine whether a target object exists in the anchor frame according to the first classifier; If so, perform border regression on the anchor frame to obtain a predicted frame corresponding to the first feature image.
5. The behavior detection method according to claim 1, characterized in that: The step of extracting a hand image and a facial image corresponding to each target object from the real-time video image according to the area range of each target object, and determining the image type corresponding to the hand image and the facial image comprises: Extracting a hand image and a facial image corresponding to each target object from the real-time video image according to the area range of each target object; The hand image and the facial image are recognized respectively, and the image types of the hand image and the facial image are determined according to the recognition results.
6. The behavior detection method according to claim 1, characterized in that: After performing edge computing on the first image and the second image based on the preset edge computing rule and the recognition result, the block and the video frame, and performing behavior detection on the target object according to the computing result, the method further includes: If the behavior detection result of the target object is abnormal, an alarm message is triggered to the preset monitoring center and a monitoring report is generated; The target object is reminded according to the monitoring report.
7. A behavior detection device, characterized in that: The behavior detection device comprises: A collection module, used to collect a video stream of a preset scene, extract historical video images from the video stream, and store the historical video images in an edge hardware device group of an edge computing platform, wherein the video stream includes at least two frames of historical video images containing a target object; A labeling module, used for identifying a target object in the historical video image, labeling the target object, obtaining a labeled image containing the target object and saving it as labeling data; A training module, used to generate a model training sample image according to the annotated image, and input the model training sample image into a preset YOLO model for training to obtain a facial recognition model; A recognition module, used to obtain at least two frames of real-time video images containing target objects, input the real-time video images into the facial recognition model to output face recognition results, and obtain the area range of each target object in the real-time video image according to the face recognition results; A first determination module is used to extract a hand image and a facial image corresponding to each target object from the real-time video image according to the area range of each target object, and determine the image type corresponding to the hand image and the facial image; A detection module, configured to call an image processing model corresponding to the image type from a preset model database to perform behavior detection on the target object based on a preset edge computing rule and the image type; The detection module also includes: according to the image type, filtering out all first images containing hands and all second images containing faces from the real-time video image; inputting the first image into a preset hand detection model, and respectively identifying the first image through the hand detection model to obtain a recognition result; inputting the second image into a preset facial recognition model, and parsing the blocks and video frames in the second image through the facial recognition model; performing edge computing on the first image and the second image based on a preset edge computing rule and the recognition result, the block and the video frame, and performing behavior detection on the target object according to the computing result; The performing edge computing on the first image and the second image based on the preset edge computing rule and the recognition result, the block and the video frame includes: If the hand recognition confidence reaches a threshold, a value is assigned to the unrecognized face, and the hand recognition confidence and the assigned value are weighted to obtain a calculation result.
8. The behavior detection device according to claim 7, characterized in that: The labeling module is specifically used to: circle the area range of the workstations in the historical video image, and extract the first workstation image corresponding to each workstation from the historical video image; input the first workstation image into a preset workstation recognition model to obtain a second workstation image; perform instance segmentation and labeling on the second workstation image to obtain a labeled image containing a target object; store the labeled image in a blank file in a preset format to obtain labeled data.
9. A behavior detection device, characterized in that: The behavior detection device comprises: a memory and at least one processor, the memory stores instructions, and the memory and the at least one processor are interconnected via a line; The at least one processor calls the instructions in the memory to enable the behavior detection device to perform the steps of the behavior detection method according to any one of claims 1 to 6.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the behavior detection method according to any one of claims 1 to 6 are implemented.
