Smoking detection method, device, equipment, storage medium and program product
Through real-time video stream analysis, the attribute information of cigarette branches is determined and the number of effective cigarette branches is calculated, which solves the problem of inaccurate detection of smoking behavior in the prior art and achieves higher detection accuracy and safety.
Patent Information
- Application Number
- CN202510714569.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-07-01
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the accuracy and reliability of smoking behavior detection are not high, and there are false alarms or missed reports, resulting in greater safety risks.
By acquiring the real-time video stream, multiple human images of each target user are determined, and based on the cigarette branch detection area and cigarette branch coordinate information in the human body image, the cigarette branch attribute information is determined, the effective cigarette branch number is calculated, and early warning information is output when the preset conditions are met.
It improves the accuracy and reliability of smoking behavior detection, reduces false alarms and underreports, and reduces safety risks.
Smart Images

Figure CN120236336A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a smoking detection method, device, equipment, storage medium, and program product. Background Art
[0002] In daily life, smoking behavior in special public places such as gas stations, warehouses, and factories is likely to cause serious consequences such as fires, casualties, and economic losses. Therefore, in these special public places, the timely discovery and handling of smoking behavior are of high importance.
[0003] In the related art, the identification and monitoring of smoking behavior are usually based on surveillance videos and implemented by using solutions such as human key point pose recognition. However, due to the interference of environmental factors in the actual scenario, the accuracy and reliability of smoking behavior detection in the related art are not high, and there are situations such as false alarms or missed alarms, resulting in a relatively high safety risk. Summary of the Invention
[0004] Multiple aspects of this application provide a smoking detection method, device, equipment, storage medium, and program product, which can improve the accuracy and reliability of smoking behavior detection and reduce the safety risk.
[0005] In a first aspect, an embodiment of this application provides a smoking detection method, including:
[0006] Obtain a real-time video stream, and determine multiple human body images corresponding to each target user based on the real-time video stream;
[0007] Determine the cigarette attribute information corresponding to the human body image according to the cigarette detection area and cigarette coordinate information in the human body image;
[0008] Within a target time period, determine the number of valid cigarettes corresponding to the target user according to the cigarette attribute information;
[0009] When the number of valid cigarettes meets a preset condition, determine that the target user has a smoking behavior, and output a target warning message.
[0010] In a possible implementation manner, the determining the cigarette attribute information corresponding to the human body image according to the cigarette detection area and cigarette coordinate information in the human body image includes:
[0011] For each human body image, determine the cigarette detection area in the human body image; the cigarette detection area includes a first cigarette behavior detection area and / or a second cigarette behavior detection area;
[0012] Within the cigarette detection area, determine the key point coordinates corresponding to the target cigarette to obtain the cigarette coordinate information;
[0013] Determine the cigarette attribute information corresponding to the human body image according to the cigarette detection area and the cigarette coordinate information; the cigarette attribute information includes at least one of cigarette length information, cigarette position information, and cigarette color information.
[0014] In a possible implementation manner, the cigarette attribute information includes cigarette length information; the cigarette length information includes the target cigarette length and the average scale of the cigarette detection area; the determining the cigarette attribute information corresponding to the human body image includes:
[0015] Determine the starting point coordinate information and the ending point coordinate information of the target cigarette according to the cigarette coordinate information;
[0016] Calculate the target cigarette length based on the starting point coordinate information and the ending point coordinate information;
[0017] Determine the average scale of the cigarette detection area according to the size information of the cigarette detection area.
[0018] In a possible implementation manner, the cigarette attribute information includes cigarette position information; the cigarette position information includes cigarette movement information; the determining the cigarette attribute information corresponding to the human body image includes:
[0019] Obtain the adjacent cigarette coordinate information of adjacent frames of the human body image;
[0020] Determine the cigarette movement information corresponding to the human body image according to the cigarette coordinate information of the human body image and the adjacent cigarette coordinate information.
[0021] In a possible implementation manner, the cigarette attribute information includes cigarette color information; the determining the cigarette attribute information corresponding to the human body image includes:
[0022] Perform gray processing on the cigarette detection area to obtain a target gray image;
[0023] Determine a plurality of sampling points within the target cigarette in the cigarette detection area, and determine the gray information of each sampling point respectively;
[0024] Calculate the cigarette color information corresponding to the target cigarette according to the gray information of each sampling point.
[0025] In a possible implementation manner, the cigarette attribute information includes cigarette length information, cigarette position information, and cigarette color information; the method further includes:
[0026] If the cigarette attribute information corresponding to the human body image meets the preset attribute conditions, it is determined that the target cigarette included in the human body image is a valid cigarette; the preset attribute conditions include that the cigarette length information belongs to a preset length range, and the cigarette position information belongs to a preset distance range, and the cigarette color information belongs to a preset color range.
[0027] In a second aspect, an embodiment of the present application provides a smoking detection device, including:
[0028] An acquisition module, configured to acquire a real-time video stream and determine multiple human body images corresponding to each target user based on the real-time video stream;
[0029] A first determination module, configured to determine the cigarette attribute information corresponding to the human body image according to the cigarette detection area and cigarette coordinate information in the human body image;
[0030] A second determination module, configured to determine the number of valid cigarettes corresponding to the target user according to the cigarette attribute information within a target time period;
[0031] An output module, configured to determine that the target user has a smoking behavior and output a target warning message when the number of valid cigarettes meets a preset condition.
[0032] In a third aspect, an embodiment of the present application provides a smoking detection device, including: a memory and a processor;
[0033] The memory stores computer execution instructions;
[0034] The processor executes the computer execution instructions stored in the memory, so that the processor executes the smoking detection method according to any one of the first aspects.
[0035] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer execution instructions are stored, and when the computer execution instructions are executed by a processor, they are used to implement the smoking detection method according to any one of the first aspects.
[0036] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the smoking detection method according to any one of the first aspects.
[0037] In an embodiment of the present application, a real-time video stream is obtained, and multiple human body images corresponding to each target user are determined based on the real-time video stream; according to the cigarette detection area and cigarette coordinate information in the human body image, the cigarette attribute information corresponding to the human body image is determined; within a target time period, the number of valid cigarettes corresponding to the target user is determined according to the cigarette attribute information; when the number of valid cigarettes meets a preset condition, it is determined that the target user has a smoking behavior, and a target warning message is output. In the present application, the electronic device determines multiple human body images of each target user in the real-time video stream, then determines the cigarette attribute information in the human body image according to the cigarette detection area and cigarette coordinate information in the human body image, and then within each target time period, determines the validity of the cigarette in the human body image according to the cigarette attribute information, obtains the number of valid cigarettes corresponding to the target user, and when the number of valid cigarettes meets a preset condition, determines that the target user has a smoking behavior, and finally outputs a target warning message. In this way, the electronic device determines the cigarette attribute information in the human body image based on the cigarette detection area and cigarette coordinate information, determines the validity of the cigarette in the human body image according to the cigarette attribute information, and subsequently identifies the smoking behavior according to the number of valid cigarettes. In this way, the electronic device can detect cigarettes according to the attributes of the cigarettes themselves in the human body image, avoiding the interference of environmental factors, enabling accurate identification and judgment of cigarettes, and thus can accurately detect smoking behavior, reducing false alarms and missed reports in smoking detection, and reducing safety risks. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.
[0039] Figure 1 It is a schematic flowchart of a smoking detection method provided by an exemplary embodiment of the present application;
[0040] Figure 2 It is a schematic flowchart of another smoking detection method provided by an exemplary embodiment of the present application;
[0041] Figure 3 It is a schematic diagram of a technical link of a smoking detection provided by an exemplary embodiment of the present application;
[0042] Figure 4 It is a schematic structural diagram of a smoking detection device provided by an exemplary embodiment of the present application;
[0043] Figure 5 It is a schematic structural diagram of a smoking detection device provided by an exemplary embodiment of the present application.
[0044] Through the above-mentioned drawings, specific embodiments of the present application have been shown, and there will be more detailed descriptions hereinafter. These drawings and textual descriptions are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. Detailed Embodiments
[0045] To make the objectives, technical solutions, and advantages of the present application clearer, the technical solutions of the present application will be clearly and completely described below in conjunction with specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of the present application. It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant laws, regulations, and standards, and corresponding operation entrances are provided for users to choose to authorize or refuse.
[0046] In daily life, smoking not only affects the physical health of smokers themselves but also affects others. In severe cases, it may even cause fires, resulting in significant casualties and economic losses. Therefore, smoking is usually prohibited in public places. For special public places such as gas stations, warehouses, and factories, the control of smoking behavior is an important task.
[0047] In related technologies, the recognition and monitoring of smoking behavior are usually realized based on video surveillance. Specifically, solutions such as human key point pose recognition can be used to monitor and recognize smoking behavior. In this smoking detection method in related technologies, the accuracy of smoking detection is not high. For example, similar actions such as a user touching their mouth or rubbing their eyes are easily misjudged as smoking behavior. Moreover, due to the relatively complex environmental background in the actual monitoring scenario, such as the light strips on transparent glass and various textures on clothing, the accuracy and reliability of the smoking detection method in related technologies are not high, and there are situations such as false alarms and missed detections, posing certain safety risks.
[0048] To solve the above problems, the present application provides a smoking detection method, device, equipment, storage medium and program product. The electronic device determines multiple human body images of each target user in the real-time video stream, and then determines the cigarette attribute information in the human body image according to the cigarette detection area and cigarette coordinate information in the human body image. Then, in each target time period, the electronic device determines the validity of the cigarette in the human body image according to the cigarette attribute information, obtains the number of valid cigarettes corresponding to the target user, and determines that the target user has a smoking behavior when the number of valid cigarettes meets the preset conditions, and finally outputs a target warning message. In this way, the electronic device determines the cigarette attribute information in the human body image based on the cigarette detection area and cigarette coordinate information, determines the validity of the cigarette in the human body image according to the cigarette attribute information, and then identifies the smoking behavior according to the number of valid cigarettes. In this way, the electronic device can detect the cigarette according to the attributes of the cigarette itself in the human body image, avoiding the interference of environmental factors, enabling accurate identification and judgment of the cigarette, and further enabling accurate detection of the smoking behavior, reducing the false alarms and missed detections in smoking detection, and reducing the safety risk.
[0049] The following details the technical solutions shown in the present application through specific embodiments. It should be noted that the following several embodiments can exist independently or be combined with each other, and the same or similar content will not be repeated in different embodiments.
[0050] Figure 1 It is a schematic flowchart of a smoking detection method provided by an exemplary embodiment of the present application. Please refer to Figure 1 , and the smoking detection method may include:
[0051] S101. Obtain a real-time video stream and determine multiple human body images corresponding to each target user based on the real-time video stream.
[0052] The execution subject of the embodiments of the present application can be an electronic device or a smoking detection device provided in the electronic device. The smoking detection device can be implemented by software or by a combination of software and hardware. For the sake of easy understanding, in the following, the execution subject is taken as an electronic device for illustration. The electronic device can specifically refer to a mobile phone, a computer or a cloud server, etc. The specific type of the electronic device is not limited in the embodiments of the present application.
[0053] In the embodiments of the present application, the real-time video stream may refer to a real-time monitoring video stream captured and uploaded by a capturing device. The capturing device may specifically be an ordinary camera or an Internet Protocol Camera (IPC), etc. The embodiments of the present application do not limit the specific type of the capturing device. The number of the capturing devices may be at least one. For example, an electronic device may collect video streams captured by multiple cameras for smoking behavior recognition. The embodiments of the present application also do not limit the specific number of the capturing devices.
[0054] The target user may refer to each user appearing in the real-time video stream, such as a pedestrian, an internal staff member, a consumer, etc. The human body image may refer to a series of human detection frames corresponding to the target user, that is, the image area including the target user in the video frame. Specifically, in the actual scenario of smoking recognition, the electronic device may obtain the real-time video stream uploaded by the capturing device; for this real-time video stream, the electronic device may identify the human body trajectory information corresponding to each target user based on algorithms such as target tracking detection, and obtain multiple human body images corresponding to each target user according to the human body trajectory information.
[0055] S102. Determine the cigarette attribute information corresponding to the human body image according to the cigarette detection area and the cigarette coordinate information in the human body image.
[0056] In the embodiments of the present application, the cigarette detection area may refer to the image area including the cigarette in the human body image, specifically, may refer to cigarette detection frames such as "holding a cigarette" and "smoking with the mouth". The cigarette coordinate information may refer to the coordinate information corresponding to the key points of the cigarette. Since the cigarette itself is a rigid body, the electronic device may determine the coordinates of the cigarette butt and the cigarette tail of the target cigarette in the human body image, and a cigarette object can be completely defined based on these two coordinates. Therefore, the electronic device only needs to determine the positions of the cigarette butt and the cigarette tail of the cigarette object to completely define a cigarette object, that is, the cigarette coordinate information determined by the electronic device in the embodiments of the present application may include the coordinate information of the cigarette butt (the starting point of the cigarette) and the coordinate information of the cigarette tail (the ending point of the cigarette). Of course, to ensure the accuracy of target cigarette recognition, the cigarette coordinate information may also include the coordinate information of other key points, such as the midpoint of the target cigarette, etc., which may be specifically selected based on actual needs. The embodiments of the present application do not limit this.
[0057] The cigarette attribute information may refer to the attribute information of the target cigarette included in the human body image, which can reflect the actual characteristics of the cigarette, and may specifically include at least one of the cigarette length information, the cigarette position information, and the cigarette color information. Of course, the cigarette attribute information may also include other attributes, such as the cigarette direction information, the cigarette posture information, the cigarette speed information, and the cigarette shape information, etc. The embodiments of the present application do not limit this either.
[0058] In this step, after the electronic device determines a series of human body images corresponding to each target user, for each human body image, it can first determine whether there is a target cigarette in the human body image. If there is, it determines the cigarette detection area in the human body image and the cigarette coordinate information corresponding to the target cigarette. Then, the electronic device can determine the cigarette attribute information corresponding to the human body image through methods such as length calculation, moving distance calculation, and color calculation based on the cigarette detection area and the cigarette coordinate information. If there is no target cigarette in the human body image, the electronic device can continue to detect the target cigarette in the next human body image.
[0059] S103. During the target time period, determine the number of valid cigarettes corresponding to the target user according to the cigarette attribute information.
[0060] In the embodiment of the present application, the target time period can refer to a pre-set time period, which can be implemented by establishing a sliding window of a target number of frames. For example, every 8 video frames form a sliding window, that is, a target time period, and the number of valid cigarettes in the human body image of the target user is determined within this sliding window. The number of valid cigarettes can refer to the number of valid cigarette detection objects. Since the background in the actual monitoring scenario is relatively complex, the electronic device may identify similar objects as target cigarettes. The electronic device can determine whether the target cigarette is valid according to the cigarette attribute information corresponding to the human body image, and then can determine the number of valid cigarettes within the target time period.
[0061] Specifically, after the electronic device determines the cigarette attribute information corresponding to the human body image, it can determine whether the target cigarette in the human body image is valid according to the specific numerical range of the cigarette attribute information. Exemplarily, when the cigarette attribute information includes cigarette length information, if the length of the target cigarette in the cigarette length information is too long or too short, the electronic device can determine that the target cigarette is invalid; when the cigarette attribute information includes cigarette color information, if the color of the target cigarette in the cigarette length information is not within the preset color range, the electronic device can determine that the target cigarette is invalid. Of course, when the cigarette attribute information includes other attribute information, the electronic device can also use other methods to determine whether the target cigarette in the human body image is valid, and the embodiment of the present application does not limit this.
[0062] S104. When the number of valid cigarettes meets the preset condition, determine that the target user has a smoking behavior and output a target warning message.
[0063] In the embodiments of the present application, the preset condition may refer to the judgment condition of the smoking behavior set in advance. For example, it may be that the number of valid cigarettes is greater than the preset quantity threshold, or the ratio of the number of valid cigarettes to the target number of frames corresponding to the target time period is greater than the preset ratio threshold, etc. Of course, other conditions may also be adopted, and the embodiments of the present application do not limit this. The target warning information may refer to the prompt information used for warning the smoking behavior. Specifically, it may refer to text prompt information, audio prompt information, or video (animation) prompt information, etc.
[0064] In this step, within the target time period, after the electronic device determines the number of valid cigarettes corresponding to the target user, if the number of valid cigarettes meets the preset condition, the electronic device may determine that the target user has a smoking behavior and output the target warning information. For example, the target warning information may be displayed in the form of a pop-up window on the display screen, or a notification message may be sent to the mobile terminal of the target person (such as a security person, etc.) so that the mobile terminal displays the target warning information. The target warning information may also be output through sound and light prompts by warning devices such as speakers and indicator lights, facilitating the target person to handle the smoking behavior of the target user in a timely manner and reducing the safety risk. If the number of valid cigarettes of the target user does not meet the preset condition within the target time period, the electronic device may continue to perform smoking detection in the next target time period.
[0065] In the embodiments of the present application, the electronic device acquires a real-time video stream and determines multiple human body images corresponding to each target user based on the real-time video stream; determines the cigarette attribute information corresponding to the human body image according to the cigarette detection area and cigarette coordinate information in the human body image; within the target time period, determines the number of valid cigarettes corresponding to the target user according to the cigarette attribute information; and determines that the target user has a smoking behavior and outputs the target warning information when the number of valid cigarettes meets the preset condition. In the present application, the electronic device determines multiple human body images of each target user in the real-time video stream, then determines the cigarette attribute information in the human body image according to the cigarette detection area and cigarette coordinate information in the human body image, and then within each target time period, determines the validity of the cigarettes in the human body image according to the cigarette attribute information to obtain the number of valid cigarettes corresponding to the target user, and determines that the target user has a smoking behavior when the number of valid cigarettes meets the preset condition, and finally outputs the target warning information. In this way, the electronic device determines the cigarette attribute information in the human body image based on the cigarette detection area and cigarette coordinate information, determines the validity of the cigarettes in the human body image according to the cigarette attribute information, and then identifies the smoking behavior according to the number of valid cigarettes. In this way, the electronic device can detect cigarettes according to the attributes of the cigarettes themselves in the human body image, avoiding the interference of environmental factors, enabling accurate identification and judgment of cigarettes, and then enabling accurate detection of smoking behavior, reducing false alarms and missed reports in smoking detection, etc., and reducing the safety risk.
[0066] Based on the above embodiments, Figure 2 FIG. is a schematic flowchart of another smoking detection method provided by an exemplary embodiment of the present application. Please refer to Figure 2 and the smoking detection method may include:
[0067] S201. Obtain a real-time video stream, and determine multiple human body images corresponding to each target user based on the real-time video stream.
[0068] In an embodiment of the present application, an electronic device may obtain a real-time video stream uploaded by a shooting device, and then may perform trajectory tracking on target users appearing in the real-time video stream based on detection technologies such as human body tracking. Exemplarily, the electronic device may adopt a tracking method of detection first and then tracking (Tracking-by-detection). First, human body detection is performed on each video frame in the real-time video stream, and feature extraction is performed on the human detection boxes corresponding to the human body image parts therein to obtain the person re-identification (ReID) features of each human detection box; then, according to the ReID features and attribute information such as the position, aspect ratio, etc. of the human detection boxes, the human detection boxes of target users belonging to the same identity in different video frames are associated to form a complete motion trajectory. The electronic device may specifically adopt a simple online and real-time tracking algorithm (Simple Online and Realtime Tracking, SORT), a simple online and real-time tracking algorithm based on deep association metric (SORT with a Deep Association Metric, DeepSORT), a fair multi-object tracking algorithm (Fair Multi-Object Tracking, FairMOT), etc. Of course, other tracking algorithms may also be adopted, which may be flexibly set based on actual requirements, and the embodiments of the present application do not limit this.
[0069] After the electronic device determines the motion trajectories of each target user, it may further determine multiple human body images corresponding to each target user, and subsequent smoking behavior recognition may be performed based on the detection of the human body images.
[0070] S202. For each human body image, determine a cigarette detection area in the human body image; the cigarette detection area includes a first cigarette behavior detection area and / or a second cigarette behavior detection area.
[0071] In the embodiments of the present application, the first cigarette behavior detection area may refer to the image area where the target user exhibits the first cigarette behavior. For example, it may be "holding a cigarette" or the like. The second cigarette behavior detection area may refer to the image area where the target user exhibits the second cigarette behavior. For example, it may be "smoking with the mouth" or the like.
[0072] In this step, in an actual scenario, during the smoking process, a person either holds a cigarette in the hand or holds a cigarette in the mouth. Therefore, the electronic device can use the two typical features of "holding a cigarette" and "smoking with the mouth" as the first cigarette behavior and the second cigarette behavior, and detect them in each human body image of the target user to obtain the cigarette detection area in the human body image, which may specifically refer to a "holding a cigarette" detection box and / or a "smoking with the mouth" detection box, etc. The scenario where both the "holding a cigarette" detection box and the "smoking with the mouth" detection box exist may be that the target user holds a cigarette and puts it in the mouth to smoke, etc. It should be noted that in an actual scenario, the electronic device can also detect other types of cigarette behaviors and correspondingly determine other types of cigarette behavior detection areas, which are not limited in the embodiments of the present application.
[0073] Exemplarily, the electronic device can use the method of multi-task model inference to identify the cigarette detection area in the human body image. The multi-task model may refer to an object detector or a human pose estimation multi-task model (Yolov8-Pose), etc. Of course, other multi-task models can also be used, which are not limited in the embodiments of the present application. Specifically, the electronic device can first obtain the original samples, and then generate a large number of training samples based on the method of manual annotation. For example, in each original sample, the first cigarette behavior and the second cigarette behavior are annotated to obtain the training samples; then, model iterative training is performed according to the training samples, and finally the target multi-task model is obtained. The input and output of the target multi-task model are human body images, and the output data is the cigarette detection area and cigarette coordinate information in the human body image, etc.
[0074] S203. Determine the key point coordinates corresponding to the target cigarette in the cigarette detection area to obtain the cigarette coordinate information.
[0075] In the embodiments of the present application, the target cigarette may refer to the cigarette detection object that appears in the cigarette detection area of the human body image. The key point coordinates may refer to the specific coordinates of the key points corresponding to the target cigarette, which may include the key point coordinates of the cigarette butt, the key point coordinates of the cigarette tail, etc. Of course, other key point coordinates may also be included, such as the key point coordinates of the midpoint of the cigarette, etc., which are not limited in the embodiments of the present application.
[0076] In this step, since the target cigarette is a rigid body, based on the positions of the cigarette butt and the cigarette tail of the target cigarette, the electronic device can determine a complete cigarette detection object. The electronic device can input the human body image into a pre-trained multi-task processing model, which can directly output the cigarette detection area and the cigarette coordinate information of the target cigarette. The cigarette detection box of each cigarette detection area corresponds to the cigarette coordinate information, that is, one cigarette detection box corresponds to a set of cigarette coordinate information. In some scenarios, if there are multiple cigarette detection areas and cigarette coordinate information in a human body image, the electronic device can use the cigarette detection area with the highest confidence and its corresponding cigarette coordinate information as the cigarette detection area and cigarette coordinate information of the human body image.
[0077] S204. Determine the cigarette attribute information corresponding to the human body image according to the cigarette detection area and the cigarette coordinate information; the cigarette attribute information includes at least one of cigarette length information, cigarette position information, and cigarette color information.
[0078] In the embodiment of the present application, after the electronic device determines the cigarette detection area in the human body image and the cigarette coordinate information of the target cigarette, it can further determine the cigarette attribute information based on the cigarette detection area and the cigarette coordinate information, and then can determine whether the cigarette detection object in the human body image is valid based on the cigarette attribute information.
[0079] Exemplarily, the electronic device represents the cigarette detection area corresponding to the i-th target user in the t-th frame by the following formula (1):
[0080]
[0081] In the above formula (1), B represents the cigarette detection area, that is, the cigarette detection box. Where (x, y) represents the coordinates of the upper left corner point of the detected cigarette detection area (usually a rectangular box), (w, h) represents the width and height of the detected cigarette detection area, s represents the confidence of the cigarette detection area, and c represents the category of the cigarette detection area, which can specifically refer to the first cigarette behavior detection area or the second cigarette behavior detection area, etc.
[0082] In addition, based on the cigarette detection area, the electronic device can determine the key point coordinates of the target cigarette. Exemplarily, the key point coordinates of the cigarette butt detected for the i-th target user in the t-th frame can be expressed as , and the key point coordinates of the cigarette tail can be expressed as . Based on the cigarette coordinate information, the electronic device can represent the target cigarette by the directed vector from the cigarette butt to the cigarette tail, that is, model the target cigarette detected for the i-th target user in the t-th frame through this directed vector, and achieve an accurate representation of the target cigarette.
[0083] In the embodiments of the present application, in each human body image, the electronic device determines a cigarette detection area including a first cigarette behavior detection area and / or a second cigarette behavior detection area. Then, in the cigarette detection area, the key point coordinates corresponding to the target cigarette are determined to obtain the cigarette coordinate information in the human body image. Then, the cigarette attribute information can be obtained based on the cigarette detection area and the cigarette coordinate information. The cigarette attribute may specifically include at least one of cigarette length information, cigarette position information, and cigarette color information. In this way, by identifying the cigarette detection area and performing cigarette modeling based on the cigarette coordinate information, the electronic device calculates the attribute information of the cigarette detection object itself, which can ensure the accuracy of the cigarette detection object recognition, and further improve the accuracy of subsequent smoking behavior recognition.
[0084] In a possible implementation manner, the cigarette attribute information includes cigarette length information; the cigarette length information includes the target cigarette length and the average scale of the cigarette detection area; the cigarette attribute information in step S204 can be specifically determined in the following manner:
[0085] According to the cigarette coordinate information, determine the starting point coordinate information and the ending point coordinate information of the target cigarette; based on the starting point coordinate information and the ending point coordinate information, calculate the target cigarette length; according to the size information of the cigarette detection area, determine the average scale of the cigarette detection area.
[0086] In the embodiments of the present application, the cigarette length information may refer to the relevant dimension information of the target cigarette, specifically including the target cigarette length and the average scale of the cigarette detection area, etc. Specifically, after the electronic device determines the cigarette coordinate information of the target cigarette, it can perform coordinate calculation through the key point coordinates of the cigarette butt and the key point coordinates of the cigarette tail to obtain the target cigarette length. And the electronic device can calculate the average scale of the cigarette detection area based on the width and height of the cigarette detection area as a normalized reference value, which is convenient for subsequent threshold judgment of the length and improves the robustness and accuracy of the subsequent effectiveness judgment of the cigarette detection object.
[0087] Exemplarily, the electronic device can determine the target cigarette length through the following formula (2):
[0088]
[0089] In the above formula (2), d represents the target cigarette length detected for the i-th target user in the t-th frame. The average scale l of the cigarette detection area can be calculated by Of course, the electronic device can also use other methods to calculate the cigarette length information, which can be specifically selected based on actual needs, and the embodiments of the present application do not limit this.
[0090] When subsequently determining the validity of the target cigarette based on the cigarette length information, if the electronic device determines that the length of the target cigarette does not fall within the preset length range, the electronic device can determine that the length of the target cigarette is too long or too short, and it is an invalid cigarette. Exemplarily, the preset length range can adopt a first threshold and a second threshold to represent. Among them, if the length of the target cigarette or , at this time, the length of the target cigarette does not fall within the preset length range, and the electronic device can determine that the length of the target cigarette is too long or too short and is an invalid cigarette; conversely, if the length of the target cigarette falls within the preset length range, that is , at this time, the length of the target cigarette falls within the preset length range, then the electronic device can determine that the target cigarette is a valid cigarette.
[0091] In the embodiments of the present application, the electronic device determines the length of the target cigarette through coordinate calculation, and at the same time calculates the average length of the cigarette detection area. Subsequently, the validity of the target cigarette can be determined based on the cigarette length information, which is a cigarette attribute information, which can improve the accuracy and rationality of the recognition of the cigarette detection object, and further improve the accuracy of the smoking behavior detection.
[0092] In a possible implementation manner, the cigarette attribute information includes cigarette position information; the cigarette position information includes cigarette movement information; the cigarette attribute information in step S204 can be specifically determined in the following manner:
[0093] Obtain the adjacent cigarette coordinate information of adjacent frames of the human body image; determine the cigarette movement information corresponding to the human body image according to the cigarette coordinate information and the adjacent cigarette coordinate information of the human body image.
[0094] In the embodiments of the present application, the cigarette attribute information may include cigarette position information, and the cigarette position information may specifically refer to cigarette movement information, that is, the average moving distance of the target cigarette in the current frame compared to its position in the historical frame. The historical frame may refer to the previous M frames (M is a positive integer) of the current frame, for example, it may be the previous frame, the previous three frames, etc. The embodiments of the present application do not make any limitations in this regard. The adjacent cigarette coordinate information may refer to the cigarette coordinate information of the target cigarette in the historical frame. Specifically, the electronic device can determine the adjacent cigarette coordinate information of the target cigarette in the historical frame, and then perform coordinate calculation on the adjacent cigarette coordinate information and the cigarette coordinate information in the current frame to obtain the cigarette movement information of the target cigarette in the current frame.
[0095] Exemplarily, the electronic device detects that the target cigarette of the i-th target user in the t-th frame is , and the target cigarette of the i-th target user in the (t - 1)-th frame At this time, the electronic device can calculate the cigarette movement information of the target cigarette in the t-th frame through the following formula (3):
[0096]
[0097] When subsequently determining the validity of the cigarette based on the cigarette position information, if the electronic device determines that the cigarette movement information in the cigarette position information does not belong to the preset distance range, the electronic device determines that the target cigarette is an invalid cigarette. That is, if the movement distance of the target cigarette detected in consecutive frames is too small (for example, staying still, etc.), at this time the target cigarette may be a misdetection of an environmental background object such as a light strip. If the movement distance of the cigarette detected in consecutive frames is too large, the target cigarette may be an invalid cigarette. Exemplarily, the electronic device can use a third threshold and a fourth threshold to represent the preset distance range, where , if the cigarette movement information or , then the electronic device can determine that the movement distance of the target cigarette is too small or too large, and the electronic device can determine that the target cigarette is an invalid cigarette. If the cigarette movement information belongs to the preset distance range, that is , then the electronic device can determine that the target cigarette in the current frame is valid.
[0098] In the embodiment of the present application, the electronic device determines the cigarette movement information of the target cigarette in the current frame compared with the adjacent frame through coordinate calculation, which can accurately reflect the position change of the target cigarette. Subsequently, the validity of the target cigarette can be determined based on the cigarette movement information, which is the cigarette position information, which can improve the accuracy and scientificity of target cigarette recognition, and further improve the accuracy of detecting the smoking behavior of the target user.
[0099] In a possible implementation manner, the cigarette attribute information includes cigarette color information; the cigarette attribute information in step S204 can be specifically determined in the following manner:
[0100] Perform gray processing on the cigarette detection area to obtain a target gray image; determine a plurality of sampling points corresponding to the target cigarette, and respectively determine the gray information of each sampling point; calculate the cigarette color information corresponding to the target cigarette according to the gray information of each sampling point.
[0101] In the embodiment of the present application, the cigarette color information may refer to the color information of the target cigarette in the cigarette detection area. Generally, the cigarette is usually in the form of a white short line in the actual scene. If the color of the target cigarette detected by the electronic device is not white, the target cigarette may be an invalid cigarette.
[0102] Specifically, when determining the cigarette color information, the electronic device can first convert the cigarette detection area from a color RGB image to a target grayscale image, and at the same time, perform normalization processing to convert the grayscale value range from 0 to 255 to the range from 0 to 1. Then, the electronic device can determine the cigarette color information corresponding to the target cigarette based on the grayscale information of multiple sampling points by means of uniform sampling.
[0103] Exemplarily, the electronic device can use a function to represent the grayscale value at the coordinate position. Assuming that the electronic device uniformly samples inside the target cigarette sampling points, plus two key points at the cigarette butt and the cigarette tail, a total of sampling points are sampled at this time. Then, the coordinates of the th sampling point can be expressed as:
[0104]
[0105] In the above formula (4), . At this time, the cigarette color information of the target cigarette can be represented by the average cigarette color, and the average cigarette color can be represented by the following formula (5):
[0106]
[0107] In the above formula (5), c is the average cigarette color of the target cigarette. Of course, the cigarette color information of the target cigarette can also be determined by a numerical value. For example, the grayscale value with the highest frequency of occurrence among multiple sampling points can be selected as the cigarette color information, or the median of the grayscale values among multiple sampling points can be used as the cigarette color information. The embodiments of the present application do not limit this.
[0108] When subsequently determining the validity of the target cigarette based on the cigarette color information, which is a cigarette attribute information, if the electronic device determines that the cigarette color information of the target cigarette does not belong to the preset color range, the electronic device can determine that the target cigarette is an invalid cigarette. Among them, the preset color range can be represented by a preset color threshold λ, and the numerical range of the preset color threshold is . Exemplarily, if the cigarette color information c of the target cigarette is less than λ, the electronic device can determine that the cigarette color information of the target cigarette does not belong to the preset color range, the target cigarette is not white, and the target cigarette is an invalid cigarette; conversely, if the cigarette color information c of the target cigarette is greater than or equal to λ, the electronic device can determine that the cigarette color information of the target cigarette belongs to the preset color range, and the target cigarette is valid.
[0109] In the embodiment of the present application, the electronic device performs grayscale processing on the cigarette detection area in the human body image to obtain a target grayscale image; then determines a plurality of sampling points corresponding to the target cigarette, and respectively determines the grayscale information of each sampling point, and calculates the cigarette color information corresponding to the target cigarette according to the grayscale information of each sampling point. In this way, the electronic device calculates the cigarette color information of the target cigarette through color sampling, and subsequently determines whether the target cigarette is valid based on the cigarette color information, which can ensure the accuracy of cigarette detection object recognition, and thus can improve the accuracy of smoking recognition.
[0110] It should be noted that the cigarette attribute information may also include other types of attribute information, such as cigarette direction information (the vector direction from the cigarette butt to the cigarette tail, for example, a target cigarette in the vertical direction is an invalid cigarette), cigarette posture information (the interaction posture between the human body and the cigarette, for example, a target cigarette at the ear position is an invalid cigarette), cigarette movement speed information (the moving speed of the cigarette in consecutive frames, for example, a target cigarette with a moving speed greater than a preset speed threshold is an invalid cigarette), cigarette shape information (the shape of the cigarette in the video frame, for example, a bent target cigarette in the cigarette detection area is an invalid cigarette), and cigarette contrast information (the color contrast and brightness contrast between the cigarette and the environmental background, for example, a target cigarette with a contrast less than a preset contrast threshold with the environmental background is an invalid cigarette), etc. Of course, the electronic device can also calculate other cigarette attribute information, and correspondingly there can be other determination methods for whether the target cigarette is valid. The embodiment of the present application does not limit this.
[0111] S205. During the target time period, determine the number of valid cigarettes corresponding to the target user according to the cigarette attribute information.
[0112] In a possible implementation manner, the cigarette attribute information includes cigarette length information, cigarette position information, and cigarette color information. Whether the target cigarette in the human body image is valid can be determined in the following way:
[0113] If the cigarette attribute information corresponding to the human body image meets the preset attribute conditions, it is determined that the target cigarette included in the human body image is a valid cigarette; the preset attribute conditions include that the length of the target cigarette belongs to the preset length range, and the cigarette position information belongs to the preset distance range, and the cigarette color information belongs to the preset color range.
[0114] In the embodiments of the present application, the preset attribute condition may refer to a judgment condition for determining whether a target cigarette is valid based on different cigarette attribute information. For example, when the cigarette attribute information includes cigarette color information, the preset attribute condition may include that the length of the target cigarette belongs to a preset length range; when the cigarette attribute information includes cigarette position information, the preset attribute condition may include that the cigarette position information belongs to a preset distance range; when the cigarette attribute information includes cigarette color information, the preset attribute condition may include that the cigarette color information belongs to a preset color range. When the cigarette attribute information includes two or more types of cigarette attribute information, each type of cigarette attribute information needs to meet the preset attribute condition. In this way, the electronic device calculates and determines the validity of multiple attributes such as the length, position, and color of the target cigarette, which can achieve accurate zoning of the cigarette detection object, reduce false alarms of the cigarette detection object, and improve the accuracy of target cigarette detection.
[0115] S206. When the number of valid cigarettes meets the preset condition, it is determined that the target user has a smoking behavior, and a target warning message is output.
[0116] In the embodiments of the present application, the electronic device determines the number of valid cigarettes of each target user within a target time period according to the cigarette attribute information of the target cigarettes in each determined human body image. If the number of valid cigarettes meets the preset condition, the electronic device may determine that the target user has a smoking behavior and may output a target warning message to timely remind the target person to handle the smoking behavior. Exemplarily, the electronic device may establish and maintain a sliding window of a target number of frames, and the duration of the sliding window is the target time period, where the target number of frames may be T frames, and the value of T may be 8, 10, 12, etc., which is not limited in the embodiments of the present application; within the sliding window, the electronic device may determine the number of valid cigarettes of each target user. When the number of valid cigarettes meets the preset condition, for example, the ratio of the number of valid cigarettes to the target number of frames is greater than a preset ratio threshold (50%, 60%, 70%, etc.), the electronic device may determine that the target user has a smoking behavior. Subsequently, the electronic device may move the sliding window backward to detect the smoking behavior in the next target time period to ensure the real-time and accuracy of smoking behavior detection in the actual scenario.
[0117] It should be understood that in various embodiments of the present application, the magnitudes of the sequence numbers of the processes do not mean the order of execution. The execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
[0118] Based on any one of the above embodiments, Figure 3 This is a schematic diagram of a technical module for smoking detection provided by an exemplary embodiment of the present application. As Figure 3As shown, the electronic device obtains a real-time video stream, detects and tracks the human bodies in the real-time video stream, associates the trajectories belonging to the same identity, obtains the human body trajectory information of each target user, and further determines multiple human body images corresponding to each target user. After that, the electronic device can input the human body images into a multi-task model for inference, perform a multi-task detection process, and obtain the cigarette detection area and cigarette coordinate information in the human body images. Then, the electronic device can calculate the cigarette attributes based on the cigarette detection area and cigarette coordinate information to obtain cigarette attribute information such as the length, position, and color of the target cigarette. The electronic device can construct a sliding window of multiple frames as the target time period, and within each target time period, determine the validity of the target cigarette detected in the human body image according to whether the cigarette attribute information meets the preset attribute conditions, and further obtain the number of valid cigarettes of the target user within the target time period. When the number of valid cigarettes meets the preset conditions, the electronic device can determine that the target user has a smoking behavior, output the target warning information, achieve real-time and accurate detection of smoking behavior, and ensure the safety of the actual scenario.
[0119] In the embodiment of the present application, the electronic device determines the cigarette attribute information of the cigarette itself by determining the cigarette detection area and cigarette coordinate information, realizes the modeling of the target cigarette itself, calculates the attribute information such as the cigarette length, cigarette position, and cigarette color, and judges the validity of the target cigarette based on the cigarette attribute information, which can filter out environmental interference factors such as light strips and clothing stripes, and can accurately detect and identify smoking behavior. The smoking detection method in the embodiment of the present application can be implemented by a single multi-task detection model, consumes less computing resources, is convenient to be deployed at the edge, avoids false alarms caused by similar actions at the same time, has higher accuracy and reliability, is more robust to misidentification of similar white slender line styles, is convenient for the target person to dispose of the smoking behavior in time, and reduces the safety risk.
[0120] Figure 4 For the structural schematic diagram of a smoking detection device provided by an exemplary embodiment of the present application, please refer to Figure 4 , the smoking detection device 40 includes:
[0121] An acquisition module 41, configured to acquire a real-time video stream and determine multiple human body images corresponding to each target user based on the real-time video stream;
[0122] A first determination module 42, configured to determine the cigarette attribute information corresponding to the human body image according to the cigarette detection area and cigarette coordinate information in the human body image;
[0123] A second determination module 43, configured to determine the number of valid cigarettes corresponding to the target user according to the cigarette attribute information within the target time period;
[0124] An output module 44, configured to determine that the target user has a smoking behavior when the number of valid cigarettes meets a preset condition, and output a target warning message.
[0125] In a possible implementation manner, the first determination module 42 is specifically configured to:
[0126] For each human body image, determine a cigarette detection area in the human body image; the cigarette detection area includes a first cigarette behavior detection area and / or a second cigarette behavior detection area;
[0127] In the cigarette detection area, determine the key point coordinates corresponding to the target cigarette to obtain cigarette coordinate information;
[0128] According to the cigarette detection area and the cigarette coordinate information, determine cigarette attribute information corresponding to the human body image; the cigarette attribute information includes at least one of cigarette length information, cigarette position information, and cigarette color information.
[0129] In a possible implementation manner, the cigarette attribute information includes cigarette length information; the cigarette length information includes the target cigarette length and the average scale of the cigarette detection area; the first determination module 42 is specifically configured to:
[0130] According to the cigarette coordinate information, determine the starting point coordinate information and the ending point coordinate information of the target cigarette;
[0131] Based on the starting point coordinate information and the ending point coordinate information, calculate the target cigarette length;
[0132] According to the size information of the cigarette detection area, determine the average scale of the cigarette detection area.
[0133] In a possible implementation manner, the cigarette attribute information includes cigarette position information; the cigarette position information includes cigarette movement information; the first determination module 42 is specifically configured to:
[0134] Obtain adjacent cigarette coordinate information of adjacent frames of the human body image;
[0135] According to the cigarette coordinate information of the human body image and the adjacent cigarette coordinate information, determine the cigarette movement information corresponding to the human body image.
[0136] In a possible implementation manner, the cigarette attribute information includes cigarette color information; the first determination module 42 is specifically configured to:
[0137] Perform gray processing on the cigarette detection area to obtain a target gray image;
[0138] Determine a plurality of sampling points within the target cigarette in the cigarette detection area, and respectively determine the gray information of each sampling point;
[0139] Calculate the cigarette color information corresponding to the target cigarette according to the gray-scale information of each sampling point.
[0140] In a possible implementation manner, the cigarette attribute information includes cigarette length information, cigarette position information, and cigarette color information; the apparatus 40 is further configured to:
[0141] If the cigarette attribute information corresponding to the human body image meets the preset attribute conditions, determine that the target cigarette included in the human body image is a valid cigarette; the preset attribute conditions include that the cigarette length information belongs to a preset length range, the cigarette position information belongs to a preset distance range, and the cigarette color information belongs to a preset color range.
[0142] The smoking detection apparatus 40 provided in the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and the implementation principles and beneficial effects are similar, and will not be elaborated here.
[0143] Figure 5 For a structural schematic diagram of a smoking detection device provided in an exemplary embodiment of the present application, please refer to Figure 5 The smoking detection device 50 may include a processor 51 and a memory 52. Exemplarily, the processor 51 and the memory 52 are interconnected with each other through a bus 53.
[0144] The memory 52 stores computer-executable instructions;
[0145] The processor 51 executes the computer-executable instructions stored in the memory 52, so that the processor 51 executes the smoking detection method as shown in the above method embodiment.
[0146] Correspondingly, the embodiments of the present application provide a computer-readable storage medium, and computer-executable instructions are stored in the computer-readable storage medium, and when the computer-executable instructions are executed by a processor, they are used to implement the smoking detection method of the above method embodiment.
[0147] Correspondingly, the embodiments of the present application can also provide a computer program product, including a computer program, and when the computer program is executed by a processor, the smoking detection method shown in the above method embodiment can be implemented.
[0148] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, Compact Disc Read-Only Memory (CD-ROM), optical memory, etc.) that contain computer-usable program code.
[0149] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0150] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0151] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0152] In a typical configuration, a computing device includes one or more processors, an input / output interface, a network interface, and a memory.
[0153] Memory may include non-permanent memory in the form of computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0154] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can store information by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
[0155] It should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0156] The above description is only for the embodiments of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
Claims
1. A smoking detection method, characterized in that, Including: Obtain a real-time video stream, and determine multiple human body images corresponding to each target user based on the real-time video stream; Determine the cigarette attribute information corresponding to the human body image according to the cigarette detection area and cigarette coordinate information in the human body image; Within a target time period, determine the number of valid cigarettes corresponding to the target user according to the cigarette attribute information; When the number of valid cigarettes meets a preset condition, determine that the target user has a smoking behavior and output a target warning message.
2. The method according to claim 1, characterized in that The determining the cigarette attribute information corresponding to the human body image according to the cigarette detection area and cigarette coordinate information in the human body image includes: For each human body image, determine the cigarette detection area in the human body image; the cigarette detection area includes a first cigarette behavior detection area and / or a second cigarette behavior detection area; Within the cigarette detection area, determine the key point coordinates corresponding to the target cigarette to obtain the cigarette coordinate information; Determine the cigarette attribute information corresponding to the human body image according to the cigarette detection area and the cigarette coordinate information; the cigarette attribute information includes at least one of cigarette length information, cigarette position information, and cigarette color information.
3. The method according to claim 1 or 2, characterized in that, The cigarette attribute information includes cigarette length information; the cigarette length information includes the target cigarette length and the average scale of the cigarette detection area; The determining the cigarette attribute information corresponding to the human body image includes: According to the cigarette coordinate information, determine the starting point coordinate information and the ending point coordinate information of the target cigarette; Based on the starting point coordinate information and the ending point coordinate information, calculate the target cigarette length; According to the size information of the cigarette detection area, determine the average scale of the cigarette detection area.
4. The method according to claim 1 or 2, characterized in that, The cigarette attribute information includes cigarette position information; the cigarette position information includes cigarette movement information; the determining the cigarette attribute information corresponding to the human body image includes: Obtain the adjacent cigarette coordinate information of adjacent frames of the human body image; Determine the cigarette movement information corresponding to the human body image according to the cigarette coordinate information of the human body image and the adjacent cigarette coordinate information.
5. The method according to claim 1 or 2, characterized in that, The cigarette attribute information includes cigarette color information; the determining the cigarette attribute information corresponding to the human body image includes: Perform gray processing on the cigarette detection area to obtain a target gray image; Determine multiple sampling points corresponding to the target cigarette, and respectively determine the gray information of each sampling point; Calculate the cigarette color information corresponding to the target cigarette according to the gray information of each sampling point.
6. The method according to claim 1, characterized in that, The cigarette attribute information includes cigarette length information, cigarette position information, and cigarette color information; the method further includes: If the cigarette attribute information corresponding to the human body image meets a preset attribute condition, determine that the target cigarette included in the human body image is a valid cigarette; the preset attribute condition includes that the target cigarette length belongs to a preset length range, and the cigarette position information belongs to a preset distance range, and the cigarette color information belongs to a preset color range.
7. A smoking detection device, characterized in that, Including: An acquisition module, configured to acquire a real-time video stream and determine multiple human body images corresponding to each target user based on the real-time video stream; A first determination module, configured to determine cigarette attribute information corresponding to the human body image according to a cigarette detection area and cigarette coordinate information in the human body image; A second determination module, configured to determine the number of valid cigarettes corresponding to the target user according to the cigarette attribute information within a target time period; An output module, configured to determine that the target user has a smoking behavior and output a target warning message when the number of valid cigarettes meets a preset condition.
8. A smoking detection device, characterized in that, Comprising: A memory and a processor; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory, so that the processor executes the smoking detection method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, Computer execution instructions are stored in the computer-readable storage medium, and when the computer execution instructions are executed by the processor, they are used to implement the smoking detection method according to any one of claims 1 to 6.
10. A computer program product, characterized in that, Comprising a computer program, which when executed by a computer, implements the smoking detection method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Smoking behavior detection method, device, equipment and medium
CN114783061A
Method for detecting smoking behavior based on improved yolov7
CN117095386A
Method and system for alarming and processing smoking behavior in vehicle cabin
CN118366268A
Driver smoking detection method and device, computer equipment and readable storage medium
CN118506326A