Park dressing behavior abnormity visual detection method
By using cameras and image processing technology in food processing parks and analyzing employee dressing situations in combination with machine learning algorithms, the problem of difficulty in effectively monitoring employee dressing behavior in the existing technology is solved, and efficient and accurate dress monitoring and abnormal recognition are achieved.
Patent Information
- Application Number
- CN202411746306.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-12-02
AI Technical Summary
In food processing parks, it is difficult for existing technology to effectively monitor and manage employees' dressing behavior, resulting in possible cross-infection or product contamination, affecting corporate reputation and economic benefits.
The dress of employees in the park is captured in real time through the camera, and image processing and machine learning algorithm analysis are used to build a pedestrian area recognition model in the park, extract pedestrian video features and clothing features, and similarity calculations are made to identify dress abnormalities.
It improves the efficiency and accuracy of dress monitoring of park staff, can identify and alert dress abnormalities in real time, effectively preventing cross-infection and product contamination.
Smart Images

Figure CN119580308A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of clothing detection in a park, and in particular to a method for visually detecting abnormal clothing behavior in a park. Background Art
[0002] In modern society, food processing parks, as important carriers of economic activities, carry a large number of production, R&D and service activities. The management of the park not only involves the rational allocation and efficient use of resources, but also includes the standardized management of employee behavior. Among them, employee dress behavior is an important part of park management, which directly affects the corporate image and health and hygiene management. Employees who do not wear standard clothing may cause cross infection or product contamination, affecting the company's reputation and economic benefits. Summary of the invention
[0003] In view of this, the present invention provides a visual detection method for abnormal dressing behavior in a park, which captures the dressing situation of employees in the park in real time through cameras and other equipment, and uses image processing and machine learning algorithms for analysis, effectively improving the efficiency and accuracy of clothing monitoring of park staff.
[0004] To achieve the above object, the present invention provides a method for visually detecting abnormal dressing behavior in a park, comprising the following steps: S1: Collect the video of pedestrians in the park and extract the features to obtain the features of the video of pedestrians in the park; S2: construct a park pedestrian area recognition model, use the park pedestrian area recognition model to receive park pedestrian video features and park pedestrian videos, and recognize pedestrian sub-images from video frames in the park pedestrian videos; S3: extract multi-dimensional clothing features from pedestrian sub-images to obtain pedestrian clothing feature vectors; S4: Calculate the similarity between the pedestrian clothing feature vector and the standard clothing feature vector. If the calculated similarity exceeds a preset threshold, it means that the pedestrian in the pedestrian sub-image does not have abnormal clothing. Otherwise, it means that there is abnormal clothing.
[0005] As a further improvement method of the present invention: Optionally, collecting a video of pedestrians in the park in step S1 includes: Collect the video of pedestrians in the park, where the video of pedestrians in the park consists of continuous video frames. The representation of the collected video of pedestrians in the park is: ; ; ; in: Indicates the video of pedestrians in the park. Indicates the video of pedestrians in the park The nth video frame in the video, N represents the total number of consecutive video frames in the park pedestrian video, ; represents a pixel matrix with X rows and Y columns, Represents a video frame The pixel at row x and column y in the , , X represents the number of pixel rows in the video frame, and Y represents the number of pixel columns in the video frame; Represents pixels The color values in the R, G, and B color channels respectively; Extract the grayscale value and gradient value of the pixel in the video frame, and extract the features of the park pedestrian video based on the grayscale value and gradient value of the pixel. The gray value is , the gradient value is : ; ; in: Indicates selection The maximum value in .
[0006] Optionally, extracting features from the park pedestrian video includes: S11: Calculate the motion information of pixels in the video frame, where pixels The motion information is : ; ; ; ; ; ; in: represents an exponential function with a natural constant as base; Represents pixels The neighborhood pixel gradient sequence, Represents pixels The gradient value of the jth neighboring pixel, , where the neighborhood pixels are pixels Pixels in a 3×3 pixel area centered on ; Represents pixels The gradient change sequence of the neighborhood pixels, Represents pixels The gradient change value of the j-th neighborhood pixel; Represents pixels The grayscale weight sequence of the neighborhood pixels, Represents pixels The grayscale weight of the jth neighboring pixel, Represents pixels The gray value of the jth neighboring pixel; Represents pixels The j-th neighborhood pixel to pixel The Euclidean distance of T stands for transpose; S12: Combine the motion information of the pixels and extract multi-scale features of the video frame in multiple dimensions to obtain multi-scale features of the pixels. The multi-scale features are : ; ; in: Display Pixels The eigenvalues at scale c, , C represents the maximum scale; Display Pixels Neighborhood information of the jth neighboring pixel; represents the convolution kernel of scale c, , , Convolution kernels are represented in turn kernel size in width, height, and time dimensions; Represents the convolution kernel In width ,high And the time dimension The value of S13: Based on the multi-scale features of pixels, a multi-scale feature matrix of video frames is constructed, and the multi-scale feature matrix of continuous video frames is used as the video feature of pedestrians in the park : ; ; in: Represents a video frame The multi-scale feature matrix of Represents a video frame Feature matrix at scale c.
[0007] Optionally, constructing a park pedestrian area recognition model in step S2 includes: Constructing a park pedestrian area recognition model, wherein the park pedestrian area recognition model takes park pedestrian video features and video frames of park pedestrian videos as input, and takes pedestrian sub-images in video frames as output, wherein the park pedestrian area recognition model includes an input layer, an anchor frame initialization layer, a pedestrian pixel recognition layer, an anchor frame regression layer, and an anchor frame correction layer; The input layer is used to receive the video features of pedestrians in the park and the video frames of pedestrians in the park; The anchor box initialization layer is used to generate an anchor box of fixed size for each pixel; The pedestrian pixel recognition layer is used to identify the pedestrian pixels describing pedestrians in the anchor frame; The anchor frame regression layer is used to construct a training function and regress the correction parameters of the anchor frame based on the distribution of pedestrian pixels in the anchor frame. The anchor frame correction layer is used to correct the anchor frame of each pixel and filter out anchor frames with abnormal sizes, and use the image contained in the anchor frame in the video frame as the pedestrian sub-image in the video frame; The park pedestrian area recognition model is used to receive park pedestrian video features and park pedestrian videos, and pedestrian sub-images are recognized from video frames in the park pedestrian videos.
[0008] Optionally, the using of the park pedestrian area recognition model to receive park pedestrian video features and the park pedestrian video, and identifying pedestrian sub-images from video frames in the park pedestrian video, includes: S21: The input layer receives the video features of pedestrians in the park and video frames of the park pedestrian video; S22: Anchor box initialization layer generates a fixed-size anchor box for each pixel, where the pixel The vertex coordinates of the anchor box are , , , , is the pixel width of the anchor box, is the pixel length of the anchor box; S23: The pedestrian pixel recognition layer identifies and marks the pedestrian pixels describing pedestrians in the anchor frame based on the multi-scale features of the pixels. The identification formula is: ; ; in: Represents pixels The marking results, Represents pixels is the pedestrian pixel, Represents pixels Not for pedestrian pixels; Represents pixels The multi-scale fusion value of Indicates the preset threshold; represents the attention weight of scale c; S24: The anchor frame regression layer constructs a training function and performs regression calculation on the correction parameters of the anchor frame based on the distribution of pedestrian pixels in the anchor frame; Pixels The correction parameters of the corresponding anchor frame are: , Indicates the horizontal offset of the center coordinates of the anchor box. Indicates the vertical offset of the center coordinate of the anchor box. Indicates the scaling ratio of the anchor box width, Indicates the scaling ratio of the anchor box length; S25: The anchor frame correction layer corrects the anchor frame of each pixel. The correction result of the vertex coordinates of the corresponding anchor frame is: ; ; ; ; S26: Count the total number of pixels in the corrected anchor frame, mark the anchor frame with pixels below a preset threshold as an anchor frame with abnormal size, and filter it, use non-maximum suppression to remove overlapping anchor frames, and use the image contained in the anchor frame in the video frame as the pedestrian sub-image in the video frame, where the video frame The pedestrian sub-image set is: ; in: Represents a video frame The kth pedestrian sub-image in Represents a video frame The total number of pedestrian sub-images in the image.
[0009] Optionally, in step S3, extracting multi-dimensional clothing features from the pedestrian sub-image includes: The multi-dimensional clothing feature extraction is performed on the pedestrian sub-image to obtain the pedestrian clothing feature vector, where the pedestrian sub-image The multi-dimensional clothing feature extraction process is as follows: S31: Calculate pedestrian sub-image The color saturation of any pixel in the pedestrian sub-image The color saturation of the sth pixel in is : ; in: , , represents pedestrian sub-images in turn The color value of the sth pixel in the R, G, B color channels, , Pedestrian sub-image The total number of pixels; Indicates selection The minimum value in ; S32: Calculate pedestrian sub-image The gray-level co-occurrence matrix is obtained to obtain the co-occurrence frequencies of different gray values in the 0-degree co-occurrence direction and the 45-degree co-occurrence direction, where the co-occurrence frequencies of gray values p and q in the 0-degree co-occurrence direction and the 45-degree co-occurrence direction are respectively , ; S33: Calculate the pedestrian sub-image based on the color saturation of the pixel Corner feature : ; ; in: Indicates the preset color saturation threshold; Represents the center of the s-th pixel The mean color saturation of the pixel area; Represents the response threshold. If the response threshold is exceeded, a response is made; S34: Based on the gray-level co-occurrence matrix, the pedestrian sub-image is calculated Grayscale entropy features at 0 degree co-occurrence direction and 45 degree co-occurrence direction , : ; ; S35: Construct pedestrian sub-image The pedestrian clothing feature vector is: .
[0010] Optionally, in step S4, similarity calculation is performed between the pedestrian clothing feature vector and the standard clothing feature vector, including: Collect images of pedestrians wearing standard clothing, perform multi-dimensional clothing feature extraction, and use the feature extraction results as standard clothing feature vectors ,in , , They represent the corner point features and grayscale entropy features of pedestrian images wearing standard clothing respectively; the pedestrian clothing feature vector is compared with the standard clothing feature vector The similarity is calculated as the similarity between the pedestrian's clothing in the pedestrian sub-image and the standard clothing, where and The similarity calculation formula is: ; in: express and The similarity between represents the L2 norm; If the calculated similarity exceeds a preset threshold, it means that the pedestrian in the pedestrian sub-image does not have abnormal clothing, otherwise it means that there is abnormal clothing.
[0011] Optionally, in step S24, the anchor frame regression layer constructs a training function to perform regression calculation on the correction parameters of the anchor frame, including: S241: Obtain U groups of scene images under different scenes, and manually mark pedestrians in the scene images with anchor frames, where the size of the scene image is consistent with the size of the anchor frame in step S22. The entire scene image is used as a group of anchor frames, and the center coordinates of the anchor frames are the center coordinates of the scene image, forming a training data set data: ; in: represents the u-th group of scene images, represents the vertex coordinates of the manually marked anchor box of the u-th group of scene images; in the embodiment of the present invention, the number of pedestrians in each group of scene images is 1; S242: Perform pedestrian pixel recognition on the pixels in the scene image to obtain a pedestrian pixel distribution matrix, where the values of the pixels in the pedestrian pixel distribution matrix are ; S243: extracting distribution features of the pedestrian pixel distribution matrix, wherein the distribution features include pixel coordinates of the most adjacent pedestrian pixels in the pedestrian pixel distribution matrix, the maximum distance between any two pedestrian pixels in the horizontal direction, and the maximum distance between any two pedestrian pixels in the vertical direction; wherein the adjacent pedestrian pixels are pedestrian pixels whose distance to the pedestrian pixels is less than a preset distance threshold; S244: Combine distribution characteristics and training data sets to construct a training function for regression parameters : ; ; in: represents the regression parameter, The regression coefficients representing the horizontal offset of the center coordinate of the anchor box, the vertical offset, the scaling ratio of the width of the anchor box, and the scaling ratio of the length of the anchor box respectively; is the distribution feature of the u-th group of scene images, is the pixel coordinate with the most adjacent pedestrian pixels, are the maximum distance between any two pedestrian pixels in the horizontal direction and the maximum distance in the vertical direction respectively; Represents the use of regression parameters Perform regression calculation to obtain the correction parameters of the initial anchor frame of the u-th group of scene images; Indicates the coordinate result obtained by correcting the vertex coordinates of the anchor box using the correction parameters; represents the L1 norm; S245: using a gradient descent algorithm to solve the regression parameters in the training function, and using the regression parameters to perform regression calculation on the distribution characteristics of the pedestrian pixel distribution matrix in the anchor frame to obtain correction parameters of any anchor frame.
[0012] In order to solve the above problem, the present invention provides an electronic device, the electronic device comprising: A memory storing at least one instruction; Communication interface, enabling electronic equipment to communicate; and The processor executes the instructions stored in the memory to implement the above-mentioned visual detection method for abnormal dressing behavior in the park.
[0013] In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one instruction is stored. The at least one instruction is executed by a processor in an electronic device to implement the above-mentioned visual detection method for abnormal dressing behavior in a campus.
[0014] Compared with the prior art, the present invention proposes a method for visually detecting abnormal dressing behavior in a park, which has the following advantages: First, this scheme proposes a video feature extraction method, which combines the grayscale change of the pixel's neighborhood pixels and the gradient change of the neighborhood pixels to calculate the motion information of the pixel. The higher the motion information, the higher the probability that the pixel is a dynamic pixel. The motion information of the pixel is used as a weight to perform multi-scale feature extraction, and obtain convolution features that characterize the temporal and scale changes of the pixel. The spatiotemporal characteristics of the pixel in the video are captured as the video features of pedestrians in the park, which improves the robustness of pedestrian pixel recognition.
[0015] At the same time, this scheme proposes a pedestrian image recognition and clothing anomaly detection method, which uses the park pedestrian area recognition model to generate anchor frames of different pixels and perform pedestrian pixel recognition, and corrects the anchor frame according to the distribution characteristics of pedestrian pixels in the pedestrian pixel recognition result, so that the proportion of pedestrian pixels in the anchor frame is larger, and further filters the background pixels to highlight the pedestrian area, and then extracts the pedestrian sub-image, and extracts the corner point features and grayscale entropy features that characterize the color changes and stripe changes of clothing according to the color saturation and grayscale co-occurrence matrix of the pedestrian sub-image. The larger the grayscale entropy, the more obvious the stripes, and the larger the corner point features, the brighter the clothing color. The pedestrian clothing feature vector is calculated for similarity with the standard clothing feature vector, and the calculation result is the visual detection result of clothing anomalies. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A flow chart of a method for visually detecting abnormal dressing behavior in a park provided by one embodiment of the present invention.
[0017] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0018] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0019] The embodiment of the present application provides a method for visually detecting abnormal dressing behavior in a park. The execution subject of the method for visually detecting abnormal dressing behavior in a park includes but is not limited to at least one of the electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiment of the present application. In other words, the method for visually detecting abnormal dressing behavior in a park can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.
[0020] Embodiment 1: A method for visually detecting abnormal dressing behavior in a park, comprising the following steps: S1: Collect park pedestrian videos and perform feature extraction to obtain park pedestrian video features.
[0021] The step S1 includes collecting the video of pedestrians in the park, including: Collect the video of pedestrians in the park, where the video of pedestrians in the park consists of continuous video frames. The representation of the collected video of pedestrians in the park is: ; ; ; in: Indicates the video of pedestrians in the park. Indicates the video of pedestrians in the park The nth video frame in the video, N represents the total number of consecutive video frames in the park pedestrian video, ; represents a pixel matrix with X rows and Y columns, Represents a video frame The pixel at row x and column y in , , X represents the number of pixel rows in the video frame, and Y represents the number of pixel columns in the video frame; Represents pixels The color values in the R, G, and B color channels respectively; Extract the grayscale value and gradient value of the pixel in the video frame, and extract the features of the park pedestrian video based on the grayscale value and gradient value of the pixel. The gray value is , the gradient value is : ; ; in: Indicates selection The maximum value in .
[0022] The feature extraction of the park pedestrian video includes: S11: Calculate the motion information of pixels in the video frame, where pixels The motion information is : ; ; ; ; ; ; in: represents an exponential function with a natural constant as base; Represents pixels The neighborhood pixel gradient sequence, Represents pixels The gradient value of the jth neighboring pixel, , where the neighborhood pixels are pixels Pixels in a 3×3 pixel area centered on ; Represents pixels The gradient change sequence of the neighborhood pixels, Represents pixels The gradient change value of the j-th neighborhood pixel; Represents pixels The grayscale weight sequence of the neighborhood pixels, Represents pixels The grayscale weight of the jth neighboring pixel, Represents pixels The gray value of the jth neighboring pixel; S12: Combine the motion information of the pixels and extract multi-scale features of the video frame in multiple dimensions to obtain multi-scale features of the pixels. The multi-scale features are : ; ; in: Display Pixels The eigenvalues at scale c, , C represents the maximum scale; Display Pixels Neighborhood information of the jth neighboring pixel; represents the convolution kernel of scale c, , , Convolution kernels are represented in turn kernel size in width, height, and time dimensions; Represents the convolution kernel In width ,high And the time dimension The value of S13: Based on the multi-scale features of pixels, a multi-scale feature matrix of video frames is constructed, and the multi-scale feature matrix of continuous video frames is used as the video feature of pedestrians in the park : ; ; in: Represents a video frame The multi-scale feature matrix of Represents a video frame Feature matrix at scale c.
[0023] S2: construct a park pedestrian area recognition model, use the park pedestrian area recognition model to receive park pedestrian video features and park pedestrian videos, and recognize pedestrian sub-images from video frames in the park pedestrian videos.
[0024] The step S2 constructs a park pedestrian area recognition model, including: Constructing a park pedestrian area recognition model, wherein the park pedestrian area recognition model takes park pedestrian video features and video frames of park pedestrian videos as input, and takes pedestrian sub-images in video frames as output, wherein the park pedestrian area recognition model includes an input layer, an anchor frame initialization layer, a pedestrian pixel recognition layer, an anchor frame regression layer, and an anchor frame correction layer; The input layer is used to receive the video features of pedestrians in the park and the video frames of pedestrians in the park; The anchor box initialization layer is used to generate an anchor box of fixed size for each pixel; The pedestrian pixel recognition layer is used to identify the pedestrian pixels describing pedestrians in the anchor frame; The anchor frame regression layer is used to construct a training function and regress the correction parameters of the anchor frame based on the distribution of pedestrian pixels in the anchor frame. The anchor frame correction layer is used to correct the anchor frame of each pixel and filter out anchor frames with abnormal sizes, and use the image contained in the anchor frame in the video frame as the pedestrian sub-image in the video frame; The park pedestrian area recognition model is used to receive park pedestrian video features and park pedestrian videos, and pedestrian sub-images are recognized from video frames in the park pedestrian videos.
[0025] The method of using the park pedestrian area recognition model to receive park pedestrian video features and park pedestrian video, and identifying pedestrian sub-images from video frames in the park pedestrian video, includes: S21: The input layer receives the video features of pedestrians in the park and video frames of the park pedestrian video; S22: Anchor box initialization layer generates a fixed-size anchor box for each pixel, where the pixel The vertex coordinates of the anchor box are , , , , is the pixel width of the anchor box, is the pixel length of the anchor box; S23: The pedestrian pixel recognition layer identifies and marks the pedestrian pixels describing pedestrians in the anchor frame based on the multi-scale features of the pixels. The identification formula is: ; ; in: Represents pixels The marking results, Represents pixels is the pedestrian pixel, Represents pixels Not for pedestrian pixels; Represents pixels The multi-scale fusion value of Indicates the preset threshold; represents the attention weight of scale c; S24: The anchor frame regression layer constructs a training function and performs regression calculation on the correction parameters of the anchor frame based on the distribution of pedestrian pixels in the anchor frame; Pixels The correction parameters of the corresponding anchor frame are: , Indicates the horizontal offset of the center coordinates of the anchor box. Indicates the vertical offset of the center coordinate of the anchor box. Indicates the scaling ratio of the anchor box width, Indicates the scaling ratio of the anchor box length; S25: The anchor frame correction layer corrects the anchor frame of each pixel. The correction result of the vertex coordinates of the corresponding anchor frame is: ; ; ; ; S26: Count the total number of pixels in the corrected anchor frame, mark the anchor frame with pixels below a preset threshold as an anchor frame with abnormal size, and filter it, use non-maximum suppression to remove overlapping anchor frames, and use the image contained in the anchor frame in the video frame as the pedestrian sub-image in the video frame, where the video frame The pedestrian sub-image set is: ; in: Represents a video frame The kth pedestrian sub-image in Represents a video frame The total number of pedestrian sub-images in the image.
[0026] S3: Extract multi-dimensional clothing features from the pedestrian sub-image to obtain the pedestrian clothing feature vector.
[0027] In the step S3, multi-dimensional clothing feature extraction is performed on the pedestrian sub-image, including: The multi-dimensional clothing feature extraction is performed on the pedestrian sub-image to obtain the pedestrian clothing feature vector, where the pedestrian sub-image The multi-dimensional clothing feature extraction process is as follows: S31: Calculate pedestrian sub-image The color saturation of any pixel in the pedestrian sub-image The color saturation of the sth pixel in is : ; in: , , represents pedestrian sub-images in turn The color value of the sth pixel in the R, G, B color channels, , Pedestrian sub-image The total number of pixels; Indicates selection The minimum value in ; S32: Calculate pedestrian sub-image The gray-level co-occurrence matrix is obtained to obtain the co-occurrence frequencies of different gray values in the 0-degree co-occurrence direction and the 45-degree co-occurrence direction, where the co-occurrence frequencies of gray values p and q in the 0-degree co-occurrence direction and the 45-degree co-occurrence direction are respectively , ; S33: Calculate the pedestrian sub-image based on the color saturation of the pixel Corner feature : ; ; in: Indicates the preset color saturation threshold; Represents the center of the s-th pixel The mean color saturation of the pixel area; Represents the response threshold. If the response threshold is exceeded, a response is made; S34: Based on the gray-level co-occurrence matrix, the pedestrian sub-image is calculated Grayscale entropy features at 0 degree co-occurrence direction and 45 degree co-occurrence direction , : ; ; S35: Construct pedestrian sub-image The pedestrian clothing feature vector is: .
[0028] S4: Calculate the similarity between the pedestrian clothing feature vector and the standard clothing feature vector. If the calculated similarity exceeds a preset threshold, it means that the pedestrian in the pedestrian sub-image does not have abnormal clothing. Otherwise, it means that there is abnormal clothing.
[0029] In the step S4, similarity calculation is performed between the pedestrian clothing feature vector and the standard clothing feature vector, including: Collect images of pedestrians wearing standard clothing, perform multi-dimensional clothing feature extraction, and use the feature extraction results as standard clothing feature vectors ,in , , They represent the corner point features and grayscale entropy features of pedestrian images wearing standard clothing respectively; the pedestrian clothing feature vector is compared with the standard clothing feature vector The similarity is calculated as the similarity between the pedestrian's clothing in the pedestrian sub-image and the standard clothing, where and The similarity calculation formula is: ; in: express and The similarity between represents the L2 norm; If the calculated similarity exceeds a preset threshold, it means that the pedestrian in the pedestrian sub-image does not have abnormal clothing, otherwise it means that there is abnormal clothing.
[0030] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0031] It should be noted that the serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "including a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0032] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0033] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for visually detecting abnormal dressing behavior in a park, characterized in that: The method comprises: S1: Collect the video of pedestrians in the park and extract the features to obtain the features of the video of pedestrians in the park; S2: construct a park pedestrian area recognition model, use the park pedestrian area recognition model to receive park pedestrian video features and park pedestrian videos, and recognize pedestrian sub-images from video frames in the park pedestrian videos; S3: extract multi-dimensional clothing features from pedestrian sub-images to obtain pedestrian clothing feature vectors; S4: Calculate the similarity between the pedestrian clothing feature vector and the standard clothing feature vector. If the calculated similarity exceeds a preset threshold, it means that the pedestrian in the pedestrian sub-image does not have abnormal clothing. Otherwise, it means that there is abnormal clothing.
2. A method for visually detecting abnormal dressing behavior in a park as claimed in claim 1, characterized in that: The step S1 includes collecting the video of pedestrians in the park, including: Collect the video of pedestrians in the park, where the video of pedestrians in the park consists of continuous video frames. The representation of the collected video of pedestrians in the park is: ; ; ; in: Indicates the video of pedestrians in the park. Indicates the video of pedestrians in the park The nth video frame in the video, N represents the total number of consecutive video frames in the park pedestrian video, ; represents a pixel matrix with X rows and Y columns, Represents a video frame The pixel at row x and column y in , , X represents the number of pixel rows in the video frame, and Y represents the number of pixel columns in the video frame; Represents pixels The color values in the R, G, and B color channels respectively; Extract the grayscale value and gradient value of the pixel in the video frame, and extract the features of the park pedestrian video based on the grayscale value and gradient value of the pixel. The gray value is , the gradient value is .
3. A method for visually detecting abnormal dressing behavior in a park as claimed in claim 2, characterized in that: The feature extraction of the park pedestrian video includes: S11: Calculate the motion information of pixels in the video frame, where pixels The motion information is ; S12: Combine the motion information of the pixels and extract multi-scale features of the video frame in multiple dimensions to obtain multi-scale features of the pixels. The multi-scale features are ; S13: A multi-scale feature matrix of the video frame is obtained based on the multi-scale features of the pixels, and the multi-scale feature matrix of the continuous video frames is used as the park pedestrian video feature f.
4. A method for visually detecting abnormal dressing behavior in a park as claimed in claim 1, characterized in that: The step S2 constructs a park pedestrian area recognition model, including: Constructing a park pedestrian area recognition model, wherein the park pedestrian area recognition model takes park pedestrian video features and video frames of park pedestrian videos as input, and takes pedestrian sub-images in video frames as output, wherein the park pedestrian area recognition model includes an input layer, an anchor frame initialization layer, a pedestrian pixel recognition layer, an anchor frame regression layer, and an anchor frame correction layer; The input layer is used to receive the video features of pedestrians in the park and the video frames of pedestrians in the park; The anchor box initialization layer is used to generate an anchor box of fixed size for each pixel; The pedestrian pixel recognition layer is used to identify the pedestrian pixels describing pedestrians in the anchor frame; The anchor frame regression layer is used to construct a training function and regress the correction parameters of the anchor frame based on the distribution of pedestrian pixels in the anchor frame. The anchor frame correction layer is used to correct the anchor frame of each pixel and filter out anchor frames with abnormal sizes, and use the image contained in the anchor frame in the video frame as the pedestrian sub-image in the video frame; The park pedestrian area recognition model is used to receive park pedestrian video features and park pedestrian videos, and pedestrian sub-images are recognized from video frames in the park pedestrian videos.
5. A method for visually detecting abnormal dressing behavior in a park as claimed in claim 4, characterized in that: The method of using the park pedestrian area recognition model to receive park pedestrian video features and park pedestrian video, and identifying pedestrian sub-images from video frames in the park pedestrian video, includes: S21: The input layer receives the video features of pedestrians in the park and video frames of the park pedestrian video; S22: Anchor box initialization layer generates a fixed-size anchor box for each pixel; S23: The pedestrian pixel recognition layer identifies and marks the pedestrian pixels describing the pedestrians in the anchor frame according to the multi-scale features of the pixels; S24: The anchor frame regression layer constructs a training function and performs regression calculation on the correction parameters of the anchor frame based on the distribution of pedestrian pixels in the anchor frame; S25: the anchor frame correction layer corrects the anchor frame of each pixel according to the correction parameters; S26: Count the total number of pixels in the corrected anchor frame, mark the anchor frame with pixels below a preset threshold as an anchor frame with abnormal size, and filter it, use non-maximum suppression to remove overlapping anchor frames, and use the image contained in the anchor frame in the video frame as the pedestrian sub-image in the video frame, where the video frame The pedestrian sub-image set is: ; in: Represents a video frame The kth pedestrian sub-image in Represents a video frame The total number of pedestrian sub-images in the image.
6. A method for visually detecting abnormal dressing behavior in a park as claimed in claim 5, characterized in that: In the step S3, multi-dimensional clothing feature extraction is performed on the pedestrian sub-image, including: The multi-dimensional clothing feature extraction is performed on the pedestrian sub-image to obtain the pedestrian clothing feature vector, where the pedestrian sub-image The multi-dimensional clothing feature extraction process is as follows: S31: Calculate pedestrian sub-image The color saturation of any pixel in the pedestrian sub-image The color saturation of the sth pixel in is ; S32: Calculate pedestrian sub-image The gray-level co-occurrence matrix is obtained to obtain the co-occurrence frequencies of different gray values in the 0-degree co-occurrence direction and the 45-degree co-occurrence direction, where the co-occurrence frequencies of gray values p and q in the 0-degree co-occurrence direction and the 45-degree co-occurrence direction are respectively , ; S33: Calculate the pedestrian sub-image based on the color saturation of the pixel Corner feature ; S34: Based on the gray-level co-occurrence matrix, the pedestrian sub-image is calculated Grayscale entropy features at 0 degree co-occurrence direction and 45 degree co-occurrence direction , ; S35: Construct pedestrian sub-image The pedestrian clothing feature vector: .
7. A method for visually detecting abnormal dressing behavior in a park as claimed in claim 6, characterized in that: In the step S4, similarity calculation is performed between the pedestrian clothing feature vector and the standard clothing feature vector, including: Collect images of pedestrians wearing standard clothing, perform multi-dimensional clothing feature extraction, and use the feature extraction results as standard clothing feature vectors ,in , , They represent the corner point features and grayscale entropy features of pedestrian images wearing standard clothing respectively; the pedestrian clothing feature vector is compared with the standard clothing feature vector The similarity calculation is performed as the similarity between the pedestrian's clothing in the pedestrian sub-image and the standard clothing, where and The similarity calculation formula is: ; in: express and The similarity between represents the L2 norm; If the calculated similarity exceeds a preset threshold, it means that the pedestrian in the pedestrian sub-image does not have abnormal clothing, otherwise it means that there is abnormal clothing.
8. A method for visually detecting abnormal dressing behavior in a park as claimed in claim 5, characterized in that: In step S24, the anchor frame regression layer constructs a training function to perform regression calculation on the correction parameters of the anchor frame, including: S241: Obtain U groups of scene images under different scenes, and manually mark pedestrians in the scene images with anchor frames, where the size of the scene image is consistent with the size of the anchor frame in step S22. The entire scene image is used as a group of anchor frames, and the center coordinates of the anchor frames are the center coordinates of the scene image, forming a training data set data: ; in: represents the u-th group of scene images, Represents the vertex coordinates of the manually labeled anchor boxes of the u-th group of scene images; S242: Perform pedestrian pixel recognition on the pixels in the scene image to obtain a pedestrian pixel distribution matrix, where the values of the pixels in the pedestrian pixel distribution matrix are ; S243: extracting distribution features of pedestrian pixel distribution matrix; S244: Constructing a training function of regression parameters based on the distribution characteristics and the training data set; S245: using a gradient descent algorithm to solve the regression parameters in the training function, and using the regression parameters to perform regression calculation on the distribution characteristics of the pedestrian pixel distribution matrix in the anchor frame to obtain correction parameters of any anchor frame.
Citation Information
Patent Citations
Multi-feature fusion overhead pedestrian detection method based on aggregated channel features and a gray level co-occurrence matrix
CN109190456A
Method, device and equipment for identifying uniformsign, and storage medium
CN111461101A
Method for detecting whether test field worker wears work clothes or not based on improved RetinaNet
CN112183472A
Clothing color detection method, device and equipment based on monitoring video
CN112749645A
Target recognition processing method and device, a storage medium and an electronic device
CN113537125A