Image recognition method and apparatus, and computer device and storage medium
By first determining the original detection box in image recognition, then determining the riding object and head detection box based on the box, and processing the image using the attribute recognition network, the problems of poor image recognition stability and fault tolerance in the prior art are solved, and a higher recognition success rate and accuracy are achieved.
Patent Information
- Application Number
- PCT/CN2023/114974
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-08-25
- Publication Date
- 2025-03-06
AI Technical Summary
In the prior art, the method of identifying whether a non-motor vehicle rider wears a helmet is poor due to the detection method in sequence, resulting in poor stability and fault tolerance of image recognition, which easily leads to failure of the entire image recognition due to abnormal detection of one object.
By detecting the target image containing multiple different objects, the original detection box of one object is determined first, and then the riding object detection box and the head detection box are determined based on the original detection box. The image containing the head detection frame is input to the headset attribute recognition network, the image containing the riding object detection frame is input to the riding object attribute recognition network, and finally the target recognition result is determined based on the two recognition results.
The stability and fault tolerance of image recognition are improved, recognition interruption caused by failure of any detection box determination is prevented, and the success rate and accuracy of target image recognition are ensured.
Smart Images

Figure CN2023114974_06032025_PF_FP_ABST
Abstract
Description
Image recognition method, device, computer equipment and storage medium
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on December 31, 2022, with application number 202211737844.5 and invention name “A method, device, computer equipment and storage medium for image recognition”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present invention relates to the field of image processing, and in particular to an image recognition method, device, computer equipment and storage medium. Background Art
[0003] With the development of urban transportation, more and more non-motorized vehicles are appearing on city roads. This increase in non-motorized vehicles has also led to an increase in non-motorized vehicle-related traffic accidents. Wearing a helmet can significantly reduce the fatality and injury rate in non-motorized vehicle accidents.
[0004] In order to better supervise whether non-motor vehicle riders are wearing helmets, the traffic police department will use video equipment to collect images of non-motor vehicles and their riders, and then process the collected images to identify whether the current non-motor vehicle riders are wearing helmets, so as to remind or punish riders who are not wearing helmets, so as to urge non-motor vehicle riders to wear helmets, thereby reducing the casualty rate of non-motor vehicle riders in traffic accidents.
[0005] Prior art methods for identifying images of non-motor vehicle riders typically involve first detecting the non-motor vehicle in the image, then determining whether the object being ridden is a non-motor vehicle based on the detection results. Furthermore, the person in the image is detected, and based on the detection results, whether the person is wearing a helmet, thereby concluding whether the non-motor vehicle rider in the image is wearing a helmet. However, this sequential detection method often results in the entire image recognition process being unable to proceed if one of the detection objects is abnormal, making image recognition unstable and prone to error tolerance.
[0006] Summary of the Invention
[0007] In view of this, embodiments of the present invention provide a method, apparatus, computer device, and storage medium for image recognition to improve the stability and error tolerance of image recognition containing multiple different target objects.
[0008] In a first aspect, an embodiment of the present invention provides a method for image recognition, the method comprising:
[0009] Detecting a target image containing multiple different objects and obtaining an original detection frame of one of the objects, wherein the different objects include a human object and a cycling object;
[0010] determining a riding object detection frame based on the original detection frame, and determining a head detection frame based on the original detection frame;
[0011] Inputting the target image including the head detection frame into a headwear attribute recognition network to obtain a headwear attribute recognition result, and inputting the target image including the cyclist detection frame into a cyclist attribute recognition network to obtain a cyclist attribute recognition result;
[0012] A target recognition result is determined based on the headwear attribute recognition result and the riding object attribute recognition result.
[0013] In a second aspect, an embodiment of the present invention provides an image recognition device, the image recognition device comprising:
[0014] a detection module, configured to detect a target image containing a plurality of different objects, and obtain an original detection frame of one of the target objects, wherein the different objects include a human object and a cycling object;
[0015] an adjustment module, configured to determine a riding object detection frame based on the original detection frame, and determine a head detection frame based on the original detection frame;
[0016] a recognition module, configured to input the target image including the head detection frame into a headwear attribute recognition network to obtain a headwear attribute recognition result, and input the target image including the cyclist detection frame into a cyclist attribute recognition network to obtain a cyclist attribute recognition result;
[0017] The result module is used to determine a target recognition result according to the headwear attribute recognition result and the riding object attribute recognition result.
[0018] In a third aspect, an embodiment of the present invention provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the image recognition method as described in the first aspect when executing the computer program.
[0019] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the image recognition method as described in the first aspect is implemented.
[0020] The aforementioned image recognition method, apparatus, computer device, and storage medium detect a target image containing multiple different objects, obtaining an original detection frame for one of the objects, including a human body and a cyclist. A cyclist detection frame is then determined based on the original detection frame, and a head detection frame is then determined based on the original detection frame. In this process, the original detection frame for one of the objects is first identified, and then different target detection frames, namely the cyclist detection frame and the head detection frame, are determined based on the original detection frame. These two processes can be performed simultaneously, effectively preventing the failure of determining either the head detection frame or the cyclist detection frame, resulting in an inability to proceed to the next recognition step and thus interrupting the target image recognition. Then, the target image containing the head detection frame is input into a headwear attribute recognition network to obtain a headwear attribute recognition result. The target image containing the cyclist detection frame is then input into a cyclist attribute recognition network to obtain a cyclist attribute recognition result. Finally, a target recognition result is determined based on the headwear attribute recognition result and the cyclist attribute recognition result. This effectively prevents abnormalities in the recognition of either the headwear attribute or the cyclist attribute, which could interrupt overall image recognition and result in an inability to obtain a recognition result, leading to target image recognition failure. This improves the stability and fault tolerance of image recognition. Since only the original detection frame of one object needs to be detected throughout the entire process, rather than each object individually, the head detection frame and cyclist detection frame are then determined based on the original detection frame. This allows simultaneous image recognition of multiple objects, ensuring the precision of target image recognition while also improving the recall of target image recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0022] FIG1 is a schematic diagram of an application environment of an image recognition method according to an embodiment of the present invention;
[0023] FIG2 is a flow chart of an image recognition method according to an embodiment of the present invention;
[0024] FIG3 is a schematic diagram of an image recognition method according to an embodiment of the present invention;
[0025] FIG4 is a schematic diagram of an image recognition device according to an embodiment of the present invention;
[0026] FIG5 is a schematic diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In the following description, specific details such as particular system structures and techniques are provided for purposes of illustration, not limitation, to facilitate a thorough understanding of the embodiments of the present invention. However, it will be apparent to those skilled in the art that the present invention may be practiced in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
[0028] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0029] It will also be understood that the term "and / or" used in the present description and appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0030] As used in the present specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0031] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0032] References to "one embodiment" or "some embodiments" in the present specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present invention. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in yet other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0033] Embodiments of the present invention can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results.
[0034] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0035] It should be understood that the order of execution of the steps in the following embodiments does not necessarily mean the order in which they are executed. The order in which each process is executed should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0036] In order to illustrate the technical solution of the present invention, specific embodiments are provided below.
[0037] The image recognition method provided by an embodiment of the present invention can be applied in the application environment shown in Figure 1. The acquisition end includes, but is not limited to, image acquisition devices such as cameras and monitoring equipment, and input devices for uploading images. The server end can be a standalone server, or a computer device such as a PDA, desktop computer, laptop computer, ultra-mobile personal computer (UMPC), netbook, cloud terminal device, or personal digital assistant (PDA). It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The acquisition end can be applied in scenarios such as intelligent security and traffic monitoring. The acquisition end obtains images that need to be recognized. For example, in a traffic monitoring scenario, surveillance cameras can be used to collect images of all target objects. The processing end is connected to the acquisition end in the application scenario, thereby receiving the image to be identified sent by the acquisition end and processing multiple target objects in the image. For example, in a traffic monitoring scenario, the image to be identified by the processing end will determine whether the target object has committed a violation and return the identification results to the traffic control department. The target object can be a vehicle or a pedestrian. For example, through image recognition, it can batch identify whether the pedestrians collected have committed dangerous behaviors such as running a red light or jaywalking. The identification results are returned to the traffic control department, helping the traffic control department to promptly detect violations and thus improve the work efficiency of the traffic control department. In this embodiment, it is assumed that the image to be identified includes multiple target objects that need to be identified.
[0038] As shown in Figure 2, it is a flow chart of an image recognition method provided by one embodiment of the present invention. The above-mentioned image recognition method can be applied to the processing end in Figure 1. The acquisition device corresponding to the acquisition end is connected to the processing end to obtain an image to be recognized containing multiple target objects. The processing end receives the image to be recognized sent by the acquisition end and then recognizes the image to be recognized. As shown in Figure 2, the image recognition method may include the following steps:
[0039] Step S10: Detecting a target image containing a plurality of different objects to obtain an original detection frame of one of the objects, wherein the different objects include a human object and a cycling object.
[0040] In this embodiment, the processing end obtains a target image captured by the acquisition end. This target image refers to an image to be identified by the processing end, where the image to be identified contains multiple different objects. These objects include, but are not limited to, human bodies, vehicles, plants, graphics, patterns, and other objects to be identified. Furthermore, methods for acquiring images by the acquisition end include, but are not limited to, directly capturing the image to be identified using an image acquisition device, manually uploading the image to be identified via a user's visual interface, and so on.
[0041] The acquisition device sends the image to be identified to the processing end via a network. The processing end detects the image to be identified and obtains an original detection frame for any object therein. Methods for detecting the image and obtaining the original detection frame include, but are not limited to, any functional methods and tools capable of detecting the target object. Furthermore, this embodiment does not limit the shape of the original detection frame.
[0042] For example, in the use scenario of detecting whether a non-motor vehicle rider is wearing a helmet, since it is necessary to determine whether the current person is wearing a helmet and whether the current person is riding a non-motor vehicle, this scenario requires the target image to detect two objects: a human body and a vehicle. The acquisition end is a traffic monitoring device, which captures a target image of a non-motor vehicle rider. This target image is the image to be identified that needs to be processed in this embodiment. The processing end sets the human body as the default object, which refers to any object in the image to be identified. After receiving the image to be identified, the processing end detects the position of the human body in it and obtains the original detection frame, that is, the detection frame of the target human body.
[0043] Step S20: determining a riding object detection frame based on the original detection frame, and determining a head detection frame based on the original detection frame.
[0044] After obtaining the original detection frame of any object, a target detection frame is determined for each object based on the relative position of the original detection frame and each object to be identified. This target detection frame includes, but is not limited to, a riding detection frame and a head detection frame. In this step, multiple objects to be identified can be detected simultaneously, ultimately obtaining detection frames for each of them. This embodiment does not impose any restrictions on the shape of the target detection frame.
[0045] Specifically, the relative position of each object to be identified and the original detection frame is first determined, and the target detection frame to be identified is determined based on each relative position. The relative position refers to the relative position of the target object for which the target detection frame is to be determined and the default object of the original detection frame. The default object here is the object used to determine the original detection frame in step S10.
[0046] For example, in the detection of non-motorized vehicle riders, the default object is the human body, so the original detection frame is the human body detection frame. Then, the target detection frame of the cyclist target object needs to be confirmed. Based on the relative positions of the human body and the cyclist, the cyclist detection frame is confirmed based on the human body detection frame.
[0047] In addition, if the target detection frame that needs to be determined currently is the default object, then the target detection frame of the default object can be determined based on the specific object that needs to be detected by the default object or possible missed detection situations, and then referring to the original detection frame.
[0048] For example, in the scenario of detecting whether people entering a factory are wearing helmets, the default object is the human body, and the initial detection frame obtained from the initial detection is the human body detection frame. Because the need to detect whether a person is wearing a helmet exists, the default object to be detected is actually the location of the helmet, that is, the head. Therefore, based on the relative position of the head to the body, the target detection frame of the default object, that is, the head detection frame, is derived with reference to the human body detection frame.
[0049] Another possible scenario that may arise in this embodiment is illustrated below: In the scenario of detecting whether a motor vehicle exceeds the height limit, the default object is the vehicle, and the initial detection frame obtained from the initial detection is the vehicle detection frame. However, due to the inconsistency of the size and appearance of each vehicle, the surface area of each vehicle is different. Furthermore, even for the same vehicle model, the surface area of each vehicle can vary if the objects loaded on the vehicle have different widths and heights. To prevent the initial detection frame from being too small, resulting in the detection frame not actually containing all object features, for example, a truck is loaded with a narrow but tall object. Because the vehicle has been illegally modified, its surface area is wider than that of an average truck. Therefore, the initial detection frame obtained from the vehicle detection is actually insufficient and fails to contain some features of the narrow but tall object in the cargo. This results in the subsequent target object recognition being unable to accurately determine whether the vehicle exceeds the height limit due to the partial loss of object features. Therefore, after obtaining the initial detection frame, i.e., the vehicle detection frame, it is necessary to further expand the original detection frame based on the specific situation of the vehicle and the position of the original detection frame to obtain the target detection frame, i.e., the vehicle detection frame, for the target object.
[0050] Step S30: Inputting the target image including the head detection frame into a headwear attribute recognition network to obtain a headwear attribute recognition result, and inputting the target image including the cyclist detection frame into a cyclist attribute recognition network to obtain a cyclist attribute recognition result.
[0051] After obtaining the target detection frames of different objects to be identified, the target images with the target detection frames are input into different attribute recognition networks one by one to obtain the attribute recognition results of different objects to be identified. The attribute recognition networks include but are not limited to the headwear attribute recognition network, the bicycle attribute recognition network, etc.
[0052] Specifically, in the scenario of detecting whether a non-motorized vehicle rider is wearing a helmet, the target image containing the head detection frame is input into a headwear attribute recognition network to obtain a headwear attribute recognition result. Furthermore, the target image containing the cyclist detection frame is input into a cyclist attribute recognition network to obtain a cyclist attribute recognition result. Attribute recognition network implementation methods include, but are not limited to, ResNet (residual neural network), MobileNet (a lightweight deep neural network), ViT (a self-attention mechanism network, also known as Vision Transformer), and others.
[0053] Step S40: determining a target recognition result based on the headwear attribute recognition result and the riding object attribute recognition result.
[0054] After obtaining attribute recognition results for different objects to be identified, each attribute recognition result is combined to arrive at a target recognition result. This attribute recognition result includes, but is not limited to, the category of the object to be identified, the items contained within the object to be identified, the color of the object to be identified, the volume of the object to be identified, etc. The target recognition result refers to the conclusion obtained after combining the attribute recognition results, including, but not limited to, whether a certain category of objects to be identified contains a certain item, whether an object to be identified in a certain state exceeds a preset volume range, etc.
[0055] For example, in the scenario of determining whether an electric bike rider is wearing a helmet, the target detection frames obtained through steps S10 and S20 are a human body detection frame and a riding object detection frame. Then, in steps S30 and S40, it is determined whether the human head in the human body detection frame contains a helmet, and at the same time, it is determined what the target object in the riding object detection frame is. Therefore, the final recognition results of the two target detection frames are that a cotton hat is detected on the human head in the human body detection frame and a tricycle is detected in the riding object detection frame. Combining these two recognition results, it is concluded that a person wearing a cotton hat is riding a tricycle. Since tricycles are not electric bikes, the target recognition result is that the rider does not need to wear a helmet.
[0056] It should be noted that in this embodiment, when detecting a target image containing multiple different objects, the original detection frame of one of the objects (including, but not limited to, human objects and cyclists) is first detected. Then, different target detection frames are determined based on the different objects to be identified: a cyclist detection frame and a head detection frame. These two detection frames can be performed simultaneously, effectively preventing the failure of detecting any of the objects to be identified from preventing the next step of recognition, thereby interrupting target image recognition. The target image containing the head detection frame is then input into the headwear attribute recognition network to obtain a headwear attribute recognition result. The target image containing the cyclist detection frame is then input into the cyclist attribute recognition network to obtain a cyclist attribute recognition result. The target recognition result is then determined based on the headwear attribute recognition results and the cyclist attribute recognition results. This effectively prevents abnormal recognition of either the headwear attribute or the cyclist attribute, which could interrupt target image recognition and lead to a failure in target image recognition. This improves the stability and fault tolerance of target image recognition. Since in the whole process, only the original detection frame of one of the objects needs to be detected, there is no need to detect each object one by one. Then, based on the different target detection frames determined by the original detection, image recognition can be performed on multiple objects at the same time. This ensures the precision rate of target image recognition while improving the recall rate of target image recognition.
[0057] In one embodiment, in the scenario of detecting non-motor vehicle riders, step S10, i.e., detecting a target image containing multiple different objects and obtaining an original detection frame of one of the objects, specifically includes the following steps:
[0058] S11: Detecting a human body object in the target image, determining a human body detection frame, and using the human body detection frame as the original detection frame.
[0059] The human object in the target image is used as the default object, that is, any object in step S10, so as to determine the human detection frame. In the scenario of detecting non-motor vehicle riders, the human detection frame is the original detection frame.
[0060] In one embodiment, in the scenario of detecting a non-motorized vehicle rider, as shown in FIG3 , step S20, i.e., determining a rider detection frame based on the original detection frame, and determining a head detection frame based on the original detection frame, may specifically include the following steps:
[0061] S21: Determine the initial vertex coordinates of the original detection frame.
[0062] S22: Determine vertex coordinates of the human head based on the position of the human head relative to the original detection frame and the initial vertex coordinates, and determine vertex coordinates of the cyclist based on the position of the cyclist relative to the original detection frame and the initial vertex coordinates.
[0063] S23: constructing a head detection frame of the human head according to the vertex coordinates of the human head, and constructing a cyclist detection frame of the cyclist object according to the vertex coordinates of the cyclist object.
[0064] In steps S21-S22, it is first necessary to determine all vertex coordinates of the original detection frame, that is, the initial vertex coordinates. Next, based on the relative position of each object to be identified relative to the original detection frame, the vertex coordinates of each object to be identified are determined according to the initial vertex coordinates and relative position of the original detection frame. Among them, the objects to be identified include but are not limited to human heads and cycling objects, etc., and the initial vertex coordinates refer to the point coordinates that can determine the original detection frame, which can be all point coordinates or part of the point coordinates, and are not limited here. Similarly, the vertex coordinates of the object to be identified refer to the point coordinates that can encompass the object to be identified, that is, the point coordinates that can confirm the target detection frame, which can be all point coordinates of the target detection frame or part of the point coordinates, and are not limited here.
[0065] For example, in the detection scenario of whether construction workers are wearing helmets, the default object is a human body, so the original detection frame is the human body detection frame. The coordinates of the four vertices of the human body detection frame are obtained. Since the detection frame is a regular rectangular parallelepiped, only two point coordinates are needed to determine the human body detection frame. Therefore, the vertex coordinates are marked as [x1, y1, x2, y2], where [x1, y1] represents the coordinates of the upper left corner of the human body detection frame, and [x2, y2] represents the coordinates of the lower right corner of the human body detection frame. Next, since we need to detect the helmet, that is, the position of the human head, we calculate each coordinate point one by one based on the relative position of the head and the human body, combined with the initial vertex coordinates [x1, y1, x2, y2]. That is, since the head is above the human body, we need to adjust the coordinates of the lower right corner of the human body detection frame and move the coordinates of the lower right corner upward by a distance of r1_bottom. Therefore, we need to move y2. Since y2 needs to move up along the y coordinate, the range of r1_bottom is between -1 and 0, that is, -1<r1_bottom<0. Assuming that the original height of the human body detection frame is h, y2 after the move is recorded as y2_r1, then y2_r1=y2+(h×r1_bottom). The final vertex coordinates of the target object human body are [x1, y1, x2, y2_r1].
[0066] Next, in step S23, the target detection frame of each target object is determined based on the vertex coordinates of the object to be identified obtained in step S22.
[0067] For example, in the above example, the vertex coordinates of the object to be identified are [x1, y1, x2, y2_r1]. Since the target detection box is a regular rectangular parallelepiped, the target detection box of the object to be identified can be determined based on the coordinates of the upper left corner [x1, y1] and the coordinates of the lower right corner [x2, y2_r2].
[0068] In addition, in steps S22-S23, each object to be identified corresponds to a target detection frame. That is, if the image to be identified has multiple objects to be identified, the vertex coordinates of the same number of objects to be identified will be determined in step S22. Then, based on the vertex coordinates of the objects to be identified, the same number of target detection frames will be determined in step S23.
[0069] It should be noted that in this embodiment, the original detection frame is not used directly. Instead, target detection frames are generated one by one based on the specific objects to be recognized and the initial vertex coordinates. During the generation process, the vertex coordinates are expanded according to the specific objects to be recognized to prevent the final target detection frame from not encompassing all the objects to be recognized. This effectively ensures the accuracy and completeness of subsequent target image recognition.
[0070] In one embodiment, step S40, i.e., determining a target recognition result based on the headwear attribute recognition result and the cyclist attribute recognition result, wherein the headwear attribute recognition result includes multiple headwear categories and category probabilities, and the cyclist attribute recognition result includes multiple cyclist categories and category probabilities, may specifically include the following steps:
[0071] S41: Calculating a target probability of a desired headwear category in the headwear attribute recognition result, and calculating a target probability of a desired cyclist category in the cyclist attribute recognition result.
[0072] S42: All the target probabilities are integrated to determine the target recognition result.
[0073] First, in step S30, the attribute recognition network identifies target attributes of the object to be identified within each target detection frame. These target attributes include headwear attributes and vehicle attributes. These target attributes also include, but are not limited to, whether the object to be identified contains the expected object name, expected object category, expected object color, whether the object to be identified contains the expected object, and whether the expected object to be identified is correctly carried. In the scenario of determining whether a non-motorized vehicle rider is wearing a helmet, the headwear attribute recognition results include, but are not limited to, multiple headwear categories and category probabilities, and the vehicle attribute recognition results include, but are not limited to, multiple vehicle categories and category probabilities. For example, if the object to be identified is a living creature, the attribute recognition results may include, for example, whether the creature has wings, the probability of the creature having wings, and the probability of the creature not having wings.
[0074] Next, in step S41, the target probability of the expected category in the attribute recognition results is calculated. This target probability includes, but is not limited to, the proportion of the number of the expected category in the entire target attribute, the predicted probability of the expected category, etc. Specifically, in the scenario of determining whether a non-motor vehicle rider is wearing a helmet, the target probability of the expected headwear category appearing in the headwear attribute recognition results is calculated, and the target probability of the expected riding object category appearing in the riding object attribute recognition results is calculated. For example, if the object to be identified is a living thing, the target attributes in the attribute recognition results include fish, mammals, etc., and the expected category is fish, then the target probability of fish in the target attribute is calculated.
[0075] Finally, in step S42, all target probabilities are fused to obtain the target recognition result for the image to be identified. Fusion of all target probabilities refers to a comprehensive consideration of all target probabilities. Fusion methods include, but are not limited to, summing all target probabilities or multiplying all target probabilities. For example, if the goal is to identify whether a fish is in a glass tank, the probability of a glass tank appearing in the first target attribute and the probability of a fish appearing in the second target attribute are combined to comprehensively determine whether the fish is in a glass tank.
[0076] Specifically, in the scenario of judging whether non-motor vehicle riders are wearing helmets, there are two target objects: human bodies and riding objects. By identifying the target detection frame, the target attributes of the target objects are obtained. That is, the human body object determines what items the human body wears on its head, such as whether the person wears a cotton hat, a helmet, or does not wear anything on his head. The riding object object determines what type of vehicle the riding object is, such as whether the vehicle is a motorcycle, an electric car, a bicycle, a tricycle, etc. Since it is necessary to identify non-motor vehicle riders who are not wearing helmets, the expected object in the target attribute of the human body object refers to an object that is not wearing a helmet, that is, the expected object includes situations such as wearing a cotton hat, not wearing items, etc. The specified object in the target attribute of the riding object object refers to a non-motor vehicle that needs to wear a helmet, that is, the expected object includes electric cars, motorcycles, etc. Next, the target probability of the expected object appearing is calculated, and then the target recognition result of the image to be identified is obtained, that is, the target probability of the target attribute of the human body object is Q HeadWear , that is, the probability of the target not wearing a helmet is Q HeadWear , and the target probability of the target attribute of the vehicle object is P Riding , that is, the target probability of non-motor vehicles requiring helmets is P Riding Therefore, the target recognition result of the final image is the result of comprehensively considering the two target probabilities.
[0077] It should be noted that in this embodiment, different target probabilities are integrated to arrive at a comprehensive target recognition result. This prevents anomalies in the attribute recognition of a particular object or in the calculation of a particular target probability, which could result in an inability to arrive at a target recognition result. This effectively improves the fault tolerance and recall rate of image recognition, ensuring the stability of the target image recognition process.
[0078] In one embodiment, step 41, i.e., calculating the target probability of the expected headwear category appearing in the headwear attribute recognition result, may specifically include the following steps:
[0079] S421: Filtering the headwear attribute recognition results to find the headwear category that meets the expectation, and obtaining the target headwear category.
[0080] S422: Obtaining a target probability of the target headwear category according to the category probability of the target headwear category in the headwear attribute recognition result.
[0081] First, within the attribute recognition network, each target attribute is classified to produce an attribute recognition result. Specifically, the attributes of the headwear and the cyclist are classified separately. Target attribute classification criteria include, but are not limited to, color, size, object type, object purpose, and method of carrying the object. Next, based on the classification results, a class probability is calculated for each category. This class probability includes, but is not limited to, the proportion of the category in the overall target attributes and the predicted probability of occurrence of the category. For example, if the target object is an animal and the target attribute is whether the animal breathes water, the target attributes are classified into categories such as fish, amphibians, whales, and birds. The calculated class probabilities for fish are 0.85, amphibians are 0.05, whales are 0.01, and birds are 0.1. Furthermore, methods for classifying target attributes include, but are not limited to, various classification algorithms using neural networks, or classification based on the target object's attributes using programs or manual methods.
[0082] Next, in step S421, the categories are filtered based on the categories and category probabilities in the attribute recognition results to obtain the target attribute category. For example, in the above example, since the target attribute needs to determine whether the current creature breathes water, the target categories to be filtered out are fish, amphibians, and whales.
[0083] Finally, after the target attribute category is obtained in step S421, the target probability of the target category in step S422 is obtained based on the category probability of the target attribute category, that is, the target probability of the target headwear category. Here, the method of obtaining the target probability based on the category probability of the target attribute category includes but is not limited to adding or multiplying the category probabilities of all target attribute categories, comprehensively considering the category probabilities of all target attribute categories and then deriving the target probability, etc. For example, to determine whether the current creature is in a fish tank, there are two target objects: the creature and the object in which the creature is located. The target attributes are set to underwater creatures and water tanks. The underwater creature category includes fish and whales, and the water tank category includes glass tanks and ceramic tanks. Assuming that the category probability of fish is A, the category probability of whales is B, the glass tank is C, and the ceramic tank is D, then the final target probability of underwater creatures can be (A+B), and the target probability of water tanks can be (C+D).
[0084] Specifically, in the scenario of determining whether a non-motorized vehicle rider is wearing a helmet, the target objects are the human body and the riding object, and the target attributes obtained are the headwear attributes and the riding attributes. Classifying the two, the following results are obtained:
[0085] Headwear attributes
[0086] Since it is necessary to identify non-motor vehicle riders who are not wearing helmets, the attributes expected to be identified are those who are not wearing helmets and those who are riding non-motor vehicles wearing helmets. Therefore, in the headwear attribute, the target attribute categories are no headwear and wearing hats, while in the riding attribute, the target attribute categories are riding electric bikes and riding motorcycles. Among them, the probability of the category of no headwear in the headwear attribute is q no , the probability of wearing a hat is q hat , the probability of riding an electric bike in the riding attribute is p bike , the probability of riding a motorcycle is p motor , therefore, the target probability of riding a non-motor vehicle that requires wearing a helmet can be (p bike +p motor ), and the probability of the target not wearing a helmet can be (q no +q hat ).
[0087] It should be noted that, in this embodiment, the target probability is derived by induction based on the category probability of the target attribute category, which can effectively prevent the recognition error of the target object and the inability to derive the target probability, thereby causing image recognition failure, and effectively improve the fault tolerance and recall rate of image recognition.
[0088] In one embodiment, step S42, i.e., fusing all the target probabilities to determine the target recognition result, may specifically include the following steps:
[0089] S431: Fusing all the target probabilities to obtain a comprehensive probability value of the target image.
[0090] S432: Compare the expected probability value with the comprehensive probability value.
[0091] S433: If the comprehensive probability value is greater than the expected probability value, it is determined that the target image has the expected headwear category and riding object category, so as to obtain the target recognition result.
[0092] First, in step S431, all target probabilities are integrated to obtain the overall comprehensive probability value of the target image. The comprehensive probability value refers to the summary of the target probabilities of all target objects, including but not limited to adding or multiplying all target objects, using other means to comprehensively analyze the target probabilities, etc. For example, in the above example of steps S421-S423, the target probability of non-motor vehicles that require wearing helmets for riding is (p bike +p motor ), the probability of the target not wearing a helmet is (q no +q hat ), then the final comprehensive probability value p of the image to be identified can be p=(p bike +pmotor )×(q no +q hat ).
[0093] Then, in steps S432-S433, an expected probability value is set, and the comprehensive probability value obtained in step S431 is compared with the expected value to determine the recognition result of the image. In the scenario of whether a non-motor vehicle rider wears a helmet, if the comprehensive probability value is greater than the expected probability value, it is determined that the target image has the expected headwear category: no helmet and the riding object category: the riding object is a non-motor vehicle, thereby obtaining the target recognition result. For example, in the example of step S431, the comprehensive probability value of the final image to be identified is p, and the expected probability value is set to 0.5 according to actual business needs. It is then determined whether p is greater than 0.5 or 0.5. If p is greater than 0.5, the image recognition result is that the non-motor vehicle rider who needs to wear a helmet is not wearing a helmet.
[0094] It should be noted that in this embodiment, the image recognition result is derived based on a comparison of a pre-set expected probability value with the comprehensive probability value. This method of setting the expected probability and comparing it with the comprehensive probability value to derive the image recognition result makes the entire image recognition method applicable to a variety of different scenarios, with good scalability and practical value.
[0095] In one embodiment, in step S30, i.e., the headwear attribute recognition network and the bicycle attribute recognition network, the attribute recognition network training method specifically includes the following steps:
[0096] S51: Setting the actual category of each target attribute.
[0097] S52: Calculate the actual probability of each target attribute according to the actual category.
[0098] S53: Obtaining an actual probability value of the image by fusing each actual probability.
[0099] S54: Calculate the loss value between the image comprehensive probability value and the actual probability value.
[0100] S55: Determine whether the loss value is within the expected loss range.
[0101] S56: If the loss value is within the expected loss range, the comprehensive probability value is consistent with the expected loss.
[0102] S57: If the loss value is not within the expected loss range, reclassify each of the target attributes and re-derive the comprehensive probability value of the image until the comprehensive probability value meets the expected loss.
[0103] First, set the actual category for each target attribute. For example, if the target attributes are headwear and riding, then set the actual category for riding to electric bikes, motorcycles, self-balancing scooters, and scooters, while the actual category for headwear is helmet, hat, or nothing. The classification method here is consistent with the classification method in step S421.
[0104] Next, the actual probability of each target attribute is calculated according to the actual category. The calculation method here is consistent with the method of calculating the target probability in step 423.
[0105] Then, each actual probability is fused to obtain an actual probability value. The method for obtaining the actual probability is consistent with the fusion method in step S432.
[0106] Next, the loss value between the comprehensive probability value of the image to be recognized and the actual probability value is calculated. Methods for calculating the loss value include, but are not limited to, using a loss function to calculate the loss value between the two, using the loss value as the loss value, or subtracting the two and using the difference as the loss value. Furthermore, loss functions for the loss value include, but are not limited to, cross entropy loss function and squared error loss.
[0107] Finally, an expected range is set and the loss value calculated in step S54 is determined to be within the expected range. If the loss value is within the expected range, the comprehensive probability value obtained in step S431 meets expectations and can be used for comparison in step S432. If the loss value is not within the expected range, the comprehensive probability value does not meet expectations and each target attribute needs to be reclassified and the comprehensive probability of the image to be identified needs to be recalculated until the loss value is within the expected range.
[0108] Specifically, in the scenario of identifying non-motorized vehicle riders without helmets, if the calculated composite probability value for the image to be identified is 0.846, and each target attribute is classified in steps S51-S53, the actual probability value is 0.981. The cross-entropy loss function is used to calculate the loss value, which is 0.135. Given the expected loss range of less than 0.1, this composite probability does not meet the expected loss, and each target attribute needs to be classified.
[0109] It should be noted that in this embodiment, a loss value is calculated to prevent the calculated comprehensive probability value from being too large, which could lead to abnormalities in the final image recognition results. Using the loss value to monitor the calculation results effectively improves the accuracy of image recognition. Furthermore, if the calculated loss value is too large, the calculation process is readjusted, and the comprehensive probability value is recalculated until the loss value meets the expected standard. This process is completed entirely automatically by the machine, effectively improving the accuracy and efficiency of image recognition while also saving labor costs.
[0110] In one embodiment, the process of calculating the loss value can also be performed according to step S71: based on the actual category, the actual category probability of each actual category in the target attribute is calculated one by one, and then based on each actual category probability of the expected category in each target attribute and each category probability calculated in step S421, a loss value for each expected category is obtained. All category loss values are combined to obtain the loss value of the image to be identified. The method for calculating the loss value can be the same as the calculation method of step S54, or other methods for calculating the loss value can be selected, which are not limited here.
[0111] In another embodiment, the process of calculating the loss value can also be performed according to step S81: based on the actual category, the actual target probability of the expected category in each target attribute is calculated, and then based on the actual target probability of the expected category in each target attribute and the target probability calculated in step S42, the expected category loss value of each expected category is obtained. All expected category loss values are combined to obtain the loss value of the recognized image. The method for calculating the loss value can be consistent with the calculation method of step S54, or other methods for calculating the loss value can be selected, which are not limited here.
[0112] In one embodiment, after step 55, that is, if the loss value is not within the expected loss range, the image recognition method may further include the following steps:
[0113] S61: Accumulate the cumulative number of occurrences of the minimum loss value.
[0114] S62: If the accumulated number of times reaches the expected number of times, it is determined that the comprehensive probability value corresponding to the loss value meets the expected loss.
[0115] First, in step S61, the number of occurrences of the minimum loss value is accumulated to obtain the cumulative number of minimum loss values. For example, if the loss values obtained each time are 0.3, 0.2, and 0.4, respectively, but the expected loss range is greater than 0.3, then it is necessary to reclassify and calculate the comprehensive probability value. Before reclassifying each target attribute, it is necessary to first accumulate the minimum loss value. That is, if the loss value of 0.2 occurs once, then, if the new comprehensive probability value obtained after reclassification still has a loss value of 0.2, then the cumulative minimum loss value is 0.2, and the minimum loss value has occurred twice.
[0116] Next, set the expected number of times the minimum loss value occurs. If the cumulative number of minimum loss values reaches the expected number, it can be considered that the minimum loss value is within the expected loss range, that is, the comprehensive probability value corresponding to the loss value is within the expected loss range.
[0117] Specifically, in any scenario, the calculated results of the loss value are 0.28, 0.2, and 0.19, respectively, while the expected range is less than 0.1, and the expected number of times is 10. The current minimum loss value is 0.19, and the cumulative number of occurrences of the minimum loss value is counted as 1. Then, the next calculation of the loss value is still 0.19, so count is 2. Then, when the next calculation of the loss value is 0.18, the minimum loss value is recorded as 0.18, and the cumulative number of occurrences of the minimum loss value is counted and becomes 1 again. The loss value is continuously recalculated, and it is found that its minimum loss value is always 0.18, until the cumulative result of 10 calculations of the loss value is 0.18, that is, count is equal to 10. Then, it is considered that 0.18 is in line with the expected loss range, that is, the comprehensive probability value corresponding to 0.18 is in line with the expected loss, and this comprehensive probability value can be used in subsequent judgments on the image to be recognized.
[0118] It should be noted that in this embodiment, the cumulative number of occurrences of the minimum loss value is required to prevent the pre-set expected loss range from being unreasonable, resulting in the loss value being unable to decrease further during the actual calculation process, causing program operation abnormalities and consuming excessive and ineffective computing time and costs. By monitoring the number of occurrences of the minimum loss value, when it reaches the expected number, it means that the loss value can no longer decrease. At this point, the comprehensive probability value corresponding to the current loss value should be determined to be consistent with the expected value. This effectively ensures the stability and rationality of the overall image recognition method.
[0119] In one embodiment, step S57, i.e., reclassifying each target attribute, may specifically include the following steps:
[0120] S571: Adjust the category weight of each target attribute based on the loss value.
[0121] In step S571, after each calculation of the loss value of the comprehensive probability value, each target attribute needs to be reclassified. In one embodiment, different category weights can be assigned to the categories of each target attribute based on the calculated loss value, and the target probability of each target attribute can be calculated based on the different weights to obtain a comprehensive probability value.
[0122] Specifically, after step S71, i.e., calculating the loss value for each expected category, the image recognition method further includes weighting each category within each expected category based on the loss value for each expected category, thereby determining a comprehensive probability after adjusting the loss. Based on the newly determined comprehensive probability, the loss value is recalculated, and then the new loss value is determined, i.e., step S55.
[0123] Similarly, after step S81, i.e., after calculating the expected category loss value for each expected category, the image recognition method further includes weighting each expected category based on the expected category loss value, thereby determining a comprehensive probability after adjusting the loss. Based on the newly determined comprehensive probability, the loss value is recalculated, and then the new loss value is determined, i.e., step S55.
[0124] It should be noted that, in this embodiment, the categories of the target attributes are re-weighted according to the calculated loss values, thereby obtaining a more reasonable comprehensive probability value, making subsequent image recognition operations more accurate and reasonable.
[0125] Corresponding to the image recognition method in the above embodiment, FIG4 shows a block diagram of the image recognition apparatus provided by the present invention. The image recognition apparatus is applied to a processing end, and a computer device corresponding to the processing end is connected to an acquisition end to obtain images to be recognized containing multiple different target objects. For ease of illustration, only the portions relevant to the embodiment of the present invention are shown.
[0126] Referring to FIG4 , the image recognition device includes a detection module, an adjustment module, and a result module. The functional modules are described in detail as follows:
[0127] a detection module, configured to detect a target image containing a plurality of different objects, and obtain an original detection frame of one of the objects, wherein the different objects include a human object and a cycling object;
[0128] an adjustment module, configured to determine a riding object detection frame based on the original detection frame, and determine a head detection frame based on the original detection frame;
[0129] a recognition module, configured to input the target image including the head detection frame into a headwear attribute recognition network to obtain a headwear attribute recognition result, and input the target image including the cyclist detection frame into a cyclist attribute recognition network to obtain a cyclist attribute recognition result;
[0130] The result module is used to determine a target recognition result according to the headwear attribute recognition result and the riding object attribute recognition result.
[0131] It should be noted that the information interaction, execution process, etc. between the above modules, units, and sub-units are based on the same concept as the embodiment of the method of the present invention. Their specific functions and technical effects can be found in the method embodiment section and will not be repeated here. The various modules in the above-mentioned image recognition device can be implemented in whole or in part by software, hardware, and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0132] Figure 5 is a schematic diagram of the structure of a computer device provided by the present invention. As shown in Figure 5, the computer device of this embodiment includes: at least one processor (only one is shown in Figure 5), a memory, and a computer program stored in the memory and executable by the at least one processor. When the processor executes the computer program, the steps of any of the above-mentioned image recognition method embodiments are implemented.
[0133] The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that FIG5 is merely an example of a computer device and does not limit the computer device. The computer device may include more or fewer components than shown, or a combination of certain components, or different components. For example, it may also include a network interface, a display screen, and an input device.
[0134] The processor may be a CPU, other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, or any conventional processor, etc.
[0135] The memory includes a readable storage medium, an internal memory, etc., wherein the internal memory can be the memory of a computer device, and the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the readable storage medium. The readable storage medium can be the hard disk of the computer device, and in other embodiments, it can also be an external storage device of the computer device, for example, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device. Furthermore, the memory can also include both the internal storage unit of the computer device and the external storage device. The memory is used to store the operating system, application programs, boot loaders (BootLoader), data, and other programs, such as the program code of the computer program. The memory can also be used to temporarily store data that has been output or is about to be output.
[0136] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other and are not used to limit the scope of protection of the present invention. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, it can implement the steps of the above-mentioned method embodiment. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include at least: any entity or device capable of carrying computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0137] The present invention may implement all or part of the processes in the above-mentioned method embodiments, and may also be completed through a computer program product. When the computer program product runs on a computer device, the computer device can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0138] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0139] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0140] In the embodiments provided by the present invention, it should be understood that the disclosed apparatus / computer equipment and methods can be implemented in other ways. For example, the apparatus / computer equipment embodiments described above are merely illustrative. For example, the division of modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0141] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0142] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.
Claims
1. A method for image recognition, characterized in that: The method comprises: Detecting a target image containing a plurality of different objects and obtaining an original detection frame of one of the objects, wherein the different objects include a human object and a cycling object; Determining a riding object detection frame according to the original detection frame, and determining a head detection frame according to the original detection frame; Inputting the target image including the head detection frame into a headwear attribute recognition network to obtain a headwear attribute recognition result, and inputting the target image including the cyclist detection frame into a cyclist attribute recognition network to obtain a cyclist attribute recognition result; A target recognition result is determined according to the headwear attribute recognition result and the riding object attribute recognition result.
2. The method for image recognition according to claim 1, characterized in that: The detecting includes a target image of multiple different objects, and obtaining an original detection frame of one of the objects, including: Detect a human object in the target image, determine a human detection frame, and use the human detection frame as the original detection frame.
3. The image recognition method according to claim 1, characterized in that: The step of determining a head detection frame according to the original detection frame includes: Determining initial vertex coordinates of the original detection frame; Determine the vertex coordinates of the human head according to the position of the human head relative to the original detection frame and in combination with the initial vertex coordinates; A head detection frame of the human head is constructed according to the vertex coordinates of the human head.
4. The image recognition method according to claim 1, characterized in that: The determining a riding object detection frame according to the original detection frame includes: Determining initial vertex coordinates of the original detection frame; Determining the vertex coordinates of the cycling object according to the position of the cycling object relative to the original detection frame and in combination with the initial vertex coordinates; A riding object detection frame of the riding object is constructed according to the vertex coordinates of the riding object.
5. The image recognition method according to claim 1, characterized in that: The headwear attribute recognition result includes a plurality of headwear categories and category probabilities, the riding object attribute recognition result includes a plurality of riding object categories and category probabilities, and determining the target recognition result according to the headwear attribute recognition result and the riding object attribute recognition result includes: Calculating the target probability of the desired headwear category in the headwear attribute recognition result, and calculating the target probability of the desired riding object category in the riding object attribute recognition result; All the target probabilities are combined to determine the target recognition result.
6. The image recognition method according to claim 5, characterized in that: The calculating the target probability of the expected headwear category appearing in the headwear attribute recognition result includes: Filtering the headwear category that meets the expected headwear category in the headwear attribute recognition result to obtain the target headwear category; According to the category probability of the target headwear category in the headwear attribute recognition result, the target probability of the target headwear category is obtained.
7. The image recognition method according to claim 5, characterized in that: The fusing of all the target probabilities to determine the target recognition result includes: Fusion of all the target probabilities to obtain a comprehensive probability value of the target image; comparing the expected probability value with the comprehensive probability value; If the comprehensive probability value is greater than the expected probability value, it is determined that the target image has a headwear category and a riding object category that meet the expectations, so as to obtain the target recognition result.
8. An image recognition device, characterized in that: The device comprises: A detection module, used to detect a target image containing a plurality of different objects and obtain an original detection frame of one of the objects, wherein the different objects include a human object and a cycling object; an adjustment module, configured to determine a riding object detection frame according to the original detection frame, and determine a head detection frame according to the original detection frame; a recognition module, configured to input the target image including the head detection frame into a headwear attribute recognition network to obtain a headwear attribute recognition result, and input the target image including the riding object detection frame into a riding object attribute recognition network to obtain a riding object attribute recognition result; The result module is used to determine the target recognition result according to the headwear attribute recognition result and the riding object attribute recognition result.
9. A computer device, characterized in that: The computer device comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor implements the image recognition method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the image recognition method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Safety helmet wearing detection method and system based on improved YOLOV3
CN113255826A
Warning method and related equipment
CN113392735A
Method for detecting behavior of rider without wearing helmet based on multi-task deep learning
CN113887343A
Decompositional learning for color attribute prediction
US20220383031A1
Cited By
Moving target data analysis method and system based on field environment and storage medium
CN121034091A