Warehouse personnel behavior recognition method, device, computer equipment, and storage medium
By using the personnel detection model and abnormal behavior recognition model in the warehouse environment, identifying and cropping images, the problem of low accuracy of abnormal behavior recognition of warehouse personnel in the existing technology is solved, and higher recognition accuracy and applicability are achieved, and enhanced Cargo safety management in warehouses.
Patent Information
- Application Number
- CN202111375436.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-19
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2041-11-19
AI Technical Summary
When identifying abnormal behaviors of people in warehouse environments, the prior art has low accuracy and poor applicability, making it difficult to effectively detect abnormal behaviors of people carrying goods.
A warehouse personnel behavior recognition method is adopted to detect images through personnel detection models, and crop images based on detection results. The abnormal behavior recognition model processes the cropped images to identify personnel's abnormal behavior. The model improves the accuracy of recognition based on the first type of training samples containing objects and personnel and the second type of training samples containing personnel.
It improves the accuracy of identifying abnormal behaviors of personnel in the warehouse, can more effectively detect abnormal behaviors of personnel carrying goods, and enhances the safety management of goods in the warehouse.
Smart Images

Figure CN114241354B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer vision technology, and in particular to a method, device, computer equipment, and storage medium for identifying warehouse personnel behavior. Background Art
[0002] Object detection and image recognition are two basic tasks in machine vision, which have a wide range of applications. Image recognition refers to the technology of using computers to process, analyze and understand images to identify targets and objects of various patterns. Object detection refers to extracting the target of interest from an image or video.
[0003] The abnormal behavior recognition of people carrying goods is in the cold chain warehouse environment of financial pledge. Pledged goods are not allowed to be brought in or taken out by people, and goods are only allowed to enter and exit the warehouse by forklift. At present, there is no relevant research on the abnormal behavior recognition of people carrying goods. The abnormal behavior detection of people based on topological relationships judges abnormal behavior based on the coordinate relationship between specific targets and human body areas. Without depth information, it is difficult to accurately judge that specific targets are near the human body area.
[0004] Traditional anomaly detection methods are usually applied to relatively static time series data. If more subtle anomalies need to be detected, traditional methods are difficult to apply. Current warehouse abnormal behavior identification methods have problems such as low accuracy and poor applicability. Summary of the invention
[0005] Based on this, it is necessary to provide a warehouse personnel behavior recognition method, device, computer equipment, computer-readable storage medium and computer program product that can improve the accuracy of identifying abnormal behavior of personnel in the warehouse in response to the above technical problems.
[0006] In a first aspect, the present application provides a method for identifying warehouse personnel behavior. The method comprises:
[0007] Performing person detection on the first image using a person detection model;
[0008] If a person is detected in the first image, the position of the person in the first image is obtained, and the first image is cropped according to the position of the person in the first image to obtain a second image;
[0009] The second image is processed by an abnormal behavior recognition model to obtain an abnormal behavior recognition result, wherein the abnormal behavior recognition model is trained based on a first type of training samples including objects and persons and a second type of training samples including persons.
[0010] In one embodiment, the training method of the person detection model includes:
[0011] Obtain a first training set, the first training set includes multiple training samples, each training sample includes a training image and annotation information, and the annotation information is used to represent the position information of the person in the training image;
[0012] Input a training sample in the first training set into the initial detection model to obtain a person detection result corresponding to the training sample;
[0013] Calculate the error loss based on the annotation information in a training sample and the corresponding person detection result, and adjust the network parameter weights of the initial detection model based on the error loss;
[0014] The initial detection model with adjusted network parameter weights is further trained using the training samples in the first training set to obtain a personnel detection model.
[0015] In one embodiment, the training method of the abnormal behavior recognition model includes:
[0016] Obtain a second training set, the second training set includes a first type of training samples including objects and people and a second type of training samples including people, each of the first type of training samples and the second type of training samples includes a training image and a behavior label, the behavior label is used to characterize the type of person behavior in the training image; the person behavior type includes acting on the object and not acting on the object;
[0017] Input a training sample from the second training set into the initial recognition model to obtain a human behavior recognition result corresponding to the training sample;
[0018] Calculate the loss function based on the behavior label in a training sample and the corresponding person behavior recognition result, and adjust the network parameter weights of the initial recognition model based on the loss function;
[0019] The training samples in the second training set are used to continue training the initial recognition model with adjusted network parameter weights to obtain an abnormal behavior recognition model.
[0020] In one embodiment, before performing person detection on the first image using a person detection model, the method further includes:
[0021] Video data is collected through cameras, which are placed just above the warehouse gate;
[0022] The video data is sampled at a preset time interval to obtain a frame of image, and the frame of image is used as the first image.
[0023] In one embodiment, after performing person detection on the first image using a person detection model, the method further includes:
[0024] If the person cannot be detected by the person detection model, a first prompt information is generated, and the first prompt information is used to indicate that the person is not detected;
[0025] After the abnormal behavior recognition model is used to process the second image to obtain an abnormal behavior recognition result, the method further includes:
[0026] If the abnormal behavior recognition result is that abnormal behavior exists, a second prompt information is generated, and the second prompt information is used to indicate that a person is detected and the person's behavior is abnormal;
[0027] If the abnormal behavior identification result is that there is no abnormal behavior, a third prompt information is generated, and the third prompt information is used to represent that a person is detected but the person's behavior is not abnormal.
[0028] In one embodiment, cropping the first image according to the position of the person in the first image to obtain the second image includes:
[0029] Acquire an initial cropping area according to the position of the person in the first image;
[0030] Adjust the initial cropping area according to the preset pixel size to obtain the cropping area;
[0031] A second image is obtained from the first image according to the cropping area.
[0032] In a second aspect, the present application also provides a device for identifying the behavior of warehouse personnel. The device comprises:
[0033] A person detection module, used to perform person detection on the first image using a person detection model;
[0034] An image cropping module, configured to obtain a position of the person in the first image if a person is detected in the first image, and crop the first image according to the position of the person in the first image to obtain a second image;
[0035] The behavior recognition module is used to process the second image through an abnormal behavior recognition model to obtain an abnormal behavior recognition result, where the abnormal behavior recognition model is trained based on a first type of training samples including objects and people and a second type of training samples including people.
[0036] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0037] Performing person detection on the first image using a person detection model;
[0038] If a person is detected in the first image, the position of the person in the first image is obtained, and the first image is cropped according to the position of the person in the first image to obtain a second image;
[0039] The second image is processed by an abnormal behavior recognition model to obtain an abnormal behavior recognition result, wherein the abnormal behavior recognition model is trained based on a first type of training samples including objects and persons and a second type of training samples including persons.
[0040] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0041] Performing person detection on the first image using a person detection model;
[0042] If a person is detected in the first image, the position of the person in the first image is obtained, and the first image is cropped according to the position of the person in the first image to obtain a second image;
[0043] The second image is processed by an abnormal behavior recognition model to obtain an abnormal behavior recognition result, wherein the abnormal behavior recognition model is trained based on a first type of training samples including objects and persons and a second type of training samples including persons.
[0044] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0045] Performing person detection on the first image using a person detection model;
[0046] If a person is detected in the first image, the position of the person in the first image is obtained, and the first image is cropped according to the position of the person in the first image to obtain a second image;
[0047] The second image is processed by an abnormal behavior recognition model to obtain an abnormal behavior recognition result, wherein the abnormal behavior recognition model is trained based on a first type of training samples including objects and persons and a second type of training samples including persons.
[0048] The above-mentioned warehouse personnel behavior recognition method, device, computer equipment, storage medium and computer program product detect personnel in the first image through the personnel detection model; if a person is detected in the first image, the position of the person in the first image is obtained, and the first image is cropped according to the position of the person in the first image to obtain a second image; the second image is processed through the abnormal behavior recognition model to obtain an abnormal behavior recognition result, and the abnormal behavior recognition model is trained based on the first type of training samples containing objects and personnel and the second type of training samples containing personnel. It can improve the accuracy of abnormal behavior recognition of personnel in the warehouse. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 A flowchart of a method for identifying warehouse personnel behavior in one embodiment;
[0050] Figure 2 A schematic diagram of a process of obtaining a second image in one embodiment;
[0051] Figure 3 A flowchart of a method for identifying warehouse personnel behavior in one embodiment;
[0052] Figure 4 A schematic diagram of a result of a personnel test in one embodiment;
[0053] Figure 5 A schematic diagram of a behavior recognition result in one embodiment;
[0054] Figure 6 is a structural block diagram of a warehouse personnel behavior recognition device in one embodiment;
[0055] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0057] In one embodiment, Figure 1 As shown, a method for identifying warehouse personnel behavior is provided. This embodiment uses the method applied to a terminal as an example. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0058] Step 102: Perform person detection on the first image using a person detection model.
[0059] Among them, the personnel detection model is a network model trained with a preset training set. For example, the yolov5 network model trained with the preset training set is used as the personnel detection model. The personnel detection model can detect the position of a person from an image.
[0060] Specifically, the surveillance image in the warehouse is taken as the first image, and the first image is input into the personnel detection model. The personnel detection model performs personnel detection on the first image. If there is a person in the first image, the personnel detection model marks the original first image and outputs the first image marked with the position of the person. If there is no person in the first image, the personnel detection model does not mark the first image.
[0061] Step 104: If a person is detected in the first image, the position of the person in the first image is obtained, and the first image is cropped according to the position of the person in the first image to obtain a second image.
[0062] Specifically, if the person detection model detects a person in the first image, the person's position is marked in the first image, and then the first image is cropped according to the marked person's position, and only the part of the person's position is retained as the second image.
[0063] Step 106: Process the second image through an abnormal behavior recognition model to obtain an abnormal behavior recognition result. The abnormal behavior recognition model is trained based on a first type of training samples including objects and people and a second type of training samples including people.
[0064] Among them, the abnormal behavior recognition model adopts a network model trained with a preset training set. For example, the resnet101 deep residual network trained with the preset training set is used as the abnormal behavior recognition model. The abnormal behavior recognition model can identify abnormal behaviors of the input image according to the object features and character features in the input image, and determine whether there is abnormal behavior in the input image.
[0065] Specifically, a preset training set is used to train the initial network model in advance to obtain an abnormal behavior recognition model. The preset training set includes two types of training samples, one type of training sample includes object features and personnel features, and the other type of training sample includes only personnel features. The second image is input into the trained abnormal behavior recognition model, and the abnormal behavior recognition model recognizes the human features and object features in the second image. If only human features exist in the second image, the abnormal behavior recognition model outputs a recognition result of no abnormal behavior. If both human features and object features exist in the second image, the abnormal behavior recognition model outputs a recognition result of abnormal behavior.
[0066] In the above warehouse personnel behavior recognition method, personnel detection is performed on the first image through the personnel detection model; if a person is detected in the first image, the position of the person in the first image is obtained, and the first image is cropped according to the position of the person in the first image to obtain the second image; the second image is processed by the abnormal behavior recognition model to obtain the abnormal behavior recognition result, and the abnormal behavior recognition model is trained based on the first type of training samples containing objects and people and the second type of training samples containing people. It can improve the accuracy of abnormal behavior recognition of personnel in the warehouse.
[0067] In one embodiment, a training method for a personnel detection model includes: obtaining a first training set, the first training set includes multiple training samples, each training sample includes a training image and an annotation information, and the annotation information is used to characterize the position information of a person in the training image; inputting a training sample in the first training set into an initial detection model to obtain a personnel detection result corresponding to the training sample; calculating an error loss based on the annotation information in a training sample and the corresponding personnel detection result, and adjusting the network parameter weights of the initial detection model based on the error loss; and continuing to train the initial detection model with the adjusted network parameter weights using the training samples in the first training set to obtain a personnel detection model.
[0068] Specifically, select some images containing people, frame the people in each image with a rectangular frame, use each image as a training sample, and integrate these images to obtain the first training set. Use the first training set to train the initial detection model, input a training sample into the initial detection model, and obtain a person detection result corresponding to the training sample; calculate the error loss based on the position of the rectangular frame in the training sample and the corresponding person detection result, and adjust the network parameter weight of the initial detection model based on the error loss. Use multiple training samples in the first training set to continuously train the initial detection model to obtain a person detection model.
[0069] Furthermore, for example, yolov5 is used as the initial detection model. The yolov5 network model mainly consists of 4 parts:
[0070] a) Input, data preprocessing, adaptive scaling and data enhancement;
[0071] b) Backbone, a convolutional neural network that aggregates and forms image features at different image granularities;
[0072] c) Neck, a series of network layers that mix and combine image features and pass them to the prediction layer;
[0073] d)Output, predict the image features, generate the target bounding box and predict the target category.
[0074] The video data required for training is collected through the warehouse camera, and ffmepg is used to convert the video into frame images. The target frame images containing personnel are selected to ensure that the amount of data containing personnel is greater than 1000. LabelImg is used as the annotation tool to frame the personnel in the image with a rectangular frame, and each frame image corresponds to a annotation file. The data is preprocessed, including adaptive scaling and data enhancement methods such as rotation and translation. The input size of the model is 640×640. The preprocessed image is input into the Backbone network to generate three feature layers of different sizes. The three feature layers are then input into the Neck part to generate three new feature layers. The target bounding box is predicted based on the three newly generated feature layers. Since the predicted bounding box is redundant, the non-maximum suppression method is used to filter out the duplicate bounding boxes. The remaining bounding boxes are the final target prediction boxes, which are then compared with the previously manually annotated boxes, and the CIOU loss function is used to calculate the error loss, so as to back-propagate and adjust the network parameter weights of yolov5. Finally, the personnel detection model is obtained.
[0075] In one embodiment, Figure 3 As shown, the training method of the abnormal behavior recognition model includes: obtaining a second training set, the second training set includes a first type of training samples including objects and personnel and a second type of training samples including personnel, each training sample in the first type of training samples and the second type of training samples includes a training image and a behavior label, the behavior label is used to characterize the type of personnel behavior in the training image; the type of personnel behavior includes acting on the object and not acting on the object; inputting a training sample in the second training set into the initial recognition model to obtain a personnel behavior recognition result corresponding to the training sample; calculating the loss function according to the behavior label in a training sample and the corresponding personnel behavior recognition result, and adjusting the network parameter weights of the initial recognition model according to the loss function; using the training samples in the second training set to continue training the initial recognition model with the adjusted network parameter weights to obtain the abnormal behavior recognition model.
[0076] Specifically, select some images containing people (the size of the people should fill the entire image as much as possible), and divide these images into two categories, one is the image of people carrying objects, and the other is the image of people without objects. Add behavior labels to these two types of images respectively. The image of people carrying objects corresponds to abnormal behavior labels (acting on the object label), and the image of people without objects without objects corresponds to non-abnormal behavior labels (not acting on the object label). Integrate these two types of images with added behavior labels to obtain the second training set. Use the second training set to train the initial recognition model, input a training sample in the second training set into the initial recognition model, and obtain a person behavior recognition result corresponding to the training sample (abnormal behavior or no abnormal behavior); calculate the loss function based on the behavior label in this training sample and the corresponding person behavior recognition result, and adjust the network parameter weights of the initial recognition model based on the loss function. Use multiple training samples in the second training set to continuously train the initial recognition model to obtain an abnormal behavior recognition model.
[0077] Furthermore, for example, the resnet101 deep residual network is used as the initial recognition model, and finally the extracted features are classified through softmax to identify whether the current person has reported the goods. All cropped person images are divided into two categories, the person features and the goods features are merged into a person holding goods category (Carry), and the other category is a non-carrying category (NoCarry) with only person features. Among them, the category of people holding goods includes data on different ways of holding goods, including people holding goods with both hands, people holding goods with one hand, etc. The total data set ensures that each type of data should be no less than 500. Due to the imbalance of categories in the collected data and the presence of a large number of repeated features in the samples, FocalLoss was selected as the loss function. FocalLoss is improved on the basis of the standard cross entropy loss. The standard two-category cross entropy loss is as follows:
[0078] For the standard binary cross entropy loss, the greater the output probability, the smaller the loss for the positive sample. For the negative sample, the smaller the output probability, the smaller the loss. At this time, the loss function is relatively slow in the iterative process of a large number of simple samples and may not be optimized to the optimal level. FocalLoss adds a balancing factor alpha to the original one, so that the loss focuses more on difficult samples and misclassified samples, and reduces the loss of easy-to-classify samples, resulting in: After the model training is completed, the abnormal behavior recognition model is obtained.
[0079] In one embodiment, before performing personnel detection on the first image through a personnel detection model, the method further includes: collecting video data through a camera, where the camera is placed directly above the gate of the warehouse; sampling the video data at a preset time interval to obtain a frame of image, and using the frame of image as the first image.
[0080] Specifically, the first image can be collected by a camera. The camera is installed just above the gate of the warehouse or at other designated locations. The camera shoots surveillance video and saves video images at preset time intervals. For example, a surveillance video frame image can be obtained every 0.5 seconds, and each frame image is used as the first image.
[0081] In one embodiment, after performing person detection on the first image by using a person detection model, the method further includes: if the person cannot be detected by the person detection model, generating first prompt information, the first prompt information being used to indicate that the person is not detected;
[0082] After the second image is processed by the abnormal behavior recognition model to obtain the abnormal behavior recognition result, it also includes: if the abnormal behavior recognition result is the presence of abnormal behavior, second prompt information is generated, and the second prompt information is used to characterize that a person is detected and the person's behavior is abnormal; if the abnormal behavior recognition result is the absence of abnormal behavior, third prompt information is generated, and the third prompt information is used to characterize that a person is detected but the person's behavior is not abnormal.
[0083] Specifically, if the personnel detection model fails to detect a person from the first image, it means that no person entered or left the warehouse during the shooting time of the first image, and a prompt message of "no person and no abnormality" is generated. If the abnormal behavior recognition result output by the abnormal behavior recognition model is that there is abnormal behavior, it means that during the shooting time of the first image, there are people entering or leaving the warehouse, and the people are carrying goods, and a prompt message of "there are people entering or leaving and the people's behavior is abnormal" is generated; if the abnormal behavior recognition result output by the abnormal behavior recognition model is that there is no abnormal behavior, it means that during the shooting time of the first image, there are people entering or leaving the warehouse, but the people are empty-handed and do not carry goods, and a prompt message of "there are people entering or leaving and the people's behavior is normal" is generated.
[0084] In one embodiment, Figure 2 As shown, the first image is cropped according to the position of the person in the first image to obtain the second image, including:
[0085] Step 202: Acquire an initial cropping area according to the position of the person in the first image.
[0086] Specifically, the initial cropping area is determined according to the position of the person obtained by the person detection model. Usually, after the person detection model detects the first image, it will frame the position of the person in the first image with a rectangular frame, and the rectangular frame is the initial cropping area.
[0087] Step 204, adjusting the initial cropping area according to a preset pixel size to obtain a cropping area.
[0088] Specifically, a preset pixel size is set according to actual needs. For example, if the preset pixel size is 10, the rectangular frame is reduced or enlarged at a ratio of 10 pixels, so that the cropped second image meets the usage requirements.
[0089] Step 206: acquiring a second image from the first image according to the cropping area.
[0090] Specifically, the image inside the adjusted rectangular frame in the first image is obtained by cropping or cutting out, and is used as the second image.
[0091] In this embodiment, an initial cropping area is obtained according to the position of the person in the first image; then the initial cropping area is adjusted according to a preset pixel size to obtain a cropping area; and finally, a second image is obtained from the first image according to the cropping area. The second image obtained in this way can meet the needs of behavior recognition to the greatest extent, for example, the person in the second image can occupy the entire image as much as possible, avoiding the deviation of the recognition result caused by the objects in the surrounding environment of the person during the behavior recognition process, and can improve the accuracy of abnormal behavior recognition.
[0092] In one embodiment, Figure 3 As shown, a warehouse personnel behavior recognition method is applied to a warehouse personnel behavior recognition system composed of a camera, a personnel detector and a behavior detector as an example. The method specifically includes:
[0093] The abnormal judgment of personnel carrying goods is mainly located at the gate between the warehouse cargo storage area and the operation area. By installing a camera on the top of the gate, the entry and exit of personnel passing through the gate are monitored. If the personnel entering or leaving the warehouse carry goods, an alarm will be issued to notify relevant personnel to handle it. The camera on the top can effectively avoid the problem of obstruction between personnel and goods and reduce the influence of other irrelevant interference factors.
[0094] Furthermore, the personnel detector uses opencv to obtain the rtsp video stream data of the camera, and detects pedestrians in the warehouse scene, and detects the position of the personnel from the video image frame. The detection results are as follows Figure 4 shown.
[0095] Among them, the personnel detector uses yolov5 as the detection framework. Through the camera on the top, the video data required for training is collected, and ffmepg is used to convert the video into frame images. The training process of the personnel detector includes: selecting the target frame image containing personnel, ensuring that the amount of data containing personnel is greater than 1000. Use LabelImg as the annotation tool to frame the personnel in the image with a rectangular frame, and each frame image corresponds to a annotation file. During the training process, the data needs to be preprocessed, including adaptive scaling and data enhancement methods such as rotation and translation. The input size of the model is 640×640. The preprocessed image is input into the Backbone network of yolov5 to generate three feature layers of different sizes. The three feature layers are then input into the Neck part of yolov5 to generate three new feature layers. The target bounding box is predicted based on the three newly generated feature layers. Since the predicted bounding box is redundant, the non-maximum suppression method is used to filter out the repeated bounding boxes. The remaining bounding boxes are the final target prediction boxes, which are then compared with the previously manually annotated boxes, and the CIOU loss function is used to calculate the error loss, so as to back-propagate and adjust the network parameter weights of yolov5. Finally, load the trained model as a person detector.
[0096] Furthermore, the length and width of the person area detected by the person detector are cropped by 10 pixels, and the cropped image is resized to a size of (128, 128) as the input of the behavior detector.
[0097] Finally, the behavior detector obtains the output of the previous person detector and resizes it to (128,128). The result is as follows Figure 5 If it is identified that the current person is carrying goods, it is in an abnormal state and an alarm is sent to the warehouse staff. If there is no carrying behavior, it is in a normal state.
[0098] Among them, the behavior detector uses the resnet101 deep residual network as the feature extraction module, and finally classifies the extracted features through softmax to identify whether the current person has reported the behavior of goods. The training process of the behavior detector includes: dividing all the cropped data into two categories, merging the characteristics of personnel and goods into a person holding goods category (Carry), and the other category is a non-carrying category (NoCarry) with only personnel characteristics. Among them, the category of people holding goods includes data of different ways of holding goods, including people holding goods with both hands, people holding goods with one hand, etc. The total data set ensures that each type of data should be no less than 500. Due to the imbalance of categories in the collected data and the presence of a large number of repeated features in the samples, FocalLoss is selected as the loss function. FocalLoss is improved on the basis of the standard cross entropy loss. The standard two-category cross entropy loss is as follows: For the standard binary cross entropy loss, the greater the output probability, the smaller the loss for the positive sample. For the negative sample, the smaller the output probability, the smaller the loss. At this time, the loss function is relatively slow in the iterative process of a large number of simple samples and may not be optimized to the optimal level. FocalLoss adds a balancing factor alpha to the original one, so that the loss focuses more on difficult samples and misclassified samples, and reduces the loss of easy-to-classify samples, resulting in: After the model training is completed, the behavior detector is obtained.
[0099] Compared with the abnormal behavior detection method based on topological relationships, the above method does not need to train multiple detectors, and the abnormal behavior recognition method that fuses the target object features with the personnel features is more effective than the topological model. Compared with the abnormal behavior detection based on the key points of the human body, the above method runs faster. Since the key points are prone to missed detection and unstable coordinates, the accuracy of the above method will be higher. Traditional methods are all for static time series images. In the warehouse scene, the accuracy of detecting abnormal behaviors such as people holding goods will be greatly reduced. In actual application and warehouse environment, the above method can effectively ensure the safety of goods in the warehouse and reduce manpower consumption.
[0100] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0101] Based on the same inventive concept, the embodiment of the present application also provides a warehouse personnel behavior recognition device for implementing the warehouse personnel behavior recognition method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more warehouse personnel behavior recognition device embodiments provided below can refer to the limitations of the warehouse personnel behavior recognition method above, and will not be repeated here.
[0102] In one embodiment, Figure 6 As shown, a warehouse personnel behavior recognition device 600 is provided, comprising: a personnel detection module 601, an image cropping module 602 and a behavior recognition module 603, wherein:
[0103] A person detection module 601 is used to perform person detection on the first image using a person detection model;
[0104] An image cropping module 602 is configured to obtain a position of the person in the first image if a person is detected in the first image, and crop the first image according to the position of the person in the first image to obtain a second image;
[0105] The behavior recognition module 603 is used to process the second image through an abnormal behavior recognition model to obtain an abnormal behavior recognition result, where the abnormal behavior recognition model is trained based on a first type of training samples including objects and people and a second type of training samples including people.
[0106] In one embodiment, the personnel detection module 601 is also used to obtain a first training set, the first training set includes multiple training samples, each training sample includes a training image and a labeling information, and the labeling information is used to characterize the personnel position information in the training image; a training sample in the first training set is input into the initial detection model to obtain a personnel detection result corresponding to the training sample; the error loss is calculated according to the labeling information in a training sample and the corresponding personnel detection result, and the network parameter weights of the initial detection model are adjusted according to the error loss; the initial detection model with adjusted network parameter weights is continued to be trained using the training samples in the first training set to obtain a personnel detection model.
[0107] In one embodiment, the behavior recognition module 603 is also used to obtain a second training set, the second training set includes a first type of training samples including objects and personnel and a second type of training samples including personnel, each training sample in the first type of training samples and the second type of training samples includes a training image and a behavior label, the behavior label is used to characterize the type of personnel behavior in the training image; the type of personnel behavior includes acting on objects and not acting on objects; a training sample in the second training set is input into the initial recognition model to obtain a personnel behavior recognition result corresponding to the training sample; a loss function is calculated based on the behavior label in a training sample and the corresponding personnel behavior recognition result, and the network parameter weights of the initial recognition model are adjusted based on the loss function; the initial recognition model with adjusted network parameter weights is continued to be trained using the training samples in the second training set to obtain an abnormal behavior recognition model.
[0108] In one embodiment, the apparatus further comprises:
[0109] The image acquisition module 604 is used to collect video data through a camera, and the camera is placed just above the gate of the warehouse; the video data is sampled at a preset time interval to obtain a frame of image, and the frame of image is used as the first image.
[0110] In one embodiment, the person detection module 601 is further used to generate first prompt information if a person cannot be detected by the person detection model, and the first prompt information is used to indicate that a person is not detected;
[0111] The behavior recognition module 603 is also used to generate a second prompt message if the abnormal behavior recognition result is the presence of abnormal behavior, and the second prompt message is used to characterize that a person is detected and the person's behavior is abnormal; if the abnormal behavior recognition result is the absence of abnormal behavior, a third prompt message is generated, and the third prompt message is used to characterize that a person is detected but the person's behavior is not abnormal.
[0112] In one embodiment, the image cropping module 602 is further used to obtain an initial cropping area according to the position of the person in the first image; adjust the initial cropping area according to a preset pixel size to obtain a cropping area; and obtain a second image from the first image according to the cropping area.
[0113] Each module in the above-mentioned warehouse personnel behavior recognition device can be implemented in whole or in part by software, hardware and their combination. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the corresponding operations of each of the above modules.
[0114] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for identifying warehouse personnel behavior is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0115] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0116] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0117] Performing person detection on the first image using a person detection model;
[0118] If a person is detected in the first image, the position of the person in the first image is obtained, and the first image is cropped according to the position of the person in the first image to obtain a second image;
[0119] The second image is processed by an abnormal behavior recognition model to obtain an abnormal behavior recognition result, wherein the abnormal behavior recognition model is trained based on a first type of training samples including objects and persons and a second type of training samples including persons.
[0120] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0121] Obtain a first training set, the first training set includes multiple training samples, each training sample includes a training image and annotation information, and the annotation information is used to represent the position information of the person in the training image;
[0122] Input a training sample in the first training set into the initial detection model to obtain a person detection result corresponding to the training sample;
[0123] Calculate the error loss based on the annotation information in a training sample and the corresponding person detection result, and adjust the network parameter weights of the initial detection model based on the error loss;
[0124] The initial detection model with adjusted network parameter weights is further trained using the training samples in the first training set to obtain a personnel detection model.
[0125] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0126] Obtain a second training set, the second training set includes a first type of training samples including objects and people and a second type of training samples including people, each of the first type of training samples and the second type of training samples includes a training image and a behavior label, the behavior label is used to characterize the type of person behavior in the training image; the person behavior type includes acting on the object and not acting on the object;
[0127] Input a training sample from the second training set into the initial recognition model to obtain a human behavior recognition result corresponding to the training sample;
[0128] Calculate the loss function based on the behavior label in a training sample and the corresponding person behavior recognition result, and adjust the network parameter weights of the initial recognition model based on the loss function;
[0129] The training samples in the second training set are used to continue training the initial recognition model with adjusted network parameter weights to obtain an abnormal behavior recognition model.
[0130] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0131] Video data is collected through cameras, which are placed just above the warehouse gate;
[0132] The video data is sampled at a preset time interval to obtain a frame of image, and the frame of image is used as the first image.
[0133] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0134] If the person cannot be detected by the person detection model, a first prompt information is generated, and the first prompt information is used to indicate that the person is not detected;
[0135] After the abnormal behavior recognition model is used to process the second image to obtain an abnormal behavior recognition result, the method further includes:
[0136] If the abnormal behavior recognition result is that abnormal behavior exists, a second prompt information is generated, and the second prompt information is used to indicate that a person is detected and the person's behavior is abnormal;
[0137] If the abnormal behavior identification result is that there is no abnormal behavior, a third prompt information is generated, and the third prompt information is used to represent that a person is detected but the person's behavior is not abnormal.
[0138] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0139] Acquire an initial cropping area according to the position of the person in the first image;
[0140] Adjust the initial cropping area according to the preset pixel size to obtain the cropping area;
[0141] A second image is obtained from the first image according to the cropping area.
[0142] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0143] Performing person detection on the first image using a person detection model;
[0144] If a person is detected in the first image, the position of the person in the first image is obtained, and the first image is cropped according to the position of the person in the first image to obtain a second image;
[0145] The second image is processed by an abnormal behavior recognition model to obtain an abnormal behavior recognition result, wherein the abnormal behavior recognition model is trained based on a first type of training samples including objects and persons and a second type of training samples including persons.
[0146] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0147] Obtain a first training set, the first training set includes multiple training samples, each training sample includes a training image and annotation information, and the annotation information is used to represent the position information of the person in the training image;
[0148] Input a training sample in the first training set into the initial detection model to obtain a person detection result corresponding to the training sample;
[0149] Calculate the error loss based on the annotation information in a training sample and the corresponding person detection result, and adjust the network parameter weights of the initial detection model based on the error loss;
[0150] The initial detection model with adjusted network parameter weights is further trained using the training samples in the first training set to obtain a personnel detection model.
[0151] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0152] Obtain a second training set, the second training set includes a first type of training samples including objects and people and a second type of training samples including people, each of the first type of training samples and the second type of training samples includes a training image and a behavior label, the behavior label is used to characterize the type of person behavior in the training image; the person behavior type includes acting on the object and not acting on the object;
[0153] Input a training sample from the second training set into the initial recognition model to obtain a human behavior recognition result corresponding to the training sample;
[0154] Calculate the loss function based on the behavior label in a training sample and the corresponding person behavior recognition result, and adjust the network parameter weights of the initial recognition model based on the loss function;
[0155] The training samples in the second training set are used to continue training the initial recognition model with adjusted network parameter weights to obtain an abnormal behavior recognition model.
[0156] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0157] Video data is collected through cameras, which are placed just above the warehouse gate;
[0158] The video data is sampled at a preset time interval to obtain a frame of image, and the frame of image is used as the first image.
[0159] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0160] If the person cannot be detected by the person detection model, a first prompt information is generated, and the first prompt information is used to indicate that the person is not detected;
[0161] After the abnormal behavior recognition model is used to process the second image to obtain an abnormal behavior recognition result, the method further includes:
[0162] If the abnormal behavior recognition result is that abnormal behavior exists, a second prompt information is generated, and the second prompt information is used to indicate that a person is detected and the person's behavior is abnormal;
[0163] If the abnormal behavior identification result is that there is no abnormal behavior, a third prompt information is generated, and the third prompt information is used to represent that a person is detected but the person's behavior is not abnormal.
[0164] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0165] Acquire an initial cropping area according to the position of the person in the first image;
[0166] Adjust the initial cropping area according to the preset pixel size to obtain the cropping area;
[0167] A second image is obtained from the first image according to the cropping area.
[0168] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0169] Performing person detection on the first image using a person detection model;
[0170] If a person is detected in the first image, the position of the person in the first image is obtained, and the first image is cropped according to the position of the person in the first image to obtain a second image;
[0171] The second image is processed by an abnormal behavior recognition model to obtain an abnormal behavior recognition result, wherein the abnormal behavior recognition model is trained based on a first type of training samples including objects and persons and a second type of training samples including persons.
[0172] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0173] Obtain a first training set, the first training set includes multiple training samples, each training sample includes a training image and annotation information, and the annotation information is used to represent the position information of the person in the training image;
[0174] Input a training sample in the first training set into the initial detection model to obtain a person detection result corresponding to the training sample;
[0175] Calculate the error loss based on the annotation information in a training sample and the corresponding person detection result, and adjust the network parameter weights of the initial detection model based on the error loss;
[0176] The initial detection model with adjusted network parameter weights is further trained using the training samples in the first training set to obtain a personnel detection model.
[0177] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0178] Obtain a second training set, the second training set includes a first type of training samples including objects and people and a second type of training samples including people, each of the first type of training samples and the second type of training samples includes a training image and a behavior label, the behavior label is used to characterize the type of person behavior in the training image; the person behavior type includes acting on the object and not acting on the object;
[0179] Input a training sample from the second training set into the initial recognition model to obtain a human behavior recognition result corresponding to the training sample;
[0180] Calculate the loss function based on the behavior label in a training sample and the corresponding person behavior recognition result, and adjust the network parameter weights of the initial recognition model based on the loss function;
[0181] The training samples in the second training set are used to continue training the initial recognition model with adjusted network parameter weights to obtain an abnormal behavior recognition model.
[0182] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0183] Video data is collected through cameras, which are placed just above the warehouse gate;
[0184] The video data is sampled at a preset time interval to obtain a frame of image, and the frame of image is used as the first image.
[0185] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0186] If the person cannot be detected by the person detection model, a first prompt information is generated, and the first prompt information is used to indicate that the person is not detected;
[0187] After the abnormal behavior recognition model is used to process the second image to obtain an abnormal behavior recognition result, the method further includes:
[0188] If the abnormal behavior recognition result is that abnormal behavior exists, a second prompt information is generated, and the second prompt information is used to indicate that a person is detected and the person's behavior is abnormal;
[0189] If the abnormal behavior identification result is that there is no abnormal behavior, a third prompt information is generated, and the third prompt information is used to represent that a person is detected but the person's behavior is not abnormal.
[0190] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0191] Acquire an initial cropping area according to the position of the person in the first image;
[0192] Adjust the initial cropping area according to the preset pixel size to obtain the cropping area;
[0193] A second image is obtained from the first image according to the cropping area.
[0194] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0195] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0196] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0197] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A warehouse personnel behavior recognition method, characterized in that: The method comprises: Performing person detection on the first image using a person detection model; If a person is detected in the first image, obtaining a position of the person in the first image, and cropping the first image according to the position of the person in the first image to obtain a second image; Processing the second image by using an abnormal behavior recognition model to obtain an abnormal behavior recognition result, wherein the abnormal behavior recognition model is trained based on a first type of training samples including objects and people and a second type of training samples including people; The training method of the abnormal behavior recognition model includes: Obtain a second training set, the second training set including a first type of training samples including objects and people and a second type of training samples including people, each of the first type of training samples and the second type of training samples including a training image and a behavior label, the behavior label being used to characterize a type of person behavior in the training image; the person behavior type including acting on an object and not acting on an object; the first type of training samples is divided into two types: a person holding goods with both hands and a person holding goods with one hand; Inputting a training sample from the second training set into the initial recognition model to obtain a human behavior recognition result corresponding to the training sample; Calculating a loss function based on a behavior label in a training sample and a corresponding person behavior recognition result, and adjusting a network parameter weight of the initial recognition model based on the loss function; Using the training samples in the second training set to continue training the initial recognition model with adjusted network parameter weights, to obtain an abnormal behavior recognition model; Before performing personnel detection on the first image by using the personnel detection model, the method further includes: Collecting video data through a camera, wherein the camera is placed directly above the gate of the warehouse; Sampling the video data at a preset time interval to obtain a frame of image, and using the frame of image as the first image; After the abnormal behavior recognition model is used to process the second image to obtain an abnormal behavior recognition result, the method further includes: If the abnormal behavior recognition result is that abnormal behavior exists, second prompt information is generated, and the second prompt information is used to indicate that a person is detected and the person's behavior is abnormal; If the abnormal behavior identification result is that there is no abnormal behavior, a third prompt information is generated, and the third prompt information is used to represent that a person is detected but the person's behavior is not abnormal.
2. The method according to claim 1, characterized in that The training method of the person detection model includes: Acquire a first training set, where the first training set includes a plurality of training samples, each training sample includes a training image and annotation information, and the annotation information is used to represent the position information of a person in the training image; Inputting a training sample in the first training set into the initial detection model to obtain a person detection result corresponding to the training sample; Calculating error loss based on the annotation information in a training sample and the corresponding person detection result, and adjusting the network parameter weight of the initial detection model based on the error loss; The initial detection model with adjusted network parameter weights is further trained using the training samples in the first training set to obtain a personnel detection model.
3. The method according to claim 1, characterized in that After performing personnel detection on the first image by using the personnel detection model, the method further includes: If a person cannot be detected by the person detection model, first prompt information is generated, where the first prompt information is used to indicate that a person has not been detected.
4. The method according to claim 1, characterized in that: The step of cropping the first image according to the position of the person in the first image to obtain the second image includes: Acquire an initial cropping area according to the position of the person in the first image; Adjust the initial cropping area according to a preset pixel size to obtain a cropping area; The second image is acquired from the first image according to the cropping area.
5. A warehouse personnel behavior recognition device, characterized in that: The device comprises: A person detection module, used to perform person detection on the first image using a person detection model; an image cropping module, configured to obtain a position of the person in the first image if a person is detected in the first image, and crop the first image according to the position of the person in the first image to obtain a second image; a behavior recognition module, configured to process the second image through an abnormal behavior recognition model to obtain an abnormal behavior recognition result, wherein the abnormal behavior recognition model is trained based on a first type of training samples including objects and persons and a second type of training samples including persons; The behavior recognition module is further used for: Obtain a second training set, the second training set including a first type of training samples including objects and people and a second type of training samples including people, each of the first type of training samples and the second type of training samples including a training image and a behavior label, the behavior label being used to characterize a type of person behavior in the training image; the person behavior type including acting on an object and not acting on an object; the first type of training samples is divided into two types: a person holding goods with both hands and a person holding goods with one hand; Inputting a training sample from the second training set into the initial recognition model to obtain a human behavior recognition result corresponding to the training sample; Calculating a loss function based on a behavior label in a training sample and a corresponding person behavior recognition result, and adjusting a network parameter weight of the initial recognition model based on the loss function; Using the training samples in the second training set to continue training the initial recognition model with adjusted network parameter weights, to obtain an abnormal behavior recognition model; The device also includes an image acquisition module for collecting video data through a camera, and the camera is placed just above the gate of the warehouse; Sampling the video data at a preset time interval to obtain a frame of image, and using the frame of image as the first image; The personnel detection module is further configured to generate second prompt information if the abnormal behavior recognition result indicates that an abnormal behavior exists, wherein the second prompt information is used to indicate that a person is detected and the person's behavior is abnormal; If the abnormal behavior identification result is that there is no abnormal behavior, a third prompt information is generated, and the third prompt information is used to represent that a person is detected but the person's behavior is not abnormal.
6. The device according to claim 5, characterized in that The personnel detection module is also used for: Acquire a first training set, where the first training set includes a plurality of training samples, each training sample includes a training image and annotation information, and the annotation information is used to represent the position information of a person in the training image; Inputting a training sample in the first training set into the initial detection model to obtain a person detection result corresponding to the training sample; Calculating error loss based on the annotation information in a training sample and the corresponding person detection result, and adjusting the network parameter weight of the initial detection model based on the error loss; The initial detection model with adjusted network parameter weights is further trained using the training samples in the first training set to obtain a personnel detection model.
7. The device according to claim 5, characterized in that The image cropping module is further used to obtain an initial cropping area according to the position of the person in the first image; Adjust the initial cropping area according to a preset pixel size to obtain a cropping area; The second image is acquired from the first image according to the cropping area.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
9. 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 method according to any one of claims 1 to 4 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Abnormal behavior recognition method and device, electronic equipment and storage medium
CN112200081A