Method, device, computer equipment and storage medium for identifying position of person in image
By identifying the image type of surveillance video files and using the corresponding model to identify the person's location, the problem of low query efficiency in the video surveillance system is solved, automatic identification is achieved and the processing efficiency of surveillance videos is improved.
Patent Information
- Application Number
- CN201910628940.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-07-12
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2039-07-12
AI Technical Summary
When existing video surveillance systems query target objects in massive video data, they rely on human viewing and manual retrieval, resulting in low automation and slow query efficiency.
By obtaining surveillance video files, preprocessing and image type determination are performed, and the trained human posture model is used to identify human key points in color images, or a lightweight target detection model is used to identify person position information in night vision images to achieve automation. Quick identification.
It improves the accuracy and efficiency of video content recognition, gets rid of the dependence on manual recognition, and realizes automated processing of surveillance videos.
Smart Images

Figure CN110502986B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer device and storage medium for identifying the position of a person in an image. Background Art
[0002] With the needs of social economy and safe production, video surveillance equipment has been more and more widely deployed in the fields of safe cities, smart transportation, security engineering, etc. In addition, in recent years, video surveillance has developed towards high definition, networking and intelligence. However, due to the widespread use of surveillance videos, the large amount of video data generated by massive cameras is also increasing. In order to view the target object, it is necessary to query from the massive video data. The existing query method mainly relies on human viewing and manual retrieval, resulting in low automation of video content monitoring and slow query efficiency. Summary of the invention
[0003] Based on this, it is necessary to provide a method, device, computer equipment and storage medium that can improve the efficiency of identifying the position of a person in an image in order to solve the above technical problems.
[0004] A method for identifying a position of a person in an image, the method comprising:
[0005] Acquire a surveillance video file to be identified, and preprocess the surveillance video file to be identified to obtain a video image to be identified;
[0006] Determining the image type of the video image to be identified;
[0007] When the image type is a color image, identifying key points of a human body in the image to be identified through a human posture model obtained through training, and determining position information of a person in the video image to be identified based on the identified key points of the human body;
[0008] When the image type is a night vision image, the position information of the person in the video image to be identified is identified through a lightweight target detection model obtained through training.
[0009] In one embodiment, the step of determining the image type of the video image to be identified includes:
[0010] Obtaining three-channel pixel values of each pixel in the video image to be identified;
[0011] Performing difference calculation based on the three-channel pixel values, and selecting the value with the largest difference as the pixel difference;
[0012] The image type of the video image to be identified is determined according to a preset value and the pixel difference value.
[0013] In one embodiment,
[0014] The determining the image type of the video image to be identified includes:
[0015] Obtaining the acquisition mode adjustment time of the monitoring device corresponding to the monitoring video file to be identified, and obtaining the shooting time corresponding to the video image to be identified;
[0016] The image type of the video image to be identified is determined by adjusting the time according to the acquisition mode.
[0017] In one of the embodiments, when the image type is a color image, identifying key points of a human body in the image to be identified through a trained human posture model, and determining position information of a person in the video image to be identified based on the identified key points of the human body, includes:
[0018] Using the front network layer of the human posture model to extract features of the video image to be identified, to obtain a feature map corresponding to the video image to be identified;
[0019] Extracting the key points of the human body in the to-be-identified video image from the feature map using the confidence network layer of the human body posture model, and obtaining a key point confidence map corresponding to the key points of the human body in the to-be-identified video image;
[0020] Extracting the correlation degree of each of the key points of the human body in the video image to be identified from the feature map using the correlation degree vector network layer of the human body posture model;
[0021] The person position information of the video image to be identified is determined according to the correlation between the key point confidence map and the human body key points.
[0022] In one embodiment, determining the person position information of the to-be-identified video image according to the correlation between the key point confidence map and the human key points includes:
[0023] According to the correlation degree of the human body key points, the human body key points on the key point confidence map are connected, and the key point contours are calculated;
[0024] Acquire a minimum circumscribed rectangle according to the key point contour, wherein the minimum circumscribed rectangle is a rectangle with the smallest area including the key point contour;
[0025] The position information of the person in the video image to be identified is determined according to the circumscribed minimum rectangle.
[0026] In one embodiment, after obtaining the position information of the person to be identified, the method further includes:
[0027] Generating video information corresponding to the person's position information;
[0028] The video information is written into the corresponding log.
[0029] In one embodiment,
[0030] Before obtaining the surveillance video file to be identified, the method further includes the steps of training the human posture model and the lightweight target detection model; the steps of training the human posture model and the lightweight target detection model include:
[0031] Obtain historical surveillance videos of surveillance equipment;
[0032] Extracting color image samples and night vision image samples from the historical surveillance video, and marking key points of human bodies in the color image samples, and marking position coordinates of human bodies in the night vision image samples, to obtain marked color images and marked night vision images;
[0033] Resizing the annotated color image and the annotated night vision image respectively to obtain a training color image and a training night vision image;
[0034] Mapping the key points of the human body in the training color image with the key points of the human body annotated in the annotated color image, and using the mapped training color image to train the human body posture model;
[0035] The position coordinates in the training night vision image are mapped with the position coordinates annotated in the annotated night vision image, and the lightweight target detection model is trained using the mapped training night vision image.
[0036] A device for identifying a position of a person in an image, the device comprising:
[0037] A preprocessing module is used to obtain a surveillance video file to be identified, and preprocess the surveillance video file to be identified to obtain a video image to be identified;
[0038] A determination module, used to determine the image type of the video image to be identified;
[0039] A recognition module, used for recognizing key points of a human body in the video image to be recognized by using a human posture model obtained through training when the image type is a color image, and determining position information of a person in the video image to be recognized based on the recognized key points of the human body;
[0040] The recognition module is also used to identify the position information of the person in the video image to be identified by using a lightweight target detection model obtained through training when the image type is a night vision image.
[0041] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned method for identifying the position of a person in an image when executing the computer program.
[0042] A computer-readable storage medium stores a computer program, which implements the above-mentioned method for identifying the position of a person in an image when executed by a processor.
[0043] The above-mentioned method, device, computer equipment and storage medium for identifying the position of a person in an image, after obtaining the surveillance video file to be identified, pre-processes the surveillance video file to be identified to obtain the video image to be identified, so as to facilitate the subsequent processing of video content identification. After determining the image type of the video image to be identified, the corresponding recognition model is called according to the image type, that is, when the image type is a color image, the human body key points in the image to be identified are identified by the human body posture model obtained through training, and the position information of the person in the video image to be identified is determined based on the identified human body key points. When the image type is a night vision image, the position information of the person in the video image to be identified is identified by the lightweight target detection model obtained through training. Thereby, it is ensured that different types of video images to be identified can be identified by the most matching recognition model, thereby improving the accuracy of recognition. And according to different recognition models, the position of the person in the video image can be detected, which can get rid of the old manual recognition and viewing method, and realize automatic and rapid recognition of surveillance video content. Improve work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A diagram of an application scenario of a method for identifying a position of a person in an image in one embodiment;
[0045] Figure 2 A schematic diagram of a flow chart of a method for identifying a position of a person in an image in one embodiment;
[0046] Figure 3 A schematic diagram of a flow chart of a step of determining the type of a video image in one embodiment;
[0047] Figure 4 A schematic flow chart of a method for identifying a position of a person in an image in another embodiment;
[0048] Figure 5 is a structural block diagram of a device for identifying a position of a person in an image in one embodiment;
[0049] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0050] 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.
[0051] The method for identifying the position of a person in an image provided by the present application can be applied to Figure 1 In the application environment shown. Among them, the monitoring device 102 communicates with the server 104 through the network. The server 104 obtains the monitoring video file to be identified sent by the monitoring device 102, and the server 104 pre-processes the monitoring video file to obtain the video image to be identified. The server 104 determines the image type of the video image to be identified. When the image type is a color image, the server 104 identifies the key points of the human body in the image to be identified through the human posture model obtained by training, and determines the position information of the person in the video image to be identified based on the identified key points of the human body. When the image type is a night vision image, the server 104 identifies the position information of the person in the video image to be identified through the lightweight target detection model obtained by training. Among them, the monitoring device 102 can be but is not limited to various cameras, personal computers with cameras, laptops, smart phones, tablet computers and portable wearable devices, etc., and the server 104 can be implemented with an independent server or a server cluster composed of multiple servers.
[0052] In one embodiment, Figure 2 As shown, a method for identifying the position of a person in an image is provided, and the method is applied to Figure 1 The server in the example is used to illustrate the following steps:
[0053] Step S202: obtaining a surveillance video file to be identified, and preprocessing the surveillance video file to be identified to obtain a video image to be identified.
[0054] Among them, the surveillance video file to be identified refers to a file including the surveillance video collected by the monitoring device. It can be understood that the surveillance video file to be identified includes but is not limited to the surveillance video collected by the monitoring device and transmitted to the server, and can also be other terminal devices with transmission function and communicating with the server. That is, the surveillance video file to be identified obtained by the server can come from the monitoring device, or from the video file sent by other terminal devices. Preprocessing refers to decoding the surveillance video file to be identified to obtain the corresponding surveillance video to be identified, and segmenting the surveillance video to be identified to obtain the video image to be identified in the surveillance video to be identified, and performing grayscale adjustment, denoising and sharpening on the video image to be identified, that is, improving the image quality and noise by adjustment to ensure the clarity and quality of the image.
[0055] Specifically, the user can issue a person position recognition instruction through the monitoring device, and select a surveillance video to be recognized that needs to be recognized. When the monitoring device receives the person position recognition instruction issued by the user, it obtains the surveillance video to be recognized selected by the user, compresses and encapsulates it into a corresponding surveillance video file to be recognized, and sends the surveillance video file to be recognized to the corresponding server, and sends a request for person position recognition to the corresponding server. After the server receives the person position recognition request, it decodes and restores the surveillance video file to be recognized corresponding to the person position recognition request to obtain the surveillance video to be recognized, and then pre-processes the surveillance video to be recognized to obtain the video image to be recognized in the surveillance video to be recognized.
[0056] Step S204: determining the image type of the video image to be identified.
[0057] Specifically, after the server pre-processes the surveillance video file to be identified to obtain the corresponding video image to be identified, it determines whether the video image to be identified is a night vision image or a color image by obtaining pixel values in the video image to be identified.
[0058] Step S206, when the image type is a color image, the human body key points in the image to be identified are identified by the trained human body posture model, and the person position information in the video image to be identified is determined based on the identified human body key points.
[0059] Among them, the human posture model is the openpose model, which is a posture detection framework used to detect human joints, such as key points such as the neck, shoulders and elbows, and connect the key points to obtain the human posture. The openpose model includes a front network layer and a dual-branch multi-level CNN network (Convolutional Neural Networks). The front network is a VGG-19 network modified on the basis of the VGG network (Visual Geometry Group Network, super-resolution test network), including ten two-dimensional convolutional layers and rectified linear unit layers connected in series, with three pooling layers inserted in between. That is, the VGG-19 module includes 4 blocks, among which block1, block2 and block4 have two convolutional layers and two rectified linear units respectively, block3 has four convolution kernels and four rectified linear units, and three pooling layers are between each block. The dual-branch multi-level CNN network includes a confidence network and a correlation vector field network.
[0060] Specifically, after the server determines the type of the video image to be identified, if the type of the video image to be identified is a color image, the openpose model is called as the recognition model of the video image to be identified. The video image to be identified is input into the openpose model, and the openpose model is used to identify the video image to be identified, and the human body key points of the human body in the video image to be identified are obtained, so as to obtain the position of the person according to the human body key points.
[0061] Step S208, when the image type is a night vision image, the position information of the person in the video image to be identified is identified by using the lightweight target detection model obtained through training.
[0062] Among them, the lightweight target detection model is the ssdlite (Single Shot Detector-Lite) model, which is a target detection framework for identifying whether a target object exists. In this embodiment, in order to improve the accuracy of the model, the original loss function of the ssdlite model is changed to focal loss. In addition, since it is difficult to detect the key points of human posture in night vision images, in this embodiment, the openpose model is used to detect color images, and the ssdlite model is used to detect night vision images.
[0063] Specifically, after the server determines the type of video image to be identified, if the type of video image to be identified is a night vision image, the ssdlite model is called as the recognition model of the video image to be identified, and then the ssdlite model is used to identify the position of the person in the video image to be identified.
[0064] In the above method for identifying the position of a person in an image, after obtaining the surveillance video file to be identified, the surveillance video file to be identified is preprocessed to obtain the video image to be identified, thereby facilitating the subsequent processing of video content identification. After determining the image type of the video image to be identified, the corresponding recognition model is called according to the image type, that is, when the image type is a color image, the human body key points in the image to be identified are identified through the human body posture model obtained through training, and the position information of the person in the video image to be identified is determined based on the identified human body key points. When the image type is a night vision image, the lightweight target detection model obtained through training is used to identify the position information of the person in the video image to be identified. This ensures that different types of video images to be identified can be identified by the most matching recognition model, thereby improving the accuracy of recognition. In addition, by detecting the position of the person in the video image according to different recognition models, the old-fashioned manual recognition and viewing method can be eliminated, and the automatic and rapid recognition of the surveillance video content can be realized. Improve work efficiency.
[0065] In one embodiment, Figure 3 As shown, step S204, determining the image type of the video image to be identified includes the following steps:
[0066] Step S302, obtaining three-channel pixel values of each pixel in the video image to be identified.
[0067] Among them, pixels refer to the small squares that make up the image, that is, the smallest unit in the image. And the small squares have clear positions and assigned color values, and the color and position of the small squares determine how the image appears. The pixel value is the color value corresponding to the pixel, and the type of image can be determined by the pixel value. Image types include night vision images and color images. The three-channel pixel values are RGB pixel values, and the RGB pixel values are the color values that determine the color of the image. RGB is red, green, and blue, respectively. Specifically, when the server determines whether the video image is a night vision image or a color image based on the image pixel value, it first obtains the RGB pixel values corresponding to all pixels in the image.
[0068] Step S304, performing difference calculation based on the three-channel pixel values, and selecting the value with the largest difference as the pixel difference.
[0069] Specifically, after obtaining the three-channel pixel values of each pixel, that is, after obtaining the RGB pixel values, the difference calculation is performed on RGB. The difference calculation is to perform a subtraction operation on any two of RGB, and select the value with the largest difference from the multiple differences obtained as the pixel difference corresponding to this pixel. For example, taking pixel 1 as an example, the RGB value corresponding to pixel 1 is obtained. Each RGB has a corresponding component value. The specific component value depends on the specific image. Generally, the component value corresponding to RGB is between 0-255. That is, the component value corresponding to R, the component value corresponding to G, and the component value corresponding to B are obtained respectively, and then the three component values are subjected to difference calculation. It is equivalent to calculating the absolute value of RG, the absolute value of RB, and the absolute value of GB respectively, because the values of RB or BR are the same, but the signs are opposite, and the opposite signs are different in mathematics, but not for pixels. Therefore, by taking the absolute value, the calculation steps can be reduced, thereby completing the calculation quickly. In other words, taking the value with the largest difference as the pixel difference of pixel 1, that is, selecting a maximum value from the absolute values of RG, RB, and GB as the pixel difference of pixel 1.
[0070] Step S306: determining the image type of the video image to be identified according to the preset value and the pixel difference.
[0071] Among them, the preset value is a reference pixel value preset for judging whether a video image is a color image or a night vision image. In the present embodiment, the preset value is 10. Specifically, after obtaining the pixel difference value corresponding to the pixel, the pixel difference value is compared with the preset value 10. If the pixel difference value is greater than the preset value 10, it is determined that the video image to be identified is a color image, and if the pixel difference value is less than or equal to the preset value 10, it is determined that the video image to be identified is a night vision image. In the present embodiment, the image type of the video image to be identified is determined by the pixel value of the video image to be identified, so as to ensure that the recognition model that best matches the video image to be identified can be called according to the image type of the video image to be identified for identification, thereby improving the recognition accuracy.
[0072] In another embodiment, step S204, determining the image type of the video image to be identified includes: obtaining the acquisition mode adjustment time of the monitoring device corresponding to the monitoring video file to be identified, and obtaining the shooting time corresponding to the video image to be identified; determining the image type of the video image to be identified according to the acquisition mode adjustment time.
[0073] Specifically, the monitoring device has two modes, including a color acquisition mode and a night vision black and white acquisition mode. When the monitoring device collects monitoring videos, the quality of the color video collected is lost due to low light conditions. In order to ensure the quality of the monitoring video, when the light is low, the monitoring device can automatically adjust the color acquisition mode to the night vision black and white mode, thereby collecting night vision black and white monitoring videos. Therefore, when determining the content of the video image to be identified, the acquisition mode adjustment time of the monitoring device of the monitoring video file to be identified corresponding to the video image content to be identified is obtained, that is, the time of adjusting from the color acquisition mode to the night vision black and white mode is obtained, thereby determining the time of adjusting the mode of the monitoring device. Then, the shooting time of the video image to be identified is further obtained, and the shooting time of the video image to be identified can be obtained from the video information. By comparing the acquisition mode adjustment time and the shooting time, when the shooting time is before the acquisition mode adjustment time, it can be determined that the video image to be identified is a color image, and when the shooting time is after the acquisition mode adjustment time, it can be determined that the video image to be identified is a night vision image. In one embodiment, when the image type is a color image, a human body posture model obtained through training is used to identify human body key points in the image to be identified, and based on the identified human body key points, the position information of the person in the video image to be identified is determined, specifically including: using the front network layer of the human body posture model to extract features of the video image to be identified, and obtaining a feature map corresponding to the video image to be identified; using the confidence network layer of the human body posture model to extract the human body key points of the human body in the video image to be identified from the feature map, and obtaining a key point confidence map corresponding to the human body key points in the video image to be identified; using the correlation vector network layer of the human body posture model to extract the correlation of each of the human body key points in the video image to be identified from the feature map; determining the person position information of the video image to be identified according to the key point confidence map and the correlation of the human body key points.
[0074] Specifically, when the video image to be identified is a color image, the video image to be identified is first input into the front network of the human body model, and the front network layer performs convolution and pooling and other feature extraction operations on the video image to be identified, and then converts it into a feature map corresponding to the video image to be identified. Then the feature map is input into a dual-branch multi-level CNN network, that is, each human key point and the corresponding key point confidence map are obtained through the confidence network in the dual-branch network, and the correlation of each human key point is obtained through the correlation vector field network in the dual-branch network, that is, the position information of the person in the video image to be identified is determined according to the key point confidence map and the correlation of the human key points. The human key points of the person in the video image to be identified can be found through the key point confidence map, and the effective connection between the human key points can be obtained according to the correlation, that is, the position of the person can be determined through the key point confidence map and the correlation.
[0075] In one embodiment, the person position information of the video image to be identified is determined based on the correlation between the key point confidence map and the human key points, including: connecting the human key points on the key point confidence map according to the correlation between the human key points, and calculating the key point contour; obtaining the minimum circumscribed rectangle based on the key point contour, the minimum circumscribed rectangle being the rectangle with the smallest area including the key point contour; and determining the person position information in the video image to be identified based on the minimum circumscribed rectangle.
[0076] Among them, the key point contour refers to the irregular shape that frames the key points of the human body, and the minimum bounding rectangle refers to the minimum rectangle that frames all the key point contours. Specifically, the opencv tool is used to calculate according to the key point confidence map and the correlation degree. First, the key points of the human body on the key point confidence map are connected according to the correlation degree to obtain the corresponding posture of the human body. In addition, the key point contour is calculated using the opencv tool at the same time, and the minimum bounding rectangle is obtained according to the key point contour. The area inside the minimum bounding rectangle is the location of the person, and the position coordinates of the minimum bounding rectangle are the person's position information. Among them, if the obtained minimum bounding rectangle is deviated from the regular rectangle, that is, the obtained minimum bounding rectangle is an irregular rectangle, it will be corrected to a regular rectangle, and the final minimum bounding rectangle is a regular rectangle.
[0077] In one embodiment, Figure 4 As shown, another method for identifying the position of a person in an image is provided, that is, after obtaining the position information of the person to be identified, the method further includes the following steps:
[0078] Step S210, generating video information corresponding to the person's position information.
[0079] Step S212, writing the video information into the corresponding log.
[0080] Among them, the preset target includes but is not limited to the human body, and can also be other objects, which are preset according to actual needs. Log refers to a document used to record video information. Specifically, in this embodiment, taking the surveillance video as an example, the need for identifying the surveillance video is to identify the human body appearing in the surveillance video. Therefore, in this embodiment, the human body is used as the preset target. When the video content is obtained by identification detection, the corresponding video information is generated based on the detected person position information. Among them, the video information includes whether the video image includes the preset target, which surveillance video file the video image comes from, and the coordinate position of the preset target in the video image. It can be understood that after obtaining the source of the video image and the coordinate position of the person in the video image, it is packaged into a file to obtain the generated video information. After the video information is generated, the video information is written to the corresponding log. When the surveillance video content needs to be understood later, the log file can be directly called. The video content in all surveillance video files can be known through the video information recorded in the log file.
[0081] In one embodiment, the recognition model is a pre-trained network model, that is, the human posture model and the lightweight target detection model are pre-trained models for character position recognition. Training the human posture model and the lightweight target detection model specifically includes: obtaining historical monitoring videos of monitoring equipment; extracting color image samples and night vision image samples from the historical monitoring videos, and marking the key points of the human body in the color image samples, and marking the position coordinates of the human body in the night vision image samples, to obtain a marked color image and a marked night vision image; resizing the marked color image and the marked night vision image respectively to obtain a training color image and a training night vision image; mapping the key points of the human body in the training color image with the key points of the human body marked in the marked color image, and using the mapped training color image to train the human posture model; mapping the position coordinates in the training night vision image with the position coordinates marked in the marked night vision image, and using the mapped training night vision image to train the lightweight target detection model.
[0082] Specifically, the recognition model is trained based on the training images obtained from the historical surveillance video, so that the recognition model can fully learn the surveillance scene and be more accurate in the subsequent recognition of the surveillance video content. Since the recognition model includes two models, openpose and ssdlite, and the two models recognize different types of images, the historical surveillance videos obtained should include color videos and night vision videos.
[0083] After obtaining the historical surveillance video, FFmpeg is used to extract video images that meet the training requirements from the historical video, that is, to extract color image samples and night vision image samples including the human body. . After obtaining the color image samples and night vision image samples including the human body, the key points of the human body in the color image are annotated with the labeling software to obtain an annotated color image. Among them, the labeling software includes but is not limited to the labelme standard software. And the color image is annotated with the key points of the human body. The key points of the human body can generally have different numbers such as 9, 14, 16, 17, and 18. In order to achieve more accurate recognition, this embodiment preferably annotates the coordinates of 18 key points. The 18 key points include nose, neck, right shoulder, right elbow, right wrist, left shoulder, left elbow, left wrist, right hip, right knee, right ankle, left hip, left knee, left ankle, left eye, right eye, left ear, and right ear. The night vision image directly annotates the coordinates of the position of the person to obtain a labeled night vision image. The coordinates can be expressed as (minimum x-coordinate value, minimum y-coordinate value, maximum x-coordinate value, maximum y-coordinate value), that is, (xmin, ymin, xmax, ymax).
[0084] Since the openpose and ssdlite models process images differently, the sizes of input images they can accept are different. Therefore, after the color image is annotated with key points of the human body, the corresponding annotated color image needs to be scaled to 432*368, and the annotated night vision image needs to be scaled to 300*300. The scaled annotated color image and the annotated night vision image are used as training color images and training night vision images. Since the coordinate positions of the scaled annotated color images and the annotated night vision images will change, the scaled annotated coordinates are mapped with the target annotations before scaling, that is, the training color images and the training night vision images are mapped with the corresponding annotated color images and the annotated night vision images, and then the training color images and the training night vision images are input into the corresponding models for training. By establishing the mapping relationship and then training, the correct coordinates can be learned during the model training process. Among them, the color image is input into the Openpose model for training, and the night vision image is input into the ssdlite model for training.
[0085] It should be understood that although Figure 2-3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-3At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0086] In one embodiment, Figure 5 As shown, a device for identifying the position of a person in an image is provided, comprising: a preprocessing module 502, a determination module 504 and a recognition module 506, wherein:
[0087] The preprocessing module 502 is used to obtain the surveillance video file to be identified, and preprocess the surveillance video file to be identified to obtain the video image to be identified.
[0088] The determination module 504 is used to determine the image type of the video image to be identified.
[0089] The recognition module 506 is used to recognize the key points of the human body in the video image to be recognized through the human posture model obtained through training when the image type is a color image, and determine the position information of the person in the video image to be recognized based on the recognized key points of the human body.
[0090] The recognition module 506 is also used to recognize the position information of the person in the video image to be recognized by using the lightweight target detection model obtained through training when the image type is a night vision image.
[0091] In one embodiment, the determination module 504 is also used to obtain the three-channel pixel values of each pixel in the video image to be identified; perform difference calculation based on the three-channel pixel values, and select the value with the largest difference as the pixel difference; determine the image type of the video image to be identified based on the preset value and the pixel difference.
[0092] In one embodiment, the determination module 504 is further used to obtain the acquisition mode adjustment time of the monitoring device corresponding to the monitoring video file to be identified, and obtain the shooting time corresponding to the video image to be identified; and determine the image type of the video image to be identified according to the acquisition mode adjustment time.
[0093] In one embodiment, the recognition module 506 is also used to use the front network layer of the human posture model to extract features of the video image to be identified, and obtain a feature map corresponding to the video image to be identified; use the confidence network layer of the human posture model to extract the human body key points of the human body in the video image to be identified from the feature map, and obtain the key point confidence map corresponding to the human body key points in the video image to be identified; use the correlation vector network layer of the human posture model to extract the correlation of each of the human body key points in the video image to be identified from the feature map; determine the character position information of the video image to be identified based on the key point confidence map and the correlation of the human body key points.
[0094] In one embodiment, the recognition module 506 is also used to connect the human key points on the key point confidence map according to the correlation of the human key points, and calculate the key point contour; obtain the minimum circumscribed rectangle according to the key point contour, the minimum circumscribed rectangle is the rectangle with the smallest area including the key point contour; determine the person position information in the video image to be identified according to the minimum circumscribed rectangle.
[0095] In one embodiment, the device for identifying the position of a person in an image further includes a generating module, which is used to generate video information corresponding to the position information of the person; and write the video information into a corresponding log.
[0096] In one embodiment, the device for identifying the position of a person in an image also includes a training module, which is used to obtain historical monitoring videos of monitoring equipment; extract color image samples and night vision image samples from the historical monitoring videos, and mark the key points of the human body in the color image samples, and mark the position coordinates of the human body in the night vision image samples to obtain a marked color image and a marked night vision image; resize the marked color image and the marked night vision image respectively to obtain a training color image and a training night vision image; map the key points of the human body in the training color image with the key points of the human body marked in the marked color image, and use the mapped training color image to train the human body posture model; map the position coordinates in the training night vision image with the position coordinates marked in the marked night vision image, and use the mapped training night vision image to train the lightweight target detection model.
[0097] The specific definition of the device for identifying the position of a person in an image can be found in the definition of the method for identifying the position of a person in an image above, which will not be repeated here. Each module in the above-mentioned surveillance video content recognition device can be implemented in whole or in part by software, hardware and a combination thereof. 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 operations corresponding to the above modules.
[0098] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface and a database 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, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for identifying the position of a person in an image is implemented.
[0099] Those skilled in the art will understand that Figure 6 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.
[0100] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0101] Obtain a surveillance video file to be identified, and pre-process the surveillance video file to be identified to obtain a video image to be identified;
[0102] Determine the image type of the video image to be identified;
[0103] When the image type is a color image, the human body key points in the video image to be identified are identified through the human body posture model obtained through training, and the position information of the person in the video image to be identified is determined based on the identified human body key points;
[0104] When the image type is a night vision image, the lightweight target detection model obtained through training is used to identify the position information of the person in the video image to be identified.
[0105] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0106] The three-channel pixel value of each pixel in the video image to be identified is obtained; a difference calculation is performed based on the three-channel pixel values, and a value with the largest difference is selected as the pixel difference; and the image type of the video image to be identified is determined according to a preset value and the pixel difference.
[0107] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0108] The acquisition mode adjustment time of the monitoring device corresponding to the monitoring video file to be identified is obtained, and the shooting time corresponding to the video image to be identified is obtained; and the image type of the video image to be identified is determined according to the acquisition mode adjustment time.
[0109] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0110] The front network layer of the human body posture model is used to extract features of the video image to be identified, and a feature map corresponding to the video image to be identified is obtained; the confidence network layer of the human body posture model is used to extract the human body key points of the human body in the video image to be identified from the feature map, and a key point confidence map corresponding to the human body key points in the video image to be identified is obtained; the correlation vector network layer of the human body posture model is used to extract the correlation of each human body key point in the video image to be identified from the feature map; and the person position information of the video image to be identified is determined according to the key point confidence map and the correlation of the human body key points.
[0111] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0112] According to the correlation degree of the key points of the human body, the key points of the human body on the key point confidence map are connected, and the key point contour is calculated; the minimum circumscribed rectangle is obtained according to the key point contour, and the minimum circumscribed rectangle is the rectangle with the smallest area including the key point contour; the person position information in the video image to be identified is determined according to the minimum circumscribed rectangle.
[0113] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0114] Generate video information corresponding to the person's position information; write the video information into the corresponding log.
[0115] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0116] Acquire historical surveillance videos of surveillance equipment; extract color image samples and night vision image samples from the historical surveillance videos, and annotate key points of human bodies in the color image samples, and annotate position coordinates of human bodies in the night vision image samples, to obtain annotated color images and annotated night vision images; resize the annotated color images and annotated night vision images, respectively, to obtain training color images and training night vision images; map the key points of human bodies in the training color images with the key points of human bodies annotated in the annotated color images, and train the human body posture model using the mapped training color images; map the position coordinates in the training night vision images with the position coordinates annotated in the annotated night vision images, and train the lightweight target detection model using the mapped training night vision images.
[0117] 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:
[0118] Obtain a surveillance video file to be identified, and pre-process the surveillance video file to be identified to obtain a video image to be identified;
[0119] Determine the image type of the video image to be identified;
[0120] When the image type is a color image, the human body key points in the video image to be identified are identified through the human body posture model obtained through training, and the position information of the person in the video image to be identified is determined based on the identified human body key points;
[0121] When the image type is a night vision image, the lightweight target detection model obtained through training is used to identify the position information of the person in the video image to be identified.
[0122] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0123] The three-channel pixel value of each pixel in the video image to be identified is obtained; a difference calculation is performed based on the three-channel pixel values, and a value with the largest difference is selected as the pixel difference; and the image type of the video image to be identified is determined according to a preset value and the pixel difference.
[0124] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0125] The acquisition mode adjustment time of the monitoring device corresponding to the monitoring video file to be identified is obtained, and the shooting time corresponding to the video image to be identified is obtained; and the image type of the video image to be identified is determined according to the acquisition mode adjustment time.
[0126] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0127] The front network layer of the human body posture model is used to extract features of the video image to be identified, and a feature map corresponding to the video image to be identified is obtained; the confidence network layer of the human body posture model is used to extract the human body key points of the human body in the video image to be identified from the feature map, and a key point confidence map corresponding to the human body key points in the video image to be identified is obtained; the correlation vector network layer of the human body posture model is used to extract the correlation of each human body key point in the video image to be identified from the feature map; and the person position information of the video image to be identified is determined according to the key point confidence map and the correlation of the human body key points.
[0128] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0129] According to the correlation degree of the key points of the human body, the key points of the human body on the key point confidence map are connected, and the key point contour is calculated; the minimum circumscribed rectangle is obtained according to the key point contour, and the minimum circumscribed rectangle is the rectangle with the smallest area including the key point contour; the person position information in the video image to be identified is determined according to the minimum circumscribed rectangle.
[0130] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0131] Generate video information corresponding to the person's position information; write the video information into the corresponding log.
[0132] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0133] Acquire historical surveillance videos of surveillance equipment; extract color image samples and night vision image samples from the historical surveillance videos, and annotate key points of human bodies in the color image samples, and annotate position coordinates of human bodies in the night vision image samples, to obtain annotated color images and annotated night vision images; resize the annotated color images and annotated night vision images, respectively, to obtain training color images and training night vision images; map the key points of human bodies in the training color images with the key points of human bodies annotated in the annotated color images, and train the human body posture model using the mapped training color images; map the position coordinates in the training night vision images with the position coordinates annotated in the annotated night vision images, and train the lightweight target detection model using the mapped training night vision images.
[0134] 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 memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0135] 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.
[0136] The above-mentioned 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 invention patent. 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 patent of the present application shall be subject to the attached claims.
Claims
1. A method for identifying a person's position in an image, the method comprising: Acquire a surveillance video file to be identified, and preprocess the surveillance video file to be identified to obtain a video image to be identified; Determining the image type of the video image to be identified; When the image type is a color image, the front network layer of the human posture model obtained through training is used to perform feature extraction on the video image to be identified, and a feature map corresponding to the video image to be identified is obtained; the confidence network layer of the human posture model is used to extract the human key points of the human body in the video image to be identified from the feature map, and a key point confidence map corresponding to the human key points in the video image to be identified is obtained; the correlation vector network layer of the human posture model is used to extract the correlation degree of each of the human key points in the video image to be identified from the feature map, and the person position information in the video image to be identified is determined according to the key point confidence map and the correlation degree of the human key points; When the image type is a night vision image, identifying the position information of the person in the video image to be identified by using a lightweight target detection model obtained through training; Before obtaining the surveillance video file to be identified, the method further includes the step of training the human posture model and the lightweight target detection model; The step of training the human posture model and the lightweight object detection model comprises: Obtain historical surveillance videos of surveillance equipment; Color image samples and night vision image samples are extracted from the historical surveillance video, and the key points of the human body in the color image samples are annotated, and the position coordinates of the human body in the night vision image samples are annotated to obtain an annotated color image and an annotated night vision image; the annotated color image and the annotated night vision image are resized to obtain a training color image and a training night vision image; the key points of the human body in the training color image are mapped with the key points of the human body annotated in the annotated color image, and the human body posture model is trained using the mapped training color image; the position coordinates in the training night vision image are mapped with the position coordinates annotated in the annotated night vision image, and the lightweight target detection model is trained using the mapped training night vision image.
2. The method according to claim 1, characterized in that The step of determining the image type of the video image to be identified comprises: Obtaining three-channel pixel values of each pixel in the video image to be identified; Performing difference calculation based on the three-channel pixel values, and selecting the value with the largest difference as the pixel difference; The image type of the video image to be identified is determined according to a preset value and the pixel difference value.
3. The method according to claim 1, characterized in that The determining the image type of the video image to be identified includes: Obtaining the acquisition mode adjustment time of the monitoring device corresponding to the monitoring video file to be identified, and obtaining the shooting time corresponding to the video image to be identified; The image type of the video image to be identified is determined by adjusting the time according to the acquisition mode.
4. The method according to claim 1, characterized in that: The determining the person position information of the to-be-identified video image according to the correlation between the key point confidence map and the human key points includes: According to the correlation degree of the human body key points, the human body key points on the key point confidence map are connected, and the key point contours are calculated; Acquire a minimum circumscribed rectangle according to the key point contour, wherein the minimum circumscribed rectangle is a rectangle with the smallest area including the key point contour; The position information of the person in the video image to be identified is determined according to the circumscribed minimum rectangle.
5. The method according to claim 1, characterized in that After obtaining the person's location information, the method further includes: Generating video information corresponding to the person's position information; The video information is written into the corresponding log.
6. A device for identifying the position of a person in an image, characterized in that: The device comprises: A preprocessing module is used to obtain a surveillance video file to be identified, and preprocess the surveillance video file to be identified to obtain a video image to be identified; A determination module, used to determine the image type of the video image to be identified; A recognition module, used for, when the image type is a color image, using the front network layer of the human posture model obtained through training to perform feature extraction on the video image to be identified, obtaining a feature map corresponding to the video image to be identified, extracting human key points of the human body in the video image to be identified from the feature map using the confidence network layer of the human posture model, obtaining a key point confidence map corresponding to the human key points in the video image to be identified, extracting the degree of association of each of the human key points in the video image to be identified from the feature map using the degree of association vector network layer of the human posture model, and determining the position information of the person in the video image to be identified according to the key point confidence map and the degree of association of the human key points; The recognition module is also used to identify the position information of the person in the video image to be recognized by using the lightweight target detection model obtained through training when the image type is a night vision image; It also includes a training module, which is used to: obtain historical monitoring videos of monitoring equipment; extract color image samples and night vision image samples from the historical monitoring videos, and mark the key points of the human body in the color image samples, and mark the position coordinates of the human body in the night vision image samples to obtain a marked color image and a marked night vision image; resize the marked color image and the marked night vision image respectively to obtain a training color image and a training night vision image; map the key points of the human body in the training color image with the key points of the human body marked in the marked color image, and use the mapped training color image to train the human body posture model; map the position coordinates in the training night vision image with the position coordinates marked in the marked night vision image, and use the mapped training night vision image to train the lightweight target detection model.
7. The device according to claim 6, characterized in that The determining module is further used for: Obtain three-channel pixel values of each pixel in the video image to be identified; perform difference calculation based on the three-channel pixel values, and select the value with the largest difference as the pixel difference; determine the image type of the video image to be identified according to a preset value and the pixel difference.
8. The device according to claim 6, characterized in that The determining module is further used for: The acquisition mode adjustment time of the monitoring device corresponding to the monitoring video file to be identified is obtained, and the shooting time corresponding to the video image to be identified is obtained; and the image type of the video image to be identified is determined according to the acquisition mode adjustment time.
9. 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 5 are implemented.
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 method according to any one of claims 1 to 5 are implemented.
