A deep learning-based method for detecting and recognizing safety wear on employees in mechanical manufacturing workshops
By combining the improved YOLOv8n and FaceNet models, efficient, accurate, and reliable intelligent management of safety wear detection and identity authentication for employees in mechanical manufacturing workshops is achieved, improving the safety and identity management efficiency of the workshop.
Patent Information
- Application Number
- CN202411583340.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2044-11-07
AI Technical Summary
The safety wear detection and identity authentication systems in mechanical manufacturing workshops are not intelligent enough, making them difficult to combine for detection, and management efficiency needs to be improved.
The improved YOLOv8n model is used for image target detection, combined with the improved FaceNet model for face recognition, and deep learning technology is used to achieve safe wearing detection and identity confirmation.
It realizes comprehensive monitoring of employees’ safety protection status and effective confirmation of their identities, improves the intelligence level and efficiency of safety management, and reduces the need for manual inspection.
Smart Images

Figure CN119479038B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image target detection and face recognition in workshop supervision, and in particular relates to a method for detecting safety wear and face recognition of employees in a machinery manufacturing workshop based on deep learning. Background Art
[0002] Mechanical manufacturing workshops are complex and dangerous, placing strict demands on employee safety wear and identity authentication. However, safety wear in mechanical manufacturing workshops is typically performed through manual inspections, which lacks intelligence. Furthermore, the effectiveness of existing identity authentication systems needs improvement. Furthermore, the aforementioned two inspection methods are difficult to combine, resulting in insufficient intelligence and a need for further improvement in overall management efficiency. Summary of the Invention
[0003] In order to solve the above technical problems, the present invention proposes a deep learning-based method for detecting and recognizing safety wear of employees in mechanical manufacturing workshops to solve the problems existing in the above-mentioned prior art.
[0004] To achieve the above objectives, the present invention provides a method for detecting safety wear and face recognition of employees in a mechanical manufacturing workshop based on deep learning, comprising:
[0005] Construct a face sample set; perform key point detection based on the face sample set to obtain template coordinates;
[0006] Constructing an image target detection model and a face recognition model, wherein the image target detection model adopts an improved YOLOv8n model, and the face recognition model adopts an improved FaceNet model;
[0007] Acquire real-time images of personnel in a mechanical manufacturing workshop, detect and locate the real-time images using an image target detection model, and obtain recognition and positioning results, wherein the recognition and positioning results include bounding boxes and corresponding types of faces and personal protective equipment worn;
[0008] Based on the recognition and positioning results, the real-time image is cropped according to the bounding box of the face to obtain a face image; and the face image is aligned according to the template coordinates;
[0009] The aligned face image is recognized by a face recognition model to obtain a face vector, and the face vector is judged according to the face sample set to obtain the identity information of the person to realize the detection of personal protective equipment and whether the person is an outsider.
[0010] Optionally, the process of building an image object detection model includes:
[0011] Add the MCS module to the output of the backbone network of the YOLOv8n model;
[0012] Introducing the DownSimper module to replace the traditional convolution of the Neck part in YOLOv8n;
[0013] The Shape-IoU loss function is used as the loss function of the YOLOv8n model to construct an image target detection model.
[0014] Optionally, the face recognition model construction process includes:
[0015] Construct a deep convolutional neural network, which includes several convolutional layers, pooling layers and fully connected layers;
[0016] The convolutional layer in the deep convolutional neural network is replaced with the depthwise separable convolutional layer in the MobileNetV1 model, and the SE module is added after the depthwise separable convolutional layer; and the triplet loss function is used as the loss function of the deep convolutional neural network to build a face recognition model.
[0017] Optionally, before building the image object detection model and face recognition model, the following steps are also included:
[0018] Constructing a target sample set, where the target sample set includes images containing human faces and personal protective equipment;
[0019] Among them, the image target detection model and the face recognition model are trained using the ten-fold cross validation method based on the target sample set and the face sample set, and the trained image target detection model and the face recognition model are used.
[0020] Optionally, the process of performing key point detection based on the face sample set includes:
[0021] The MTCNN model is used to detect key points of face samples in the face sample set to obtain template coordinates.
[0022] Optionally, before cropping the real-time image according to the face bounding box, the method includes:
[0023] The corresponding category of the personal protective equipment in the identification and positioning results is judged. If the corresponding category of the personal protective equipment is consistent with the preset personal protective equipment, the real-time image is cropped, otherwise a warning is prompted.
[0024] Optionally, the process of aligning the facial images includes:
[0025] Detecting the face image using MTCNN to obtain the coordinates of the face and key points;
[0026] According to the difference between the key point coordinates and the template coordinates, the affine transformation matrix is calculated;
[0027] The facial image is adjusted according to the affine transformation matrix to obtain an aligned facial image.
[0028] Optionally, after aligning the facial images, the method further includes:
[0029] Performing image equalization on the aligned face image, and using the image equalization as input data for a face recognition model to obtain a face vector.
[0030] Optionally, the process of judging the face vector includes:
[0031] Obtain a sample face vector of a face sample in a face sample set; perform cosine similarity calculation between the face vector and the sample face vector, and perform a threshold judgment on the cosine similarity calculation result. If the cosine similarity calculation result is less than the threshold, the employee information corresponding to the face sample is obtained as the personnel identity information; otherwise, the personnel identity information is that of an outsider.
[0032] Optionally, after obtaining the personnel identity information, the following is also included:
[0033] If the person's identity information is that of an outsider, a warning and reminder will be issued. If the person's identity information is the employee information corresponding to the face sample, the corresponding type of personal protective equipment worn by the person identified in the real-time image will be recorded.
[0034] Compared with the prior art, the present invention has the following advantages and technical effects:
[0035] This invention integrates image object detection and face recognition technologies to achieve comprehensive monitoring of employee safety protection status and effective identity verification. This method boasts high efficiency, accuracy, and reliability, and has broad application prospects in the machinery manufacturing industry. Specifically, to enhance safety management effectiveness, the combination of YOLOv8n and FaceNet in the workshop can achieve more intelligent safety management. For safety wear detection, the YOLOv8n model has been specifically improved, incorporating an MCS module to enhance detailed feature capture. The DownSimper module replaces the traditional convolutional layers in the Neck section of YOLOv8n to improve feature fusion and downsampling performance. Furthermore, a Shape-IoU loss function is used to enhance bounding box regression accuracy. These improvements enable the model to more accurately identify whether employees are wearing necessary safety equipment in complex workshop environments. FaceNet is responsible for verifying employee identities. This system not only improves the efficiency and accuracy of safety monitoring but also enhances the intelligence of workshop management. Combining these two technologies can implement a comprehensive safety and identity management system in the workshop. The improved YOLOv8n model can automatically detect whether employees are wearing safety glasses, while FaceNet provides effective identity authentication. The combination of the two improves security, reduces the need for manual inspections, and improves overall management efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings, which constitute part of this application, are intended to provide a further understanding of this application. The exemplary embodiments and descriptions of this application are intended to explain this application and do not constitute an improper limitation on this application. In the accompanying drawings:
[0037] Figure 1 is a flow chart of a method according to an embodiment of the present invention;
[0038] Figure 2 2 is a structural diagram of the DownSimper module according to an embodiment of the present invention. DETAILED DESCRIPTION
[0039] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0040] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0041] The present invention discloses a method for detecting and recognizing employees' safety wear in a mechanical manufacturing workshop based on deep learning, and belongs to the technical field of image target detection and face recognition. In the technical solution related to the present invention, images containing clear faces and at least one type of personal protective equipment are first collected to form the person_dataset data set. A high-definition camera is used to capture clear frontal images of employees in a designated area. At the same time, combined with the employee's on-the-job information, a face database containing diverse facial features is established, which is recorded as face_dataset. MTCNN is used to perform key point detection on each sample in the face_dataset database, and the coordinates of these key points are recorded as template coordinates for subsequent face alignment. Since the YOLOv8n model has certain deficiencies in capturing detailed features and the accuracy of bounding boxes, as well as background interference problems, especially in highly complex and dynamic environments, targeted improvements are made to the YOLOv8n model. The MEW multi-axis external weight module is combined with the CBAM attention, and an MCS module is proposed. After being placed in the backbone network, it can better capture detailed features, thereby improving detection accuracy and reducing background interference. Next, the DownSimper module was introduced to replace the traditional convolution in the Neck portion of YOLOv8n, further improving feature fusion and downsampling performance. Finally, the Shape-IoU loss function was adopted, which focuses on the shape and scale of the bounding box itself to calculate the loss, thereby making the bounding box regression more accurate. The depthwise separable convolution used in MobileNetV1 in FaceNet can reduce feature representation, so the SE (Squeeze-and-Excitation) module was added to the network to enhance its response to important features, thereby improving the model's representational capabilities. Both the improved YOLOv8n model and the face recognition model were trained using the existing person_dataset and face_dataset datasets using ten-fold cross-validation. The trained workshop employee wear detection model was then used to perform inference recognition on the target image. From the recognition results, the bounding box of the face category was selected. After cropping the face image from the original image based on the face category bounding box, the MTCNN was applied to detect the face and keypoint coordinates. Next, the affine transformation matrix was calculated based on the difference between the detected keypoints and the template coordinates. This transformation matrix adjusts the facial image to a uniform pose and scale. After facial alignment, image equalization technology is further applied to optimize image quality. The processed image is then fed into the FaceNet model. If the recognition result indicates that the employee is a non-local employee, the system immediately issues a non-local alert, alerting safety managers to take appropriate measures. If the identification result indicates that the employee is a workshop employee, the system confirms their identity and records their compliance with various protective equipment.This process design of first performing safety wearing detection and then facial recognition can not only monitor employees' safety wearing status in real time, but also effectively manage the entry and exit of workshop personnel and improve the overall safety level of the workshop.
[0042] like Figure 1 As shown, the present invention is mainly verified by experimental and actual measurement methods. The implementation steps are as follows:
[0043] S1. Dataset collection and annotation:
[0044] We collected clear images of people with clear faces and at least one piece of personal protective equipment to form the person_dataset dataset. We used a high-definition camera to capture clear frontal images of employees in a designated area. We also combined this information with employee onboarding information to create a face database containing diverse facial features, referred to as face_dataset. We used MTCNN to detect key points for each sample in the face_dataset database, recording the coordinates of these key points as template coordinates for subsequent face alignment.
[0045] S2. Model improvement and training:
[0046] The YOLOv8n model was optimized to address the feature complexity and background interference issues encountered during the detection of safety protective equipment. Furthermore, the FaceNet model uses depthwise separable convolutions from MobileNetV1. While MobileNetV1 reduces computational complexity and model complexity through depthwise separable convolutions, this may reduce feature expression capabilities. Therefore, a Squeeze-and-Excitation (SE) module was added after the convolutional layer to adaptively adjust channel features and enhance responsiveness to important features, thereby improving feature differentiation while maintaining computational efficiency. Both the improved YOLOv8n model and the face recognition model were trained using the existing person_dataset and face_dataset datasets using ten-fold cross-validation.
[0047] S3. Safe wearing detection and face cropping:
[0048] The system uses a trained, improved YOLOv8n model to perform inference on live images. If an employee is found not wearing any protective equipment, the system immediately triggers a missing equipment warning, prompting management to take timely action. If the employee is wearing all necessary safety equipment, the system proceeds to perform facial recognition using the FaceNet model. Bounding boxes belonging to the face category are filtered from the detection results, and facial images are cropped from the original image based on these bounding boxes to prepare for subsequent facial recognition.
[0049] S4. Face alignment:
[0050] After acquiring the cropped facial image from step S3, MTCNN is first applied to the facial image to detect the coordinates of the face and key points. Next, an affine transformation matrix is calculated based on the differences between the detected key points and the template coordinates from step S1. This transformation matrix is used to align all collected facial images to a uniform pose and scale, achieving facial alignment and improving the accuracy of subsequent facial recognition.
[0051] S5. Image equalization:
[0052] Image equalization technology is used to equalize the aligned face images. Image equalization mainly adjusts the brightness and contrast distribution of the image to make the image quality more stable and reduce the impact of light changes on recognition results.
[0053] S6. Facial Recognition and Safety Wear Compliance Assessment:
[0054] The equalized image is fed into the FaceNet model for facial recognition. If the recognition result indicates an outsider, an outsider warning is immediately triggered, alerting safety managers to take appropriate measures. If the recognition result indicates a workshop employee, they are allowed to enter the workshop and the system records their identity and whether they are wearing any protective equipment.
[0055] The above technical solution is described in detail:
[0056] In some embodiments, step S1 includes the following:
[0057] The person_dataset dataset consists of images containing faces (face) as well as safety helmets (safety_helmet), safety vests (safety_vest), and safety gloves (safety_gloves). A high-definition camera is used to capture clear frontal images of employees in a designated area. Combined with employee onboarding information, a face database containing diverse facial features, denoted as face_dataset, is constructed. Keypoints are detected for each sample in the face_dataset database using MTCNN, and the coordinates of these keypoints are recorded as template coordinates for subsequent face alignment.
[0058] Specifically, step S1 includes the following specific steps:
[0059] S11: Go to the mechanical manufacturing workshop for field photography and collect images from multiple time periods (day and night) to ensure that the collected work scenes are diverse and cover various work situations. After communicating with the employees and obtaining their consent, shoot under different lighting conditions, angles and distances. Filter out images containing clear faces and at least one type of personal protective equipment from the collected images, try to ensure that the images contain different types and styles of various protective equipment, and collect at least thousands of images to ensure the generalization ability of the model. Use LabelImg to annotate an image dataset containing four categories: face, safety helmet (safety_helmet), safety vest (safety_vest) and safety gloves (safety_gloves), recorded as person_dataset dataset.
[0060] S12: Use a high-definition camera to capture clear frontal images of employees in a designated area. Resize the images to a fixed size (160x160 pixels) and normalize the brightness and color. Combined with employee onboarding information, a face database containing diverse facial features, denoted as face_dataset, is constructed. Use MTCNN to detect key points for each sample in face_dataset, and record the coordinates of these key points as template coordinates for subsequent face alignment.
[0061] Wherein step S2 includes the following contents:
[0062] In step S2, targeted improvements were made to the YOLOv8n model and FaceNet model. The improved YOLOv8n model and face recognition model were then trained using the established person_dataset and face_dataset datasets, respectively. In mechanical manufacturing scenarios, detecting workers' safety wear is crucial. However, the YOLOv8n model has certain deficiencies in capturing detailed features and the accuracy of bounding boxes, as well as background interference issues, especially in highly complex and dynamic environments. To address the feature complexity and background interference issues in the detection of safety protective equipment, three key improvements to YOLOv8n were proposed: the MCS module based on multi-channel attention and multi-dimensional weighting, the DownSimper module, and the Shape-IoU loss function.
[0063] Specifically, the MCS module combines the MEW multi-axis external weight module with the CBAM attention. The MCS module effectively extracts global and local information through multi-dimensional weighting, thereby better capturing the subtle features of safety equipment. The CBAM mechanism makes precise adjustments and optimizations on this basis, enabling the model to focus more closely on the wearer of the safety equipment, significantly reducing background interference and improving detection accuracy. After inserting the MCS module into the YOLOv8n backbone network, that is, setting the MCS module at the output end of the backbone network, and using the features processed by the MCS module as the final output, the algorithm can better focus on the features of key targets such as faces, helmets, safety vests, and safety gloves. The formula for the specific process of MEW is as follows:
[0064] x1,x2,x3,x4=Split(X)
[0065]
[0066] x'4=DW(x4)
[0067] Y=Concat(x1',x'2,x'3,x'4)+X
[0068] Where i=1, 2, and 3 correspond to the first three branches respectively. (I,J) and where (i, j) denotes the learnable external weights and the 2D discrete Fourier transform of the corresponding axis, respectively. ⊙ denotes element-wise multiplication. When i = 1, (i, j) denotes the Height-Width axis; when i = 2, (i, j) denotes the Channel-Width axis; and when i = 3, (i, j) denotes the Channel-Height axis. Denotes a two-dimensional inverse discrete Fourier transform. DW denotes a depthwise separable convolution.
[0069] The convolution layer in the Neck part of YOLOv8n is prone to information loss and fusion limitations in feature fusion and downsampling. The DownSimper module is introduced to replace the traditional convolution layer CONV in the Neck part. Figure 2As shown in the figure, the module divides the input feature map into two main branches. The first branch downsamples the image through a 3x3 convolution with a stride of 2 to extract deeper features. The second branch uses a 1x1 convolution to keep the spatial size unchanged and adjust the number of channels to ensure the consistency of feature dimensions. In the second branch, the convolutional feature map is combined with parallel maximum pooling and average pooling operations to extract features from different angles and enhance the diversity and robustness of features. Ultimately, the module forms three independent paths: one from the downsampled 3x3 convolution, and the other two from the maximum pooling and average pooling after the 1x1 convolution. By splicing the feature maps of these three paths in the channel dimension, rich output features are generated. This design significantly improves the detection accuracy and robustness of the model, enabling it to accurately identify safety protection equipment in complex backgrounds and different postures.
[0070] To improve the accuracy of bounding box regression, the Shape-IoU loss function is adopted. Compared with the traditional IoU loss function, Shape-IoU not only considers the degree of overlap between bounding boxes, but also focuses on the shape and scale of the bounding boxes themselves. This design allows the loss function to more accurately reflect the differences between bounding boxes, thereby guiding the model to perform more precise bounding box regression. By introducing the Shape-IoU loss function, the performance of YOLOv8n in tasks such as helmet detection is further improved. The Shape-IoU loss function is defined as follows:
[0071]
[0072] Among them, IoU is used to measure the overlap between the predicted box and the real box, where B and B gt Represents the predicted box and the ground-truth box, respectively. The IoU value is the area of the intersection of the predicted box and the ground-truth box divided by the area of their union. A larger value indicates a higher degree of overlap between the predicted box and the ground-truth box, and a more accurate prediction.
[0073]
[0074] Among them, w scale is the width adjustment formula, h scale is the height adjustment formula. scale is the scale factor, w scale and h scale They are the weight coefficients in the horizontal and vertical directions respectively. Their values are related to the shape of the real box and are used for scale adaptation of the model.
[0075]
[0076] Among them, distance shapeIt is the weighted Euclidean distance between the center point of the predicted box and the center point of the real box. The weight is the adjusted width and height, reflecting the influence of the distance between the center points on shape matching. c Represents the coordinate of the center point of the prediction box on the x-axis. c gt is the coordinate of the center point of the ground-truth box on the x-axis. c is a constant used to normalize the distance so that the distance calculation between boxes of different scales is consistent.
[0077]
[0078] Among them, Ω shape is the shape loss function, which sums the width (w) and height (h) scales. θ represents the degree of attention to shape loss and is usually set to 4.
[0079]
[0080] Among them, w w and w h are the adjusted width and height, w gt and h gt Represents the width and height of the real box, which also takes into account the maximum value of the predicted box and the real box to ensure that the adjusted box can cover the actual target area.
[0081] L Shape-IoU =1-IoU+distance shape +0.5×Ω shape
[0082] Finally, the Shape-IoU method improves the accuracy of bounding box regression by introducing additional attention to shape and scale. It combines the intersection over union (IoU) with shape and scale adjustment factors to more accurately capture the actual shape and size of the object when processing the bounding box.
[0083] FaceNet uses a deep convolutional neural network (CNN) to achieve efficient face recognition by mapping facial images into a high-dimensional embedding space. This process involves multiple convolutional layers, pooling layers, and fully connected layers, which work together to extract detailed features from the image. To improve computational efficiency and reduce model complexity, FaceNet adopts the depthwise separable convolutions from MobileNetV1. This convolution approach significantly reduces computational effort and model complexity by decomposing the standard convolution into pixel-by-pixel and channel-by-channel convolutions. However, this simplification can compromise feature representation, resulting in a reduction in feature expressiveness. To address this issue, FaceNet introduced the SE (Squeeze-and-Excitation) module, which is added after the depthwise separable convolutions. The SE module adaptively adjusts the weights of each channel to enhance the response to key features, thereby improving the model's ability to capture details and enhancing its representational power. Ultimately, by adding the SE module after the depthwise separable convolution to generate the embedding vector, facial images of the same person are close to each other in the embedding space, while images of different people are separated in space, thereby achieving high-precision face recognition. Through the above improvements, the network can improve the ability to distinguish features while maintaining computational efficiency, further improving the accuracy and robustness of facial recognition.
[0084] FaceNet uses a triplet loss function during training, directly optimizing the embedding vectors so that images of the same person are closer in the embedding space, while images of different people are further apart. Specifically, a triplet consists of a reference sample (anchor), a positive sample (positive), and a negative sample (negative). The loss function aims to minimize the distance between the reference sample and the positive sample, while maximizing the distance between the reference sample and the negative sample. This loss function design enables FaceNet to perform well in face recognition tasks and significantly improves recognition accuracy.
[0085] The triplet loss function formula is as follows:
[0086]
[0087] in and are the feature vectors of anchor points, positive samples, and negative samples respectively, α is the threshold, [z] + It means that loss occurs when the difference between the intra-class distance and the inter-class distance is greater than α.
[0088] Finally, ten-fold cross validation was used to perform ten-fold cross validation on the improved YOLOv8n and FaceNet models respectively. The dataset was randomly divided into 10 subsets, 9 subsets were used as training sets each time, and the remaining subset was used as a validation set. This was repeated 10 times to ensure that each subset was used as a validation set once.
[0089] Step S3 includes the following contents:
[0090] S3: Use the trained YOLOv8n improved model to quickly scan the live image, detecting and locating objects such as faces (face), safety helmets (safety_helmet), safety vests (safety_vest), and safety gloves (safety_gloves) in the image. The system also determines whether employees are wearing all necessary safety protective equipment. If an employee is not wearing any protective equipment, the system immediately triggers a missing equipment warning, prompting management to take timely action. If the employee is wearing all necessary safety protective equipment, the system continues with the face recognition process. From the detected results, the bounding boxes belonging to the face category are selected; these bounding boxes represent the face regions. The face image is cropped from the original image based on the bounding boxes of the face regions.
[0091] Wherein step S4 comprises the following contents:
[0092] S4: After acquiring the cropped facial image, the MTCNN is first applied to detect the face and keypoint coordinates. Based on the differences between the detected keypoints and the template coordinates, an affine transformation matrix is calculated. This matrix describes how to rotate, scale, and translate the current facial image so that its keypoints precisely align with the template coordinates. By applying this transformation matrix, all collected facial images are adjusted to a uniform pose and scale.
[0093] Specifically, after obtaining the cropped image in step S3, MTCNN is first applied to detect its face position and key point coordinates. Then, based on the difference between the detected key point coordinates and the template coordinates in step S1, the affine transformation matrix is calculated. This matrix describes how to rotate, scale, and translate the current face image so that its key points are accurately aligned with the template coordinates. By applying this transformation matrix, all collected face images are adjusted to a uniform posture and scale, thereby improving the stability and accuracy of the face recognition algorithm. MTCNN is a lightweight cascade convolutional neural network that gradually refines the face candidate frame through three network stages of different depths (P-Net, R-Net, O-Net), and finally outputs the face position and the coordinates of five key points (center of both eyes, tip of the nose, left and right corners of the mouth).
[0094] Wherein step S5 comprises the following contents:
[0095] S5: Considering the frequent and uneven lighting conditions in machine manufacturing workshops, direct face recognition may result in a drop in recognition rate due to varying lighting conditions. After face alignment, image equalization is used to optimize image quality. Image equalization primarily adjusts the brightness and contrast distribution of an image to achieve a more uniform distribution of pixel values across the entire image, thereby reducing the impact of lighting variations on recognition. Therefore, adaptive histogram equalization is used to effectively address local lighting variations.
[0096] Wherein step S6 comprises the following steps:
[0097] S61: Input the processed face image into the FaceNet model and extract the feature vector (embedding) of the face. Calculate the cosine similarity between the feature vector of the face to be verified and the feature vector of the face in the face database face_dataset, and determine whether it is a known identity based on the similarity. The value range of cosine similarity is between 0 and 1. The closer the value is to 1, the more similar the two vectors are, and the closer the value is to 0, the less similar they are. Set a suitable cosine similarity threshold based on the needs of the actual application and the performance of the system. If the cosine similarity between the new embedding and an embedding in the database is higher than this threshold, they are considered to belong to the same person; otherwise, they are considered to not belong to the same person. The formula for cosine similarity is as follows:
[0098]
[0099] Where A and B represent the feature vectors of two face images in the vector space respectively.
[0100] S62: If the identification result indicates that the employee is a non-resident, the system will immediately issue a non-resident warning, alerting safety management personnel to take appropriate measures. If the identification result indicates that the employee is a workshop employee, they will be allowed to work in the workshop, and the system will record their identity and the compliance of the various protective equipment they are wearing. This allows us to not only monitor employees' safety wearing in real time, but also effectively manage the entry and exit of workshop personnel, improving the overall safety level of the workshop.
[0101] By integrating image object detection with facial recognition technology, this method enables comprehensive monitoring of employee safety and protection status and effective identification. This method is efficient, accurate, and reliable, and has broad application prospects in the machinery manufacturing industry.
[0102] The above are merely preferred embodiments of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A method for detecting safety wear and face recognition of mechanical manufacturing workshop employees based on deep learning, characterized in that: include: Construct a face sample set; Perform key point detection based on the face sample set to obtain template coordinates; Constructing an image target detection model and a face recognition model, wherein the image target detection model adopts an improved YOLOv8n model, and the face recognition model adopts an improved FaceNet model; Acquire real-time images of personnel in a mechanical manufacturing workshop, detect and locate the real-time images using an image target detection model, and obtain recognition and positioning results, wherein the recognition and positioning results include bounding boxes and corresponding types of faces and personal protective equipment worn; Based on the recognition and positioning results, the real-time image is cropped according to the bounding box of the face to obtain a face image; and the face image is aligned according to the template coordinates; The aligned face image is recognized by a face recognition model to obtain a face vector, and the face vector is judged according to the face sample set to obtain the identity information of the person to realize the detection of personal protective equipment and whether the person is an outsider; The process of building an image object detection model includes: Add the MCS module to the output of the backbone network of the YOLOv8n model; Introducing the DownSimper module to replace the traditional convolution of the Neck part in YOLOv8n; The Shape-IoU loss function is used as the loss function of the YOLOv8n model to construct an image target detection model; The MCS module combines the MEW multi-axis external weight module with the CBAM attention, sets the MCS module at the output end of the backbone network, and uses the features processed by the MCS module as the final output; The process of detecting key points based on a face sample set includes: Use the MTCNN model to detect key points of the face samples in the face sample set and obtain the template coordinates; The process of aligning the face images includes: Detecting the face image using MTCNN to obtain the coordinates of the face and key points; According to the difference between the key point coordinates and the template coordinates, the affine transformation matrix is calculated; Adjusting the facial image according to the affine transformation matrix to obtain an aligned facial image; The real-time image is cropped according to the bounding box of the face, including: Determine the corresponding category of the personal protective equipment in the identification and positioning results. If the corresponding category of the personal protective equipment matches the preset personal protective equipment, crop the real-time image; otherwise, issue a warning. The process of judging the face vector includes: Obtain a sample face vector of a face sample in a face sample set; perform cosine similarity calculation between the face vector and the sample face vector, and perform a threshold judgment on the cosine similarity calculation result. If the cosine similarity calculation result is less than the threshold, the employee information corresponding to the face sample is obtained as the personnel identity information; otherwise, the personnel identity information is that of an outsider; After obtaining the personnel identity information, it also includes: If the person's identity information is that of an outsider, a warning and reminder will be issued. If the person's identity information is the employee information corresponding to the face sample, the corresponding type of personal protective equipment worn by the person identified in the real-time image will be recorded.
Citation Information
Patent Citations
Face anti-counterfeiting method, processor chip and electronic device
CN112424795B
Tunnel worker safety helmet detection and face recognition method
CN115588165A