Target detection method, device, electronic device and storage medium

By acquiring the image to be detected in the object detection and determining the approximation and positional relationship between the candidate image and the target image, combined with multiple preset conditions, the problem of low accuracy of simple object image detection in the object detection is solved, and the accuracy of detection is improved degree and recall rate.

CN114882250BActive Publication Date: 2024-11-22BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210496559.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-07
Publication Date
2024-11-22
Estimated Expiration
2042-05-07

AI Technical Summary

Technical Problem

During the object detection process, especially when detecting a simple object image, although the recall rate is guaranteed, the accuracy rate is poor and false detection is prone to occur.

Method used

By acquiring the image to be detected, the approximation between the candidate image and the target image is determined, and whether the candidate image is a target image is determined based on whether the relative position of the text and the candidate image meets the preset position conditions. The method includes settings of multiple preset values ​​and thresholds for filtering out target images that meet the conditions, including conditions such as image complexity, proportion, similarity, transparency and color.

Benefits of technology

Improve the accuracy and recall of target detection, reduce false detection, especially when detecting simple target images, both accuracy and recall.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114882250B_ABST
    Figure CN114882250B_ABST
Patent Text Reader

Abstract

The disclosed embodiments relate to a method, device, electronic device and storage medium for target detection, the method comprising: obtaining an image to be detected; determining a candidate image in the image to be detected, wherein the similarity between the candidate image and the target image is greater than a first preset value; determining text in the image to be detected, and determining the relative position between the candidate image and the text; and determining whether the candidate image is the target image based on whether the relative position meets a preset position condition. This method can achieve a greater balance between the accuracy and recall rate of target detection on the target image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of image processing, and in particular to a target detection method, device, electronic device, and storage medium. Background Art

[0002] Object detection is a technology used to detect the target image from the background. With the development of computer technology and the widespread application of computer vision principles, the research on object detection is becoming more and more popular, and its application is becoming more and more extensive.

[0003] For example, when a user uploads an image to a website, the website will perform watermark detection on the image uploaded by the user. When a competitor's watermark is found, it will be processed according to actual business needs. In this application scenario, the watermark is the target image.

[0004] However, in the process of target detection, the accuracy and recall rates of more complex target images with a larger size in the image are good. However, when detecting simpler target images, the accuracy rate is poor while ensuring the recall rate, and more false detections will occur. Summary of the invention

[0005] In view of this, in order to solve some or all of the above technical problems, the embodiments of the present disclosure provide a target detection method, device, electronic device and storage medium.

[0006] In a first aspect, an embodiment of the present disclosure provides a target detection method, the method comprising:

[0007] Acquire the image to be detected;

[0008] Determine a candidate image in the image to be detected, wherein the degree of similarity between the candidate image and the target image is greater than a first preset value;

[0009] Determine the text in the image to be detected, and determine the relative position of the candidate image and the text;

[0010] Based on whether the relative position meets a preset position condition, it is determined whether the candidate image is the target image.

[0011] Optionally, in the method of any embodiment of the present disclosure, the determining of the text in the image to be detected includes:

[0012] If the similarity between the candidate image and the target image is greater than the first preset value and less than the second preset value, then performing the step of determining the text in the image to be detected, wherein the second preset value is greater than the first preset value; and

[0013] The above method further includes:

[0014] If the degree of similarity between the candidate image and the target image is greater than or equal to the second preset value, the candidate image is determined to be the target image.

[0015] Optionally, in the method of any embodiment of the present disclosure, the preset location condition includes at least one of the following:

[0016] The horizontal distance between the reference point position of the text and the reference point position of the candidate image is less than or equal to a preset horizontal distance threshold;

[0017] The vertical distance between the reference point position of the text and the reference point position of the candidate image is less than or equal to a preset vertical distance threshold.

[0018] Optionally, in the method of any embodiment of the present disclosure, the reference point position of the text is the center position of the text.

[0019] Optionally, in the method of any embodiment of the present disclosure, the reference point position of the candidate image is the center position of the candidate image.

[0020] Optionally, in the method of any embodiment of the present disclosure, the target image meets at least one of the following conditions:

[0021] The image complexity of the target image is less than or equal to a preset image complexity threshold;

[0022] The proportion of the target image in the image to be detected is less than or equal to a preset proportion threshold;

[0023] The similarity between the target image and the neighborhood image region of the target image is greater than or equal to a preset similarity threshold;

[0024] The transparency of the target image is greater than or equal to a preset transparency threshold;

[0025] The colors of the above target images are preset colors.

[0026] Optionally, in the method of any embodiment of the present disclosure, the target image is a logo image of a predetermined product.

[0027] Optionally, in the method of any embodiment of the present disclosure, the text is a user name of the product, and different users of the product have different user names.

[0028] In a second aspect, an embodiment of the present disclosure provides a target detection device, the device comprising:

[0029] An acquisition unit, configured to acquire an image to be detected;

[0030] A first determining unit is configured to determine a candidate image in the image to be detected, wherein the similarity between the candidate image and the target image is greater than a first preset value;

[0031] A second determination unit is configured to determine the text in the image to be detected and determine the relative position between the candidate image and the text;

[0032] The third determining unit is configured to determine whether the candidate image is the target image based on whether the relative position meets a preset position condition.

[0033] Optionally, in the device of any embodiment of the present disclosure, the second determining unit is specifically configured to:

[0034] If the similarity between the candidate image and the target image is greater than the first preset value and less than the second preset value, then performing the step of determining the text in the image to be detected, wherein the second preset value is greater than the first preset value; and

[0035] The above device also includes:

[0036] The fourth determining unit is configured to determine that the candidate image is the target image if the similarity between the candidate image and the target image is greater than or equal to the second preset value.

[0037] Optionally, in the device of any embodiment of the present disclosure, the preset location condition includes at least one of the following:

[0038] The horizontal distance between the reference point position of the text and the reference point position of the candidate image is less than or equal to a preset horizontal distance threshold;

[0039] The vertical distance between the reference point position of the text and the reference point position of the candidate image is less than or equal to a preset vertical distance threshold.

[0040] Optionally, in the device of any embodiment of the present disclosure, the reference point position of the above text is the center position of the above text.

[0041] Optionally, in the device of any embodiment of the present disclosure, the reference point position of the above-mentioned candidate image is the center position of the above-mentioned candidate image.

[0042] Optionally, in the device of any embodiment of the present disclosure, the target image meets at least one of the following conditions:

[0043] The image complexity of the target image is less than or equal to a preset image complexity threshold;

[0044] The proportion of the target image in the image to be detected is less than or equal to a preset proportion threshold;

[0045] The similarity between the target image and the neighborhood image region of the target image is greater than or equal to a preset similarity threshold;

[0046] The transparency of the target image is greater than or equal to a preset transparency threshold;

[0047] The colors of the above target images are preset colors.

[0048] Optionally, in the device of any embodiment of the present disclosure, the target image is a logo image of a predetermined product.

[0049] Optionally, in the device of any embodiment of the present disclosure, the text is a user name of the product, and different users of the product have different user names.

[0050] In a third aspect, an embodiment of the present disclosure provides an electronic device, including:

[0051] Memory for storing computer programs;

[0052] The processor is used to execute the computer program stored in the above-mentioned memory, and when the above-mentioned computer program is executed, the method of any embodiment of the target detection method of the above-mentioned first aspect of the present disclosure is implemented.

[0053] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable medium, and when the computer program is executed by a processor, the method of any embodiment of the target detection method of the first aspect described above is implemented.

[0054] In a fifth aspect, an embodiment of the present disclosure provides a computer program, which includes a computer-readable code. When the computer-readable code is run on a device, the processor in the device executes instructions for implementing the steps in the method of any embodiment of the target detection method of the first aspect above.

[0055] The target detection method provided by the embodiment of the present disclosure obtains an image to be detected, determines a candidate image in the image to be detected, and the similarity between the candidate image and the target image is greater than a first preset value. Then, the text in the image to be detected is determined, and the relative position between the candidate image and the text is determined. Subsequently, based on whether the relative position meets the preset position condition, it is determined whether the candidate image is the target image. According to this method, by judging whether the relative position between the candidate image in the image to be detected and the text in the image to be detected meets the preset position condition set for the text and the target image, it is determined whether the candidate image is the target image, thereby achieving target detection. As a result, the accuracy and recall rate of target detection of the target image can be taken into account to a greater extent. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 A flowchart of a target detection method provided by an embodiment of the present disclosure;

[0057] Figure 2 A flowchart of another target detection method provided by an embodiment of the present disclosure;

[0058] Figure 3A-3B A flowchart of another target detection method provided by an embodiment of the present disclosure;

[0059] Figure 4 A schematic diagram of the structure of a target detection device provided by an embodiment of the present disclosure;

[0060] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0061] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present disclosure unless otherwise specifically stated.

[0062] Those skilled in the art will understand that the terms "first" and "second" in the embodiments of the present disclosure are only used to distinguish objects such as different steps, devices or modules, and do not represent any specific technical meanings, nor do they indicate the logical order between them.

[0063] It should also be understood that in the embodiments of the present disclosure, “plurality” may refer to two or more than two, and “at least one” may refer to one, two, or more than two.

[0064] It should also be understood that any component, data or structure mentioned in the embodiments of the present disclosure can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.

[0065] In addition, the term "and / or" in the present disclosure is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present disclosure generally indicates that the associated objects before and after are in an "or" relationship.

[0066] It should also be understood that the description of the various embodiments in the present disclosure focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.

[0067] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.

[0068] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the above-mentioned technologies, methods, and equipment should be considered as part of the specification.

[0069] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0070] It should be noted that, in the absence of conflict, the embodiments in the present disclosure and the features in the embodiments can be combined with each other. To facilitate the understanding of the embodiments of the present disclosure, the present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.

[0071] Figure 1 A flow chart of a target detection method provided by an embodiment of the present disclosure is shown as follows: Figure 1 As shown, the method specifically includes:

[0072] 101. Obtain an image to be detected.

[0073] In the embodiments of the present disclosure, an execution subject of the target detection method (eg, a terminal device, a server, a target detection apparatus, etc.) may acquire an image to be detected.

[0074] The above-mentioned image to be detected may be any one or more images to be detected. As an example, the image to be detected may be an image uploaded by a user, an image presented by a terminal device, an image stored in a memory, and the like.

[0075] 102. Determine a candidate image in the image to be detected, wherein a degree of similarity between the candidate image and the target image is greater than a first preset value.

[0076] In this embodiment, the execution subject may determine a candidate image in the image to be detected, wherein the similarity between the candidate image and the target image is greater than a first preset value. The first preset value may be a predetermined similarity value, and as an example, the first preset value may be 0.

[0077] In some cases, the candidate image may be an image determined by the execution subject in the process of detecting the target image in the image to be detected. In other words, the image determined by the execution subject in the process of detecting the target image in the image to be detected (that is, the candidate image) has a similarity with the target image greater than a first preset value.

[0078] In practice, it can be determined that the similarity between the candidate image and the target image is greater than the first preset value in the following scenario: the execution subject determines the image in the process of detecting the target image in the image to be detected.

[0079] In the above scenario, the above execution subject may use a target detection frame to select a candidate image during the process of detecting the target image in the image to be detected, and each target detection frame corresponds to a confidence level that the target image is contained in the frame. The confidence level indicates the probability that the target image is contained in the target detection frame.

[0080] As an example, the execution subject may determine the confidence level in the following manner:

[0081] The image to be detected is input into a pre-trained confidence determination model, and the image to be detected is subjected to image recognition through the confidence determination model to determine the confidence that the target image is contained in the target detection frame. The confidence determination model can be a model such as a convolutional neural network trained by a machine learning algorithm.

[0082] In the above situation, the execution subject may determine whether the image to be detected includes the candidate image in the following manner:

[0083] The target image in the image to be detected is subjected to target detection. If the target image is detected, the detected image is used as a candidate image.

[0084] It can be understood that, usually, there is often a certain false detection rate in the process of target detection. Therefore, when a target image is detected here, the detected image is not directly determined as the target image, but is first used as a candidate image to further determine whether it is the target image.

[0085] The target image may be any one or more images with predetermined features. As an example, the target image may include a watermark with predetermined features of at least one of shape, color, and texture. For example, the target image may be a watermark of a social software.

[0086] Here, the execution subject may determine the position of the candidate image in the image to be detected by performing target detection on the target image in the image to be detected.

[0087] 103. Determine the text in the image to be detected, and determine the relative position between the candidate image and the text.

[0088] In this embodiment, the execution subject may determine the text in the image to be detected, and determine the relative position between the candidate image and the text.

[0089] The text may be any one or more characters with predetermined characteristics. As an example, the text may include a watermark with at least one of the predetermined characteristics of the font and color. For example, the text may be a watermark formed by the user name of the user of the above social software.

[0090] In addition, the position of the text in the image to be detected may be the position of the text line where the text is located.

[0091] Here, the following method can be used to determine the position of the above text line:

[0092] First, an image region including the candidate image in the image to be detected is cut out.

[0093] Among them, the above-mentioned image area can be any image area in the image to be detected that includes the above-mentioned candidate image. The image area can be determined in a variety of ways. As an example, the central pixel of the above-mentioned candidate image can be used as a reference pixel point, and the image area including the reference pixel point, the first preset number of pixels above and below the reference pixel point, and the second preset number of pixels above and below the reference pixel point can be used as the image area intercepted by the above-mentioned execution subject. For example, the central pixel of the above-mentioned target image, 100 pixels above and below the central pixel, and the image area of ​​250 pixels above and below the central pixel can be used as the image area intercepted by the above-mentioned execution subject.

[0094] Afterwards, a text detection algorithm is used to perform text detection on the above image area to obtain the position of the text line of the above text.

[0095] Furthermore, the execution entity may determine a relative position between the candidate image and the text in the image to be detected.

[0096] 104. Determine whether the candidate image is the target image based on whether the relative position meets a preset position condition.

[0097] In this embodiment, the execution subject may determine whether the candidate image is the target image based on whether the relative position meets a preset position condition.

[0098] The relative position between the text and the target image meets the preset position condition. In other words, in the process of generating an image including a target image and text (such as the image to be detected), the relative position between the target image in the image and the text in the image must meet the preset position condition.

[0099] The preset position condition may be a predetermined condition that characterizes the positional relationship between the target image and the text.

[0100] Specifically, if the above-mentioned image to be detected includes the above-mentioned text, then the above-mentioned execution entity can further determine whether the relative position between the text included in the above-mentioned image to be detected and the candidate image meets the preset position condition (for example, the candidate image and the text are separated by a preset number of pixels, and the central pixel of the candidate image and the central pixel of the text are located in the same row of the image). If the relative position between the text and the candidate image meets the preset position condition, the candidate image is determined to be the target image, that is, the above-mentioned image to be detected includes the above-mentioned target image. If the relative position between the text and the candidate image does not meet the preset position condition, it is determined that the candidate image is not the target image, that is, the above-mentioned image to be detected does not include the target image.

[0101] If the detection result does not indicate that the image to be detected includes the text, it is determined that the image to be detected does not include the target image.

[0102] In some optional implementations of this embodiment, the preset location condition includes at least one of the following:

[0103] The first item is that the horizontal distance between the reference point position of the above text and the reference point position of the above candidate image is less than or equal to a preset horizontal distance threshold.

[0104] The second item is that the vertical distance between the reference point position of the above text and the reference point position of the above candidate image is less than or equal to a preset vertical distance threshold.

[0105] The reference point position may be an endpoint position, a center position, etc.

[0106] In some application scenarios of the above optional implementation manner, the reference point position of the above text is the center position of the above text.

[0107] In some application scenarios of the above optional implementation manner, the reference point position of the above candidate image is the center position of the above candidate image.

[0108] In some application scenarios of the above optional implementation manner, the reference point position of the above text is the center position of the above text, and the reference point position of the above candidate image is the center position of the above candidate image.

[0109] Optionally, the preset position condition may also be: the text row is arranged around the candidate image row.

[0110] It is understandable that when a user uses a product to publish an image, the product can automatically generate and add a target image and text to the image to distinguish the product that publishes the image and the publisher of the image. Here, the target image and text automatically generated and added by the product to the image can meet the preset position conditions, thereby making the target image and text in the generated image (such as the image to be detected) meet the preset text line generation conditions.

[0111] Specifically, if the above relative position meets the above preset position condition, then the above execution subject can determine that the above candidate image is the target image; if the above relative position does not meet the above preset position condition, then the above execution subject can determine that the above candidate image is not the target image.

[0112] In some optional implementations of this embodiment, the target image satisfies at least one of the following conditions (including conditions 1 to 5):

[0113] Condition 1: The image complexity of the target image is less than or equal to a preset image complexity threshold.

[0114] The above image complexity can represent the complexity of the image. In practice, the image complexity can be represented by the complexity of the image texture. Here, the complexity of the image texture can be calculated using a gray level co-occurrence matrix or a gray level covariance matrix.

[0115] It can be understood that the above condition 1 can be used to screen out target images whose image complexity is less than or equal to a preset image complexity threshold.

[0116] Condition 2: The proportion of the target image in the image to be detected is less than or equal to a preset proportion threshold.

[0117] The preset ratio threshold may be a predetermined ratio value, for example, 0.05, 0.1, etc.

[0118] It can be understood that the above condition 2 can be used to filter out target images whose proportion is less than or equal to a preset proportion threshold.

[0119] Condition three: The similarity between the target image and the neighborhood image area of ​​the target image is greater than or equal to a preset similarity threshold.

[0120] Among them, the neighborhood image area of ​​the above-mentioned target image can be determined in a variety of ways. As an example, the central pixel of the above-mentioned target image can be used as a reference pixel, and the image area including the reference pixel, the first preset number of pixels above and below the reference pixel, and the second preset number of pixels above and below the reference pixel can be used as the neighborhood image area of ​​the above-mentioned target image. For example, the central pixel of the above-mentioned target image, the image area of ​​100 pixels above and below the central pixel, and the image area of ​​250 pixels above and below the central pixel can be used as the neighborhood image area of ​​the above-mentioned target image.

[0121] It can be understood that the above condition three can be used to screen out target images whose similarity in the neighborhood image regions is greater than or equal to a preset similarity threshold.

[0122] Condition 4: The transparency of the target image is greater than or equal to a preset transparency threshold.

[0123] The preset transparency threshold may be a predetermined transparency value.

[0124] It can be understood that the above condition 4 can be used to filter out target images whose transparency is greater than or equal to a preset transparency threshold.

[0125] Condition 5: The color of the target image is a preset color.

[0126] The preset color may be a predetermined color. As an example, the preset color may be white or off-white. Optionally, the preset color may also be set by determining the RGB (RedGreenBlue) value of the image.

[0127] It can be understood that the above condition five can be used to filter out target images with preset colors.

[0128] In some optional implementations of this embodiment, the target image is a logo image of a predetermined product. The product may be a virtual product or a physical product. As an example, the product may be a software application (such as the social software). The logo image may be a logo of a predetermined product. As an example, the logo image may be a trademark image, a name image, etc. of a product.

[0129] In some optional implementations of the present embodiment, the above text is the user name of the above product, and different users of the above product have different user names. As an example, if the user name of user A is "123", then the text corresponding to user A may be "123" and, in this case, no other user except user A can use "123" as a user name. Here, the text may be the user name contained in the image posted by user A. In the process of using the above product to post an image, the user may automatically generate and add a target image and text for the image to distinguish the publishing application and publisher of the image. Here, the above product is the target image automatically generated and added for the image, and may meet at least one of the above conditions one to five, and the relative position between the text automatically generated and added for the image and the target image may meet the above preset position condition.

[0130] The target detection method provided by the embodiment of the present disclosure obtains an image to be detected, determines a candidate image in the image to be detected, and the similarity between the candidate image and the target image is greater than a first preset value. Then, the text in the image to be detected is determined, and the relative position between the candidate image and the text is determined. Subsequently, based on whether the relative position meets the preset position condition, it is determined whether the candidate image is the target image. According to this method, by judging whether the relative position between the candidate image in the image to be detected and the text in the image to be detected meets the preset position condition set for the text and the target image, it is determined whether the candidate image is the target image, thereby achieving target detection. As a result, the accuracy and recall rate of target detection of the target image can be taken into account to a greater extent.

[0131] Figure 2 A flowchart of another target detection method provided by an embodiment of the present disclosure is shown in FIG. Figure 2 As shown, the method specifically includes:

[0132] 201. Obtain an image to be detected.

[0133] In the embodiment of the present disclosure, the execution subject of the target detection method (eg, a terminal device, a server, a target detection apparatus, etc.) may obtain an image to be detected. Then, step 202 is executed.

[0134] In the embodiment of the present disclosure, the execution method of step 201 can refer to the above-mentioned step 101, which will not be repeated here.

[0135] 202. Determine a candidate image in the image to be detected, wherein a degree of similarity between the candidate image and the target image is greater than a first preset value.

[0136] In this embodiment, the execution subject may determine a candidate image in the image to be detected, wherein the similarity between the candidate image and the target image is greater than a first preset value. Then, step 203 is executed.

[0137] In the embodiment of the present disclosure, the execution method of step 202 can refer to the above-mentioned step 102, which will not be repeated here.

[0138] 203. Determine whether the similarity between the candidate image and the target image is less than a second preset value.

[0139] In this embodiment, the execution subject may determine whether the similarity between the candidate image and the target image is less than a second preset value, wherein the second preset value is greater than the first preset value. If yes, step 204 is executed; if no, step 206 is executed.

[0140] Here, the similarity between the candidate image and the target image may be the confidence that the target image is contained in the target detection box where the candidate image is located. In this case, the second preset value may be a predetermined confidence value. As an example, the second preset value may be 0.8, 0.9, etc.

[0141] 204 . Determine the text in the image to be detected, and determine the relative position between the candidate image and the text in the image to be detected.

[0142] In this embodiment, the execution subject may determine the text in the image to be detected, and determine the relative position between the candidate image and the text in the image to be detected. Then, step 205 is executed.

[0143] In the embodiment of the present disclosure, the execution method of step 204 can refer to the above-mentioned step 103, which will not be repeated here.

[0144] 205. Determine whether the candidate image is the target image based on whether the relative position meets a preset position condition.

[0145] In this embodiment, the execution subject may determine whether the candidate image is the target image based on whether the relative position meets a preset position condition.

[0146] In the embodiment of the present disclosure, the execution method of step 205 can refer to the above-mentioned step 104, which will not be repeated here.

[0147] 206. Determine the candidate image as the target image.

[0148] In this embodiment, the execution subject may determine the candidate image as the target image.

[0149] In the target detection method provided by the embodiment of the present disclosure, when the approximation between the candidate image and the target image is less than the second preset value, the text in the image to be detected is detected, and then the relative position between the candidate image and the text meets the preset position condition to determine whether the candidate image is the target image. If the approximation is greater than the second preset value, the candidate image is directly determined to be the target image, and then the target image is determined to be included in the image to be detected, thereby improving the speed of determining whether the target image is included in the image to be detected.

[0150] Fig. 3 is a flow chart of another target detection method provided by an embodiment of the present disclosure, which can be applied to scenarios such as social software, shopping software, news publishing platforms, etc. This method can be applied to electronic devices such as terminals and servers.

[0151] As an example, the method specifically includes: obtaining an image to be detected, determining a candidate image in the image to be detected, wherein the degree of similarity between the candidate image and the target image is greater than a first preset value, then determining the text in the image to be detected, determining the relative position between the candidate image and the text, and then, based on whether the relative position meets a preset position condition, determining whether the candidate image is the target image.

[0152] Specifically, refer to Figure 3A As shown, the above example is explained:

[0153] In practice, in the detection scenario of watermarks (such as watermarks of the above-mentioned social software and watermarks of other software), since the features of some watermarks (such as watermarks of the above-mentioned social software) are not obvious and the proportion of watermarks in the image is small, it often leads to many false detections. Therefore, it is necessary to improve the accuracy of such watermark detection and effectively filter out the detected watermarks with errors.

[0154] The following example is explained by taking the watermark of the above social software in the image as the target image and the username of the user of the social software as the text:

[0155] After detecting the watermark in the image (i.e., the above-mentioned image to be detected), the category information (the category information may indicate the watermark of the above-mentioned social software, or the watermark of other software), location information, and confidence information (e.g., the confidence that the target image is included in the target detection box where the above-mentioned candidate image is located) of the detected watermark can be obtained through the detection algorithm. Here, it is assumed that the category information of the watermark indicates that the detected candidate image is the target image, that is, the category information of the watermark indicates that the detected candidate image is the watermark of the above-mentioned social software.

[0156] Afterwards, the confidence information can be used to filter out the detection results with low confidence. For the watermarks of the above-mentioned social software, in order to ensure the high recall of the algorithm, the threshold of the confidence filter needs to be set low, which will result in more false detections. Here, the detection results with a lower threshold are used to perform text detection on the images around the watermarks of the above-mentioned social software again, and the position information of each line of text obtained by the text detection is used to reversely judge whether the low-confidence target object is the correct watermark of the above-mentioned social software.

[0157] When the object detection algorithm detects that the image contains a candidate image, and the confidence that the candidate image is the target image is higher than the set threshold (that is, the second preset value mentioned above), the following results will be generated:

[0158] Result 1: If a candidate image is detected and the confidence that the candidate image is the target image is higher than the threshold set for secondary text detection (i.e., the second preset value mentioned above), no secondary text detection is performed to reversely confirm whether the result of the object detection is correct. For example, if a candidate image is detected and the confidence that the candidate image is the target image (e.g., 0.95) is higher than the threshold set for secondary text detection (e.g., 0.8), no secondary text detection is performed, and it can be directly determined that the image to be detected includes the target image, i.e., the watermark of the above social software.

[0159] Result 2: If a candidate image is detected and the confidence that the candidate image is the target image is lower than the threshold set for secondary text detection (i.e., the second preset value mentioned above), secondary text detection is required. For example, a candidate image is detected and the confidence that the candidate image is the target image (e.g., 0.73) is lower than the threshold set for secondary text detection (e.g., 0.8), so secondary text detection is required. If text information is detected, it can be determined that the target image is included in the image to be detected.

[0160] Result three: If a candidate image is detected, and the confidence that the candidate image is the target image is lower than the threshold set for secondary text detection (i.e., the second preset value mentioned above), secondary text detection is required. For example, a candidate image is detected, and the confidence that the candidate image is the target image (e.g., 0.72) is lower than the threshold set for secondary text detection (e.g., 0.8), so secondary text detection is required. Specifically, if only part of the text information is detected, but the height information and relative position of the detected text line can be used to determine that the target image is included in the image to be detected.

[0161] Result 4: If a candidate image is detected and the confidence that the candidate image is the target image is lower than the threshold set for secondary text detection (i.e., the second preset value mentioned above), secondary text detection is required. For example, if no text information is detected, it can be reversely determined that the target image is not included in the image to be detected.

[0162] like Figure 3B As shown, when secondary detection is required, the image data near the candidate image is intercepted, and the text line information contained in the intercepted image can be detected by using the text detection algorithm. When the absolute value of the reference point position of the text line and the reference point position of the candidate image is less than a fixed threshold, the height of the detected candidate image and the height of the detected text line are less than a threshold calculated in a fixed way, the text line appears behind the candidate image, or the candidate image is closely connected to the text box, and the text box appears on the right side of the candidate image, or the candidate image and the text box are at a certain distance (the text line detection is incomplete due to the light text), but the text box appears on the right side of the candidate image. It is determined that the target image is included in the image to be detected and can be output.

[0163] Similarly, when secondary detection is required, the image data near the candidate image is intercepted, and the text line information contained in the intercepted image can be detected by using the text detection algorithm. If the detected text line appears in other positions and does not meet the above preset position conditions, the text detection is considered to be invalid, that is, it is determined that the target image is not included in the image to be detected, so the watermark detection is considered to be a false detection and no output is made.

[0164] Similarly, when secondary detection is required, image data near the candidate image is intercepted. For example, if no text line information is detected with the help of a text detection algorithm, if no text line information is found, the watermark detection is considered to be a false detection and no output is made.

[0165] In practice, when users upload images to some websites, watermark detection is usually performed on the images uploaded by users. When a competitor's watermark is found, it will be processed according to actual business needs. At present, watermarks in images can be detected through object detection technology, such as detecting an image with a specific watermark (such as the watermark of the above-mentioned social software). Generally, in the process of object detection, the accuracy and recall rates of watermarks that are more complex and occupy a larger proportion of the image are good. However, when detecting simpler watermarks, the accuracy performance is poor while ensuring the recall rate, and more false detections will occur. For example, when detecting the watermark of the above-mentioned social software, it is not conducive to the object detection algorithm to detect it, whether from the perspective of the complexity of the watermark, the color of the watermark, or the proportion of the watermark in the image.

[0166] Therefore, for the watermarks of the above-mentioned social software, it is necessary to use the object detection algorithm to detect them, and then use the post-processing algorithm to perform a secondary detection on this type of watermark to determine whether this type of watermark is the target watermark. The usual format of this type of watermark is "watermark of social software + user name". If the style of "watermark of social software + user name" is detected during the object detection process, then, since the user names are very different in terms of text length and text content, this will affect the accuracy of the object detection algorithm. Therefore, it is chosen to detect the common style of this type of watermark to detect the watermark. However, the watermarks of the above-mentioned social software can have more complex features, and when they appear in an image, their proportion is also very small. In the actual object detection process, if the recall rate of the watermarks of the above-mentioned social software is guaranteed to be high, more false detections will occur. Usually, some objects with lighter colors and size ratios close to the watermarks of the above-mentioned social software will be falsely detected. Therefore, a text detection algorithm is added here to detect images near the watermark of the above-mentioned social software, and the position characteristics of the text area are used to reversely judge whether the watermark of the above-mentioned social software detected by the object detection algorithm is correct (that is, to determine whether the candidate image is the target image).

[0167] In the above example, in order to solve the problem that the object detection algorithm usually has poor performance when detecting the target image that is small or has unclear features, by fully analyzing the features of the watermark of the social software according to actual business needs, it is determined to use the secondary confirmation algorithm "text detection algorithm" to confirm whether there is text information that meets the watermark features of the social software around the watermark of the social software detected for the first time, and then to confirm whether the watermark detected in the first object detection is the correct watermark of the social software (that is, to confirm whether the candidate image is the target image). In this way, while ensuring the high recall of the watermark of the social software, the false detection is also greatly reduced.

[0168] Figure 4 A schematic diagram of a target detection device provided in an embodiment of the present disclosure specifically includes:

[0169] An acquisition unit 401 is configured to acquire an image to be detected;

[0170] A first determining unit 402 is configured to determine a candidate image in the image to be detected, wherein the similarity between the candidate image and the target image is greater than a first preset value;

[0171] The second determining unit 403 is configured to determine the text in the image to be detected, and determine the relative position between the candidate image and the text;

[0172] The third determining unit 404 is configured to determine whether the candidate image is the target image based on whether the relative position meets a preset position condition.

[0173] Optionally, in the device of any embodiment of the present disclosure, the second determining unit 403 is specifically configured to:

[0174] If the similarity between the candidate image and the target image is greater than the first preset value and less than the second preset value, then performing the step of determining the text in the image to be detected, wherein the second preset value is greater than the first preset value; and

[0175] The above device also includes:

[0176] The fourth determining unit (not shown in the figure) is configured to determine that the candidate image is the target image if the similarity is greater than the second preset value.

[0177] Optionally, in the device of any embodiment of the present disclosure, the preset location condition includes at least one of the following:

[0178] The horizontal distance between the reference point position of the text and the reference point position of the candidate image is less than or equal to a preset horizontal distance threshold;

[0179] The vertical distance between the reference point position of the text and the reference point position of the candidate image is less than or equal to a preset vertical distance threshold.

[0180] Optionally, in the device of any embodiment of the present disclosure, the reference point position of the above text is the center position of the above text.

[0181] Optionally, in the device of any embodiment of the present disclosure, the reference point position of the above-mentioned candidate image is the center position of the above-mentioned candidate image.

[0182] Optionally, in the device of any embodiment of the present disclosure, the target image meets at least one of the following conditions:

[0183] The image complexity of the target image is less than or equal to a preset image complexity threshold;

[0184] The proportion of the target image in the image to be detected is less than or equal to a preset proportion threshold;

[0185] The similarity between the target image and the neighborhood image region of the target image is greater than or equal to a preset similarity threshold;

[0186] The transparency of the target image is greater than or equal to a preset transparency threshold;

[0187] The colors of the above target images are preset colors.

[0188] Optionally, in the device of any embodiment of the present disclosure, the target image is a logo image of a predetermined product.

[0189] Optionally, in the device of any embodiment of the present disclosure, the text is a user name of the product, and different users of the product have different user names.

[0190] The target detection device provided in this embodiment can be as follows Figure 4 The target detection device shown in FIG. 1 may perform the following steps: Figure 1-3B All steps of the target detection method in Figure 1-3B For details, please refer to the technical effect of the target detection method shown in Figure 1-3B For the sake of brevity, the relevant description is not repeated here.

[0191] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure is provided. Figure 5 The electronic device 500 shown includes: at least one processor 501, a memory 502, at least one network interface 504 and other user interfaces 503. The various components in the electronic device 500 are coupled together via a bus system 505. It is understood that the bus system 505 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 505 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 505 is not shown in FIG. Figure 5 Various buses are labeled as bus system 505 .

[0192] The user interface 503 may include a display, a keyboard, or a pointing device (eg, a mouse, a trackball, a touch pad, or a touch screen).

[0193] It can be understood that the memory 502 in the embodiment of the present disclosure can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct RAM bus random access memory (DRRAM). The memory 502 described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0194] In some implementations, the memory 502 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 5021 and an application program 5022 .

[0195] The operating system 5021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 5022 includes various application programs, such as a media player (Media Player), a browser (Browser), etc., which are used to implement various application services. The program for implementing the method of the embodiment of the present disclosure may be included in the application 5022.

[0196] In the embodiment of the present disclosure, by calling the program or instruction stored in the memory 502, specifically, the program or instruction stored in the application 5022, the processor 501 is used to execute the method steps provided by each method embodiment, for example, including:

[0197] Acquire the image to be detected;

[0198] Determine a candidate image in the image to be detected, wherein the degree of similarity between the candidate image and the target image is greater than a first preset value;

[0199] Determine the text in the image to be detected, and determine the relative position of the candidate image and the text;

[0200] Based on whether the relative position meets a preset position condition, it is determined whether the candidate image is the target image.

[0201] Optionally, in some optional implementations of this embodiment,

[0202] The above-mentioned determining the text in the above-mentioned image to be detected includes:

[0203] If the similarity between the candidate image and the target image is greater than the first preset value and less than the second preset value, then performing the step of determining the text in the image to be detected, wherein the second preset value is greater than the first preset value; and

[0204] The above method further includes:

[0205] If the degree of similarity between the candidate image and the target image is greater than or equal to the second preset value, the candidate image is determined to be the target image.

[0206] Optionally, in some optional implementations of this embodiment, the preset location condition includes at least one of the following:

[0207] The horizontal distance between the reference point position of the text and the reference point position of the candidate image is less than or equal to a preset horizontal distance threshold;

[0208] The vertical distance between the reference point position of the text and the reference point position of the candidate image is less than or equal to a preset vertical distance threshold.

[0209] Optionally, in some optional implementations of this embodiment, the reference point position of the above text is the center position of the above text.

[0210] Optionally, in some optional implementations of this embodiment, the reference point position of the candidate image is the center position of the candidate image.

[0211] Optionally, in some optional implementations of this embodiment, the target image meets at least one of the following conditions:

[0212] The image complexity of the target image is less than or equal to a preset image complexity threshold;

[0213] The proportion of the target image in the image to be detected is less than or equal to a preset proportion threshold;

[0214] The similarity between the target image and the neighborhood image region of the target image is greater than or equal to a preset similarity threshold;

[0215] The transparency of the target image is greater than or equal to a preset transparency threshold;

[0216] The colors of the above target images are preset colors.

[0217] Optionally, in some optional implementations of this embodiment, the target image is a predetermined product logo image.

[0218] Optionally, in some optional implementations of this embodiment, the above text is a user name of the above product, and different users of the above product have different user names.

[0219] The method disclosed in the above embodiment of the present disclosure can be applied to the processor 501, or implemented by the processor 501. The processor 501 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 501 or the instruction in the form of software. The above processor 501 can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present disclosure can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present disclosure can be directly embodied as a hardware decoding processor to execute, or the hardware and software units in the decoding processor can be executed. The software unit can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 502, and the processor 501 reads the information in the memory 502 and completes the steps of the above method in combination with its hardware.

[0220] It is understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPDevice, DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the above-mentioned functions of the present application, or a combination thereof.

[0221] For software implementation, the technology described above in this article can be implemented by a unit that performs the functions described above in this article. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0222] The electronic device provided in this embodiment may be Figure 5 The electronic device shown in FIG. 1 may perform the following steps: Figure 1-3B All steps of the target detection method in Figure 1-3B For details, please refer to the technical effect of the target detection method shown in Figure 1-3B For the sake of brevity, the relevant description is not repeated here.

[0223] The embodiments of the present disclosure also provide a storage medium (computer-readable storage medium). The storage medium here stores one or more programs. The storage medium may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state drive; the memory may also include a combination of the above-mentioned types of memory.

[0224] When one or more programs in the storage medium can be executed by one or more processors, the target detection method executed on the electronic device side can be implemented.

[0225] The processor is used to execute the prediction program stored in the memory to implement the following steps of the target detection method performed on the electronic device side:

[0226] Acquire the image to be detected;

[0227] Determine a candidate image in the image to be detected, wherein the degree of similarity between the candidate image and the target image is greater than a first preset value;

[0228] Determine the text in the image to be detected, and determine the relative position of the candidate image and the text;

[0229] Based on whether the relative position meets a preset position condition, it is determined whether the candidate image is the target image.

[0230] Optionally, in some optional implementations of this embodiment,

[0231] The above-mentioned determining the text in the above-mentioned image to be detected includes:

[0232] If the similarity between the candidate image and the target image is greater than the first preset value and less than the second preset value, then performing the step of determining the text in the image to be detected, wherein the second preset value is greater than the first preset value; and

[0233] The above method further includes:

[0234] If the degree of similarity between the candidate image and the target image is greater than or equal to the second preset value, the candidate image is determined to be the target image.

[0235] Optionally, in some optional implementations of this embodiment, the preset location condition includes at least one of the following:

[0236] The horizontal distance between the reference point position of the text and the reference point position of the candidate image is less than or equal to a preset horizontal distance threshold;

[0237] The vertical distance between the reference point position of the text and the reference point position of the candidate image is less than or equal to a preset vertical distance threshold.

[0238] Optionally, in some optional implementations of this embodiment, the reference point position of the above text is the center position of the above text.

[0239] Optionally, in some optional implementations of this embodiment, the reference point position of the candidate image is the center position of the candidate image.

[0240] Optionally, in some optional implementations of this embodiment, the target image meets at least one of the following conditions:

[0241] The image complexity of the target image is less than or equal to a preset image complexity threshold;

[0242] The proportion of the target image in the image to be detected is less than or equal to a preset proportion threshold;

[0243] The similarity between the target image and the neighborhood image region of the target image is greater than or equal to a preset similarity threshold;

[0244] The transparency of the target image is greater than or equal to a preset transparency threshold;

[0245] The colors of the above target images are preset colors.

[0246] Optionally, in some optional implementations of this embodiment, the target image is a predetermined product logo image.

[0247] Optionally, in some optional implementations of this embodiment, the above text is a user name of the above product, and different users of the above product have different user names.

[0248] The professionals should further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this disclosure.

[0249] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0250] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present disclosure in detail. It should be understood that the above description is only the specific implementation methods of the present disclosure and is not intended to limit the protection scope of the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure should be included in the protection scope of the present disclosure.

Claims

1. A target detection method, characterized in that: The method comprises: Acquire the image to be detected; Determine a candidate image in the image to be detected, wherein the degree of similarity between the candidate image and the target image is greater than a first preset value; Determining the text in the image to be detected, and determining the relative position of the candidate image and the text; Determining whether the candidate image is the target image based on whether the relative position meets a preset position condition; wherein the preset position condition is: in the process of generating an image containing a target image and text, a condition that the relative position between the target image in the generated image and the text in the generated image meets; The determining whether the candidate image is the target image based on whether the relative position meets a preset position condition includes one of the following: In a case where the relative position meets the preset position condition, determining the candidate image as the target image; When the relative position does not meet the preset position condition, determining that the candidate image is not the target image; The target image is a logo image of a predetermined product, the text is a user name of the product, and different users of the product have different user names.

2. The method according to claim 1, characterized in that The determining of the text in the image to be detected includes: If the similarity between the candidate image and the target image is greater than the first preset value and less than a second preset value, the step of determining the text in the image to be detected is performed, wherein the second preset value is greater than the first preset value.

3. The method according to claim 1, characterized in that The preset location condition includes at least one of the following: The horizontal distance between the reference point position of the text and the reference point position of the candidate image is less than or equal to a preset horizontal distance threshold; A vertical distance between a reference point position of the text and a reference point position of the candidate image is less than or equal to a preset vertical distance threshold.

4. The method according to claim 3, characterized in that The reference point position of the text is the center position of the text.

5. The method according to claim 3, characterized in that: The reference point position of the candidate image is the center position of the candidate image.

6. The method according to any one of claims 1 to 5, characterized in that: The target image meets at least one of the following conditions: The image complexity of the target image is less than or equal to a preset image complexity threshold; The proportion of the target image in the image to be detected is less than or equal to a preset proportion threshold; The similarity between the target image and the neighborhood image area of ​​the target image is greater than or equal to a preset similarity threshold; The transparency of the target image is greater than or equal to a preset transparency threshold.

7. A target detection device, characterized in that: The device comprises: An acquisition unit, configured to acquire an image to be detected; A first determining unit is configured to determine a candidate image in the image to be detected, wherein the similarity between the candidate image and the target image is greater than a first preset value; A second determination unit is configured to determine the text in the image to be detected and determine the relative position between the candidate image and the text; a third determining unit, configured to determine whether the candidate image is the target image based on whether the relative position meets a preset position condition; wherein the preset position condition is: in the process of generating an image containing a target image and text, a relative position between the target image in the generated image and the text in the generated image meets a condition; The determining whether the candidate image is the target image based on whether the relative position meets a preset position condition includes one of the following: In a case where the relative position meets the preset position condition, determining the candidate image as the target image; When the relative position does not meet the preset position condition, determining that the candidate image is not the target image; The target image is a logo image of a predetermined product, the text is a user name of the product, and different users of the product have different user names.

8. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute a computer program stored in the memory, and when the computer program is executed, implement the method described in any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method described in any one of claims 1 to 6 is implemented.