A watermark detection method and device, an electronic device, and a storage medium
The target configuration information is determined through the watermark clustering results and preset configuration files, and the peripheral watermark detection is carried out, which solves the problem that the watermark identification surrounding other information in the prior art cannot be detected, and the detection efficiency is improved.
Patent Information
- Application Number
- CN202210614410.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-31
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2042-05-31
AI Technical Summary
The prior art cannot effectively detect other information around the watermark identification through a general watermark detection algorithm.
By acquiring the object to be detected, watermark detection is performed to determine the watermark clustering result, target configuration information is determined in the preset configuration file based on the clustering result, and peripheral watermark detection is performed according to the information to determine the target watermark.
The detection efficiency of watermark detection is improved, other information around the watermark identification can be effectively detected, and the problem that cannot be detected in the prior art is solved.
Smart Images

Figure CN114943633B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular, to a watermark detection method and apparatus, an electronic device, and a storage medium. Background Art
[0002] With the increase in online video platforms and the growing number of users uploading videos, it often occurs that users upload the same video on different platforms.
[0003] For example, many videos on Platform A are from user uploads, and many of them carry watermark identifiers of competitors. For these identifiers, detection algorithms are required to detect them, and the detected watermark identifiers are masked.
[0004] However, in actual detection of watermark identifiers of competitors, through object detection algorithms, only the watermark identifiers can be detected, and there is a lot of other auxiliary information around the watermark identifiers, such as "live broadcast", "first broadcast", "exclusive broadcast", "user ID", etc., which also need to be detected and masked. In the actual watermark identifier detection process, first, frames are extracted from the video, the extracted frame images are obtained and the watermark identifiers are detected and recognized, and finally the target watermark identifier is determined.
[0005] In related technologies, since detection and recognition algorithms are usually used for the detection of objects with fixed styles, they have good applicability for watermark identifiers with fixed styles. However, there is often a lot of other information around the usual watermark identifiers, and these other information has diverse styles and may change at any time, and cannot be detected by a general watermark detection algorithm.
[0006] Aiming at the technical problem that other information around the watermark identifier cannot be detected by a general watermark detection algorithm in related technologies, no effective solution has been provided yet. Summary of the Invention
[0007] In order to solve the above technical problem that other information around the watermark identifier cannot be detected by a general watermark detection algorithm, the present application provides a watermark detection method and apparatus, an electronic device, and a storage medium.
[0008] In a first aspect, an embodiment of the present application provides a watermark detection method, including:
[0009] Obtaining a to-be-detected object that needs to detect a watermark;
[0010] Determining a watermark clustering result corresponding to the to-be-detected object by performing watermark detection on the to-be-detected object, where the watermark clustering result is used to indicate the distribution of watermarks in the to-be-detected object;
[0011] Determine the target configuration information corresponding to the watermark clustering result in the preset configuration file, where the target configuration information is used to indicate the detection scheme for detecting the surrounding watermark corresponding to the watermark clustering result;
[0012] According to the target configuration information, perform surrounding watermark detection on the periphery of the specified watermark corresponding to the watermark clustering result, and determine the target watermark in the object to be detected.
[0013] Optionally, as in the foregoing method, when the object to be detected is a video to be detected, the determining the watermark clustering result corresponding to the object to be detected by performing watermark detection on the object to be detected includes:
[0014] Extract at least one target image from the video to be detected;
[0015] Perform watermark detection on each target image, determine the candidate watermarks corresponding to each target image, and determine the watermark category and position information corresponding to each candidate watermark;
[0016] Cluster all the candidate watermarks according to the watermark category and position information corresponding to each candidate watermark to obtain the watermark clustering result, where the watermark category of the specified candidate watermark that clusters to obtain the watermark clustering result among all the candidate watermarks is the candidate watermark category, and the position information of the specified candidate watermark is the candidate position information.
[0017] Optionally, as in the foregoing method, the determining the target configuration information corresponding to the watermark clustering result in the preset configuration file includes:
[0018] Determine the watermark category of the watermark clustering result as the candidate watermark category corresponding to the specified candidate watermark;
[0019] Match the specified watermark category that is the same as the candidate watermark category from all the preset watermark categories, and determine the preset configuration information corresponding to the specified watermark category as the target configuration information, where the preset configuration file stores the preset watermark categories and the preset configuration information set correspondingly.
[0020] Optionally, as in the foregoing method, before the performing surrounding watermark detection on the periphery of the specified watermark corresponding to the watermark clustering result according to the target configuration information and determining the target watermark in the object to be detected, the method further includes:
[0021] Among all the candidate watermarks, all specified candidate watermarks for clustering to obtain the watermark clustering result are determined, as well as the confidence corresponding to each specified candidate watermark, where the confidence is used to indicate the probability that the specified candidate watermark belongs to the candidate watermark category;
[0022] Among all the specified candidate watermarks, the specified candidate watermark with the maximum confidence is determined as the specified watermark.
[0023] Optionally, as in the foregoing method, the method of performing peripheral watermark detection on the periphery of the specified watermark corresponding to the watermark clustering result according to the target configuration information and determining the target watermark in the object to be detected includes:
[0024] When the peripheral watermark detection sub - information indicating that peripheral watermark detection needs to be performed is included in the target configuration information, text detection is performed on the image area within a preset range from the specified watermark in the specified image, where the specified image is the target image where the specified watermark is located;
[0025] When target text is detected in the image area, the target watermark is determined according to the target configuration information and based on the positional relationship between the target text and the specified watermark.
[0026] Optionally, as in the foregoing method, the method of determining the target watermark when target text is detected in the image area according to the target configuration information and based on the positional relationship between the target text and the specified watermark includes:
[0027] When the target text is detected in the image area, the target position information of the target text is determined, where the target position information is used to indicate the position of the target text relative to the specified watermark;
[0028] When the reserved text position sub - information in the target configuration information does not include the target position information, the target text is filtered;
[0029] When the reserved text position sub - information in the target configuration information includes the target position information, the target text is retained; the target watermark is determined according to the target configuration information and based on the text content of the target text and the specified watermark.
[0030] Optionally, as in the foregoing method, the method of determining the target watermark according to the target configuration information and based on the text content of the target text and the specified watermark includes:
[0031] When the target configuration information includes text recognition sub-information for indicating that text content recognition needs to be performed on the target text, perform text recognition on the target text to obtain a recognition result; when the recognition result indicates that the text content includes the keyword indicated by the text recognition sub-information, determine the target text and the specified watermark as the target watermark; when the recognition result indicates that the text content does not include the keyword indicated by the text recognition sub-information, determine the specified watermark as the target watermark;
[0032] When the text recognition sub-information is not included in the target configuration information, determine the target text and the specified watermark as the target watermark.
[0033] Optionally, as in the foregoing method, the method further includes:
[0034] Obtain a watermark to be added of a new watermark category;
[0035] Determine a surrounding watermark detection scheme corresponding to the watermark to be added;
[0036] When there is no preset configuration information in the preset configuration file that is the same as the surrounding watermark detection scheme, add a new detection scheme corresponding to the new watermark category to the preset configuration file;
[0037] When there is a specified detection scheme in the preset configuration file that is the same as the surrounding watermark detection scheme, establish a correspondence between the new watermark category and the specified detection scheme in the preset configuration file.
[0038] In a second aspect, an embodiment of the present application provides a watermark detection device, including:
[0039] An acquisition module, configured to acquire an object to be detected that needs to detect a watermark;
[0040] A determination module, configured to determine a watermark clustering result corresponding to the object to be detected by performing watermark detection on the object to be detected, where the watermark clustering result is used to indicate the distribution of watermarks in the object to be detected;
[0041] An information determination module, configured to determine target configuration information corresponding to the watermark clustering result in a preset configuration file, where the target configuration information is used to indicate a detection scheme for performing surrounding watermark detection corresponding to the watermark clustering result;
[0042] A detection module, configured to perform surrounding watermark detection on the periphery of the specified watermark corresponding to the watermark clustering result according to the target configuration information, and determine the target watermark in the object to be detected.
[0043] In a third aspect, an embodiment of the present application provides an electronic device, including: a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete communication with each other through the communication bus;
[0044] The memory is used to store a computer program;
[0045] When the processor is used to execute the computer program, the method described in any one of the foregoing is implemented.
[0046] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. The storage medium includes a stored program, and when the program runs, the method described in any one of the foregoing is executed.
[0047] The above technical solutions provided by the embodiments of the present application have the following advantages compared with the prior art:
[0048] For the method provided by the embodiment of the present application, on the basis of obtaining the watermark clustering result of the object to be detected, the surrounding watermark of the specified watermark corresponding to the watermark clustering result is detected according to the target configuration information corresponding to the watermark clustering result. Thus, the purpose of detecting the surrounding watermark of the specified watermark by using the detection scheme for this watermark clustering result can be achieved, the detection efficiency of watermark detection can be effectively improved, and further the technical problem that other information around the watermark identifier cannot be detected by a general watermark detection algorithm in the related art can be solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The drawings here are incorporated into the description and form a part of this description, showing embodiments consistent with the present invention and used together with the description to explain the principles of the present invention.
[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.
[0051] Figure 1 It is a schematic flowchart of a watermark detection method provided by an embodiment of the present application;
[0052] Figure 2 It is a schematic flowchart of a watermark detection method provided by another embodiment of the present application;
[0053] Figure 3 It is a schematic flowchart of a watermark detection method provided by another embodiment of the present application;
[0054] Figure 4A flowchart of a watermark detection method provided for an application example of the present application;
[0055] Figure 5 A block diagram of a watermark detection device provided for an embodiment of the present application;
[0056] Figure 6 A structural diagram of an electronic device provided for an embodiment of the present application. Detailed implementation manners
[0057] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Apparently, the described embodiments are some but not all of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0058] According to one aspect of the embodiments of the present application, a watermark detection method is provided. Optionally, in this embodiment, the above watermark detection method can be applied to a hardware environment composed of a terminal and a server. The server is connected to the terminal through a network and can be used to provide services (such as advertisement pushing services, application services, etc.) for the terminal or a client installed on the terminal. A database can be set on the server or independently of the server to provide data storage services for the server.
[0059] The above network can include but is not limited to at least one of the following: wired network, wireless network. The above wired network can include but is not limited to at least one of the following: wide area network, metropolitan area network, local area network. The above wireless network can include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal is not limited to a PC, mobile phone, tablet computer, etc.
[0060] The watermark detection method of the embodiments of the present application can be executed by the server, or by the terminal, or jointly by the server and the terminal. Among them, when the terminal executes the watermark detection method of the embodiments of the present application, it can also be executed by a client installed thereon.
[0061] Taking the execution of the watermark detection method in this embodiment by the server as an example, Figure 1 A watermark detection method provided for an embodiment of the present application includes the following steps:
[0062] Step S101, obtain a to-be-detected object that needs to detect a watermark;
[0063] The watermark detection method in this embodiment can be applied to scenarios where it is necessary to identify whether there are peripheral watermarks (such as user IDs, "exclusive broadcast", "premiere", "live broadcast", etc.) in multimedia information (such as videos, images). For example: scenarios where it is necessary to identify whether there are peripheral watermarks in a video, scenarios where peripheral watermarks in an image are identified for occlusion, etc. In the embodiments of this application, the above watermark detection method is illustrated by taking the scenario of identifying whether there are peripheral watermarks in an image intercepted from a video as an example. For other types of media resources, the above watermark detection method is equally applicable without contradiction.
[0064] Taking the scenario of identifying whether there are peripheral watermarks in a video as an example, by performing peripheral watermark identification on the images extracted from the video, all the watermarks in the video can be determined.
[0065] Before performing watermark detection, a detection object to be detected for watermarks is obtained in advance. The detection object can be uploaded by a terminal user to the server that implements watermark detection in this application through a preset interface.
[0066] For example, when a terminal user needs to upload a video (i.e., the detection object) on a target platform, the video needs to be transmitted to the server through the client installed on the terminal used by the terminal user.
[0067] Step S102, by performing watermark detection on the detection object, a watermark clustering result corresponding to the detection object is determined, where the watermark clustering result is used to indicate the distribution of watermarks in the detection object.
[0068] After obtaining the detection object, watermark detection can be performed on the detection object, and when it is determined that there are watermarks in the detection object, it is necessary to determine the distribution of the watermarks on the detection object.
[0069] Optionally, watermark detection (such as clustering) can be performed on the detection object to determine the watermark clustering result corresponding to the detection object, and in some cases, there may be multiple clustering results in a detection object.
[0070] As Figure 2 shown, as an optional implementation manner, as in the previous method, when the detection object is a detection video, step S102 determines the watermark clustering result corresponding to the detection object by performing watermark detection on the detection object, including the following steps:
[0071] Step S201, extract at least one target image from the detection video by frame extraction.
[0072] In the case where the object to be detected is a video to be detected, the video to be detected can be frame-extracted to obtain at least one target image.
[0073] Optionally, frame extraction can be performed on the video to be detected according to a fixed number of frames to be extracted. For example, when the number of frames to be extracted is 20, 20 target images can be extracted.
[0074] Furthermore, frame extraction can be performed on the video to be detected according to the duration of the video to be detected and a preset frame extraction strategy (such as 1 frame per second, 20 frames per minute, etc.) to obtain at least one target image.
[0075] Step S202: Perform watermark detection on each target image, determine a candidate watermark corresponding to each target image, and determine a watermark category and position information corresponding to each candidate watermark.
[0076] After obtaining the target images, each target image can be subjected to watermark detection through a preset watermark detection algorithm, and then a candidate watermark corresponding to each watermark image can be obtained. The candidate watermark can be a watermark detected in the target image. And in this embodiment, the specific watermark category of the candidate watermark can be identified, that is, the specific information in the candidate watermark can be determined, such as "XX video".
[0077] For example, for each target image, a binary classification model can be used to perform watermark detection on each target image to determine a partial image including a watermark in the target image, and then a watermark recognition model can be used to recognize the partial image to determine the watermark type corresponding to the partial image; furthermore, the position, label (i.e., watermark type, such as "XX video") and confidence level (confidence level of the recognized label, such as the confidence level of being recognized as "XX video") of the candidate watermark can also be obtained.
[0078] Step S203: Cluster all candidate watermarks according to the watermark category and position information corresponding to each candidate watermark to obtain a watermark clustering result, where the watermark category of the designated candidate watermark in all candidate watermarks that are clustered to obtain the watermark clustering result is the candidate watermark category, and the position information of the designated candidate watermark is the candidate position information.
[0079] When processing video frame-extracted pictures, the appearance of watermarks is time-sequential, and the positions where watermarks exist are relatively stable. Therefore, in the process of detecting information around the watermark logo, the same watermark at the same position can be clustered first, and for the clustered result, a text detection and text recognition algorithm can be used to perform a single detection of information around the watermark to obtain other text information of all watermarks within the same class.
[0080] Therefore, after determining the candidate watermarks corresponding to each target image, all candidate watermarks can be clustered. All candidate watermarks here include the candidate watermarks in all target images.
[0081] After obtaining all candidate watermarks, as well as the watermark category and location information corresponding to each candidate watermark, all candidate watermarks can be clustered according to the watermark category and location information corresponding to each candidate watermark to obtain a watermark clustering result. The candidate watermarks that are clustered to obtain the watermark clustering result are designated candidate watermarks. Among them, all candidate watermarks in the same clustering result have the same watermark category and location information. The watermark category of the designated candidate watermark is recorded as the candidate watermark category, and the location information of the designated candidate watermark is recorded as the candidate location information. That is, when there is a watermark clustering result A, and the watermark clustering result A includes designated candidate watermarks a1, a2, and a3, the watermark category and location information in the designated candidate watermarks a1, a2, and a3 are the same.
[0082] For example, for 20 candidate pictures obtained by video frame extraction, there is a watermark of "XX Video" in the upper right corner of each candidate picture. The position of this "XX Video" is fixed, and the category is the same, all being "XX Video". Through such clustering, it can be confirmed that there is a watermark of "XX Video" in the upper right corner of this video.
[0083] There are two possibilities for a video to have multiple clustering results. One is that the watermark will flutter and may appear in the upper left corner and the lower right corner at the same time. After clustering, there will be two categories, one is the watermark in the upper left corner and the other is the watermark in the lower right corner. Another possibility is that there may be multiple watermarks in a video. If it includes both the watermark of "YY Video" and the watermark of "XX Video", that is: the original video comes from the XX video platform, but is uploaded by the user to the YY video platform, and a new watermark is added.
[0084] Through the method in this embodiment, the watermark clustering result in the watermark to be detected can be determined by clustering. And since the watermark category of the designated candidate watermark that is clustered to obtain the watermark clustering result among all candidate watermarks is the candidate watermark category, and the location information of the designated candidate watermark is the candidate location information; therefore, the number of watermarks that need to be detected for surrounding watermarks can be reduced, and the detection efficiency of surrounding watermarks can be improved.
[0085] Step S103, determine the target configuration information corresponding to the watermark clustering result in the preset configuration file, where the target configuration information is used to indicate the detection scheme for performing surrounding watermark detection corresponding to the watermark clustering result.
[0086] After determining the watermark clustering result, since the watermark clustering result is used to indicate the distribution of watermarks, it is possible to determine the watermarks indicated by the watermark clustering result and the distribution of the watermarks in the object to be detected.
[0087] After determining the watermarks indicated by the watermark clustering result, the target configuration information corresponding to the watermark clustering result can be determined in the preset configuration file.
[0088] The preset configuration file can be a file for storing different configuration information, and different configuration information can correspond to different categories of watermarks.
[0089] Furthermore, based on the watermark category corresponding to the watermarks indicated by the watermark clustering result, the target configuration information corresponding to the watermark clustering result can be determined.
[0090] Step S104: According to the target configuration information, perform peripheral watermark detection on the periphery of the specified watermark corresponding to the watermark clustering result, and determine the target watermarks in the object to be detected.
[0091] After obtaining the target configuration information, since the target configuration information is used to indicate the detection scheme for performing peripheral watermark detection corresponding to the watermark clustering result, therefore, according to this target configuration information, peripheral watermark detection can be performed on the periphery of the specified watermark corresponding to the watermark clustering result; generally, since the specified watermark is the watermark partial image in one of the frames of the object to be detected, therefore, performing peripheral watermark detection on the periphery of the specified watermark means performing peripheral watermark detection on the periphery of the specified watermark in the image of the frame where the specified watermark is located.
[0092] The specified watermark corresponding to the watermark clustering result can be one of all candidate watermarks obtained by clustering to get the watermark clustering result.
[0093] Based on the specified watermark, peripheral watermark detection can be performed on its periphery to detect whether there are other watermarks around the specified watermark. When there are other watermarks, the other watermarks and the specified watermark can be determined as the target watermarks; when there are no other watermarks, the specified watermark can be directly determined as the target watermark.
[0094] For example, when the specified watermark corresponding to the watermark clustering result A is "XX Video", the picture I where the specified watermark is located can be determined; then peripheral watermark detection is performed on the periphery of "XX Video" in the picture I. If peripheral watermarks such as "Exclusive Broadcast" are detected, then "XX Video" and "Exclusive Broadcast" are determined as the target watermarks. If no peripheral watermarks are detected, then only "XX Video" is used as the target watermark.
[0095] Through the method in this embodiment, based on obtaining the watermark clustering result of the object to be detected, the surrounding watermarks of the specified watermark corresponding to the watermark clustering result are detected according to the target configuration information corresponding to the watermark clustering result, so that the purpose of detecting the surrounding watermarks of the specified watermark by using the detection scheme for the watermark clustering result can be achieved, the detection efficiency of watermark detection can be effectively improved, and further the technical problem that other information around the watermark identifier cannot be detected by a general watermark detection algorithm in the related art can be solved.
[0096] As an optional implementation manner, like the foregoing method, step S103 determines the target configuration information corresponding to the watermark clustering result in the preset configuration file, including the following steps:
[0097] Step S301, determine the candidate watermark category of the specified candidate watermark that is clustered to obtain the watermark clustering result.
[0098] Since all candidate watermarks that are clustered to obtain the same watermark clustering result have the same watermark category and location information, after obtaining the watermark clustering result, the candidate watermark category of any candidate watermark in the watermark clustering result can be determined.
[0099] Step S302, match the specified watermark category that is the same as the candidate watermark category among all the preset watermark categories, and determine the preset configuration information corresponding to the specified watermark category as the target configuration information, where the preset configuration file stores the preset watermark categories and the preset configuration information set correspondingly.
[0100] The preset configuration file stores the preset watermark categories and the preset configuration information set correspondingly in advance; optionally, since different watermark categories may have the same setting strategy for surrounding watermarks, the same preset configuration information may correspond to one or more preset watermark categories.
[0101] After obtaining the candidate watermark category, the specified watermark category that is the same as the candidate watermark category can be first matched among all the preset watermark categories in the preset configuration file, and then the preset configuration information corresponding to the specified watermark category is determined as the target configuration information.
[0102] For example, when it is determined that the candidate watermark category is "YY Video", then "YY Video" can be used to match in the preset configuration file, the "YY Video" in the preset configuration file is determined, and the preset configuration information B1 corresponding to "YY Video" in the preset configuration file is obtained. Finally, the preset configuration information B1 can be used as the target configuration information.
[0103] Through the method in this embodiment, the target configuration information corresponding to the watermark clustering result can be determined, which is convenient for subsequent targeted detection of surrounding watermarks based on the target configuration information for the watermark clustering result, so as to improve the detection efficiency.
[0104] As Figure 3 shown, as an optional implementation manner, for the method as described above, before performing surrounding watermark detection on the periphery of the specified watermark corresponding to the watermark clustering result according to the target configuration information in step S104 and determining the target watermark in the object to be detected, the method further includes the following steps:
[0105] Step S401, among all candidate watermarks, determine all specified candidate watermarks used for clustering to obtain the watermark clustering result, and the confidence level corresponding to each specified candidate watermark, where the confidence level is used to indicate the probability that the specified candidate watermark belongs to the candidate watermark category;
[0106] Step S402, among all specified candidate watermarks, determine the specified candidate watermark with the highest confidence level as the specified watermark.
[0107] Since all specified candidate watermarks that cluster to obtain the same watermark clustering result have the same watermark category (i.e., candidate watermark category) and location information, the confidence level corresponding to each specified candidate watermark obtained in advance can be determined. After determining the confidence level corresponding to each specified candidate watermark, the maximum confidence level can be determined from the confidence levels; furthermore, the specified candidate watermark with the highest confidence level can be determined as the specified watermark.
[0108] Through the method in this embodiment, by determining the specified candidate watermark with the highest confidence level as the specified watermark, and generally, the higher the confidence level, the clearer the watermark, so the accuracy of subsequent surrounding watermark detection can be effectively improved by this method.
[0109] As an optional implementation manner, for the method as described above, step S104 performs surrounding watermark detection on the periphery of the specified watermark corresponding to the watermark clustering result according to the target configuration information and determines the target watermark in the object to be detected, including the following steps:
[0110] Step S501, when the target configuration information includes surrounding watermark detection sub-information indicating that surrounding watermark detection needs to be performed, perform text detection on the image area within a preset range from the specified watermark in the specified image through a preset text detection algorithm, where the specified image is the target image where the specified watermark is located.
[0111] When the peripheral watermark detection sub - information indicating the need for peripheral watermark detection is included in the target configuration information, it indicates that the specified watermark of the specified watermark type will have peripheral watermark settings. Therefore, it is necessary to perform text detection on the image area within the preset range from the specified watermark in the specified image through a preset text detection algorithm.
[0112] The preset text detection algorithm can be an algorithm used to detect whether there is text in the image area within the preset range from the specified watermark in the specified image.
[0113] The preset range can be set according to the detection range of the peripheral watermark. Generally, it can be set based on the historical settings of the peripheral watermark of the candidate watermark type. For example, within the preset distance below, within the preset distance above, within the preset distance on the left, within the preset distance on the right, etc.
[0114] For example, when the target configuration information of "XX Video" includes text related to "presence of peripheral watermark", it indicates the need for peripheral watermark detection; and the CTPN text detection algorithm can be used to perform text detection on the image area within 10 pixels from the "XX Video" watermark in the specified image.
[0115] Step S502, when target text is detected in the image area, determine the target watermark according to the target configuration information and based on the positional relationship between the target text and the specified watermark.
[0116] When target text is detected in the image area, then according to the target configuration information, continue to determine the peripheral watermark of the specified watermark based on the positional relationship between the target text and the specified watermark, and thus obtain the target watermark.
[0117] Through the method in this embodiment, it is possible to determine whether text detection needs to be performed on the specified watermark based on the peripheral watermark detection sub - information in the target configuration information, so as to determine the final target watermark based on the detected target text in the later stage.
[0118] As an alternative implementation manner, like the aforementioned method, in step S502, when target text is detected in the image area, determine the target watermark according to the target configuration information and based on the positional relationship between the target text and the specified watermark, including the following steps:
[0119] Step S601, when target text is detected in the image area, determine the target position information of the target text, where the target position information is used to indicate the position of the target text relative to the specified watermark.
[0120] When the target text is detected within the image area, the positional relationship between the target text and the specified watermark can be determined, and this positional relationship is determined as the target position information of the target text.
[0121] For example, when the target text is located below the specified watermark, the target position information may include one or more sub-information, and the sub-information may include, but is not limited to, information such as "below", "above", "left", "right", etc. that indicates the positional relationship between the target text and the specified watermark.
[0122] Step S602, when the reserved text position sub-information in the target configuration information does not include the target position information, filter the target text.
[0123] There may also be reserved text position sub-information in the target configuration information, and the reserved text position sub-information may be information used to indicate the conditions for retaining the detected text.
[0124] When the reserved text position sub-information in the target configuration information does not include the target position information, filter the target text, that is, do not regard the target text as the surrounding watermark.
[0125] For example, when the reserved text position sub-information is "below", but the target position information is "above", then the reserved text position sub-information does not include the target position information, so the target text is filtered.
[0126] Step S603, when the reserved text position sub-information in the target configuration information includes the target position information, retain the target text; determine the target watermark according to the target configuration information, based on the text content of the target text and the specified watermark.
[0127] When the reserved text position sub-information in the target configuration information includes the target position information, retain the target text, that is, it is necessary to further judge the target text to determine whether it can be used as the surrounding watermark.
[0128] For example, when the reserved text position sub-information is "below" and the target position information is "below", then the reserved text position sub-information includes the target position information, so the target text is retained. And determine the target watermark according to the target configuration information, based on the text content of the target text and the specified watermark.
[0129] Through the method in this embodiment, it is possible to determine whether it is necessary to detect the position of the target text based on the reserved text position sub-information in the target configuration information, so that the final target watermark can be determined based on the detected target position information of the target text. As an alternative implementation, as described in the foregoing method, step S603 determines the target watermark according to the target configuration information and based on the text content of the target text and the specified watermark, including the following steps:
[0130] Step S701, when the target configuration information includes text recognition sub-information for indicating that text content recognition of the target text is required, perform text recognition on the target text to obtain a recognition result; when the recognition result indicates that the text content includes the keyword indicated by the text recognition sub-information, determine the target text and the specified watermark as the target watermark; when the recognition result indicates that the text content does not include the keyword indicated by the text recognition sub-information, determine the specified watermark as the target watermark.
[0131] When the target text is detected in the image area and the target text needs to be retained, it means that there is a probability that the target text is recognized as a surrounding watermark.
[0132] Therefore, in this case, if the target configuration information includes text recognition sub-information for indicating that text content recognition of the target text is required, perform text recognition on the target text to obtain a recognition result.
[0133] The text recognition sub-information can be configuration information for indicating whether text recognition is required. For example: it is necessary to recognize whether "ID" exists, where "ID" can be the keyword to be recognized. When the recognition result indicates that the text content includes the keyword indicated by the text recognition sub-information, the target text can be determined as a surrounding watermark and jointly determined as the target watermark with the specified watermark; if the recognition result indicates that the text content does not include the keyword indicated by the text recognition sub-information, it means that there is no surrounding watermark, and only the specified watermark is determined as the target watermark.
[0134] Step S702, when the target configuration information does not include text recognition sub-information, determine the target text and the specified watermark as the target watermark.
[0135] When the target configuration information does not include text recognition sub-information, that is, when the target text is any text content, it can be used as a surrounding watermark. Therefore, there is no need to perform text recognition on the target text, and the target text is directly used as a surrounding watermark, and then the target text and the specified watermark can be determined as the target watermark.
[0136] Through the method in this embodiment, by configuring the text recognition sub-information in the target configuration information, it is possible to determine whether it is necessary to recognize the text content of the target text to judge whether it is a surrounding watermark, and thus the accuracy of the finally recognized target watermark can be effectively improved.
[0137] As an alternative implementation, as described in the foregoing method, the method further includes the following steps:
[0138] Step S801, obtain the watermark to be added for the new watermark category.
[0139] When it is necessary to perform surrounding watermark detection on the watermark of the new watermark category, it is necessary to obtain the watermark to be added for the new watermark category.
[0140] The new watermark category may be a watermark category for which there is no corresponding configuration information in the preset configuration file.
[0141] Step S802, determine the surrounding watermark detection scheme corresponding to the watermark to be added.
[0142] After obtaining the watermark to be added, the surrounding watermark detection scheme corresponding to the watermark to be added can be determined by observing the style of the surrounding watermark of the watermark to be added.
[0143] For example, when the watermark to be added includes text on the left side and the keyword included in the text is "ID", the determined surrounding watermark detection scheme is: detect whether the left side of the watermark of the new watermark category contains text and whether the text contains the keyword "ID". If the above conditions are met, the detected text is determined as the surrounding watermark.
[0144] Step S803, in the case where there is no specified configuration information in the preset configuration file that is adapted to the surrounding watermark detection scheme, add new configuration information corresponding to the new watermark category to the preset configuration file.
[0145] After determining the surrounding watermark detection scheme, it is possible to judge whether there is specified configuration information in the preset configuration file that is adapted to the surrounding watermark detection scheme; optionally, new configuration information corresponding to the surrounding watermark detection scheme can be generated first; then the new configuration information is compared with all the specified configuration information to determine whether there is already specified configuration information that is adapted to the surrounding watermark detection scheme. The new configuration information may be the configuration information for implementing the surrounding watermark detection scheme. The implementation method of implementing the surrounding watermark detection through the new configuration information can refer to the implementation method of detecting the target watermark in the foregoing embodiment and will not be elaborated here.
[0146] When there is no specified configuration information adapted to the surrounding watermark detection scheme, new configuration information corresponding to the new watermark category is added to the preset configuration file, so that the watermark of the new watermark category can be detected for surrounding watermarks through the new configuration information in the later stage.
[0147] Step S804, when there is specified configuration information adapted to the surrounding watermark detection scheme in the preset configuration file, establish a correspondence between the new watermark category and the specified configuration information in the preset configuration file.
[0148] When there is specified configuration information adapted to the surrounding watermark detection scheme in the preset configuration file, the correspondence between the new watermark category and the specified configuration information can be directly established in the preset configuration file, so that the watermark of the new watermark category can be detected for surrounding watermarks through the specified detection scheme corresponding to the specified configuration information in the later stage.
[0149] Through the method in this embodiment, the specified configuration information for detecting the watermark of the new watermark category can be quickly configured, and then the surrounding watermarks of the watermark of the new watermark category can be detected based on the specified detection scheme corresponding to the specified configuration information.
[0150] As Figure 4 described, an application example applying any of the foregoing embodiments is provided:
[0151] I. Specific algorithm for detecting surrounding information of watermarks:
[0152] 1. When detecting the watermark of a short video (i.e., the object to be detected), first extract frames from the video. 20 frames of pictures (i.e., target images) are extracted from each short video for frame extraction and watermark detection, and the positions, labels, and confidence levels of each extracted-frame watermark (i.e., candidate watermark) are obtained.
[0153] 2. Cluster the extracted-frame watermarks of the same watermark category at the same position. There may be multiple clustering results in one video.
[0154] 3. Dynamically read the target configuration file and process each clustering result separately. If a watermark clustering result requires surrounding information detection, select the picture where the watermark with the highest confidence level in the watermark clustering result is located (i.e., the specified image), and use the CTPN text detection algorithm (i.e., the preset text detection algorithm) to detect the text around the watermark in this picture, and obtain the text position information (i.e., the target position information) of all the text positions.
[0155] 4. For the watermark clustering results that have undergone text detection, dynamically read the target configuration file and obtain the preset position information of the text information to be detected that may exist around the extracted-frame watermark (i.e., retain the text position sub-information). Based on this preset position information and the detected text position information, filter out the text content that does not need to be detected.
[0156] 5. Under the condition that there are still conditions that may contain text to be detected (i.e., there is text recognition sub-information) after clustering for text detection and filtering by text position. Dynamically read the target configuration file, determine whether secondary verification of OCR is required. If required, perform OCR text recognition on the position of the text detection, and match the recognition result with the keyword in the configuration file. If the match is successful, the text corresponding to this position is the text information around the watermark to be detected. If secondary verification of OCR is not required, directly consider the position where the text is located as the text information around the watermark to be detected.
[0157] II. Update of the watermark detection configuration file:
[0158] 1. It is found that there is a new style (i.e., a new watermark category) among the currently supported detected watermarks.
[0159] 2. Determine whether the text positions to be detected in the new style are common with the current configuration file. If they are common, there is no need to modify. If they are not common, add the position information to be detected for this watermark in the configuration file.
[0160] 3. Determine whether the text keywords to be recognized in the new style are common with the configuration file. If they are common, there is no need to modify. If they are not common, add the corresponding keyword information to the configuration file.
[0161] As Figure 5 shown, according to an embodiment of another aspect of the present application, a watermark detection device is further provided, including:
[0162] An acquisition module 1 for acquiring an object to be detected for the watermark to be detected;
[0163] A determination module 2 for determining a watermark clustering result corresponding to the object to be detected by performing watermark detection on the object to be detected, where the watermark clustering result is used to indicate the distribution of the watermark in the object to be detected;
[0164] An information determination module 3 for determining target configuration information corresponding to the watermark clustering result in a preset configuration file, where the target configuration information is used to indicate a detection scheme for performing surrounding watermark detection corresponding to the watermark clustering result;
[0165] The detection module 4 is configured to perform peripheral watermark detection on the periphery of the specified watermark corresponding to the watermark clustering result according to the target configuration information, and determine the target watermark in the object to be detected.
[0166] Specifically, for the specific processes of each module in the device according to the embodiments of the present invention to implement their functions, reference may be made to the relevant descriptions in the method embodiments, which will not be elaborated herein.
[0167] According to another embodiment of the present application, there is also provided an electronic device, including: as Figure 6 shown, the electronic device may include: a processor 1501, a communication interface 1502, a memory 1503, and a communication bus 1504. Among them, the processor 1501, the communication interface 1502, and the memory 1503 communicate with each other through the communication bus 1504.
[0168] The memory 1503 is used to store a computer program;
[0169] The processor 1501, when executing the program stored on the memory 1503, implements the steps of the above-mentioned method embodiments.
[0170] The bus mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity, only a thick line is used to represent it in the figure, but it does not mean that there is only one bus or one type of bus.
[0171] The communication interface is used for communication between the above electronic device and other devices.
[0172] The memory may include a Random Access Memory (RAM), and may also include a Non-Volatile Memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.
[0173] The above-mentioned processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0174] An embodiment of the present application further provides a computer-readable storage medium. The storage medium includes a stored program, wherein the program, when running, executes the method steps of the above method embodiment.
[0175] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element.
[0176] The above description is only a specific implementation manner of the present invention, enabling those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but rather to the broadest scope consistent with the principles and novel features claimed herein.
Claims
1. A watermark detection method, characterized in that, Including: Obtain an object to be detected that needs to be watermark - detected; Determine a watermark clustering result corresponding to the object to be detected by performing watermark detection on the object to be detected, where the watermark clustering result is used to indicate the distribution of watermarks in the object to be detected; Determine target configuration information corresponding to the watermark clustering result in a preset configuration file, where the target configuration information is used to indicate a detection scheme for performing peripheral watermark detection corresponding to the watermark clustering result; Perform peripheral watermark detection on the periphery of a specified watermark corresponding to the watermark clustering result according to the target configuration information, and determine the target watermark in the object to be detected, including: when the target configuration information includes peripheral watermark detection sub - information indicating that the peripheral watermark detection needs to be performed, perform text detection on an image area within a preset range from the specified watermark in a specified image through a preset text detection algorithm, where the specified image is the target image where the specified watermark is located; when target text is detected in the image area, determine the target watermark according to the target configuration information and based on the positional relationship between the target text and the specified watermark.
2. The method according to claim 1, characterized in that, When the object to be detected is a video to be detected, the step of determining a watermark clustering result corresponding to the object to be detected by performing watermark detection on the object to be detected includes: Extract at least one frame of target image from the video to be detected; Perform watermark detection on each target image, determine candidate watermarks corresponding to each target image, and determine the watermark category and position information corresponding to each candidate watermark; Cluster all the candidate watermarks according to the watermark category and position information corresponding to each candidate watermark to obtain the watermark clustering result, where the watermark category of the specified candidate watermark that is clustered to obtain the watermark clustering result among all the candidate watermarks is the candidate watermark category, and the position information of the specified candidate watermark is the candidate position information.
3. The method according to claim 2, characterized in that, The step of determining target configuration information corresponding to the watermark clustering result in the preset configuration file includes: Determine the watermark category of the watermark clustering result as the candidate watermark category corresponding to the specified candidate watermark; Match a specified watermark category that is the same as the candidate watermark category from all preset watermark categories, and determine the preset configuration information corresponding to the specified watermark category as the target configuration information, where the preset configuration file stores the preset watermark categories and the preset configuration information set correspondingly.
4. The method according to claim 2, characterized in that, Before performing peripheral watermark detection on the periphery of a specified watermark corresponding to the watermark clustering result according to the target configuration information and determining the target watermark in the object to be detected, the method further includes: Among all the candidate watermarks, determine all the specified candidate watermarks used for clustering to obtain the watermark clustering result, and the confidence level corresponding to each specified candidate watermark, where the confidence level is used to indicate the probability that the specified candidate watermark is of the candidate watermark category. Among all the specified candidate watermarks, the specified candidate watermark with the highest confidence is determined as the specified watermark.
5. The method according to claim 1, characterized in that, When the target text is detected within the image area, determining the target watermark according to the target configuration information and based on the positional relationship between the target text and the specified watermark includes: When the target text is detected within the image area, determining the target position information of the target text, where the target position information is used to indicate the position of the target text relative to the specified watermark; When the reserved text position sub-information in the target configuration information does not include the target position information, filtering the target text; When the reserved text position sub-information in the target configuration information includes the target position information, retaining the target text; determining the target watermark according to the target configuration information and based on the text content of the target text and the specified watermark.
6. The method according to claim 5, characterized in that, Determining the target watermark according to the target configuration information and based on the text content of the target text and the specified watermark includes: When the text recognition sub-information for indicating that the text content of the target text needs to be recognized is included in the target configuration information, performing text recognition on the target text to obtain a recognition result; when the recognition result indicates that the text content includes the keyword indicated by the text recognition sub-information, determining the target text and the specified watermark as the target watermark; when the recognition result indicates that the text content does not include the keyword indicated by the text recognition sub-information, determining the specified watermark as the target watermark; When the text recognition sub-information is not included in the target configuration information, determining the target text and the specified watermark as the target watermark.
7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: Obtaining a watermark to be added of a new watermark category; Determining a surrounding watermark detection scheme corresponding to the watermark to be added; When there is no preset configuration information identical to the surrounding watermark detection scheme in the preset configuration file, adding a new detection scheme corresponding to the new watermark category to the preset configuration file; When there is a specified detection scheme identical to the surrounding watermark detection scheme in the preset configuration file, establishing a correspondence between the new watermark category and the specified detection scheme in the preset configuration file.
8. A watermark detection device, characterized in that, Including: An acquisition module, configured to acquire an object to be detected for watermark detection; A determination module, configured to determine a watermark clustering result corresponding to the object to be detected by performing watermark detection on the object to be detected, where the watermark clustering result is used to indicate the distribution of watermarks in the object to be detected; An information determination module, configured to determine target configuration information corresponding to the watermark clustering result in a preset configuration file, where the target configuration information is used to indicate a detection scheme for performing surrounding watermark detection corresponding to the watermark clustering result. The detection module is used to perform peripheral watermark detection on the periphery of the specified watermark corresponding to the watermark clustering result according to the target configuration information, and determine the target watermark in the object to be detected, including: when the target configuration information includes peripheral watermark detection sub-information for indicating that the peripheral watermark detection needs to be performed, performing text detection on the image area within a preset range from the specified watermark in the specified image through a preset text detection algorithm, where the specified image is the target image where the specified watermark is located; when target text is detected in the image area, determining the target watermark according to the target configuration information and based on the positional relationship between the target text and the specified watermark.
9. An electronic device, characterized in that, Including: A processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus; The memory is used to store a computer program; When the processor executes the computer program, it implements the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The storage medium includes a stored program, where the program executes the method according to any one of claims 1 to 7 when running.
Citation Information
Patent Citations
Image watermark processing method and device based on artificial intelligence and electronic equipment
CN111160335A
Icon identification method and device and computer readable storage medium
CN113822126A