A chef hat detection method and device, computer equipment and storage medium
Patent Information
- Application Number
- CN202310087143.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-02
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2043-02-02
AI Technical Summary
但是厨师帽检测场景存在前景目标类别多、目标运动产生遮挡、光线干扰等特点,容易出现非人目标误检、厨师帽佩戴状态误检等问题,另外利用多步骤结合方案,检测效率低下,容易将静止目标判定为运动目标
[0039]存储器,用于存储计算机程序;
Smart Images

Figure CN116343108B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, computer device, and storage medium for detecting chef's hats. Background Technology
[0002] Every kitchen staff member has the obligation and responsibility to wear a chef's hat correctly to prevent hair and other debris from falling into the food and causing food safety issues. However, in reality, apart from a few hotels that strictly regulate the attire of their kitchen staff, most restaurants or canteens do not strictly adhere to this requirement, or their staff do not strictly follow it. This poses a serious challenge to food safety and hygiene.
[0003] With the development of machine vision, most catering businesses have achieved comprehensive video surveillance coverage. Current chef hat detection methods mainly employ a combination of fixed-point detection and classification, using deep learning to detect workers under video surveillance and determine whether they are wearing their chef hats correctly, thus reducing the burden of human supervision and improving the efficiency of transparent kitchen monitoring. However, chef hat detection scenarios are characterized by numerous foreground target categories, target movement causing occlusion, and lighting interference, easily leading to false detections of non-human targets and incorrect chef hat wearing status. Furthermore, the multi-step approach results in low detection efficiency and a tendency to classify stationary targets as moving targets. Simultaneously, due to the diverse application scenarios of chef hat detection, the performance of existing deep learning models depends heavily on the scene categories covered by the training samples, resulting in poor robustness. When the actual application scenario differs significantly from the training samples, false negatives or false positives are highly likely. Therefore, improving the efficiency and accuracy of chef hat detection is a problem urgently needing to be solved by those skilled in the art. Summary of the Invention
[0004] The purpose of this invention is to provide a chef's hat detection method, device, computer equipment, and storage medium. This invention filters out image information under backlight by enhancing the image information, thereby reducing the risk of misclassification of the chef's hat model. Furthermore, the method of determining the behavioral state of the target person and detecting based on the behavioral state can effectively avoid the problem of misclassifying the target person. It can be applied to various kitchen scenarios and can effectively reduce the risk of false alarms for chef's hats without affecting detection.
[0005] According to one aspect of the present invention, a method for detecting a chef's hat is provided, comprising:
[0006] Acquire scene information images, and detect the scene information images to obtain image information;
[0007] Based on the image information, image enhancement processing is performed on the image information to obtain the target image information;
[0008] Based on the target image information, determine the behavioral state of the target person in the target image information;
[0009] Based on the described behavioral state, the target person is classified and detected to obtain the chef's hat detection result.
[0010] Optionally, the step of performing image enhancement processing on the image information to obtain the target image information based on the image information includes:
[0011] Based on the image information, a superpixel image is obtained by color space conversion of the image information;
[0012] Based on the superpixel image, the variance of the brightness value of the superpixel image is calculated from the pixels of the superpixel image;
[0013] Determine whether the variance of the brightness value exceeds a preset threshold;
[0014] If the preset threshold is not exceeded, the image information corresponding to the superpixel image is extracted to obtain the target image information.
[0015] Optionally, determining the behavioral state of the target person in the target image information based on the target image information includes:
[0016] Based on the target image information, the motion ellipse of the target person in the target image information is calculated using the elliptical positioning method;
[0017] The behavioral state of the target person is determined based on the motion ellipse.
[0018] Optionally, the step of calculating the motion ellipse of the target person in the target image information using an elliptical positioning method based on the target image information includes:
[0019] The target image information is detected, and the initial coordinates of the first appearance of the target person and the first coordinates of the second appearance of the target person in the target image information are recorded.
[0020] The second coordinate is calculated based on the initial coordinate and the first coordinate;
[0021] The motion ellipse of the target person is calculated using the standard formula for an ellipse based on the first and second coordinates.
[0022] Optionally, determining the behavioral state of the target person based on the motion ellipse includes:
[0023] Based on the area of motion of the ellipse, determine whether the difference in the area of motion exceeds a preset threshold;
[0024] If the preset threshold is exceeded, the target person's behavior state is determined to be in motion.
[0025] If the preset threshold is not exceeded, the target person's behavior state is determined to be static.
[0026] Optionally, the step of classifying and detecting the target person to obtain the chef's hat detection result includes:
[0027] The target individuals are classified and detected to obtain classification results;
[0028] Based on the classification results, the chef's hat detection result is obtained by calculating the classification results.
[0029] Optionally, the step of calculating the chef's hat detection result based on the classification result includes:
[0030] Based on the classification results, the proportion of those not wearing chef hats is calculated.
[0031] Determine whether the ratio exceeds a preset ratio value;
[0032] If the preset ratio value is exceeded, it is determined that the target person is not wearing a chef's hat, and an alarm is issued to the target person.
[0033] This invention provides a chef's hat detection device, comprising:
[0034] The image acquisition module is used to acquire scene information images and detect the scene information images to obtain image information;
[0035] An image enhancement module is used to perform image enhancement processing on the image information to obtain target image information based on the image information;
[0036] The judgment module is used to determine the behavioral state of the target person in the target image information based on the target image information.
[0037] The detection module is used to classify and detect the target person based on the behavioral state to obtain the chef's hat detection result.
[0038] This invention provides a computer device, comprising:
[0039] Memory, used to store computer programs;
[0040] A processor is used to implement the chef's hat detection method as described above when executing the computer program.
[0041] The present invention provides a storage medium storing computer-executable instructions, which, when loaded and executed by a processor, implement the steps of the chef's hat detection method described above.
[0042] As can be seen, this invention, by enhancing image information, can filter out image information under backlighting, thereby reducing the risk of misclassification by the chef's hat model. Furthermore, the method of determining the target person's behavioral state and detecting based on that state effectively avoids misclassification. This invention is applicable to various kitchen scenarios and can effectively reduce the risk of false alarms in chef's hat detection without affecting detection accuracy. This application also provides a chef's hat detection device, computer equipment, and storage medium, which have the aforementioned beneficial effects. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0044] Figure 1 A flowchart of a chef's hat detection method provided in an embodiment of the present invention;
[0045] Figure 2 This is a structural block diagram of a chef's hat detection device provided in an embodiment of the present invention;
[0046] Figure 3 This is a structural block diagram of a computer device provided in an embodiment of the present invention. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0048] In response to the government's call for transparent kitchens, every kitchen worker is obligated and responsible to wear a chef's hat correctly to prevent hair and other debris from falling into the food and causing food safety issues. However, in reality, apart from a few hotels that strictly regulate kitchen staff attire, most restaurants and canteens do not strictly adhere to this requirement, or their staff do not strictly follow it. This poses a serious challenge to food safety and hygiene. Currently, most catering businesses have implemented comprehensive video surveillance coverage, but relying solely on visual supervision is not only labor-intensive but also difficult to maintain vigilance for extended periods.
[0049] With the development of machine vision, current chef hat detection methods mainly adopt a combination of fixed-point detection and classification. Deep learning methods are used to detect workers under video surveillance and determine whether they are wearing chef hats correctly. This can reduce the burden of manpower and greatly improve efficiency. However, existing deep learning methods have problems adapting to new scenarios in detection and classification. This leads to problems such as the personnel detection model detecting non-human targets with high confidence and the classification model misclassifying targets with high confidence. In addition, existing detection methods tend to identify stationary targets as moving targets, which is not conducive to logical filtering and poses a risk of false alarms.
[0050] In view of this, the present invention provides a chef's hat detection method. By performing image enhancement on the image information, image information under backlight can be filtered out, thereby reducing the risk of misclassification by the chef's hat model. Furthermore, the method of determining the behavioral state of the target person and detecting based on the behavioral state can effectively avoid the problem of misclassifying the target person. It can be applied to various different kitchen scenarios and can effectively reduce the risk of false alarms in chef's hat detection without affecting the detection.
[0051] The following is a detailed introduction; please refer to it. Figure 1 , Figure 1 This is a flowchart of a chef's hat detection method provided in an embodiment of the present invention. The chef's hat detection method in this embodiment may include:
[0052] Step S101: Acquire scene information images and perform detection on the scene information images to obtain image information.
[0053] In this embodiment of the invention, the scene information image is an image of a specific kitchen scene. There are no restrictions on the method of acquiring the scene information image. It can be acquired using a surveillance camera, a 3D camera, or other image acquisition devices. It should be noted that in this embodiment of the invention, the scene information image can be acquired in real time or at preset time intervals. There are no restrictions on this.
[0054] In this embodiment of the invention, the image information is the image information of the head and shoulders of a person. In this embodiment of the invention, there is no limitation on the detection method. The image information can be obtained by using the YOLO v5 detection algorithm. YOLO v5 is a single-stage object detection algorithm that can detect object information in the image. Other object detection algorithms can also be used to obtain the image information.
[0055] In this embodiment of the invention, by using a detection algorithm to detect scene information images to obtain image information, the image information of the head and shoulders of a person can be identified more accurately, thus improving the accuracy of chef's hat detection.
[0056] Step S102: Based on the image information, perform image enhancement processing on the image information to obtain the target image information.
[0057] In this embodiment of the invention, the target image information is the image information of a person's head and shoulders obtained after image enhancement processing. It should be noted that this embodiment of the invention does not limit the method of image enhancement processing; it can involve converting the image information to a color space and calculating the brightness value, then filtering based on the brightness value to obtain the target image information. Specifically, this embodiment of the invention can involve converting the image to a color space to obtain a superpixel image, calculating the brightness value variance of the superpixel image's pixels, and then determining whether the brightness value variance exceeds a preset threshold. If it does not exceed the preset threshold, the image information corresponding to the superpixel image is extracted to obtain the target image information.
[0058] It should be noted that in this embodiment of the invention, image information can be converted to a color space to obtain superpixel images. Specifically, the image can be converted to a color space, and then the converted image can be clustered and merged to obtain superpixel images, where a superpixel image can be one or more images. For example, the image information can be converted from the RGB (color model) color space to the Lab color space. Using the L, a, b values of the head and shoulder pixels and their corresponding X, Y coordinates, the color distance and spatial distance in the Lab (color model) color space are calculated one by one with other pixels. Then, the density-based clustering algorithm DBSCAN is used to cluster the pixels using the color distance and spatial distance of each pixel, merging similar pixels into superpixels. Here, the Lab color space is a color-opposites space, where dimension L represents brightness, and a and b represent color-opposites dimensions. The RGB color space is any color space based on the RGB color model, where the RGB color model is based on the three primary colors of red, green, and blue, and different degrees of superposition produce rich and wide colors, hence it is commonly known as the three primary color model. It should be noted that the DBSCAN algorithm is a relatively representative density-based clustering algorithm. It defines a cluster as the largest set of density-connected points, which can divide regions with sufficiently high density into clusters and can discover clusters of arbitrary shapes in noisy spatial databases.
[0059] It should be noted that, in this embodiment of the invention, the variance of the brightness value of the superpixel image can be calculated based on the superpixel image and the pixels of the superpixel image. Specifically, the brightness values of the pixels in the superpixel image can be summed and then averaged to obtain the brightness value of the superpixel image. Then, the variance of the brightness value is calculated using a formula. For example, the brightness values of the pixels within each superpixel can be summed and then averaged to obtain the brightness value l of that superpixel. i Then, the number of pixels in each superpixel is counted, and finally, the luminance variance is calculated by weighting the luminance values of all superpixels using the formula shown below.
[0060]
[0061] Among them, w i Let l be the number of pixels within the i-th superpixel. i Let be the brightness of the i-th superpixel, and n be the total number of superpixels. To calculate the weighted average brightness of superpixels, l w The variance of the brightness values for all superpixels should be noted. The weighted average brightness of superpixels can be calculated using the following formula:
[0062]
[0063] Among them, wi Let l be the number of pixels within the i-th superpixel. i Let be the brightness of the i-th superpixel, and n be the total number of superpixels. This represents the weighted average brightness of the superpixels.
[0064] It should be noted that, in this embodiment of the invention, after obtaining the luminance value variance, it can be determined whether the luminance value variance exceeds a preset threshold. If it does not exceed the preset threshold, the image information corresponding to the superpixel image is extracted to obtain the target image information. If it exceeds the preset threshold, the image information corresponding to the superpixel image is excluded to obtain the target image information. The setting of the preset threshold is not limited; it can be preset by the designer according to requirements. For example, the luminance threshold L... var The value is set to 1400. Alternatively, it can be set according to actual usage.
[0065] Current chef hat detection methods generally combine multi-frame detection results and use a voting mechanism to ultimately determine whether the target is wearing a chef hat. However, lighting interference in kitchen scenes can affect the accuracy of chef hat classification results in some frames. In this embodiment of the invention, the brightness of the acquired multi-frame images can be judged, and multi-frame backlit scene images that are not suitable for chef hat detection can be filtered out, thereby improving the accuracy of the final detection results and reducing the risk of false recognition of chef hat detection.
[0066] Step S103: Determine the behavioral state of the target person in the target image based on the target image information.
[0067] Existing chef's hat detection methods are mostly single-frame detection, meaning that multiple frames of images of the same target are used to detect chef's hats separately, and the results from multiple frames are combined to vote on whether the target is wearing a chef's hat. However, in a kitchen scene, the target usually moves within a certain range, so the target detection bounding box in each frame will differ due to target movement, occlusion, etc., for example, misdetecting interfering objects as targets, affecting the final judgment result. This invention improves the detection accuracy by judging the behavioral state of the target person, thus eliminating some false detections. The behavioral state can be divided into a moving state and a stationary state. It should be noted that in this invention, the motion ellipse of the target person in the target image information can be calculated using the elliptical positioning method, and then the behavioral state of the target person can be determined based on the motion ellipse. It should be noted that, in this embodiment of the invention, the motion ellipse of the target person in the target image information can be calculated using the elliptical positioning method. Specifically, the target image information can be detected, and the initial coordinates of the target person when they first appear and the first coordinates of the target person when they reappear can be recorded. Then, based on the initial coordinates and the first coordinates, the second coordinates can be calculated. Finally, based on the first coordinates and the second coordinates, the motion ellipse of the target person can be calculated using the standard formula of an ellipse. There is no limit to the number of motion ellipses calculated, and different motion ellipses can be obtained based on different coordinates. For example, obtain the bounding box of the first video frame in which the target person A appears and calculate the center point (x0, y0). Then obtain the bounding box of the target person A in the current frame and calculate the center point (x1, y1). Based on (x0, y0) and (x1, y1), calculate the line Y containing these two points, and find the coordinates (x2, y2) of the point on the line Y that is of equal length to (x0, y0) in the opposite direction of (x1, y1). Based on the calculated (x1, y1) and (x2, y2), the standard equation of the ellipse containing these two points can be obtained. The motion ellipse can be obtained by calculating each frame with the starting frame.
[0068] It should be noted that, after obtaining the motion ellipse, this embodiment of the invention can determine the target character's behavior state based on the motion ellipse. Specifically, it can determine whether the difference in the motion area exceeds a preset threshold based on the motion area of the motion ellipse. If it exceeds the preset threshold, the target character's behavior state is determined to be in motion; if it does not exceed the preset threshold, the target character's behavior state is determined to be stationary. Furthermore, this embodiment of the invention can also determine the target character's movement direction based on the changing trend of the motion area. For example, after calculating the ellipse for each frame and the starting frame, the area of the ellipse is calculated. When the difference in area exceeds a preset threshold, the target's behavior state is determined to be in motion. Further, if the area of the ellipse gradually increases, and each area includes the former, the target is considered to be moving outwards; if it only partially includes the former, the target is considered to be moving short distances; if the area gradually decreases, and each area includes the latter, the target is considered to be moving inwards. When the difference in area does not exceed the preset threshold, the target is considered to be stationary.
[0069] This invention innovatively proposes an elliptical positioning method to determine the dynamic and static changes of a target. This method can effectively solve the problem of motion distortion in a 3D scene on a 2D screen and avoid the problem of misjudgment caused by the unstable size of the detection box at the same position of the same target in different frames, thus effectively reducing the risk of false alarms in chef's hat detection.
[0070] Step S104: Based on the behavioral state, classify and detect the target person to obtain the chef's hat detection result.
[0071] In this embodiment of the invention, the target person can be classified and detected according to the behavior state to obtain the chef's hat detection result. Specifically, if the behavior state is a moving state, the target person can be classified and detected to obtain a classification result. Then, the classification result is calculated to obtain the chef's hat detection result. If the behavior state is a stationary state, it is determined whether the state has changed from a moving state to a stationary state. If the state has changed from a moving state to a stationary state, the classification and detection of the target person can be stopped, and the chef's hat detection result is calculated using the previously obtained classification result. If the state has not changed from a moving state to a stationary state, that is, the target has been stationary for a long time, the target person is excluded and no classification and detection is performed.
[0072] It should be noted that in this embodiment of the invention, the target person can be classified and detected to obtain a classification result. Then, based on the classification result, a chef's hat detection result is calculated. Specifically, in this embodiment of the invention, the target person can be classified and detected to obtain voting results for those not wearing a chef's hat and voting results for those wearing a chef's hat. Then, the voting results for those not wearing a chef's hat and voting results for those wearing a chef's hat are merged to obtain a classification result. For example, a ResNet-18 network can be used for chef's hat classification and detection to obtain a classification result. The ResNet-18 network is a residual network composed of a series of residual blocks, used for image recognition tasks. It should be noted that there is no restriction on the way the votes are identified. Votes for those not wearing a chef's hat and votes for those wearing a chef's hat can be identified by numbers, for example, 1 for votes for those wearing a chef's hat and 0 for votes for those not wearing a chef's hat. Alternatively, letters can be used to identify votes for those not wearing a chef's hat and votes for those wearing a chef's hat.
[0073] It should be noted that in this embodiment of the invention, the chef's hat detection result can be calculated based on the classification result. Specifically, the proportion of people not wearing chef's hats can be calculated based on the classification result, and then it can be determined whether the proportion exceeds a preset proportion value. If it exceeds the preset proportion value, it is determined that the target person is not wearing a chef's hat, and an alarm is issued to the target person. If it does not exceed the preset proportion value, it is determined that the target person is wearing a chef's hat. In this embodiment of the invention, the alarm method is not limited; it can be issued via voice or text. Furthermore, in this embodiment of the invention, the target person who has been alarmed can be reclassified to obtain a classification result. The proportion of people wearing chef's hats can be calculated based on the classification result, and it can be determined whether the proportion of people wearing chef's hats exceeds a first preset threshold. If it exceeds the first preset threshold, it is considered that the target person is wearing a chef's hat, i.e., there is a risk of not wearing a chef's hat, and the alarm for the target person is canceled. The setting of the first preset threshold and the preset proportion value is not limited; they can be preset by the designer according to requirements or set according to actual usage.
[0074] The method of classifying and detecting target individuals based on their behavioral states to obtain chef hat detection results in this embodiment of the invention can effectively avoid the problem of misclassifying target individuals. It can be applied to various kitchen scenarios and can effectively reduce the risk of false alarms in chef hat detection without affecting the detection.
[0075] Based on the above embodiments, this invention provides a chef's hat detection method. By enhancing the image information, image information under backlight can be filtered out, thereby reducing the risk of misclassification by the chef's hat model. Furthermore, the method of determining the behavioral state of the target person and detecting based on the behavioral state can effectively avoid the problem of misclassifying the target person. This method is applicable to various kitchen scenarios and can effectively reduce the risk of false alarms in chef's hat detection without affecting the detection.
[0076] The process described above is illustrated below with a specific example. In this example, the image information is a small head and shoulders image. The process is as follows:
[0077] 1. Collect scene information images and use YOLO v5 (detection algorithm) to detect the scene information images to obtain head and shoulder thumbnails of all people in the scene information images.
[0078] 2. Perform Lab color space conversion on the head and shoulder image, then perform superpixel segmentation based on the DBSCA clustering algorithm to obtain superpixels. Then, average the brightness values of the pixels within each superpixel in the head and shoulder image to obtain the brightness value of that superpixel. Calculate the variance of all superpixels in the head and shoulder image based on the brightness values. Finally, determine whether the variance is greater than a threshold. If it is, filter out the head and shoulder image; otherwise, extract the corresponding head and shoulder image to obtain the target image information.
[0079] 3. Based on the target image information, use the elliptic positioning method to determine the behavioral state of the target person in the target image information.
[0080] 4. Based on the behavioral state, the chef's hat is classified using ResNet-18 (network structure) to obtain the classification result, and the chef's hat detection result is obtained by calculating the classification result.
[0081] In this embodiment of the invention, image enhancement can filter out backlit image information, thereby reducing the risk of misclassification by the chef's hat model. Furthermore, the method of determining the behavioral state of the target person and detecting based on the behavioral state can effectively avoid misclassification of the target person. This method is applicable to various kitchen scenarios and can effectively reduce the risk of false alarms in chef's hat detection without affecting detection.
[0082] The following describes a chef's hat detection device and computer equipment provided by an embodiment of the present invention. The chef's hat detection device and computer equipment described below can be referred to in correspondence with the chef's hat detection method described above.
[0083] Please refer to Figure 2 , Figure 2This is a structural block diagram of a chef's hat detection device provided in an embodiment of the present invention. The device may include:
[0084] Image acquisition module 201 is used to acquire scene information images and detect the scene information images to obtain image information;
[0085] Image enhancement module 202 is used to perform image enhancement processing on the image information to obtain target image information based on the image information;
[0086] The judgment module 203 is used to determine the behavioral state of the target person in the target image information based on the target image information.
[0087] The detection module 204 is used to classify and detect the target person based on the behavioral state to obtain the chef's hat detection result.
[0088] Based on the above embodiments, the image enhancement module 202 may include:
[0089] A color conversion unit is used to perform color space conversion on the image information to obtain a superpixel image based on the image information;
[0090] The calculation unit is used to calculate the variance of the brightness value of the superpixel image based on the pixels of the superpixel image.
[0091] The judgment unit is used to determine whether the variance of the brightness value exceeds a preset threshold.
[0092] An extraction unit is used to extract the image information corresponding to the superpixel image to obtain target image information if the preset threshold is not exceeded.
[0093] Based on any of the above embodiments, the determination module 203 may include:
[0094] The trajectory calculation unit is used to calculate the motion ellipse of the target person in the target image information using the elliptical positioning method based on the target image information.
[0095] The behavior determination unit is used to determine the behavior state of the target person based on the motion ellipse.
[0096] Based on any of the above embodiments, the trajectory calculation unit may include:
[0097] A coordinate acquisition subunit is used to detect the target image information and record the initial coordinates of the target person when it first appears in the target image information and the first coordinates of the target person when it reappears.
[0098] A calculation subunit is used to calculate the second coordinate based on the initial coordinate and the first coordinate;
[0099] The trajectory calculation subunit is used to calculate the motion ellipse of the target person based on the first coordinate and the second coordinate using the standard formula of an ellipse.
[0100] Based on any of the above embodiments, the behavior determination unit may include:
[0101] The area determination subunit is used to determine whether the difference in the motion areas of the motion ellipse exceeds a preset threshold.
[0102] The behavior determination subunit is used to determine that the behavior state of the target person is in motion if the behavior exceeds the preset threshold, and to determine that the behavior state of the target person is in stillness if the behavior does not exceed the preset threshold.
[0103] Based on any of the above embodiments, the detection module 204 may include:
[0104] A classification unit is used to classify and detect the target person to obtain a classification result;
[0105] The detection unit is used to calculate the detection result of the chef's hat based on the classification result.
[0106] Based on any of the above embodiments, the detection unit may include:
[0107] The proportion calculation subunit is used to calculate the proportion of those not wearing chef hats based on the classification results.
[0108] A judgment subunit is used to determine whether the ratio exceeds a preset ratio value;
[0109] An alarm subunit is used to determine that the target person is not wearing a chef's hat if the preset ratio value is exceeded, and to issue an alarm to the target person.
[0110] In this embodiment of the invention, image enhancement can filter out backlit image information, thereby reducing the risk of misclassification by the chef's hat model. Furthermore, the method of determining the behavioral state of the target person and detecting based on the behavioral state can effectively avoid misclassification of the target person. This method is applicable to various kitchen scenarios and can effectively reduce the risk of false alarms in chef's hat detection without affecting detection.
[0111] Please refer to Figure 3 , Figure 3 This is a structural block diagram of a computer device provided in an embodiment of the present invention. The computer device includes:
[0112] Memory 10 is used to store computer programs;
[0113] The processor 20 is used to execute the computer program to implement the chef's hat detection method described above.
[0114] like Figure 3 The diagram shown is a structural schematic of a computer device, which may include: a memory 10, a processor 20, a communication interface 31, an input / output interface 32, and a communication bus 33.
[0115] In this embodiment of the invention, the memory 10 is used to store one or more programs. The programs may include program code, which includes computer operation instructions. In this embodiment, the memory 10 may store programs for implementing the following functions:
[0116] Acquire scene information images and perform detection on the scene information images to obtain image information;
[0117] Based on the image information, image enhancement processing is performed to obtain the target image information;
[0118] Based on the target image information, determine the behavioral state of the target person in the target image information;
[0119] Based on behavioral status, the target person is classified and detected to obtain the chef's hat detection result.
[0120] In one possible implementation, the memory 10 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and applications required for at least one function; and the data storage area may store data created during use.
[0121] Furthermore, memory 10 may include read-only memory and random access memory, providing instructions and data to the processor. A portion of the memory may also include NVRAM. The memory stores operating systems and operating instructions, executable modules, or data structures, or subsets thereof, or extended sets thereof, wherein the operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic tasks and handling hardware-based tasks.
[0122] Processor 20 can be a central processing unit (CPU), an application-specific integrated circuit, a digital signal processor, a field-programmable gate array, or other programmable logic device. Processor 20 can be a microprocessor or any conventional processor. Processor 20 can call programs stored in memory 10.
[0123] The communication interface 31 can be an interface for connecting with other devices or systems.
[0124] The input / output interface 32 can be an interface used to acquire external input data or output data to the outside world.
[0125] Of course, it should be noted that, Figure 3 The structure shown does not constitute a limitation on the computer device in the embodiments of this application. In practical applications, the computer device may include more than Figure 3 More or fewer components as shown, or combinations of certain components.
[0126] In this embodiment of the invention, image enhancement can filter out backlit image information, thereby reducing the risk of misclassification by the chef's hat model. Furthermore, the method of determining the behavioral state of the target person and detecting based on the behavioral state can effectively avoid misclassification of the target person. This method is applicable to various kitchen scenarios and can effectively reduce the risk of false alarms in chef's hat detection without affecting detection.
[0127] This invention also provides a storage medium storing computer-executable instructions. When the computer-executable instructions are loaded and executed by a processor, they enable the following actions: acquiring scene information images; detecting the scene information images to obtain image information; performing image enhancement processing on the image information to obtain target image information; determining the behavioral state of the target person in the target image information based on the target image information; and classifying and detecting the target person based on the behavioral state to obtain a chef's hat detection result.
[0128] In this embodiment of the invention, image enhancement can filter out backlit image information, thereby reducing the risk of misclassification by the chef's hat model. Furthermore, the method of determining the behavioral state of the target person and detecting based on the behavioral state can effectively avoid misclassification of the target person. This method is applicable to various kitchen scenarios and can effectively reduce the risk of false alarms in chef's hat detection without affecting detection.
[0129] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.
[0130] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0131] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0132] The above provides a detailed description of the chef's hat detection method, apparatus, computer equipment, and storage medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the invention. The descriptions of these embodiments are merely for the purpose of helping to understand the method and core ideas of the present invention. It should be noted that those skilled in the art can make various improvements and modifications to the present invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
Claims
1. A method for detecting a chef's hat, characterized in that, include: Scene information images are acquired, and the scene information images are detected to obtain image information; wherein, the image information is the image information of the head and shoulders of a person; Based on the image information, image enhancement processing is performed on the image information to obtain the target image information; Based on the target image information, determine the behavioral state of the target person in the target image information; the behavioral state is divided into a moving state and a stationary state; Based on the behavioral state, the target person is classified and detected to obtain the chef's hat detection result; If the behavior state is in motion, the target person is classified and detected to obtain a classification result. Based on the classification result, the chef's hat detection result is calculated. If the behavior state is in stillness, it is determined whether the behavior state has changed from motion to stillness. If yes, the classification and detection of the target person is stopped, and the chef's hat detection result is calculated using the previously obtained classification result. If no, the target person is excluded and no classification and detection is performed. The process of enhancing the image information to obtain target image information, based on the image information, includes: converting the image information to a color space, and then clustering and merging the converted image to obtain superpixel images. If the image information is converted from RGB color space to Lab color space, the L, a, b values of the head and shoulder pixels and their corresponding X and Y coordinates are used to calculate the color distance and spatial distance in the Lab color space with each other pixel. Then, a density-based clustering algorithm is used to cluster the pixels using the color distance and spatial distance of each pixel, merging similar pixels into superpixels. Here, dimension L represents brightness, and a and b represent color-opposite dimensions. The brightness values of pixels within each superpixel of the superpixel image are summed and then averaged to obtain the brightness value of that superpixel. The number of pixels in each superpixel is then counted. Finally, the brightness value variance is calculated from the weighted sum of all the superpixel values. It is then determined whether the brightness value variance exceeds a preset threshold. If it does not exceed the preset threshold, the image information corresponding to the superpixel image is extracted to obtain the target image information. If it exceeds the preset threshold, the image information corresponding to the superpixel image is excluded to obtain the target image information.
2. The chef's hat detection method as described in claim 1, characterized in that, The step of determining the behavioral state of the target person in the target image information based on the target image information includes: Based on the target image information, the motion ellipse of the target person in the target image information is calculated using the elliptical positioning method; The behavioral state of the target person is determined based on the motion ellipse.
3. The method for detecting a chef's hat as described in claim 2, characterized in that, The step of calculating the motion ellipse of the target person in the target image information using the elliptical positioning method based on the target image information includes: The target image information is detected, and the initial coordinates of the first appearance of the target person and the first coordinates of the second appearance of the target person in the target image information are recorded. The second coordinate is calculated based on the initial coordinate and the first coordinate; The motion ellipse of the target person is calculated using the standard formula for an ellipse based on the first and second coordinates.
4. The chef's hat detection method as described in claim 2, characterized in that, Determining the behavioral state of the target person based on the motion ellipse includes: Based on the area of motion of the ellipse, determine whether the difference in the area of motion exceeds a preset threshold; If the preset threshold is exceeded, the target person's behavior state is determined to be in motion. If the preset threshold is not exceeded, the target person's behavior state is determined to be static.
5. A method for detecting a chef's hat as described in any one of claims 1-4, characterized in that, The classification and detection of the target person to obtain the chef's hat detection result includes: The target individuals are classified and detected to obtain classification results; Based on the classification results, the chef's hat detection result is obtained by calculating the classification results.
6. The chef's hat detection method as described in claim 5, characterized in that, The step of calculating the chef's hat detection result based on the classification result includes: Based on the classification results, the proportion of those not wearing chef hats is calculated. Determine whether the ratio exceeds a preset ratio value; If the preset ratio value is exceeded, it is determined that the target person is not wearing a chef's hat, and an alarm is issued to the target person.
7. A chef's hat detection device, characterized in that, include: The image acquisition module is used to acquire scene information images and detect the scene information images to obtain image information; wherein, the image information is the image information of the head and shoulders of a person; An image enhancement module is used to perform image enhancement processing on the image information to obtain target image information based on the image information; The judgment module is used to determine the behavioral state of the target person in the target image information based on the target image information; the behavioral state is divided into a moving state and a stationary state. The detection module is used to classify and detect the target person according to the behavior state to obtain a chef's hat detection result. Specifically, if the behavior state is a moving state, the target person is classified and detected to obtain a classification result, and the chef's hat detection result is calculated based on the classification result. If the behavior state is a stationary state, it is determined whether the state has changed from a moving state to a stationary state. If so, the classification and detection of the target person is stopped, and the chef's hat detection result is calculated using the previously obtained classification result. If not, the target person is excluded, and no classification and detection is performed. The image enhancement module is specifically used for: converting image information to a color space, then clustering and merging the converted images to obtain superpixel images. If the image information is converted from RGB color space to Lab color space, the L, a, b values of the head and shoulder pixels and their corresponding X and Y coordinates are used to calculate the color distance and spatial distance in Lab color space with other pixels one by one. Then, a density-based clustering algorithm is used to cluster the pixels using the color distance and spatial distance of each pixel, merging similar pixels into superpixels. Here, dimension L represents brightness, and a and b represent color-opposite dimensions. The brightness values of the pixels within each superpixel of the superpixel image are summed and then averaged to obtain the brightness value of that superpixel. The number of pixels in each superpixel is then counted, and finally, the brightness value variance is calculated from the weighted brightness values of all superpixels. It is determined whether the brightness value variance exceeds a preset threshold. If it does not exceed the preset threshold, the image information corresponding to the superpixel image is extracted to obtain the target image information. If it exceeds the preset threshold, the image information corresponding to the superpixel image is excluded to obtain the target image information.
8. A computer device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the chef's hat detection method as described in any one of claims 1 to 6.
9. A storage medium, characterized in that, The storage medium stores computer-executable instructions, which, when loaded and executed by a processor, implement the steps of the chef's hat detection method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method for recognizing state of person in monitoring video
CN108537829A
Safety helmet real-time detection method based on hypergraph learning
CN112836644A
Safety helmet detection method and system based on improved YOLO V5
CN113553977A
Smoke and fire detection method, device, equipment and medium
CN114549866A