Improved YOLO model and application thereof in kitchen sanitary safety
Through the improved YOLOv10 model, combined with the Wise-IOU loss function and GAM module, the existing kitchen food safety monitoring measures are solved, and efficient and accurate food safety inspection is achieved.
Patent Information
- Application Number
- CN202411816458.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-03-28
AI Technical Summary
Existing food safety monitoring measures in the back kitchen are inefficient, costly and slow to respond, making it difficult to meet complex food safety needs.
Develop an improved YOLO model called YOLOv10, using Wise-IOU loss function and Global Attention Mechanism (GAM) module to improve object detection performance and efficiency.
The model performs well in complex environments, and can accurately identify and monitor various risk behaviors in the kitchen, improving the accuracy and efficiency of food safety testing.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of sanitation and safety, and in particular to an improved YOLO model and its application in kitchen sanitation and safety. Background Art
[0002] Food safety is a core issue in the field of global public health and is directly related to the health and quality of life of consumers. With the rapid development of the food industry, food safety issues are becoming increasingly complex, especially in the back-kitchen operation environment, where hygiene and safety standards have become the focus of regulatory agencies and the food industry. According to Dai and Wu (2023), although the rise of online food delivery platforms has brought great convenience to consumers, it has also increased the risk of food safety, especially in the food processing and distribution links, where safety issues are more prominent. In addition, Gao et al. Gao, Dai, Wu, Zhang, and Hu (2023) pointed out that corporate behavior in the food supply chain is not only strictly regulated by the government, but also jointly supervised by consumers and social organizations, emphasizing the importance of social co-governance in food safety management.
[0003] However, bad behaviors in the kitchen environment, such as rats, shirtless workers and smoking, are still common. These behaviors should not occur in a kitchen with strict hygiene management. The kitchen operations are displayed in real time through monitoring projection, transparent kitchen glass and Internet live broadcast. These measures have enhanced food safety to a certain extent, but due to the reliance on manual operations, there are still several significant problems:
[0004] 1. Low efficiency: Manual supervision requires a lot of human resources to continuously monitor back-kitchen activities. This is especially difficult in large catering institutions or environments with multiple kitchens, resulting in low supervision efficiency.
[0005] 2. High cost: Long-term reliance on manual supervision not only requires paying a large amount of staff wages, but also requires continuous investment in maintenance and upgrading of monitoring equipment, which undoubtedly increases operating costs.
[0006] 3. Slow response: Manual supervision makes it difficult to detect problems in real time, especially during peak hours or when multiple tasks are running in parallel. Problems may be ignored or delayed, resulting in the inability to respond to food safety incidents in a timely manner.
[0007] The above problems clearly show that the current measures can no longer meet the increasingly complex food safety needs. Therefore, the development of an automated kitchen food safety detection system has become a key task that needs to be solved urgently. The automated system can not only significantly improve monitoring efficiency and reduce labor costs, but also achieve real-time monitoring and rapid response to potential risks, thereby comprehensively improving the level of kitchen food safety management.
[0008] At present, target detection technology is mainly divided into two categories: single-stage target detection and two-stage target detection.
[0009] Single-stage target detection, represented by YOLO, was proposed by Joseph Redmon et al. in 2016. YOLO transforms target detection into a regression problem, and YOLOv1 achieves near real-time detection speed Redmon, Divvala, Girshick, and Farhadi (2016). The subsequent YOLOv3 introduced multi-scale prediction and Darknet-53 network structure Redmon (2018), YOLOv4 and YOLOv5 optimized detection speed and accuracy, and YOLOv8 improved small target detection capabilities through CSP variants, Mish activation functions, E-Mosaic data enhancement and other technologies. The latest version YOLOv10 greatly reduces computational overhead and improves detection performance through dual assignment strategies and new model design, which is suitable for real-time feedback scenarios, such as back-kitchen food safety detection Wang et al. (2024).
[0010] Two-stage object detection, represented by R-CNN, was proposed by Ross Girshick et al. in 2014. R-CNN generates candidate regions through the region proposal network (RPN), and then uses CNN to extract features and classify Girshick (2015). Fast R-CNN reduces the amount of calculation and improves detection efficiency by sharing convolutional features; Faster R-CNN achieves end-to-end training by integrating RPN and optimizes the detection process Ren (2015) Girshick, Donahue, Darrell, and Malik (2015).
[0011] In the field of food safety detection, the YOLO series of models have shown great potential. However, the application scope and model optimization degree of existing research are still insufficient. Tao et al. Tao, Ruixia, Biao, and Jianlin (2021) used the YOLOv5s training model to detect not wearing a chef hat and smoking behavior. Although the overall accuracy rate was 87.3%, the model structure was not improved, and there is still room for improvement. Zhou et al. Zhou et al. (2023) based on the YOLOv5s detection system achieved an average accuracy of up to 0.857 and a detection speed of 31.42FPS, but the model structure was also not optimized. Guo et al. Guo et al. (2022) used YOLOv5l and DeepSort algorithms for personnel detection and behavior recognition. The model achieved 95.32% and 96.32% accuracy respectively under the time constraint of detecting whether the chef wears a hat and a mask. However, the YOLOv5l model is not suitable for the actual deployment of back kitchen monitoring due to its large number of parameters, long training time and slow recognition speed. Shi et al. (2023) used COCO pre-trained YOLOv5s weights for transfer learning, and achieved 97.6% mAP (0.5) through parameter tuning and model pruning, but the amount of test data was only 48, which limited its versatility. Chen et al. Chen, Gao, Li, and Zhang (2023) proposed a model based on the improved YOLOv5-5.0 framework and k-medoids clustering algorithm, combined with the SENet layer to improve the feature extraction ability of small targets, and the average accuracy reached 99.2% (0.5IOU). However, the data used in this study were all simulated scenes, and the objects were hamsters, and the problems of multi-scale detection and low-quality data were not fully considered. In summary, although these studies have shown the great application potential of the YOLO series model in back-kitchen food safety detection, the current research has limited types of behavior recognition and the model structure has not been fully optimized, and there is still a lot of room for improvement. Summary of the invention
[0012] In view of the above problems, the present invention provides an improved YOLO model, which has high target detection performance, especially small target detection effect in complex environments, and is an efficient model that can support multi-category recognition. The model can accurately identify and monitor various risk behaviors in the kitchen environment, and can improve the accuracy and efficiency of food safety detection in the kitchen.
[0013] In order to achieve the above object, the present invention provides an improved YOLO model, including a YOLOv10 model, wherein the loss function of the YOLOv10 model is a Wise-IOU loss function.
[0014] YOLOv10 was proposed by the research team of Tsinghua University Wang et al. (2024), and has made many improvements on the basis of YOLOv8. These improvements include the introduction of the PSA (Partial Self-Attention) module to enhance the model's perception of targets of different scales. In addition, the original C2F module is replaced with the C2FCIB (Cross Stage Partial with Inverted Bottleneck) module, which further improves the efficiency of feature extraction by introducing partial channel interactions across stages and inverted residual structures. At the same time, YOLOv10 uses the SCDown (Spatial-Channel Decoupled Downsampling) module to replace the traditional convolution downsampling operation, optimizes the downsampling process, and significantly reduces the computational cost without losing accuracy.
[0015] The Backbone structure of YOLOv10 is based on ELAN (Efficient Layer Aggregation Network), which is an efficient feature aggregation network that inherits the excellent design of the YOLO series and introduces a multi-level feature fusion mechanism. ELAN significantly reduces the amount of computation by hierarchically aggregating multi-scale features while maintaining high-precision feature extraction capabilities. The Backbone of YOLOv10 also combines the C2FCIB module, which enhances the model's ability to learn multi-scale features by introducing deep separable convolutions and point-by-point convolutions in the inverted residual structure. In addition, the SCDown module further reduces computational complexity and maximizes information retention by decoupling spatial downsampling and channel transformation.
[0016] In the head part, YOLOv10 adopts a design that combines a lightweight classification head and a partial self-attention module. This design aims to improve the accuracy of target classification and positioning while maintaining computational efficiency. Compared with YOLOv8, the head part of YOLOv10 is more flexible in design and can work efficiently and stably in complex scenarios.
[0017] The loss function has an important impact on the performance of target detection. YOLOv10 uses the CIoU (Complete Intersection over Union) loss function by default, which not only takes into account the overlap between bounding boxes, but also takes into account the center point distance and aspect ratio, so as to more accurately evaluate the difference between the predicted box and the true box. However, when dealing with the specific needs of kitchen hygiene and safety, CIoU may not provide optimal performance, especially when facing small targets or complex backgrounds. In order to improve the performance of YOLOv10 in kitchen monitoring, the inventors introduced the Wise-IOU (WIoU) loss function, which optimizes the model's learning of low-quality samples through a dynamic non-monotonic focusing mechanism, enhances the generalization ability, especially in small target detection and night environments.
[0018] In one embodiment, the backbone network of the YOLOv10 model includes a GAM module.
[0019] The inventors also introduced the Global Attention Mechanism (GAM) module in the Backbone of YOLOv10. The GAM module is loaded before the Spatial Pyramid Pooling Module (SPPF) of Backbone. Figure 1 The improved YOLOv10 model structure is shown. The choice of this position is to use GAM to enhance the global interaction of feature maps, thereby improving the model's perception of objects in the kitchen scene. GAM significantly improves the model's detection performance for objects of different scales and positions by reducing information dimensionality and amplifying global interaction representation. Through these targeted improvements, the YOLOv10-S version can provide more efficient and accurate detection capabilities for kitchen monitoring tasks while maintaining a smaller model size.
[0020] The above model integrates the Wiou (Weighted Intersection over Union) and GAM (Global Attention Module) attention mechanisms on the basis of the original YOLOv10 model, further improving the performance of target detection, especially the detection of small targets in complex environments. In addition, the inventors verified the effectiveness of the Wiou and GAM mechanisms through a large number of experiments and ablation studies, and compared them with other attention mechanisms, demonstrating the advantages of the proposed method.
[0021] In one of the embodiments, the GAM module is arranged before the SPPF of the backbone network.
[0022] In one of the embodiments, the GAM module includes a channel attention submodule and a spatial attention submodule, and the spatial attention submodule is used to input the output data of the channel attention submodule.
[0023] In one embodiment, the calculation formula of the channel attention map Mc of the channel attention submodule is as follows: F2=Mc(F1)⊙F1; the calculation formula of the spatial attention map Ms of the spatial attention submodule is as follows: F3=Ms(F2)⊙F2; wherein F1 is the input data of the channel attention submodule, F2 is the output data of the channel attention submodule, F3 is the output data of the spatial attention submodule, ⊙ represents element-by-element multiplication, Mc=MLP(permute(F1)), Ms=Conv(F2).
[0024] In one embodiment, the calculation formula of the Wise-IOU loss function is as follows: L W iou =L CIoU +λ·Orientation, where L W iou is the Wise-IOU loss function, L CIoU is the CIoU loss function, λ is the balance factor, and Orientation represents the directional consistency measure of the bounding box.
[0025] In one embodiment, the YOLOv10 model is a YOLOv10-S model.
[0026] The YOLOv10 series includes five versions: N, S, M, L, and X, suitable for different application scenarios. The N version is the lightest and suitable for edge device applications; the X version has a significant advantage in accuracy. In response to the special requirements for speed and model size in kitchen monitoring, we chose the YOLOv10-S version, which can provide excellent detection results while maintaining a small model size.
[0027] The present invention also provides a method for evaluating the hygiene and safety of a back kitchen, comprising the following steps: inputting the back kitchen monitoring data to be evaluated into the improved YOLO model, calculating the category, confidence score and location box information of the back kitchen monitoring data, marking the back kitchen monitoring data with a confidence score ≥ 0.25, and evaluating the hygiene and safety of the back kitchen.
[0028] In one embodiment, the categories include violation categories, and the violation categories include at least one of rats, smoking, being shirtless, not wearing a hat, and not wearing a mask; the evaluation method includes: if the category of the back kitchen monitoring data is at least one of the violation categories, then the back kitchen monitoring data is evaluated as unsanitary.
[0029] The above model can be used to accurately identify and monitor various risky behaviors in the kitchen environment, such as being shirtless, smoking, not wearing a mask, rats, not wearing a hat, etc., covering the key aspects of kitchen safety.
[0030] In one embodiment, the categories include compliance categories and violation categories, the compliance categories include at least one of people, wearing clothes, wearing hats, and wearing masks, and the violation categories include at least one of mice, smoking behavior, shirtless, not wearing hats, and not wearing masks.
[0031] In one of the embodiments, after the back-kitchen monitoring data is input into the improved YOLO model, if the improved YOLO model does not identify the back-kitchen monitoring data as at least one of the categories, the back-kitchen monitoring data is output.
[0032] In one of the embodiments, the back kitchen monitoring data includes image data of the back kitchen.
[0033] The present invention also provides a system for evaluating kitchen hygiene and safety, comprising:
[0034] A data storage module, used to store the improved YOLO model and the kitchen monitoring data to be evaluated;
[0035] A data analysis module, used for performing analysis according to the evaluation method; and
[0036] The data display module is used to output and display the kitchen hygiene and safety status of the kitchen monitoring data to be evaluated.
[0037] Compared with the prior art, the present invention has the following beneficial effects:
[0038] An improved YOLO model of the present invention and its application in kitchen hygiene and safety, the model has high target detection performance, especially small target detection effect in complex environment, and is an efficient model that can support multi-category recognition. The model can accurately identify and monitor various risk behaviors in the kitchen environment, and can improve the accuracy and efficiency of kitchen food safety detection. The experimental results show that the improved model performs well in complex backgrounds and diversified scenarios, especially in monitoring risk behaviors such as bare chest, not wearing masks, and rats. Through a large number of experiments and ablation studies, the effectiveness of Wiou and GAM mechanisms is verified, and compared with other attention mechanisms, showing the advantages of the proposed method in kitchen food safety detection. The evaluation indicators of the final model on the validation set show that the accuracy is 0.915, the recall rate is 0.851, the mAP50 is 0.909, and the mAP50-95 is 0.564. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 This is a structural diagram of the improved YOLO model of the present invention;
[0040] Figure 2 This is a schematic diagram of the GAM module structure in the embodiment;
[0041] Figure 3 This is the confusion matrix result diagram of the improved YOLO model on the verification data in the experimental example;
[0042] Figure 4 This is a diagram showing the prediction effect of the improved YOLO model in different scenarios in the experimental example, where: Figure 4 (a) is the true label, Figure 4 (b) is the prediction result. DETAILED DESCRIPTION
[0043] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. The preferred embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive.
[0044] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0045] source:
[0046] Unless otherwise specified, the reagents, materials, and equipment used in this example are all commercially available; the experimental methods are all conventional experimental methods in the art unless otherwise specified.
[0047] Example
[0048] An improved YOLO model.
[0049] 1. Integrate into GAM module.
[0050] In order to meet the special target detection needs in the kitchen scene, YOLOv10 incorporates the GAM (Global Attention Mechanism) attention mechanism Liu et al. (2021). The target detection in the kitchen is mainly for chefs and mice. The detection of chefs needs to pay attention to behavioral norms such as whether they wear masks, hats, and shirtless; while the detection of mice needs to consider their size and activity time period, especially at night. The detection is more difficult. GAM can effectively improve the detection accuracy of small targets and targets in complex backgrounds by enhancing the model's ability to capture features of global space-channel interactions.
[0051] The structure of the GAM module can be derived from Figure 2 The module mainly consists of two key parts: channel attention and spatial attention. The following is the detailed workflow and core calculation formula of the GAM module:
[0052] Channel attention submodule: This submodule first uses 3D permutation technology to retain information across three dimensions: channel, height, and width. Then, a two-layer MLP (multi-layer perceptron) is used to enhance the channel-spatial dependencies across dimensions. The MLP adopts an encoder-decoder structure with a reduction ratio r. Given an input feature map F1∈R C×H×W , the channel attention map Mc is calculated as follows:
[0053] F2=Mc(F1)⊙F1
[0054] Here, ⊙ represents element-wise multiplication.
[0055] Spatial attention submodule: This submodule focuses on the extraction of spatial information and realizes the fusion of spatial information through two convolutional layers. Similar to the channel attention submodule, the reduction ratio r is also used here. In order to further preserve the feature map information, we remove the pooling operation. The calculation of the spatial attention map Ms is as follows:
[0056] F3=Ms(F2)⊙F2
[0057] In the calculation of Mc and Ms, we use the following formula to ensure that the calculation of the attention map does not introduce too many parameters when the feature map size is large:
[0058] Mc=MLP(permute(F1))
[0059] Ms=Conv(F2)
[0060] Through this design, the GAM module not only reduces the dimensionality of information, but also amplifies the global interaction representation, thereby significantly improving the model's performance in target detection in the kitchen environment, especially the detection of small targets such as mice at night or under poor lighting conditions.
[0061] The introduction of GAM significantly enhances the accuracy and robustness of YOLOv10 in target detection in the kitchen environment, especially in the detection of small targets such as mice at night or under complex lighting conditions, the performance improvement is particularly significant.
[0062] 2. Loss Function Improvement
[0063] The loss function plays a vital role in the object detection task, which directly affects the performance of the model. YOLOv10 uses the CIoU loss function by default. This function adds the consideration of center point distance and aspect ratio on the basis of traditional IoU, thereby improving the accuracy of bounding box regression. The formula of CIoU is as follows:
[0064]
[0065] Among them, ρ(b,bgt) represents the Euclidean distance between the center points of the predicted box and the true box, c is the diagonal distance of the minimum closed area surrounding the predicted box and the true box, v is a parameter used to measure the consistency of the aspect ratio, and α is a weight balance factor.
[0066] However, CIoU still has certain limitations when dealing with complex scenes. To this end, we introduced Wise-IOU (Wiou) as an improved loss function. Based on CIoU, Wiou further optimizes the accuracy of bounding box regression. By considering the directional consistency between the predicted box and the true box, Wiou significantly improves the detection ability of the model in complex backgrounds. The calculation formula of Wiou is:
[0067] L W iou =L CIoU +λ·Orientation
[0068] Among them, λ is the balance factor, and Orientation represents the directional consistency measurement item of the bounding box. By introducing the Wiou loss function, the performance of YOLOv10 in the kitchen monitoring task has been further optimized, especially in dealing with scenes with severe occlusion and dense targets, the detection accuracy has been significantly improved.
[0069] 3. Improved YOLO model.
[0070] By integrating the GAM module and improving the loss function in this embodiment, an improved YOLO model is obtained, which is a YOLOv10 model. In this embodiment, the YOLOv10-S model is specifically used.
[0071] The loss function of the YOLOv10 model is the Wise-IOU loss function, and a GAM module is set before the SPPF of the backbone network. The GAM module includes a channel attention submodule and a spatial attention submodule.
[0072] Experimental example
[0073] 1. Dataset and Experimental Settings.
[0074] The experiment was conducted on Windows 10 operating system, using Python 3.9.19 and PyTorch 2.4.0+cu118, equipped with CUDA:0 (Tesla P100-PCIE-16GB, 16299MiB). The experimental setting includes 200 training cycles (epochs), 32 samples per batch, and the input image size is 640 pixels. The model performance is evaluated by precision (P), recall (R), and average precision (mAP50 and mAP50-95) at IoU thresholds from 50% to 95%. The calculation formulas for these indicators are as follows:
[0075] Precision
[0076] Recall
[0077] Mean Average Precision (mAP): The AP of each category is calculated at different IoU thresholds and then the average is taken.
[0078] Since the acquisition of kitchen monitoring data involves privacy and security issues, we used a publicly available dataset and manually annotated it. A total of 5,378 images were collected, divided into 4,841 training sets and 537 validation sets. Nine categories were annotated, including people, mice, smoking behavior, shirtless, wearing a hat, not wearing a mask, wearing a mask, wearing clothes, and not wearing a hat. The specific number of each category is shown in Table 1.
[0079] Table 1 Total amount of data in each category
[0080]
[0081] The method for evaluating kitchen hygiene and safety using the improved YOLO model is as follows:
[0082] The kitchen monitoring data to be evaluated is input into the improved YOLO model in the embodiment, the category, confidence score and location box information of the kitchen monitoring data are calculated, and the kitchen monitoring data with confidence ≥ 0.25 is marked by box selection.
[0083] In this experimental example, the above categories include compliance categories and violation categories. The compliance categories are people, wearing clothes, wearing hats, and wearing masks. The violation categories are mice, smoking behavior, bare-chested, not wearing hats, and not wearing masks. If the category of the kitchen monitoring data to be evaluated is at least one of the violation categories, the kitchen hygiene and safety of the kitchen monitoring data is evaluated as unhygienic. If the improved YOLO model does not identify the kitchen monitoring data to be evaluated as any of the above categories (including compliance categories and violation categories), the improved YOLO model outputs the original kitchen monitoring data to be evaluated.
[0084] 2. The impact of different loss functions on model performance.
[0085] In order to verify the effectiveness of the WIoU loss function, this experiment compared it with loss functions such as CIoU, aFEIoU (Alphal Focal-EIoU), FEIoU (Focal-EIoU), EIoU, DIoU, SIoU and GIoU.
[0086] Among them, FEIoU (Focal-EIoU) Zhang et al. (2022) improves the focus on difficult samples by combining the characteristics of Focal Loss and EIoU; DIoU (Distance IoU) Zheng et al. (2020) enhances the positioning accuracy by introducing the distance penalty term between the predicted box and the center point of the true box; SIoU (Scaled IoU) optimizes the target scale and is more suitable for processing targets of different sizes; GIoU (Generalized IoU) Rezatofighi et al. (2019) solves the problem of zero IoU loss when the bounding boxes do not overlap by considering the minimum closure of the bounding box. In contrast, WIoU (Weighted IoU) Tong et al. (2023) introduces weighted factors for the width and height of the bounding box, making it more robust in multi-scale and complex backgrounds, especially when dealing with the shape and overlapping areas of the bounding boxes.
[0087] Experimental results show that WIoU provides higher mAP50 and recall values in most cases.
[0088] Table 2 Performance comparison of different loss functions
[0089]
[0090]
[0091] As can be seen in Table 2, each loss function has different performances on different indicators. WIoU achieved the highest mAP50 indicator of 0.908, and the recall rate also reached the highest 0.853, indicating its excellent performance in kitchen hygiene and safety monitoring. Although GIoU is slightly higher than WIoU in the mAP50-95 indicator by 0.003, other evaluation indicators are lower than WIoU. Therefore, after comprehensive consideration, WIoU was selected as the best loss function. This shows that WIoU has stronger adaptability and stability when dealing with complex backgrounds and diverse scenes, and is an ideal choice for kitchen hygiene monitoring tasks.
[0092] 3. The impact of adding different attention modules on model performance.
[0093] This experiment explores the impact of different attention mechanisms on model performance. Attention mechanisms, such as SENet's SE module, CBAM, ELA, LSKA, CAA, and EMA, help the model focus on key information in the image by enhancing the weight of specific features.
[0094] The SE module (Squeeze-and-Excitation) Hu, Shen, and Sun (2018) compresses the spatial dimension through global average pooling and generates channel attention weights to enhance the features of specific channels; CBAM (Convolutional Block Attention Module) Woo, Park, Lee, and Kweon (2018) combines channel and spatial attention modules to further refine the expression of feature maps; EMA (Efficient Multi-Scale Attention) Ouyang et al. (2023) improves the performance of the model by learning multi-scale features and fusing global information; LSKA (Large Separable Kernel Attention) Lau, Po, and Rehman (2024) achieves effective processing of large receptive fields through the decomposition of large convolution kernels; ELA (Efficient Local Attention) Xu and Wan (2024) proposes an efficient local attention mechanism that accurately locates the region of interest through strip pooling without reducing the channel dimension, thereby improving the performance of the model in image classification and object detection; CAA (Context Anchor Attention) Cai et al. al. (2024) performed well in the task of object detection in remote sensing images by combining multi-scale convolution kernels and global context information, capturing long-distance pixel relationships and enhancing central area features. In contrast, GAM (Global Attention Mechanism) Liu et al. (2021) enhances the interaction of channel and spatial features through global information, thereby improving the model's ability to recognize key objects and behaviors in the kitchen environment. GAM performs well by reducing information reduction and amplifying global interaction features, especially when dealing with complex backgrounds and diverse scenes.
[0095] Experimental results show that GAM performs best on all evaluation metrics, especially on the mAP50-95 metric, which demonstrates its effectiveness in dealing with complex backgrounds and diverse scenes.
[0096] Table 3 Performance comparison of different attention mechanisms
[0097]
[0098] As can be seen from Table 3, different attention modules have different performances in various indicators. GAM achieved the highest precision indicator of 0.915, indicating that it can more accurately identify key objects in the back kitchen hygiene and safety monitoring task. Although CAA is slightly better in the mAP50 and mAP50-95 indicators, GAM has the best overall performance, especially when dealing with complex backgrounds and diverse scenes, showing higher stability and adaptability. Therefore, in practical applications, GAM is considered to be the best choice for back kitchen hygiene and safety monitoring tasks.
[0099] 4. Ablation experiment.
[0100] The purpose of the ablation experiment is to evaluate the contribution of each component to the overall performance by gradually removing different components of the model. In this study, YOLOv10s is used as the baseline model, and the GAM (Global Attention Mechanism) and WIoU (Weighted IoU) loss functions are gradually added to observe the changes in model performance. The experimental results in Table 4 show that the combination of GAM and WIoU has the best effect, improving the model's precision and mAP indicators. This result emphasizes the importance of accurately capturing details and coping with complex scenarios in back kitchen safety monitoring.
[0101] Table 4 Ablation experiment results
[0102]
[0103] In order to better view the recognition effect of the improved model on different categories, the confusion matrix of the model on the training set is also plotted. Figure 3 As shown, the recognition accuracy of each category is shown.
[0104] From the confusion matrix analysis, it can be seen that the model's accuracy in identifying people, mice, shirtless and wearing masks is over 90%, among which the highest accuracy of mice is 95%. This performance is due to the high-quality samples for the mouse category in the dataset, especially the rich data in the dark environment. In contrast, the accuracy of not wearing a hat is the lowest, at 80%. This problem may be related to the quality and quantity of the data, or it may be related to the shape diversity and color variation of the hat. However, overall, the improved model has demonstrated a high recognition effect in the back kitchen monitoring task.
[0105] Finally, we use the trained model to test on unseen data. The test results are as follows: Figure 4As shown in the figure, it is obvious that the model performs well in identifying mice with a confidence level of 90%, while the recognition of smoking is relatively poor, with some misjudgment. This problem may be largely related to image quality and lighting conditions. Nevertheless, the overall recognition performance of the model is still worthy of recognition.
[0106] 5. Conclusion
[0107] By comparing different loss functions and attention mechanisms, the present invention verifies the effectiveness of GAM (Global Attention Mechanism) and WIoU (Weighted IoU) in kitchen safety monitoring. Ablation experiments show that the combination of GAM and WIoU can achieve the best model precision and recall. Specific experimental results show that GAM performs best in accuracy evaluation indicators, reaching 91.5%. Although other indicators did not achieve the best results, the overall effect is the best, indicating its effectiveness in dealing with complex backgrounds and diverse scenes.
[0108] The research content of this invention comes from the following projects:
[0109] 1. Project name: Key theories and methods of intelligent industrial Internet under big data environment. Project information: Guangdong Basic and Applied Basic Research Fund Project, No.: 2021B1515120048.
[0110] 2. Project name: Dual-mode kitchen safety detection system based on LLaVA multimodal large language model and YOLOv5 target detection model. Project information: Climbing Project, number: pdjh2024b398.
[0111] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0112] The above-mentioned embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. An improved YOLO model, characterized in that: A YOLOv10 model is included, and the loss function of the YOLOv10 model is a Wise-IOU loss function.
2. The improved YOLO model according to claim 1, characterized in that The backbone network of the YOLOv10 model includes a GAM module.
3. The improved YOLO model according to claim 2, characterized in that The GAM module is arranged before the SPPF of the backbone network.
4. The improved YOLO model according to claim 2, characterized in that The GAM module includes a channel attention submodule and a spatial attention submodule, and the spatial attention submodule is used to input the output data of the channel attention submodule.
5. The improved YOLO model according to claim 4, characterized in that The calculation formula of the channel attention map Mc of the channel attention sub-module is as follows: F2=Mc(F1)⊙F1; the calculation formula of the spatial attention map Ms of the spatial attention sub-module is as follows: F3=Ms(F2)⊙F2; wherein, F1 is the input data of the channel attention sub-module, F2 is the output data of the channel attention sub-module, F3 is the output data of the spatial attention sub-module, ⊙ represents element-by-element multiplication, Mc=MLP(permute(F1)), Ms=Conv(F2).
6. The improved YOLO model according to claim 1, characterized in that The calculation formula of the Wise-IOU loss function is as follows: L Wiou =L CIoU +λ·Orientation, where L Wiou is the Wise-IOU loss function, L CIoU is the CIoU loss function, λ is the balance factor, and Orientation represents the directional consistency measure of the bounding box.
7. The improved YOLO model according to any one of claims 1-6, characterized in that The YOLOv10 model is a YOLOv10-S model.
8. A method for evaluating kitchen hygiene and safety, characterized in that: The following steps are involved: The kitchen monitoring data to be evaluated is input into the improved YOLO model described in any one of claims 1-7, the category, confidence score and location box information of the kitchen monitoring data are calculated, the kitchen monitoring data with a confidence score ≥ 0.25 is marked by box selection, and the hygiene and safety of the kitchen is evaluated.
9. The evaluation method according to claim 8, characterized in that: The categories include violation categories, and the violation categories include at least one of rats, smoking, being shirtless, not wearing a hat, and not wearing a mask; the evaluation method includes: if the category of the back kitchen monitoring data is at least one of the violation categories, then the back kitchen monitoring data is evaluated as unsanitary.
10. A system for evaluating kitchen hygiene and safety, characterized in that: include: A data storage module, used to store the improved YOLO model according to any one of claims 1 to 7 and the back kitchen monitoring data to be evaluated; A data analysis module, used for performing analysis according to the evaluation method according to any one of claims 8 to 9; as well as The data display module is used to output and display the kitchen hygiene and safety status of the kitchen monitoring data to be evaluated.
Citation Information
Cited By
Image classification credibility evaluation method and system based on activation mode
CN121725331A