An image detection method, device and electronic device
By detecting the target object in the characteristic area of the target object, combining the intersection and union ratio and feature information, the missed detection problem caused by too small target objects is solved, and the accuracy of target behavior detection is improved.
Patent Information
- Application Number
- CN202111628335.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2041-12-27
AI Technical Summary
The existing target behavior detection methods are prone to missed detection due to too small target objects, especially for small objects such as smoke, lollipops, etc., resulting in low detection accuracy.
By acquiring the image to be detected, the first feature area and the second feature area in the target object are determined, and the target object detection is performed in these areas. The target behavior of the target object is determined from the preset behavior table based on the type of the target object, and the detection accuracy is improved by using the intersection and union ratio and feature information.
It effectively prevents missed detection caused by too small target objects, and improves the accuracy and reliability of target behavior detection.
Smart Images

Figure CN114332929B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to an image detection method, apparatus and electronic device. Background Art
[0002] The existing target behavior detection uses an image detection method. First, a target image is collected. Secondly, single feature detection is performed on the target object in the target image. Then, according to whether the target object exists, it is determined whether the target object has a target behavior, so as to complete the detection and determination of the target behavior. However, in the actual process of target behavior detection, the target object to be detected may be small objects such as smoke or lollipops, and often be ignored and missed due to too small pixels, resulting in low detection accuracy of the target behavior. Summary of the Invention
[0003] In view of this, embodiments of the present invention provide an image detection method, apparatus and electronic device to solve the problem of being ignored and missed due to too small target detection object when detecting target behavior.
[0004] In a first aspect, an embodiment of the present invention provides an image detection method, including:
[0005] Obtaining an image to be detected; determining a target object in the image to be detected; determining a first feature region and a second feature region in the target object; detecting a target object in the first feature region and / or the second feature region; and determining a target behavior of the target object according to the type of the target object.
[0006] The image detection method provided in this embodiment obtains an image to be detected, determines a target object from the image to be detected, then determines a first feature region and a second feature region from the target object, then performs target object detection on the first feature region and the second feature region, and finally determines the target behavior of the target object according to the type of the detected target object. By gradually narrowing the detection range of the target object to be detected, then detecting the target object from the detection region of the target object, and determining the target behavior of the target object according to the type of the target object, it is possible to prevent missed detection caused by too small target objects and further improve the accuracy of target behavior detection.
[0007] Optionally, determining the target behavior of the target object according to the type of the target object includes: detecting whether there is a target object in the first feature region; if there is no target object in the first feature region, detecting whether there is the target object in the second feature region; if there is a target object in the second feature region, obtaining the ratio of the intersection to the union of the first feature region and the second feature region; if the ratio is greater than or equal to a preset threshold, determining the target behavior of the target object from a preset behavior table based on the type of the target object.
[0008] Optionally, it further includes: if the ratio is less than the preset threshold, determining the target behavior of the target object according to the feature information of the target object in the second feature region.
[0009] The image detection method provided in this embodiment realizes rapid detection of the target object by performing target object detection on the first feature region and the second feature region; prevents the occurrence of missed detection by judging the region where the target object is located through a preset threshold; and quickly completes the recognition of the target behavior of the target object through the preset behavior table of the target object and the feature information of the target object in the second feature region.
[0010] Optionally, determining the target object in the image to be detected includes:
[0011] Determining the target region where the target object is located in the image to be detected; adjusting the size of the target region according to a preset region range threshold; extracting the target image corresponding to the adjusted target region.
[0012] The image detection method provided in this embodiment adjusts the size of the target region by setting a preset region range threshold to facilitate rapid recognition of the target object. Secondly, to prevent the selection range from being too small to completely extract the target region where the target object is located. Therefore, it is necessary to set the selection range of the target image through the preset region range threshold to obtain a more reasonable target region where the target object is located, which is beneficial to the subsequent extraction of the target behavior.
[0013] Optionally, determining the first feature region and the second feature region in the target object includes: inputting the target image into a feature extraction model so that the feature extraction model extracts features of the target object in the target image; obtaining the first feature region and the second feature region with identifiers set from the feature extraction model.
[0014] The image detection method provided in this embodiment improves the accuracy of target behavior detection by obtaining the first feature region and the second feature region with identifiers set from the feature extraction model.
[0015] Optionally, before detecting the target object in the first feature region and / or the second feature region, the method further includes: obtaining a first feature value in the first feature region and a second feature value in the second feature region; respectively performing non-linear mapping on the first feature value and the second feature value to obtain a first feature mapping value and a second feature mapping value; performing feature reconstruction on the first feature value according to the first feature mapping value to obtain a first target feature value, and performing feature reconstruction on the second feature value according to the second feature mapping value to obtain a second target feature value; adjusting the position of the first feature region according to the first target feature value, and adjusting the position of the second feature region according to the second target feature value.
[0016] The image detection method provided in this embodiment obtains the first feature value and the second feature value in the first feature region and the second feature region; respectively performs non-linear mapping based on the first feature value and the second feature value, and outputs the first feature mapping value and the second feature mapping value; respectively performs feature reconstruction according to the first feature mapping value and the second feature mapping value, and outputs the first feature value and the second feature value after feature reconstruction. Then, the first feature region and the second feature region corresponding to the first feature value and the second feature value after feature reconstruction are obtained, thereby improving the resolution of the first feature region and the second feature region, reducing the missed detection caused by the too small target object, and further improving the accuracy of target behavior detection.
[0017] Optionally, detecting the target object in the first feature region and / or the second feature region includes: extracting a first preset feature from the first feature region and / or the second feature region; performing sub-pixel convolution on the first preset feature to obtain a second preset feature; extracting the target feature of the target object in the first feature region and / or the second feature region; if the target feature matches the second preset feature, determining the position of the target object in the first feature region and / or the second feature region.
[0018] The image detection method provided in this embodiment extracts the first preset feature from the first feature region and the second feature region; performs sub-pixel convolution on the first preset extracted feature to obtain a second preset feature; extracts the target feature of the target object in the first feature region and / or the second feature region, and matches the target feature with the preset second feature, so as to reduce the missed detection caused by the too small target object and further improve the accuracy of target behavior detection.
[0019] In a second aspect, an embodiment of the present invention provides an image detection device, which includes: an acquisition module for acquiring an image to be detected; a first determination module for determining a target object in the image to be detected; a second determination module for determining a first feature region and a second feature region in the target object; a detection module for detecting a target object in the first feature region and / or the second feature region; and a third determination module for determining a target behavior of the target object according to the type of the target object.
[0020] For the image detection device provided in this embodiment, the acquisition module outputs the image to be detected, sends the image to be detected to the first determination module, the first determination module determines the target object in the image to be detected, and then sends the target object in the image to be detected to the second determination module to determine the first feature region and the second feature region in the target object. Then, the first feature region and the second feature region in the target object are sent to the detection module for target detection to obtain the target object in the first feature region and / or the second feature region, and the target object in the first feature region and / or the second feature region is sent to the third determination module, and the type of the target object is used to determine the target behavior of the target object, thereby reducing missed detection caused by the target object being too small and further improving the accuracy of target behavior detection.
[0021] In a third aspect, an embodiment of the present invention provides an electronic device, including: a memory and a processor, where a computer program is stored in the memory, and the computer program is executed by the processor to perform the image detection method described in the first aspect or any one of the embodiments of the first aspect.
[0022] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processor to perform the image detection method described in the first aspect or any one of the embodiments of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The features and advantages of the present invention will be more clearly understood by referring to the accompanying drawings. The drawings are schematic and should not be construed as limiting the present invention in any way. In the drawings:
[0024] Figure 1 It is a schematic diagram of the scenario when the image detection method provided by the embodiment of the present invention is performed;
[0025] Figure 2 It is a flowchart of the image detection method provided by the embodiment of the present invention;
[0026] Figure 3 It is a flowchart of steps S51 to S55 in the image detection method provided by the embodiment of the present invention;
[0027] Figure 4 It is a flowchart of step S2 in the image detection method provided by an embodiment of the present invention;
[0028] Figure 5 It is an identifier in the first feature region and the second feature region in the image detection method provided by an embodiment of the present invention;
[0029] Figure 6 It is a flowchart of steps S101 to S103 in the image detection method provided by an embodiment of the present invention;
[0030] Figure 7 It is a flowchart of step S4 in the image detection method provided by an embodiment of the present invention;
[0031] Figure 8 It is a schematic diagram of the execution process of the image detection method provided by an embodiment of the present invention;
[0032] Figure 9 It is a schematic structural diagram of the image detection device provided by an embodiment of the present invention;
[0033] Figure 10 It is a schematic structural diagram of the electronic device provided by an embodiment of the present invention.
[0034] Reference numerals
[0035] 1 - Acquisition module; 2 - First detection module; 3 - Determination module; 4 - Second detection module; 5 - Third determination module; 6 - Processor; 7 - Memory. Detailed implementation manners
[0036] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0037] It should be noted that an image detection method provided by an embodiment of the present invention is applicable to detecting target objects that can be humans or animals. By detecting whether there are target objects (such as small objects like smoke, fruits, lollipops, etc.) in specific regions of the target objects, corresponding action behaviors (such as smoking, eating food) are determined according to the types of the corresponding target objects.
[0038] Please refer to Figure 1 , Figure 1It is a schematic diagram of the scenario of the image detection method provided by an embodiment of the present invention. Specifically, the hardware device for executing the image detection method may include: a camera and a host. Among them, the camera is connected to the host. The camera captures the monitoring video of the target behavior performed by the target object. The host obtains the monitoring video captured by the camera, splits the frame of the monitoring video, and then the host performs target behavior detection and analysis on the frame of the monitoring video, determines the target behavior from the frame of the monitoring video, and stores the frame of the monitoring video in which the target behavior is determined.
[0039] Please refer to Figure 2 , Figure 2 It is a flowchart of an image detection method provided by an embodiment of the present invention. This image detection method can be applicable to detecting the target actions / behaviors (such as: actions like smoking, eating lollipops, etc.) performed by the target object. Specifically, the image detection method provided in this embodiment includes:
[0040] S1, Obtain the image to be detected.
[0041] In this embodiment, the image to be detected can be a single image frame captured by a camera device, or a video segment within a preset time. Then, the video segment is disassembled into single-frame images to be detected using video software. In order to accurately detect the target behavior, in this embodiment, it is necessary to perform frame-by-frame detection on the captured video to improve the accuracy of target behavior detection.
[0042] S2, Determine the target object in the image to be detected.
[0043] In this embodiment, since there may be multiple target objects in the image to be detected, in order to quickly determine the target behavior of the target object, it is necessary to extract the target object from the image to be detected, reduce the interference pixels, and narrow the detection range of the target object, so as to accurately identify the target object, and determine the target behavior of the target object according to the type of the identified target object. It should be noted that the target object can be a person or an animal, and the detected person or animal includes the complete body posture of the person or animal, such as: the head or limbs of the person or animal.
[0044] S3, Determine the first feature region and the second feature region in the target object.
[0045] In this embodiment, the first feature region and the second feature region can be feature regions preset by the user according to needs, or preset target feature region ranges. Among them, the first feature region and the second feature region are different feature regions, but in order to ensure accuracy, the first feature region and the second feature region can also be feature regions for detecting the same feature. Further, in order to narrow the detection range, after obtaining the target object, it is necessary to extract the first feature region and the second feature region of the target object.
[0046] Among them, the first feature area and the second feature area can be facial features or limb features of a person or an object. For example, when determining the smoking behavior of a specified person, it is necessary to obtain the mouth feature and hand feature of the specified person, and determine the smoking behavior of the specified person by judging whether the target object, i.e., smoke, exists in the mouth feature and hand feature of the specified person. Another example: when detecting the behavior of holding a knife, the first feature area can be the left hand feature, and the second feature area can be the right hand feature.
[0047] In order to quickly detect the target behavior and prevent the occurrence of missed detections, in this embodiment, two feature areas are detected to reduce the occurrence of missed detections or false detections.
[0048] S4. Detect the target object in the first feature area and / or the second feature area.
[0049] S5. Determine the target behavior of the target object according to the type of the target object.
[0050] In this embodiment, after obtaining the first feature area and the second feature area, small object detection can be performed on the first feature area and the second feature area to obtain the target object, where the target object is a specific physical object, such as smoke, a ball, a lollipop, etc.
[0051] Specifically, after determining the first feature area and the second feature area, the images corresponding to the first feature area and the second feature area are input into the target object detection model for small object detection to output the target object. Then, according to the type data of the target object, the preset behavior table stored in the host is searched to obtain the behavior actions matching the target object. After that, the corresponding behavior actions are output to determine the target behavior of the target object.
[0052] For example: when the target object detection model detects that the target object is smoke, the target behavior corresponding to the type of smoke can be searched in the preset behavior table in the host, and then a prompt indicating that the target object has a smoking behavior is output through the host or on the display device of the host. The prompt method can be to output the detected target behavior of the target object, which is smoking, through text messages or on the host screen. By performing target object detection on the first feature area and the second feature area, the target object can be quickly extracted, and then combined with the target object and the preset behavior table, the target behavior can be accurately output.
[0053] The image detection method provided in this embodiment determines a target object from a to-be-detected image by obtaining the to-be-detected image, and then determines a first feature region and a second feature region from the target object. Then, object detection is performed on the first feature region and the second feature region. Finally, the target behavior of the target object is determined according to the type of the detected target object. By gradually narrowing the detection range of the target object to be detected, and then detecting the target object from the detection region of the target object, and according to the type of the target object, it is possible to prevent missed detection caused by the target object being too small and further improve the accuracy of target behavior detection.
[0054] Optionally, in order to accurately detect the target behavior and prevent missed detection and false detection, as Figure 3 shown, the image detection method provided in this embodiment, step S5 may further include:
[0055] S51, Detect whether there is a target object in the first feature region.
[0056] S52, If there is no target object in the first feature region, then detect whether there is a target object in the second feature region.
[0057] In this embodiment, the first feature region and the second feature region can be determined from the target object, and the image corresponding to the first feature region or the second feature region is input into a preset target detection model for small object detection to determine whether there is a target object in the first feature region or the second feature region.
[0058] S53, If there is a target object in the second feature region, then obtain the ratio of the intersection to the union of the first feature region and the second feature region.
[0059] In this embodiment, there may be a situation where the first feature region and the second feature region overlap and the target object cannot be detected in the first feature region. For example: holding a cigarette in the mouth and the hand is about to pull away from the mouth. In order to solve this technical problem, it is necessary to calculate the intersection of the first feature region and the second feature region, as well as the union of the first feature region and the second feature region, and calculate the ratio of the intersection to the union (also called the intersection over union). According to this ratio, the accuracy of detecting the target object can be improved.
[0060] S54, If the ratio is greater than or equal to a preset threshold, then determine the target behavior of the target object from a preset behavior table based on the type of the target object.
[0061] S55, If the ratio is less than the preset threshold, then determine the target behavior of the target object according to the feature information of the target object in the second feature region.
[0062] In this embodiment, by detecting each target object in the feature region, the accuracy of target object detection is improved, so as to improve the accuracy of target behavior detection. And the location of the target object can be determined according to the intersection over union (IoU), and then the target object is recognized to determine the type of the target object. The target behavior of the target object is determined according to the preset behavior table and the feature information of the target object. Among them, the preset behavior table and the feature information of the target object can be a behavior database established by the user in advance. Through this behavior database, the feature information of the target object and the type of the target object can be associated with the preset target behavior, so as to quickly and accurately determine the target behavior of the target object through the feature information of the target object and the type of the target object.
[0063] Optionally, the preset threshold can be set according to the user's needs. In order to ensure the accuracy of the detection result and reduce the situation of missed detection, preferably, the preset threshold can be 0.1. The IoU formula can be:
[0064]
[0065] Among them, IOU represents the ratio of the intersection to the union of the first feature region and the second feature region; P1 represents the first feature region; P2 represents the second feature region; P1∩P2 represents the intersection of the first feature region and the second feature region; P1∪P2 represents the union of the first feature region and the second feature region.
[0066] Optionally, the preset behavior table and the behavior information associated with the feature information of the target object are stored in the host or storage device in advance. Among them, the behavior information associated in the preset behavior table can include smoking behavior. For example, when the feature information of the target object is a hand and the target object is a cigarette, the behavior information associated with the feature information of the target object is smoking behavior.
[0067] An image detection method provided by an embodiment of the present invention, as Figure 4 shown, in addition to the above steps, step S2 may include:
[0068] S21, determining the target region where the target object is located in the image to be detected.
[0069] S22, adjusting the size of the target region according to the preset region range threshold.
[0070] S23, extracting the target image corresponding to the adjusted target region.
[0071] In this embodiment, the target object can be detected and framed by a box selection tool and a target object detection model, and the image to be detected with a selection box is output. Then, the cropping tool is used to crop the image to be detected with the selection box, and only the framed target area, that is, the first feature area and the second feature area, is retained. In order to prevent missed detection and reduce the amount of computation, in this embodiment, it is necessary to determine the target object by cropping the target area to reduce the recognition error of the target behavior.
[0072] In this embodiment, in order to prevent the situation of missed detection of the target object, before image cropping, it is necessary to obtain a preset area range threshold to adjust the cropping range of the target object. Among them, the preset area range threshold can be defined by the user himself, or can be obtained by threshold iteration through a calculation model.
[0073] Optionally, when performing step S2, it may further include:
[0074] S24, input the target image into the feature extraction model so that the feature extraction model extracts features of the target object in the target image.
[0075] S25, obtain the first feature area and the second feature area with identifiers from the feature extraction model.
[0076] In this embodiment, in order to avoid missed detection of the target behavior, it is necessary to input the target image into the feature extraction model for preset feature extraction. For example, if it is necessary to detect whether a person has a smoking behavior, the existing solution only detects whether the feature of smoke exists in the mouth feature, and it may miss the situation where the person holds a cigarette in his hand. In order to reduce the occurrence of missed detection, in this embodiment, two feature areas will be obtained from the target object, and then the target object detection will be performed on the two feature areas to improve the accuracy of the target behavior detection. Optionally, as Figure 5 shown, the identifiers in the first feature area and the second feature area can be "hand" and "mouth", etc.
[0077] As Figure 6 shown, before step S4, it may include:
[0078] S101, obtain the first feature value in the first feature area and the second feature value in the second feature area.
[0079] In this embodiment, it is necessary to perform interpolation method calculation on the first feature area and the second feature area to obtain the first feature value and the second feature value; optionally, the interpolation method used can be the bicubic interpolation method.
[0080] S102, perform non-linear mapping on the first feature value and the second feature value respectively to obtain the first feature mapping value and the second feature mapping value.
[0081] In this embodiment, when performing non - linear mapping, the first eigenvalue and the second eigenvalue can be input into the filter for re - configuration. Specifically, the formula for the filter to output the feature mapping value can be:
[0082] P2 = MAX(0, W * P1 + B)
[0083] Where P2 is the feature mapping value, MAX() represents the activation function, 0 represents the initial value, W represents the weight of the activation function, B represents the bias of the activation function, and P1 represents the eigenvalue. Optionally, the feature mapping value includes the first feature mapping value and the second feature mapping value, and the eigenvalue includes the first eigenvalue and the second eigenvalue.
[0084] In this embodiment, by configuring the weight and bias in the activation function, the original eigenvalue is feature - mapped.
[0085] S103. Feature - reconstruct the first eigenvalue according to the first feature mapping value to obtain the first target eigenvalue, and feature - reconstruct the second eigenvalue according to the second feature mapping value to obtain the second target eigenvalue.
[0086] In this embodiment, feature - reconstruction is performed to accurately identify the target object, and its feature - reconstruction formula is:
[0087] Y C = W C * P2 + B C
[0088] Where Y C represents the reconstructed eigenvalue, and P2 represents the feature mapping value; W C represents the weight coefficient of feature - reconstruction, and B C represents the bias coefficient of feature - reconstruction.
[0089] In this embodiment, by obtaining the first feature region and the second feature region with low resolution, and then through non - linear mapping and feature - reconstruction, the low - resolution feature regions are converted into high - resolution feature regions to enhance the image clarity of the first feature region and the second feature region. Correspondingly, the image clarity corresponding to the feature information of the target object can also be enhanced to more quickly and accurately determine the target object in the first feature region or the second feature region.
[0090] S104. Adjust the position of the first feature region according to the first target eigenvalue, and adjust the position of the second feature region according to the second target eigenvalue.
[0091] As Figure 7 shown, step S4 may include:
[0092] S41. Extract a first preset feature from the first feature region and / or the second feature region.
[0093] In this embodiment, it is necessary to extract the first preset feature in the first feature region and the second feature region through a feature extraction model. Herein, the first preset feature can be a feature preset according to the target behavior. For example, it can be a mouth feature or a limb feature.
[0094] S42. Perform sub-pixel convolution on the first preset feature to obtain a second preset feature.
[0095] In this embodiment, the second preset feature can be the preset feature output after image scaling. In this embodiment, in order to make the frame of the picture extracted by the target object consistent with the frame of the feature region extracted, it is necessary to perform sub-pixel convolution on the preset extracted feature, so as to facilitate subsequent rapid and accurate feature extraction.
[0096] S43. Extract the target feature of the target object in the first feature region and / or the second feature region.
[0097] S44. If the target feature matches the second preset feature, determine the position of the target object in the first feature region and / or the second feature region.
[0098] In this embodiment, the target feature of the target object in the first feature region and / or the second feature region is extracted through a feature extraction model. After that, the extracted target feature is compared with the second preset feature. If the target feature matches the second preset feature, according to the mapping relationship between the second preset feature and the corresponding region, the region corresponding to the second preset feature is used as the position of the target feature in the first feature region and / or the second feature region.
[0099] Specifically, as Figure 8 shown, it is a schematic diagram of the execution process of an image detection method provided by an embodiment of the present invention. When this image detection method is applied to a grain depot intelligent management system, when it is detected that a grain depot administrator is inspecting the grain depot and there is a smoking behavior, the grain depot intelligent management system issues an alarm message to remind the grain depot administrator to stop the smoking behavior, thereby preventing a fire in the grain depot.
[0100] When detecting the smoking behavior, it is necessary to collect the mouth feature and limb feature of the grain depot administrator. The specific collection process is as follows:
[0101] The host obtains the real-time video image of the grain depot captured by the camera, and obtains a frame of the image to be detected containing the target object from it; inputs the image to be detected into the target object detection model for target object detection, and outputs the image of the detected target object, where the image of the target object includes the global image of the target object. Secondly, input the image of the target object into the feature extraction model, and extract the mouth feature and hand feature of the target object through the feature extraction model. When the feature extraction model extracts feature information, it can pre-train the feature extraction network to obtain the feature extraction model, and extract the mouth feature and hand feature through the feature extraction model. The area where the mouth feature is located is used as the mouth feature area, and the area where the hand feature is located is used as the hand feature area.
[0102] It should be noted that the clarity of the images of the mouth feature area and the hand feature area is not high, and it is necessary to improve the resolution of the images of the mouth feature area and the hand feature area. Then, input the images of the mouth feature area and the hand feature area with improved resolution into the target object detection model. If the target object detection model detects that the image of the mouth feature area contains smoke, look up the corresponding target behavior in the first preset behavior table, which is the smoking behavior. Send a notice about the smoking behavior by means of text message, alarm, voice, social software or email, etc., to remind that there is a smoking behavior in the grain depot, so as to prompt the grain depot administrator to stop the smoking behavior. If it is detected that the image of the corresponding area of the mouth feature does not contain smoke, then detect whether the image of the corresponding area of the hand feature contains smoke. If the image of the hand feature area contains smoke, calculate the intersection-over-union ratio of the hand feature area and the mouth feature area to accurately determine that the target object has a smoking behavior.
[0103] By extracting the features of the target object and determining the target object according to the feature information of the target object, and then judging the behavior of the target object according to the target object, the missed detection caused by the too small target object can be reduced, and the accuracy of the target behavior detection can be further improved.
[0104] Correspondingly, please refer to Figure 9 In this embodiment of the present invention, an image detection device is provided. Specifically, the device may include:
[0105] An acquisition module 1, configured to acquire an image to be detected;
[0106] A first determination module 2, configured to determine a target object in the image to be detected;
[0107] A second determination module 3, configured to determine a first feature area and a second feature area in the target object;
[0108] A detection module 4, configured to detect a target object in the first feature area and / or the second feature area;
[0109] A third determination module 5, configured to determine a target behavior of the target object according to the type of the target object.
[0110] The image detection device provided in this embodiment outputs a to-be-detected image through the acquisition module 1, sends the to-be-detected image to the first determination module 2, determines a target object in the to-be-detected image through the first determination module 2, and then sends the target object in the to-be-detected image to the second determination module 3 to determine a first feature region and a second feature region in the target object. Then, the first feature region and the second feature region in the target object are sent to the detection module 4 for target detection to obtain a target object in the first feature region and / or the second feature region, and the target object in the first feature region and / or the second feature region is sent to the third determination module 5 to determine the target behavior of the target object by using the type of the target object, thereby reducing missed detection caused by the target object being too small and further improving the accuracy of target behavior detection.
[0111] An embodiment of the present invention further provides an electronic device, such as Figure 10 shown. The electronic device may include a processor 6 and a memory 7, where the processor 6 and the memory 7 may be connected through a bus or other means. Figure 10 Taking the connection through the bus as an example.
[0112] The processor 6 may be a central processing unit (CPU). The processor 6 may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. chips, or a combination of the above types of chips.
[0113] The memory 7, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the image detection method in the embodiment of the present invention (for example, Figure 9 the acquisition module 1, the first determination module 2, the second determination module 3, the detection module 4, and the third determination module 5 shown). The processor 6 executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions, and modules stored in the memory 7, that is, implements the image detection method in the above method embodiment.
[0114] The memory 7 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created by the processor 6, etc. In addition, the memory 7 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory 7 optionally includes a memory remotely disposed relative to the processor 6, and these remote memories can be connected to the processor 6 through a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0115] The one or more modules are stored in the memory 7 and, when executed by the processor 6, perform the image detection method in the Figures 1 to 7 embodiment shown.
[0116] Specific details of the above electronic device can be correspondingly referred to Figures 1 to 7 the corresponding relevant descriptions and effects in the embodiment shown for understanding, and will not be elaborated here.
[0117] Those skilled in the art can understand that to implement all or part of the processes in the above method embodiments, it can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above method embodiments. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (abbreviation: HDD), or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above types of memories.
[0118] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. An image detection method, characterized in that, Including: Obtain the image to be detected; Determine the target area where the target object is located in the image to be detected; Adjust the size of the target area according to a preset area range threshold; Extract the target image corresponding to the adjusted target area; Determine the first feature area and the second feature area in the target object; Detect the target object in the first feature area and / or the second feature area; Detect whether there is a target object in the first feature area; If there is no target object in the first feature area, then detect whether there is the target object in the second feature area; If there is a target object in the second feature area, then obtain the ratio of the intersection to the union of the first feature area and the second feature area; If the ratio is greater than or equal to a preset threshold, then determine the target behavior of the target object from a preset behavior table based on the type of the target object.
2. The method according to claim 1, characterized in that, Also including: If the ratio is less than the preset threshold, then determine the target behavior of the target object according to the feature information of the target object in the second feature area.
3. The method according to claim 1, wherein The determining the first feature area and the second feature area in the target object includes: Input the target image into a feature extraction model, so that the feature extraction model extracts features of the target object in the target image; Obtain the first feature area and the second feature area with identifiers from the feature extraction model.
4. The method according to any one of claims 1-3, characterized in that Before detecting the target object in the first feature area and / or the second feature area, the method further includes: Obtain the first feature value in the first feature area and the second feature value in the second feature area; Perform non-linear mapping on the first feature value and the second feature value respectively to obtain a first feature mapping value and a second feature mapping value; Perform feature reconstruction on the first feature value according to the first feature mapping value to obtain a first target feature value, and perform feature reconstruction on the second feature value according to the second feature mapping value to obtain a second target feature value; Adjust the position of the first feature area according to the first target feature value, and adjust the position of the second feature area according to the second target feature value.
5. The method according to any one of claims 1 to 3, characterized in that, The detecting the target object in the first feature area and / or the second feature area includes: Extract a first preset feature from the first feature area and / or the second feature area; Perform sub-pixel convolution on the first preset feature to obtain a second preset feature; Extract the target feature of the target object in the first feature area and / or the second feature area; If the target feature matches the second preset feature, then determine the position of the target object in the first feature area and / or the second feature area.
6. An image detection device, characterized in that, Including: An obtaining module, configured to determine the target area where the target object is located in the image to be detected; Adjust the size of the target area according to a preset area range threshold; Extract the target image corresponding to the adjusted target area; A first determining module, configured to determine the target object in the image to be detected; A second determining module, configured to determine the first feature area and the second feature area in the target object; A detection module, configured to detect a target object in the first feature region and / or the second feature region; A third determination module, configured to detect whether there is a target object in the first feature region; if there is no target object in the first feature region, then detect whether there is the target object in the second feature region; if there is the target object in the second feature region, then obtain a ratio of an intersection to a union of the first feature region and the second feature region; If the ratio is greater than or equal to a preset threshold, then determine a target behavior of the target object from a preset behavior table based on the type of the target object.
7. An electronic device, characterized in that, Comprising: A memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the steps of the image detection method according to any one of claims 1-5 are implemented.
8. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the image detection method according to any one of claims 1-5 are implemented.
Citation Information
Patent Citations
Target behavior detection method and system, computer equipment and machine readable medium
CN113076903A