Working personnel tool and cap wearing detection method and system
By combining a multi-channel image acquisition module, a work uniform and work cap recognition network, and a face recognition network, and utilizing the cumulative number detection method, the misjudgment and erroneous judgment problems of the existing work uniform and work cap detection algorithm are solved, thus achieving efficient and accurate detection of individual work uniform and work cap wearing.
Patent Information
- Application Number
- CN202510543083.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-09-26
AI Technical Summary
Existing workwear and hat detection algorithms are difficult to pinpoint to individuals, and are prone to misjudgment and misjudgment due to environmental occlusion and camera angle issues, reducing the accuracy and speed of detection.
A multi-channel image acquisition module is used to read the camera video stream through multiple processes. Combined with the work clothes and hat recognition network and the face recognition network, the cumulative number of detection methods are used to process the results to realize the detection of individual work clothes and hats.
It improves the accuracy and speed of workwear and hat wearing detection, can accurately output the identity information of the inspected person, reduces misjudgments and miscalculations, and improves detection efficiency through memory operations.
Smart Images

Figure CN120708257A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of safety detection of work clothes and work hats, and more particularly to a method and system for detecting the wearing of work clothes and work hats by workers. Background Art
[0002] With the advancement of society, safe production has become a crucial issue. However, even in safe production scenarios, some people still lack safety awareness and do not follow work procedures, such as not wearing their work uniforms and hats correctly. This behavior poses a serious threat to personnel safety, factory production, and even public security, especially for certain more dangerous types of work. With the development of artificial intelligence technology, computer vision-based inspection has become increasingly cost-effective, with increasing accuracy and speed, and its use is becoming increasingly widespread. Computer vision-based inspection of workers' uniforms and hats can leverage these advantages and become an effective method for reducing safety hazards.
[0003] In recent years, AI-based workwear and hat detection has primarily focused on broadly checking the uniforms and hats worn by workers captured by cameras, without specifically targeting individual workers. Without specific individual detection, it's difficult to provide effective warnings to violators. Furthermore, complex factory environments with high traffic volumes, obstructions, and camera angles can lead to misjudgments and false positives. Therefore, reducing these misjudgments and improving algorithm accuracy is a crucial issue.
[0004] In summary, it is necessary to propose a workwear and work cap detection method that can be specific to individuals and can significantly reduce misjudgments and erroneous judgments. Summary of the Invention
[0005] The object of the present invention is to provide a method and system for detecting the wearing of work clothes and work hats by workers, which can improve the detection accuracy and detection speed of the wearing of work clothes and work hats.
[0006] The present invention provides a method for detecting the wearing of work clothes and hats by workers, comprising the following steps: multi-channel image acquisition: utilizing a multi-process camera call algorithm to acquire video streams from all cameras to obtain a single-frame picture; work clothes and hat wearing detection: utilizing a work clothes and hat recognition network to recognize the single-frame picture to obtain head image data of workers who are not wearing prescribed work hats and upper body image data of workers who are not wearing prescribed work clothes; face recognition: utilizing a face recognition network to perform face recognition on the head image data of workers who are not wearing prescribed work hats and upper body image data of workers who are not wearing prescribed work clothes to obtain face detection results; result processing: utilizing a cumulative number detection method according to the face detection results to obtain a final work clothes and hat wearing detection result.
[0007] Furthermore, the above-mentioned multi-channel image acquisition specifically includes: using a multi-process camera calling algorithm to set at least 2 processes and at least 1 queue for each camera, wherein the first process is used to obtain a single frame from the camera video stream and put it into the queue, confirm that the queue storage is full and delete the old picture and store the new picture; the second process is used to take the single frame from the queue and store it in the memory in the form of a two-dimensional array for subsequent detection.
[0008] Furthermore, the above-mentioned work clothes and hat recognition network is obtained by training an artificial neural network using a training data set, and the training data set includes positive samples and negative samples. The positive samples include head images of people wearing prescribed work hats and upper body images of people wearing prescribed work clothes; the negative samples include head images of people not wearing prescribed work hats and upper body images of people not wearing prescribed work clothes.
[0009] Furthermore, the above-mentioned work clothes and work hat wearing detection specifically includes: using the work clothes and work hat recognition network to identify a single frame image, and after detecting a person who is not wearing the prescribed work hat in the current camera image, storing his head image in the form of a two-dimensional array in the memory to obtain the head image data of the person who is not wearing the prescribed work hat; after detecting a person who is not wearing the prescribed work clothes, storing his upper body image in the form of a two-dimensional array in the memory to obtain the upper body image data of the person who is not wearing the prescribed work clothes.
[0010] Furthermore, the above result processing specifically includes: according to the face detection result, using the cumulative number detection method to obtain the final workwear and work cap wearing detection result, such as the formula: , , , Among them, M represents the flag bit of the final work hat wearing status. When M is an integer of 0, it means the work hat is worn, and when it is an integer of 1, it means the work hat is not worn; is the threshold value of the cumulative number detection method, Z is a set of integers, i is a natural number, The flag bit of each test result, when it is an integer of 2, it means that the work cap is worn, and when it is an integer of 0, it means that the work cap is not worn; N represents the flag bit of the work clothes wearing situation, when it is an integer of 0, it means that the work clothes are worn, and when it is an integer of 1, it means that the work clothes are not worn; is the threshold value of the cumulative number detection method, i is a natural number, It is the flag of each test result. When it is an integer of 3, it means that the work clothes are worn, and when it is an integer of 1, it means that the work clothes are not worn.
[0011] The present invention also provides a system for detecting the wearing of work clothes and work hats by workers, and the system includes the following modules: a multi-channel image acquisition module is configured to use a multi-process camera call algorithm to obtain video streams from all cameras to obtain a single-frame picture; a work clothes and work hat wearing detection module is configured to use a work clothes and work hat recognition network to identify the single-frame picture to obtain head image data of personnel who are not wearing prescribed work hats and upper body image data of personnel who are not wearing prescribed work clothes; a face recognition module is configured to use a face recognition network to perform face recognition on the head image data of personnel who are not wearing prescribed work hats and upper body image data of personnel who are not wearing prescribed work clothes to obtain face detection results; a result processing module is configured to use a cumulative number detection method according to the face detection results to obtain a final work clothes and work hat wearing detection result.
[0012] Furthermore, the above-mentioned multi-channel image acquisition module is specifically configured as follows: using a multi-process camera calling algorithm, at least 2 processes and at least 1 queue are set for each camera, wherein the first process is used to obtain a single frame from the camera video stream and put it into the queue, confirm that the queue storage is full and delete the old picture and store the new picture; the second process is used to take the single frame out of the queue and store it in the memory in the form of a two-dimensional array for subsequent detection.
[0013] Furthermore, the above-mentioned work clothes and hat recognition network is obtained by training an artificial neural network using a training data set, and the training data set includes positive samples and negative samples. The positive samples include head images of people wearing prescribed work hats and upper body images of people wearing prescribed work clothes; the negative samples include head images of people not wearing prescribed work hats and upper body images of people not wearing prescribed work clothes.
[0014] Furthermore, the above-mentioned work clothes and work hat wearing detection module is specifically configured as follows: after detecting a person who is not wearing the prescribed work hat in the current camera image, the head image of the person is stored in the memory in the form of a two-dimensional array to obtain the head image data of the person who is not wearing the prescribed work hat; after detecting a person who is not wearing the prescribed work clothes, the upper body image of the person is stored in the memory in the form of a two-dimensional array to obtain the upper body image data of the person who is not wearing the prescribed work clothes.
[0015] Furthermore, the above result processing module is specifically configured as follows: according to the face detection result, the cumulative number of detection method is used to obtain the final workwear and work cap wearing detection result, such as the formula: , , , Among them, M represents the flag bit of the final work hat wearing status. When M is an integer of 0, it means the work hat is worn, and when it is an integer of 1, it means the work hat is not worn; is the threshold value of the cumulative number detection method, Z is a set of integers, i is a natural number, The flag bit of each test result, when it is an integer of 2, it means that the work cap is worn, and when it is an integer of 0, it means that the work cap is not worn; N represents the flag bit of the work clothes wearing situation, when it is an integer of 0, it means that the work clothes are worn, and when it is an integer of 1, it means that the work clothes are not worn; is the threshold value of the cumulative number detection method, i is a natural number, It is the flag of each test result. When it is an integer of 3, it means that the work clothes are worn, and when it is an integer of 1, it means that the work clothes are not worn.
[0016] The implementation of the method and system for detecting workers wearing work uniforms and work hats provided by the present invention has the following beneficial effects: The present invention utilizes a multi-channel image acquisition module to simultaneously read real-time video streams from multiple cameras through multiple processes. The workwear and work cap wear detection module includes a pre-trained workwear and work cap recognition network. Personnel images captured from the video stream are input into the network to determine and record the wear status of the current personnel. Based on the wear detection module, the face recognition module inputs the personnel image into a preset face recognition network for recognition. The result processing module uses a cumulative number detection method to determine the personnel's name and their workwear and work cap wear status. The present invention not only detects the wear of personnel using multiple cameras but also accurately outputs the identity information of the inspected personnel. Compared to existing workwear and work cap detection algorithms, the present invention can combine facial recognition algorithms to perform specific detection on an individual basis. Furthermore, the combined algorithms operate directly in computer memory without using hard disk storage, resulting in faster detection speeds. The cumulative number detection method of the present invention effectively filters out false positives and misjudgments caused by facial angles and environmental occlusion, thereby improving detection accuracy and speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which: Figure 1 This is a flow chart of a method for detecting the wearing of work uniforms and work hats by workers provided by the present invention; Figure 2 This is a flow chart of a method for detecting the wearing of work uniforms and work hats by workers according to another embodiment of the present invention; Figure 3 This is a structural block diagram of the worker uniform and hat wearing detection system provided by the present invention. DETAILED DESCRIPTION
[0018] In order to have a clearer understanding of the technical features, purposes and effects of the present invention, specific embodiments of the present invention are now described in detail with reference to the accompanying drawings.
[0019] Figure 1A schematic diagram of a method for detecting the wearing of uniforms and hats by workers in accordance with this embodiment is shown. In this embodiment, the method for detecting the wearing of uniforms and hats by workers in accordance with this embodiment comprises the following steps: Multi-channel image acquisition: Utilize multi-process camera call algorithm to obtain video streams from all cameras and obtain a single frame; In an exemplary embodiment, multi-channel image acquisition specifically includes: utilizing a multi-process camera call algorithm to set at least two processes and at least one queue for each camera, wherein a first process is used to obtain a single frame from the camera video stream and place it in the queue, confirm that the queue is full, delete the old frame, and store the new frame; a second process is used to retrieve the single frame from the queue and store it in a two-dimensional array in memory for subsequent detection; Workwear and hat detection: Use the workwear and hat recognition network to identify single frames and obtain head image data of people who are not wearing the required hats and upper body image data of people who are not wearing the required workwear; In an exemplary embodiment, a workwear and work cap recognition network is obtained by training an artificial neural network using a training data set, wherein the training data set includes positive samples and negative samples, wherein the positive samples include head images of persons wearing prescribed work caps and upper body images of persons wearing prescribed workwear; and the negative samples include head images of persons not wearing prescribed work caps and upper body images of persons not wearing prescribed workwear; In an exemplary embodiment, the work clothes and hat wearing detection specifically includes: using a work clothes and hat recognition network to recognize a single frame image, after detecting a person not wearing a prescribed work hat in the current camera image, storing the head image of the person in the form of a two-dimensional array in a memory, and obtaining head image data of the person not wearing the prescribed work hat; after detecting a person not wearing prescribed work clothes, storing the upper body image of the person in the form of a two-dimensional array in a memory, and obtaining upper body image data of the person not wearing prescribed work clothes; Face recognition: Using the face recognition network, face recognition is performed on the head image data of personnel not wearing the prescribed work hats and the upper body image data of personnel not wearing the prescribed work clothes to obtain face detection results; Result processing: Based on the face detection results, the cumulative number of detection method is used to obtain the final work clothes and hat wearing detection results.
[0020] In an exemplary embodiment, the result processing specifically includes: according to the face detection result, using the cumulative number detection method to obtain the final work uniform and hat wearing detection result, such as the formula: , , , Among them, M represents the flag bit of the final work hat wearing status. When M is an integer of 0, it means the work hat is worn, and when it is an integer of 1, it means the work hat is not worn; is the threshold value of the cumulative number detection method, Z is a set of integers, i is a natural number, The flag bit of each test result, when it is an integer of 2, it means that the work cap is worn, and when it is an integer of 0, it means that the work cap is not worn; N represents the flag bit of the work clothes wearing situation, when it is an integer of 0, it means that the work clothes are worn, and when it is an integer of 1, it means that the work clothes are not worn; is the threshold value of the cumulative number detection method, i is a natural number, The flag of each test result. When it is an integer of 3, it means that the work clothes are worn, and when it is an integer of 1, it means that the work clothes are not worn. In an exemplary embodiment, the result processing specifically includes: based on the face detection result, using the cumulative number detection method, storing the serial number of the person to whom the face detected in each frame belongs in the face database in the form of an array in the memory, and temporarily storing the wearing status of the work clothes and work hat in the form of a dictionary in the memory; when the number of times the serial number of a detected person appears in the array is greater than a preset threshold, calculating the wearing status of the work clothes and work hat by using the cumulative number detection method, and the calculation result is regarded as the final wearing status of the work clothes and work hat of the person; wherein, the work hat calculation process is shown in Formula 2, wherein: M represents the flag bit of the final work hat wearing status, when M is an integer of 0, it indicates that the person is wearing a work hat, and when it is an integer of 1, it indicates that the person is not wearing a work hat; is the threshold value of the cumulative number detection method, Z is a set of integers, The value range of is: (Formula 1) i is a natural number, The flag of each test result, when it is an integer of 2, it means wearing a work hat, and when it is an integer of 0, it means not wearing a work hat. If the sum of the flags of each test result is greater than , then M takes the integer 0, the cumulative number of detection method determines that the current person is wearing a work hat, if the sum of the flag bits of each detection result is less than , then M takes the integer 1, and the cumulative number detection method determines that the current person is not wearing a work hat, (Equation 2) The tooling calculation process is shown in Equation 3, where N represents the flag bit of the tooling wearing status. When it is an integer 0, it means the tooling is worn, and when it is an integer 1, it means the tooling is not worn. is the threshold value of the cumulative number detection method, i is a natural number, The flag of each test result is 3, which means the work clothes are worn, and 1 means the work clothes are not worn. If the sum of the flags of each test result is greater than , then N takes the integer 0, the cumulative number of detection method determines that the current person is wearing work clothes, if the sum of the flag bits of each detection result is less than , then N is an integer of 1, and the cumulative number detection method determines that the current person is not wearing work clothes; (Equation 3) In another embodiment, the above-mentioned method for detecting the wearing of work uniforms and work hats by workers can also be implemented in the following manner. Figure 2 A flowchart for detecting workers wearing work uniforms and work hats is provided in this embodiment. In this embodiment, the method for detecting workers wearing work uniforms and work hats includes: multi-channel image acquisition, work uniform and work hat detection, facial recognition, and result processing. Multi-channel image acquisition involves setting up two processes and one queue for each camera. The first process extracts a single frame from the camera video stream and places it into the queue. It also checks whether the queue is full. If so, it deletes the old frame and stores it in memory as a two-dimensional array for subsequent detection. The work uniform and work hat detection process, upon detecting a person not wearing the prescribed work hat in the current camera image, stores their head image in memory as a two-dimensional array. Upon detecting a person not wearing the prescribed work uniform, it stores their upper body image in memory as a two-dimensional array. Facial recognition, instead of accessing the camera image, directly uses the head and upper body images of the person being detected stored in memory by the work uniform and work hat detection module for facial recognition. The result processing uses the cumulative number detection method to filter out erroneous results caused by facial angles and environmental occlusion problems, and obtains the name of the person and the wearing status of their work clothes and hats. The database table is used to express the wearing status of the work clothes and hats of the inspected personnel in numbers on a person-by-person basis for record and organization.
[0021] The training process of the work clothes and hat recognition network is as follows: during training, the work clothes and hat recognition network first selects the head images of people wearing prescribed work hats and the upper body images of people wearing prescribed work clothes as positive samples, and selects the head images of people not wearing prescribed work hats and the upper body images of people not wearing prescribed work clothes as negative samples.
[0022] The specific steps of the cumulative number detection method are as follows: the cumulative number detection method temporarily stores the name of the person to whom the detected face belongs in the form of an array in the memory, and continuously detects. When the number of times a certain person's name appears in the array exceeds a preset threshold, the person's work uniform and work hat wearing situation with the highest number of appearances is regarded as the final work uniform and work hat wearing detection result of the person, and it is output; In an exemplary embodiment, the preset threshold is 8; This embodiment provides a system for detecting workers wearing uniforms and work hats, including: a multi-channel image acquisition module, a uniform and work hat wearing detection module, a face recognition module, and a result processing module; Figure 3The figure shows the structural block diagram of the worker uniform and hat wearing detection system; The multi-channel image acquisition module is configured as follows: using a multi-process camera call algorithm to obtain video streams from all cameras and obtain a single frame; In an exemplary embodiment, the multi-channel image acquisition module is specifically configured as follows: using a multi-process camera call algorithm, at least two processes and at least one queue are set for each camera, wherein the first process is used to obtain a single frame from the camera video stream and put it into the queue, confirm that the queue storage is full, delete the old frame, and store the new frame; the second process is used to take the single frame from the queue and store it in the form of a two-dimensional array in the memory for subsequent detection; As an exemplary embodiment, the multi-channel image acquisition module includes a multi-process camera call algorithm, creating a queue for each camera to store video streams from all cameras. The multi-channel image acquisition module is specifically configured as follows: using the multi-process camera call algorithm, two processes and one queue are set up for each camera. The first process is responsible for extracting a single frame from the camera video stream and placing it into the queue. At the same time, it detects whether the queue is full of single frames. If so, the old frame is deleted and a new frame is stored. The second process is responsible for extracting the single frame from the queue and storing it in memory as a two-dimensional array for subsequent detection. As an exemplary embodiment, the camera device targeted by the multi-channel image acquisition module is a common network camera currently on the market. When acquiring multi-channel images, the module needs to select different network protocols based on the camera devices of different brands, and the IP addresses of the multiple camera devices need to be input into the algorithm. The workwear and work cap wearing detection module is configured as follows: using the workwear and work cap recognition network to identify a single frame image, and obtain the head image data of the person not wearing the prescribed work cap and the upper body image data of the person not wearing the prescribed workwear; In an exemplary embodiment, a workwear and work cap recognition network is obtained by training an artificial neural network using a training data set, wherein the training data set includes positive samples and negative samples, wherein the positive samples include head images of persons wearing prescribed work caps and upper body images of persons wearing prescribed workwear; and the negative samples include head images of persons not wearing prescribed work caps and upper body images of persons not wearing prescribed workwear; In an exemplary embodiment, the work clothes and hat wearing detection module is specifically configured as follows: after detecting a person not wearing a prescribed work hat in the current camera image, the work clothes and hat wearing detection network is used to recognize a single frame image, and after detecting a person not wearing a prescribed work hat in the current camera image, the head image of the person is stored in the memory in the form of a two-dimensional array to obtain the head image data of the person not wearing the prescribed work hat; after detecting a person not wearing prescribed work clothes, the upper body image of the person is stored in the memory in the form of a two-dimensional array to obtain the upper body image data of the person not wearing prescribed work clothes; As an exemplary embodiment, the workwear and work cap wearing detection module includes a trained workwear and work cap recognition network, which takes frames from a video stream and identifies the wear of workwear and work caps by people therein; During training, the workwear and hat recognition network used in the workwear and hat detection module first selects head images of people wearing prescribed work hats and upper body images of people wearing prescribed work clothes as positive samples, and head images of people not wearing prescribed work hats and upper body images of people not wearing prescribed work clothes as negative samples. After detecting a person who is not wearing the required work hat in the current camera image, the work clothes and hat wearing detection module stores the head image in the form of a two-dimensional array in the memory; after detecting a person who is not wearing the required work clothes, the upper body image is stored in the memory in the form of a two-dimensional array; As an exemplary embodiment, the training process of the workwear and work cap recognition network is as follows: during training, the network first selects head images of people wearing prescribed work caps and upper body images of people wearing prescribed work clothes as positive samples, and selects head images of people not wearing prescribed work caps and upper body images of people not wearing prescribed work clothes as negative samples; As an exemplary embodiment, the workwear and hat wearing detection module needs to be labeled before training the network. The source of the data set can be screenshots of factory camera recordings, and the screenshots need to contain clear images of workers. When training the weights for hat recognition, it is necessary to frame the worker's head image in the data set screenshot, and the image of the worker wearing the specified work hat is used as the positive sample, and the rest as the negative sample. When training the weights for workwear recognition, it is necessary to frame the worker's upper body image in the data set screenshot, and the image of the worker wearing the specified workwear is used as the positive sample, and the rest as the negative sample. As an exemplary embodiment, after the workwear and work cap detection module detects that a person is not wearing workwear or a work cap, the algorithm temporarily stores the resulting image in the form of a two-dimensional array in computer memory. This array is not continuous in memory. To improve detection speed, it is necessary to use the np.ascontiguousarray function in the open source library Numpy to convert it into a continuous array in memory. The face recognition module is configured to: utilize a face recognition network to perform face recognition on the head image data of a person who is not wearing a prescribed work hat and the upper body image data of a person who is not wearing a prescribed work uniform, and obtain face detection results; As an exemplary embodiment, the face recognition module includes a face recognition network to perform face recognition on people who are not wearing the required work clothes and hats; the face recognition module does not call the camera image, but directly calls the head and upper body images of the inspected person stored in the memory of the work clothes and hat wearing detection module for face recognition when the person has been identified; after the face recognition module recognizes the face, the result processing module uses the cumulative number of detection method to filter out errors caused by face angles and environmental occlusion problems. The result processing module is configured as follows: according to the face detection result, the cumulative number of detection methods are used to obtain the final work uniform and hat wearing detection results; In an exemplary embodiment, the result processing module is specifically configured to obtain the final workwear and work cap wearing detection result based on the face detection result using the cumulative number detection method, such as the formula: , , , Among them, M represents the flag bit of the final work hat wearing status. When M is an integer of 0, it means the work hat is worn, and when it is an integer of 1, it means the work hat is not worn; is the threshold value of the cumulative number detection method, Z is a set of integers, i is a natural number, The flag bit of each test result, when it is an integer of 2, it means that the work cap is worn, and when it is an integer of 0, it means that the work cap is not worn; N represents the flag bit of the work clothes wearing situation, when it is an integer of 0, it means that the work clothes are worn, and when it is an integer of 1, it means that the work clothes are not worn; is the threshold value of the cumulative number detection method, i is a natural number, The flag of each test result. When it is an integer of 3, it means that the work clothes are worn, and when it is an integer of 1, it means that the work clothes are not worn. In an exemplary embodiment, the result processing module is specifically configured as follows: based on the face detection result, using the cumulative number detection method, the serial number of the person to whom the face detected in each frame belongs in the face database is stored in the memory in the form of an array, and the wearing status of the work clothes and work hat of the person is temporarily stored in the memory in the form of a dictionary; when the number of times the serial number of a detected person appears in the array is greater than a preset threshold, the wearing status of the work clothes and work hat of the person is calculated using the cumulative number detection method, and the calculation result is regarded as the final wearing status of the work clothes and work hat of the person; wherein, the work hat calculation process is shown in Formula 5, wherein: M represents the flag bit of the final work hat wearing status, when M takes the integer 0, it indicates that the person is wearing a work hat, and when it takes the integer 1, it indicates that the person is not wearing a work hat; is the threshold value of the cumulative number detection method, Z is a set of integers, The value range of is: (Formula 4) i is a natural number, The flag of each test result, when it is an integer of 2, it means wearing a work hat, and when it is an integer of 0, it means not wearing a work hat. If the sum of the flags of each test result is greater than , then M takes the integer 0, the cumulative number of detection method determines that the current person is wearing a work hat, if the sum of the flag bits of each detection result is less than , then M takes the integer 1, and the cumulative number detection method determines that the current person is not wearing a work hat, (Formula 5) The tooling calculation process is shown in Equation 6, where N represents the flag bit of the tooling wearing status. When it is an integer of 0, it means that the tooling is worn, and when it is an integer of 1, it means that the tooling is not worn. is the threshold value of the cumulative number detection method, i is a natural number, The flag of each test result is 3, which means the work clothes are worn, and 1 means the work clothes are not worn. If the sum of the flags of each test result is greater than , then N takes the integer 0, the cumulative number of detection method determines that the current person is wearing work clothes, if the sum of the flag bits of each detection result is less than , then N takes an integer of 1, and the cumulative number detection method determines that the current person is not wearing work clothes.
[0023] (Equation 6) As an exemplary embodiment, the result processing module obtains the name of the person and the wearing status of their work clothes and work hats by using a cumulative number of detection methods, and uses a database table to express the wearing status of the work clothes and work hats of the inspected persons in numbers on a person-by-person basis, and records and organizes the information; The cumulative number detection method stores the serial number of the person in the face database detected in each frame in the form of an array in the memory, and temporarily stores the wearing status of their work clothes and work hats in the form of a dictionary in the memory; continuous detection is carried out. When the number of times a certain person's serial number appears in the array exceeds the threshold, the wearing status of their work clothes and work hats is calculated using the cumulative number detection method. The calculation result is regarded as the final wearing status of the person's work clothes and work hats and is output; The result processing module uses the cumulative detection method to filter out erroneous results caused by facial angles and environmental occlusion, and obtains the name of the person and the wearing status of their work clothes and hats. It also uses a database table to express the wearing status of the inspected personnel in numbers on a person-by-person basis and records them. As an exemplary embodiment, the cumulative number detection method temporarily stores the name of the person to whom the detected face belongs in the form of an array in memory and continuously detects the person. When the number of times a certain person's name appears in the array exceeds a preset threshold, the person's work uniform and work hat wearing situation with the highest number of appearances is regarded as the final work uniform and work hat wearing detection result for the person and is output. As an exemplary embodiment, the result processing module uses a database table to represent the wearing status of the work clothes and hats of the inspected personnel with numbers, specifically using the number 0 to represent not wearing a work hat; using the number 1 to represent not wearing work clothes; using the number 2 to represent wearing a work hat; using the number 3 to represent wearing work clothes; As an exemplary embodiment, the cumulative number detection method, when the face recognition module identifies the current person, the method will establish a dictionary and a person list, the person list records the corresponding serial number of the person in each frame in the face library; the key of the dictionary is the serial number of the person in the face library; the value of the dictionary is a nested list containing four word lists, where the first sublist records the alternative numbers for the person's work hat wearing situation; the second sublist records the alternative numbers for the person's work clothes wearing situation; the third sublist records the person's head image; the fourth sublist records the person's upper body image; these images are cropped by the work clothes and hat detection module; after each frame detection is completed, the algorithm will detect the number of occurrences of all serial numbers in the person list. When the number of occurrences of a person's serial number exceeds the threshold, the wear of his work clothes and hat will be further screened; specifically, the alternative numbers with the highest number of occurrences in the first and second sublists are detected respectively, and the two alternative numbers generated are used as the final work clothes and hat wearing situation of the person, and then the corresponding person images in the third and fourth sublists are output together.
[0024] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are protected by the present invention.
Claims
1. A method for detecting whether workers are wearing uniforms or work hats, characterized in that: The following steps are involved: Multi-channel image acquisition: Utilize multi-process camera call algorithm to obtain video streams from all cameras and obtain a single frame; Workwear and hat detection: Using the workwear and hat recognition network to identify the single frame image, obtain the head image data of the person not wearing the prescribed work hat and the upper body image data of the person not wearing the prescribed workwear; Face recognition: using a face recognition network, performing face recognition on the head image data of the person not wearing the prescribed work hat and the upper body image data of the person not wearing the prescribed work clothes to obtain a face detection result; Result processing: Based on the face detection result, the cumulative number of detection method is used to obtain the final work clothes and hat wearing detection result.
2. The method for detecting workers' uniforms and hats according to claim 1, characterized in that: The multi-channel image acquisition specifically includes: using a multi-process camera call algorithm to set at least two processes and at least one queue for each camera, wherein the first process is used to obtain a single frame from the camera video stream and put it into the queue, confirm that the storage of the queue is full and delete the old picture and store the new picture; the second process is used to take the single frame from the queue and store it in the memory in the form of a two-dimensional array for subsequent detection.
3. The method for detecting workers' uniforms and hats according to claim 1, characterized in that: The work clothes and hat recognition network is obtained by training an artificial neural network using a training data set, wherein the training data set includes positive samples and negative samples. The positive samples include head images of people wearing prescribed work hats and upper body images of people wearing prescribed work clothes; the negative samples include head images of people not wearing prescribed work hats and upper body images of people not wearing prescribed work clothes.
4. The method for detecting workers' uniforms and hats according to claim 1, characterized in that: The work clothes and work hat wearing detection specifically includes: using the work clothes and work hat recognition network to identify the single frame image, and after detecting a person who is not wearing the prescribed work hat in the current camera image, storing the head image of the person in the form of a two-dimensional array in the memory to obtain the head image data of the person who is not wearing the prescribed work hat; after detecting a person who is not wearing the prescribed work clothes, storing the upper body image of the person in the form of a two-dimensional array in the memory to obtain the upper body image data of the person who is not wearing the prescribed work clothes.
5. The method for detecting workers' uniforms and hats according to claim 1, characterized in that: The result processing specifically includes: according to the face detection result, using the cumulative number detection method to obtain the final work uniform and work hat wearing detection result, such as the formula: , , , Among them, M represents the flag bit of the final work hat wearing status. When M is an integer of 0, it means the work hat is worn, and when it is an integer of 1, it means the work hat is not worn; is the threshold value of the cumulative number detection method, Z is a set of integers, i is a natural number, The flag bit of each test result, when it is an integer of 2, it means that the work cap is worn, and when it is an integer of 0, it means that the work cap is not worn; N represents the flag bit of the work clothes wearing situation, when it is an integer of 0, it means that the work clothes are worn, and when it is an integer of 1, it means that the work clothes are not worn; is the threshold value of the cumulative number detection method, i is a natural number, It is the flag of each test result. When it is an integer of 3, it means that the work clothes are worn, and when it is an integer of 1, it means that the work clothes are not worn.
6. A system for detecting workers' uniforms and hats, characterized in that: The system includes the following modules: The multi-channel image acquisition module is configured to: utilize a multi-process camera call algorithm to acquire video streams from all cameras to obtain a single frame; The work clothes and hat wearing detection module is configured to: use the work clothes and hat recognition network to recognize the single frame image to obtain the head image data of the person not wearing the prescribed work hat and the upper body image data of the person not wearing the prescribed work clothes; The face recognition module is configured to: use a face recognition network to perform face recognition on the head image data of the person not wearing the prescribed work hat and the upper body image data of the person not wearing the prescribed work clothes to obtain a face detection result; The result processing module is configured to obtain a final workwear and work cap wearing detection result by using a cumulative number detection method according to the face detection result.
7. The worker uniform and hat wearing detection system according to claim 6, characterized in that: The multi-channel image acquisition module is specifically configured as follows: using a multi-process camera call algorithm, setting at least two processes and at least one queue for each camera, wherein the first process is used to obtain a single frame from the camera video stream and put it into the queue, confirming that the storage of the queue is full and deleting the old frame and storing the new frame; The second process is used to take out a single frame from the queue and store it in a memory in the form of a two-dimensional array for subsequent detection.
8. The worker uniform and hat wearing detection system according to claim 6, characterized in that: The work clothes and hat recognition network is obtained by training an artificial neural network using a training data set, wherein the training data set includes positive samples and negative samples. The positive samples include head images of people wearing prescribed work hats and upper body images of people wearing prescribed work clothes; the negative samples include head images of people not wearing prescribed work hats and upper body images of people not wearing prescribed work clothes.
9. The worker uniform and hat wearing detection system according to claim 6, characterized in that: The work clothes and work hat wearing detection module is specifically configured as follows: after detecting a person who is not wearing the prescribed work hat in the current camera image, the image of the person's head is stored in the memory in the form of a two-dimensional array to obtain the head image data of the person who is not wearing the prescribed work hat; after detecting a person who is not wearing the prescribed work clothes, the image of the person's upper body is stored in the memory in the form of a two-dimensional array to obtain the upper body image data of the person who is not wearing the prescribed work clothes.
10. The worker uniform and hat wearing detection system according to claim 6, characterized in that: The result processing module is specifically configured to obtain the final workwear and work cap wearing detection result based on the face detection result using the cumulative number of detection method, as shown in the formula: , , , Among them, M represents the flag bit of the final work hat wearing status. When M is an integer of 0, it means the work hat is worn, and when it is an integer of 1, it means the work hat is not worn; is the threshold value of the cumulative number detection method, Z is a set of integers, i is a natural number, The flag bit of each test result, when it is an integer of 2, it means that the work cap is worn, and when it is an integer of 0, it means that the work cap is not worn; N represents the flag bit of the work clothes wearing situation, when it is an integer of 0, it means that the work clothes are worn, and when it is an integer of 1, it means that the work clothes are not worn; is the threshold value of the cumulative number detection method, i is a natural number, It is the flag of each test result. When it is an integer of 3, it means that the work clothes are worn, and when it is an integer of 1, it means that the work clothes are not worn.