Identifier generation method and electronic device
By performing feature extraction and quantification processing on the media content, a cluster center index is generated, which solves the shortcomings of digital content identification in the existing technology in fuzzy comparison and similar query scenarios, and achieves efficient and accurate query results.
Patent Information
- Application Number
- PCT/CN2024/074198
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-20
- Filing Date
- 2024-01-26
- Publication Date
- 2024-10-24
AI Technical Summary
Existing technologies are difficult to generate digital content identifiers suitable for fuzzy comparison and similar queries, especially in copyright query and metadata query scenarios. Existing methods cannot effectively handle similar digital content.
By obtaining media content, extracting its features, and performing quantitative processing to generate digital content identification, the cluster center index is used to reduce data volume and complexity, and improve query efficiency and accuracy.
It realizes the association between digital content identification and media content in scenarios such as copyright query and metadata query, reduces matching complexity and calculation cost, and improves query efficiency and accuracy.
Smart Images

Figure CN2024074198_24102024_PF_FP_ABST
Abstract
Description
Marking generation method and electronic device
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on April 20, 2023, with application number 202310450602.6 and application name “Identification Generation Method and Electronic Device”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The embodiments of the present application relate to the field of data processing, and in particular to an identification method and electronic device. Background Art
[0003] Digital content identifiers are typically used to uniquely identify digital content and are widely used in file systems and databases. They are often used in various scenarios such as resource retrieval and copyright evidence.
[0004] Currently, different digital content is usually assigned different digital content identifiers by a centralized management agency in numerical order; however, for similar digital content, their digital content identifiers may have no correlation, and therefore are not suitable for some fuzzy comparison and similarity query application scenarios.
[0005] Summary of the Invention
[0006] In view of this, the present application provides an identifier generation method and electronic device. The digital content identifier generated by this method can be applied to application scenarios such as copyright query, metadata query, and fuzzy comparison and similarity query.
[0007] In a first aspect, an embodiment of the present application provides an identifier generation method, which includes: first, acquiring media content; then, performing feature extraction on the media content to obtain digital content features of the media content; then, quantifying the digital content features to obtain first data; and then, determining the digital content identifier of the media content based on the first data.
[0008] In this way, digital content features are generated through feature extraction, and then digital content identifiers are generated based on the data content features, which can associate the digital content identifiers with media content, and thus be suitable for application scenarios such as fuzzy comparison and similarity queries such as copyright queries and metadata queries.
[0009] Secondly, quantization processing can reduce the amount of data, and the digital content identifier is generated based on the digital content characteristics after quantization processing; this can reduce the complexity of generating the digital content identifier; it can also reduce the amount of digital content identifier data, thereby reducing the storage space occupied by the digital content identifier.
[0010] Again, in the application scenarios of fuzzy comparison and similarity query such as copyright query and metadata query, compared with the existing technology that matches based on digital content features, this application matches based on the digital content features after quantization (i.e., the first data), which can reduce the matching complexity, as well as the computational cost and time cost in the query process, and improve the query efficiency.
[0011] For example, media content, namely, media content, may also be referred to as digital content; digital content refers to content of different content types such as text, image, sound, etc. that exists in digital form.
[0012] Exemplarily, the digital content feature may be a multi-dimensional vector.
[0013] For example, the digital content identifier may refer to a Digital Objects Identifier (DOI). A Digital Object Identifier is a string of numbers, letters, or other symbols that identifies a digital content resource.
[0014] For example, in some scenarios, the quantization process may be called a quantization and compression process (Quantization and compression).
[0015] According to the first aspect, the first data indicates an index of one or more first cluster centers, where the one or more first cluster centers are one or more of a plurality of cluster centers, and the plurality of cluster centers are used for classifying digital content features.
[0016] For example, multiple cluster centers are used to classify digital content features. Multiple cluster centers can be obtained through pre-training, and indexes of multiple cluster centers can also be obtained through pre-training. One cluster center can be used to determine one feature type.
[0017] Exemplarily, the quantization process may include classifying the digital content features using a trained feature classification model to obtain a first cluster center, wherein the plurality of cluster centers are obtained by training the feature classification model.
[0018] For example, the index can be used to uniquely identify a cluster center, and different cluster centers have different indexes.
[0019] Exemplarily, the index of the cluster center can be a binary string, that is, the quantization processing is a binary quantization processing; in this way, the first data obtained can be a binary string, that is, the first data with a smaller data volume is obtained; and then in the application scenarios of fuzzy comparison and similarity query, it can further reduce the matching complexity and improve the query efficiency.
[0020] It should be understood that the index of the cluster center may also be a decimal string or a hexadecimal string, and this application does not impose any limitation on this.
[0021] According to the first aspect, or any implementation of the first aspect above, the one or more first cluster centers are one or more cluster centers at a preset distance from the digital content feature to the multiple cluster centers.
[0022] That is, one or more cluster centers that are at a preset distance from the digital content feature may be searched from a plurality of cluster centers as the one or more first cluster centers.
[0023] For example, the cluster center can be represented by a vector.
[0024] Exemplarily, the dimension of the cluster center is the same as the dimension of the digital content feature.
[0025] For example, the distance between the digital content feature and the cluster center may be Euclidean distance, Manhattan distance, etc., which is not limited in this application.
[0026] It should be understood that the preset distance can be set as required and this application does not impose any restrictions on this.
[0027] According to the first aspect, or any implementation of the first aspect above, the one or more first cluster centers are one or more cluster centers that are closest or farthest from the digital content feature among the multiple cluster centers.
[0028] Among them, the closer the distance between the digital content feature and the cluster center, the more accurate the classification of the digital content feature; and when the cluster center with the closest distance is selected as the first cluster center, the subsequent use of the index of the first cluster center can also accurately represent the digital content feature; and thus in the application scenarios of fuzzy comparison and similarity query, the accuracy of the query can be improved.
[0029] According to the first aspect, or any implementation of the first aspect above, digital content features are quantified to obtain first data, including: classifying the digital content features to determine one or more first cluster centers; and determining the first data based on indexes of the one or more first cluster centers.
[0030] According to the first aspect, or any implementation of the first aspect above, the multiple first cluster centers are multiple cluster centers with preset distances from the multiple second data to the multiple cluster centers, and the multiple second data are data obtained by feature transformation based on digital content features.
[0031] According to the first aspect, or any implementation of the first aspect above, digital content features are quantified to obtain first data, including: performing feature transformation on the digital content features to obtain multiple second data; classifying the multiple second data to determine multiple first cluster centers, where the first cluster center is a cluster center at a preset distance from the second data to the multiple cluster centers; and determining the first data based on the indexes of the multiple first cluster centers.
[0032] Exemplarily, feature transformation may include feature division, that is, dividing the first data into a plurality of second data.
[0033] Exemplarily, feature transformation may include homogenization and feature segmentation. The digital content features may be homogenized to obtain a third intermediate feature; then, the third intermediate feature may be segmented to obtain a plurality of second data. Homogenization involves using all elements in the digital content features to determine each element in the third intermediate feature. This disperses the concentration of the digital content features, resulting in a uniform energy distribution, facilitating subsequent classification of the digital content features.
[0034] In this case, the dimension of the first cluster center is the same as that of the second data, and the second data is obtained by performing feature transformation on the digital content features. It can be seen that the data volume of the second data is smaller than the data volume of the first data; therefore, compared with directly searching for the first cluster center based on the first data, the dimension of the cluster center in this method is lower, and thus the classification calculation amount is small and the classification efficiency is high; thereby, the efficiency of quantitative processing can be improved, as well as the efficiency of generating digital content identifiers.
[0035] In addition, the lower the dimension of the cluster center, the smaller the space occupied by the cluster center; thus, the space occupied by the cluster center can be reduced.
[0036] Thirdly, by selecting the first cluster center with a smaller granularity, the selected first cluster center is more accurate, and thus the obtained first data is also more accurate, thereby improving the accuracy of the query.
[0037] According to the first aspect, or any implementation of the first aspect above, the digital content feature is multi-dimensional data, and the dimension of the second data is smaller than the dimension of the digital content feature.
[0038] According to the first aspect, or any implementation of the first aspect above, the indexes of different first cluster centers are used to measure the similarity between different media contents.
[0039] That is, in the subsequent query process, the indexes of the first cluster centers corresponding to the two media contents can be used for matching to calculate the similarity between the two media contents.
[0040] According to the first aspect, or any implementation of the first aspect above, feature extraction is performed on media content to obtain digital content features of the media content, including: inputting the media content into a first feature extraction model and outputting the digital content features of the media content.
[0041] According to the first aspect, or any implementation of the first aspect above, the scene type to which the media content belongs corresponds to a first feature extraction model, the first feature extraction model is one or more of a plurality of feature extraction models, and the plurality of feature extraction models correspond one-to-one to a plurality of scene types.
[0042] Because the first feature extraction model corresponding to the scene type to which the media content belongs is more effective at extracting features from the media content within the scene type to which the media content belongs than feature extraction models corresponding to other scene types, using the first feature extraction model corresponding to the scene type to which the media content belongs for feature extraction can improve the accuracy of digital content features. This can improve query accuracy.
[0043] According to the first aspect, or any implementation of the first aspect above, the method further includes: classifying the media content to determine the scene type to which the media content belongs.
[0044] Exemplarily, the media content may be input into a classifier, and the scene type to which the media content belongs may be output.
[0045] According to the first aspect, or any implementation of the first aspect above, determining the digital content identifier of the media content based on the first data includes: encoding the first data to obtain the digital content identifier of the media content.
[0046] According to the first aspect, or any implementation of the first aspect above, the media content includes at least one of the following: text, video, graphics, audio, image, or 3D (3-Dimension) model.
[0047] The 3D model can be obtained through three-dimensional modeling and can be a polygonal representation of a real-world entity or a fictional object.
[0048] It should be understood that the media content may also include other types of content, which is not limited in this application.
[0049] According to the first aspect, or any implementation of the first aspect above, the digital content feature includes a digital fingerprint.
[0050] For example, the features extracted and output by a neural network model can be called digital fingerprints.
[0051] Exemplarily, a pHASH (Perceptual Hash) algorithm is also used to extract features from the media content to obtain digital content features of the media content.
[0052] According to the first aspect, or any implementation of the first aspect above, the first feature extraction model is a trained neural network model, and the training set of the first feature extraction model includes: first training data, second training data, and third training data; wherein the scene type to which the first training data belongs and the scene type to which the third training data belongs are the same as the scene type to which the media content belongs; the third training data is different from the first training data; and the second training data is adversarial data for the first training data. In this way, the trained feature extraction model can extract accurate features even for adversarial data of media content.
[0053] Exemplarily, the second training data is adversarial data of the first training data. In other words, the second training data is data generated by performing adversarial processing on the first training data.
[0054] Exemplarily, when the first training data is text, the adversarial processing may include operations such as synonym conversion; that is, the second training data may be obtained by performing synonym conversion on part of the text in the first training data.
[0055] For example, when the first training data is an image, adversarial processing can include operations such as noise addition, rotation, shearing, and compression; that is, the second training data can be obtained by performing noise addition, rotation, shearing, or compression operations on the first training data. For example, the first training data can be input into Stirmark Benchmark (an image modification tool), and the modification operations (or adversarial operations) provided by Stirmark Benchmark can be used to modify the first training data (also called adversarial processing) to obtain the second training data.
[0056] Exemplarily, when the first training data is a video, the adversarial processing may include operations such as frame extraction, flipping, and blurring; that is, the second training data may be obtained by performing operations such as frame extraction, flipping, and blurring on the first training data.
[0057] Exemplarily, when the first training data is audio, the adversarial processing may include operations such as frequency reduction and audio coding format conversion; that is, the second training data may be obtained by performing operations such as frequency reduction and audio coding format conversion on the first training data.
[0058] According to the first aspect, or any implementation of the first aspect above, the data type of the digital content feature is a floating point type, and the first data is a binary string.
[0059] According to the first aspect, or any implementation of the first aspect, the data volume of the first data is smaller than the data volume of the digital content feature.
[0060] In a second aspect, an embodiment of the present application provides a query method, which includes: first, receiving query data, the query data including first media content and / or a digital content identifier of the first media content, and metadata of the first media content is lost; then, based on the first data of the first media content and the first data of multiple second media content, determining second media content that matches the first media content from multiple second media content; wherein the first data of the first media content is obtained by quantizing the digital content features of the first media content or decoding the first digital content identifier, and the first data of the second media content is obtained by quantizing the digital content features of the second media content or decoding the digital content identifier of the second media content; thereafter, outputting metadata of the second media content that matches the first media content.
[0061] In this way, the metadata of the first media content can be retrieved.
[0062] According to a second aspect, based on the first data of the first media content and the first data of multiple second media content, second media content that matches the first media content is determined from the multiple second media content, including: determining the Hamming distance between the first data of the first media content and the first data of the multiple second media content; and determining the second media content with the smallest corresponding Hamming distance as the second media content that matches the first media content.
[0063] Compared to existing techniques that match by calculating the Euclidean distance of floating-point numbers, this application calculates the Hamming distance of binary strings, which reduces computational complexity and improves query efficiency. Furthermore, the first data is associated with the media content, allowing for accurate retrieval of the metadata for the first media content, thus enhancing the user experience.
[0064] It should be noted that, when the query data is the first media content, the first data in the second aspect and any implementation of the second aspect can be generated according to the method in the first aspect and any implementation of the first aspect.
[0065] In a third aspect, an embodiment of the present application provides a query method, which includes: first, receiving query data, the query data including first media content and / or a digital content identifier of the first media content; then, determining a matching degree between the multiple second digital content items and the first media content based on the first data of the first media content and the first data of the multiple second media content items; wherein the first data of the first media content is obtained by quantizing the digital content features of the first media content or decoding the digital content identifier of the first media content, and the first data of the second media content is obtained by quantizing the digital content features of the second media content or decoding the digital content identifier of the second media content; thereafter, outputting the top N second media content items with the highest matching degree, where N is a positive integer.
[0066] In this way, second media content that is identical or similar to the first media content can be found, which facilitates copyright determination.
[0067] According to a third aspect, determining a degree of matching between the plurality of second digital content items and the first media content based on a first digital content identifier of the first media content and second digital content identifiers of the plurality of second media content items includes using a Hamming distance between first data of the plurality of second media content items and first data of the first media content as the degree of matching between the plurality of second media content items and the first media content.
[0068] Compared to existing techniques that match by calculating the Euclidean distance of floating-point numbers, this application calculates the Hamming distance of binary strings, which reduces computational complexity and improves query efficiency. Furthermore, the correlation between the first data and the media content allows accurate retrieval of second media content that matches the first media content queried by the user, thus improving the user experience.
[0069] It should be noted that, when the query data is the first media content, the first data in the third aspect and any implementation of the third aspect can be generated according to the method in the first aspect and any implementation of the first aspect.
[0070] In addition, the present application can also train the feature extraction model, which may include the following steps: obtaining multiple training sets; multiple training sets correspond one-to-one to multiple scene types, and one training set includes: first training data, second training data, and third training data, the scene type to which the first training data belongs is the same as the scene type to which the third training data belongs, the third training data is different from the first training data, and the second training data is adversarial data of the first training data; based on multiple training sets, training multiple feature extraction models; multiple feature extraction models correspond one-to-one to multiple scene types.
[0071] Specifically, the process of training a first feature extraction model using a first training set can be as follows: input the first training set into the first feature extraction model to obtain the first digital content feature of the first training data in the first training set, the second digital content feature of the second training data in the first training set, and the third digital content feature of the third training data in the first training set; based on the first similarity between the first digital content feature and the second digital content feature, and the second similarity between the first digital content feature and the third digital content feature, the first feature extraction model is trained. In this way, the distance between the digital content feature of the first training data and the digital content feature of the second training data can be shortened, and the distance between the digital content feature of the first training data and the digital content feature of the third training data can be shortened; and then, during use, the first feature extraction model outputs close digital content features for media content and adversarial data of media content, so that the digital content identifier generated by the identifier generation method of the present application is suitable for application scenarios of fuzzy comparison and similarity query such as copyright query and metadata query.
[0072] In addition, the present application can use a quantization processing model for quantization processing, and then the quantization processing model can be trained in advance, which may include: obtaining S digital content features, which are obtained by extracting features from the data; inputting the S digital content features into the quantization processing model, and clustering the S digital content features by the quantization processing model to determine M cluster centers; and training the quantization processing model based on the M cluster centers and the indexes of the M cluster centers.
[0073] Specifically, the quantitative processing model can be trained by constraining the distance between the index of the i-th cluster center and the index of the j-th cluster center to be proportional to the distance between the i-th cluster center and the j-th cluster center, and constraining the distance between the p-th cluster center and the digital content features belonging to the p-th cluster center; where i, j, and p are integers between 1 and M. Training the quantitative processing model includes training M cluster centers and their indexes. In this way, during the identifier generation process, the index of the first cluster center can accurately represent the digital content features, thereby improving query accuracy.
[0074] Illustratively, an embodiment of the present application further provides an identification generation device, which may include:
[0075] An acquisition module, used to acquire media content;
[0076] A feature extraction module is used to extract features from media content to obtain digital content features of the media content;
[0077] A quantization processing module, configured to perform quantization processing on the digital content feature to obtain first data;
[0078] The identifier generation module is used to determine the digital content identifier of the media content according to the first data.
[0079] It should be understood that the identifier generating device can also perform the steps in the above-mentioned first aspect and any implementation manner of the first aspect.
[0080] Illustratively, an embodiment of the present application further provides a query device, which may include:
[0081] a data receiving module, configured to receive query data, the query data including first media content and / or a digital content identifier of the first media content, wherein metadata of the first media content is lost;
[0082] a matching module, configured to determine, from the plurality of second media content pieces, second media content that matches the first media content based on first data of the first media content and first data of the plurality of second media content pieces; wherein the first data of the first media content is obtained by quantizing digital content features of the first media content or decoding a first digital content identifier, and the first data of the second media content is obtained by quantizing digital content features of the second media content or decoding a digital content identifier of the second media content;
[0083] The output module is configured to output metadata of second media content that matches the first media content.
[0084] It should be understood that the query device can also execute the steps in the above-mentioned second aspect and any implementation manner of the second aspect.
[0085] Illustratively, an embodiment of the present application further provides a query device, which may include:
[0086] a data receiving module, configured to receive query data, the query data including first media content and / or a digital content identifier of the first media content, wherein metadata of the first media content is lost;
[0087] a matching module, configured to determine a degree of matching between the plurality of second digital content pieces and the first media content based on first data of the first media content and first data of the plurality of second media content pieces; wherein the first data of the first media content is obtained by quantizing digital content features of the first media content or decoding a digital content identifier of the first media content, and the first data of the second media content is obtained by quantizing digital content features of the second media content or decoding a digital content identifier of the second media content;
[0088] The output module is configured to output the top N pieces of second media content with the highest matching degree, where N is a positive integer.
[0089] It should be understood that the query device can also execute the steps in the above-mentioned third aspect and any implementation manner of the third aspect.
[0090] In a fourth aspect, an embodiment of the present application provides an electronic device comprising: a memory and a processor, wherein the memory is coupled to the processor; the memory stores program instructions, and when the program instructions are executed by the processor, the electronic device executes the identification generation method in the first aspect or any possible implementation of the first aspect.
[0091] The fourth aspect and any implementation of the fourth aspect correspond to the first aspect and any implementation of the first aspect, respectively. The technical effects corresponding to the fourth aspect and any implementation of the fourth aspect can be referred to the technical effects corresponding to the first aspect and any implementation of the first aspect, and will not be repeated here.
[0092] In a fifth aspect, an embodiment of the present application provides a chip comprising one or more interface circuits and one or more processors; the one or more processors receive or send data through the one or more interface circuits, and when the one or more processors execute computer instructions, the electronic device executes the identification generation method in the first aspect or any possible implementation of the first aspect.
[0093] The fifth aspect and any implementation of the fifth aspect correspond to the first aspect and any implementation of the first aspect, respectively. The technical effects corresponding to the fifth aspect and any implementation of the fifth aspect can be referred to the technical effects corresponding to the first aspect and any implementation of the first aspect, and will not be repeated here.
[0094] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a computer or a processor, the computer or the processor executes the identification generation method in the first aspect or any possible implementation of the first aspect.
[0095] The sixth aspect and any implementation of the sixth aspect correspond to the first aspect and any implementation of the first aspect, respectively. The technical effects corresponding to the sixth aspect and any implementation of the sixth aspect can be referred to the technical effects corresponding to the first aspect and any implementation of the first aspect, and will not be repeated here.
[0096] In the seventh aspect, an embodiment of the present application provides a computer program product, which includes computer instructions. When the computer instructions are executed by a computer or a processor, the computer or the processor executes the identification generation method in the first aspect or any possible implementation of the first aspect.
[0097] The seventh aspect and any implementation of the seventh aspect correspond to the first aspect and any implementation of the first aspect, respectively. The technical effects corresponding to the seventh aspect and any implementation of the seventh aspect can be referred to the technical effects corresponding to the first aspect and any implementation of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0098] FIG1a is a schematic diagram of an exemplary application scenario;
[0099] FIG1b is a schematic diagram of an exemplary application scenario;
[0100] FIG2 is a schematic diagram illustrating an exemplary process of generating a logo;
[0101] FIG3 a is a schematic diagram illustrating an exemplary training process of a feature extraction model;
[0102] FIG3 b is a schematic diagram of an exemplary model training;
[0103] FIG3 c is a schematic diagram illustrating an exemplary model training;
[0104] FIG3 d is a schematic diagram illustrating an exemplary training process;
[0105] FIG4 a is a schematic diagram illustrating an exemplary training process of a quantization processing model;
[0106] FIG4 b is a schematic diagram illustrating an exemplary training process;
[0107] FIG5a is a schematic diagram illustrating an exemplary process of generating a logo;
[0108] FIG5 b is a schematic diagram illustrating an exemplary quantization process;
[0109] FIG6a is a schematic diagram illustrating an exemplary process of generating a logo;
[0110] FIG6 b is a schematic diagram illustrating an exemplary quantization process;
[0111] FIG7 is a schematic diagram illustrating an exemplary query process;
[0112] FIG8 is a schematic diagram illustrating an exemplary query process;
[0113] FIG9 is a schematic diagram illustrating an exemplary identification generating device;
[0114] FIG10 is a schematic structural diagram of an exemplary device. DETAILED DESCRIPTION
[0115] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0116] The term "and / or" in this article is merely a description of the association relationship between associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0117] In the description and claims of the embodiments of this application, the terms "first" and "second" are used to distinguish different objects, rather than to describe a specific order of objects. For example, the terms "first target object" and "second target object" are used to distinguish different objects, rather than to describe a specific order of objects.
[0118] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0119] In the description of the embodiments of this application, unless otherwise specified, "multiple" means two or more. For example, "multiple processing units" means two or more processing units; "multiple systems" means two or more systems.
[0120] To facilitate understanding, some of the professional terms mentioned in the embodiments of this application are first introduced.
[0121] 1. Media content
[0122] Media content, also known as digital content, is a collection of text, images, and sounds in digital form. It can be stored on digital media such as optical discs and hard drives and distributed through networks and other means. Digital content is the sum of products or services that integrate images, text, audio, and other content through digital technology. It is the product of the integration of digital media technology and cultural creativity.
[0123] Digital technology is a science and technology that has grown alongside computers. It uses specialized equipment to convert various types of information, including images, text, sound, and video, into binary digits (0s and 1s) that computers can interpret, allowing for computation, processing, storage, transmission, dissemination, and restoration. Because computers are used to encode, compress, and decode information during computation and storage, digital technology is also known as digital technology or computer digital technology. It is also called digital control technology.
[0124] 2. Digital Content Identification
[0125] Digital content identifiers can refer to digital object identifiers (DOIs). A DOI is a string of numbers, letters, or other symbols used to identify digital content resources. It can be assigned to any digital entity using the internet. As a digital object identifier, a DOI is unique and remains unchanged once generated, regardless of changes to the copyright owner or storage location of the digital object it identifies. Traditional physical publications, such as books, periodicals, tapes, and CDs, are identified by international standard identifiers such as the ISBN (International Standard Book Number), ISSN (International Standard Serial Number), and ISRC (International Standard Recording Code). These identifiers are affixed to the physical cover in the form of barcodes as unique identifiers. These identifiers enable efficient and convenient management of publications, facilitating their discovery and use at all levels. However, once an online document changes its URL (Uniform Resource Locator), it disappears without a trace, leaving it untraceable. Adding a Digital Object Identifier (DOI) to digital information is like attaching a barcode to the publication, ensuring its traceability no matter where it is found. Therefore, the DOI is also known as the "barcode" of digital resources.
[0126] The application of digital content identification is described below.
[0127] Figure 1a is a schematic diagram of an exemplary application scenario. In the embodiment of Figure 1a, an application scenario of copyright query / copyright determination is shown.
[0128] For example, when a user needs to determine whether a certain media content (such as images, audio, video, text, graphics, etc.) has a copyright conflict, he or she can open the media content query platform client (such as an application, mini-program, web page, etc.) in the terminal device to query.
[0129] 1a(1), the main interface 101 of the media content query platform client may include one or more controls, including but not limited to: a search box, a search button, metadata options, type options (such as audio options, image / video options, graphic options), etc., which are not limited in this application.
[0130] Exemplarily, when the media content is text, the user can enter the media content or the digital content identifier of the media content in the search box. When the media content is audio, the user can click the audio option to enter the media content; and / or, the user can enter the digital content identifier of the media content in the search box. When the media content is an image / video, the user can click the image / video option to enter the media content; and / or, the user can enter the digital content identifier of the media content in the search box. When the digital content is a graphic, the user can click the graphic option to enter the media content; and / or, the user can enter the digital content identifier of the media content in the search box. For ease of description, the media content entered by the user is referred to as the first media content.
[0131] After the user enters the first media content and / or the digital content identifier of the first media content, the user can click the search button; correspondingly, the media content query platform client can send the first media content or the digital content identifier of the first media content to the media content query platform server in response to the user's operation behavior. Afterwards, the media content query platform server can compare the digital content identifier of the first media content queried by the user with the digital content identifier of the media content (hereinafter referred to as the second media content) pre-stored in the database to search for the second media content that matches the first media content queried by the user from the database (that is, to search for the second media content that is the same or similar to the first media content queried by the user). When the digital content query platform server finds the second media content that matches the first media content queried by the user, it can return it to the media content query platform client. The media content query platform client can display the second media content that matches the first media content queried by the user on the search result interface 102, as shown in Figure 1a (2). When the media content query platform server does not find the second media content that matches the first media content queried by the user, it can return a query result indicating that the query failed; at this time, the media content query platform client can display a prompt message indicating that the query failed on the search result interface 102. In this way, users can determine whether the queried media content has a copyright conflict.
[0132] Figure 1b is a schematic diagram of an exemplary application scenario. In the embodiment of Figure 1b, an application scenario of metadata query is shown. Metadata can refer to data that describes data attributes. For example, the metadata of an image can include the image's size, storage location, format, etc.
[0133] For example, when the metadata of a certain media content is lost, the user can open the media content query platform client (such as an application, applet, web page, etc.) in the terminal device to retrieve it; wherein, the main interface 101 of the media content query platform client can refer to the above description and will not be repeated here.
[0134] Exemplarily, after the user inputs the first media content and / or the digital content identifier of the first media content, the user can click on the metadata option, as shown in FIG1b(1). Correspondingly, the media content query platform client can send the first media content or the digital content identifier of the first media content to the media content query platform server in response to the user's operation behavior. Afterwards, the media content query platform server can compare the digital content identifier of the first media content queried by the user with the digital content identifier of the second media content pre-stored in the database to search for the second media content that matches the first media content queried by the user from the database. When the media content query platform server finds the second media content that matches the first media content queried by the user, it can return the metadata of the second media content that matches the first media content queried by the user to the media content query platform client. The media content query platform client can display the metadata of the second media content that matches the first media content queried by the user in the search result interface 103, as shown in FIG1b(2). When the media content query platform server does not find the second media content that matches the first media content queried by the user, it can return a query result indicating that the query failed; at this time, the media content query platform client can display a prompt message indicating that the query failed in the search result interface 103. In this way, users can retrieve the corresponding metadata for media content that has lost metadata.
[0135] It should be understood that the media content query platform in FIG. 1 a and FIG. 1 b may also adopt other names, and this application does not impose any limitation thereto.
[0136] It should be understood that the present application can also be applied to other fuzzy comparison and similarity query application scenarios, and the present application does not limit this.
[0137] In the query process of Figures 1a and 1b, the digital content identifier of the media content is one of the key factors in determining whether a second media content similar to or identical to the first media content queried by the user can be found; therefore, the present application proposes an identifier generation method that can generate a digital content identifier suitable for application scenarios such as fuzzy comparison and similarity query, such as copyright query / copyright determination and metadata query.
[0138] FIG2 is a schematic diagram illustrating an exemplary process of generating a logo.
[0139] In the embodiment of FIG2 , the present application can generate a corresponding digital content identifier for at least one media content among text, audio, image, video, 3D model or graphics, as shown in FIG2 (1); the identifier generation process can refer to FIG2 (2).
[0140] The 3D model can be obtained through three-dimensional modeling and can be a polygonal representation of a real-world entity or a fictional object.
[0141] It should be understood that the media content in this application may include content of other content types, and this application does not limit this.
[0142] S201: Acquire media content.
[0143] Exemplarily, media content for which a digital content identifier needs to be generated is obtained; wherein the media content may include at least one of the following: text, audio, image, video, or graphic.
[0144] S202: Extract features from the media content to obtain digital content features of the media content.
[0145] In one possible approach, media content can be input into a feature extraction model, which extracts features from the media content and outputs digital content features of the media content. In this case, the digital content features can be digital fingerprints.
[0146] Exemplarily, the feature extraction model can be implemented using a neural network. For example, the feature extraction model can be implemented based on a convolutional neural network (CNN). CNN may refer to a neural network comprising a convolutional layer, which may also include an activation layer (such as ReLU, PReLU, etc.), a pooling layer, a batch normalization layer (BN layer), a fully connected layer, and other network layers. Typical convolutional neural networks include LeNet, AlexNet, VGGNet, and ResNet. Exemplarily, a basic CNN may be composed of a backbone network and a head network; a complex CNN may be composed of a backbone network, a neck network, and a head network; this application does not limit the network that constitutes the CNN.
[0147] In one possible approach, a pHASH (Perceptual Hash) algorithm may be used to extract features from media content to obtain digital content features of the media content.
[0148] It should be understood that the present application does not limit the method of extracting features from media content. The present application uses the example of inputting media content into a feature extraction model and outputting digital content features of the media content for explanation.
[0149] For example, the data type of the digital content feature may be a floating point type (float) or an integer type (int), and this application does not impose any limitation on this.
[0150] S203: quantize the digital content features to obtain first data.
[0151] Next, the digital content features may be quantized to compress the digital content features and obtain first data; thus, the amount of the obtained first data is smaller than the amount of the digital content features.
[0152] Exemplarily, the quantization process may involve searching for a first cluster center from a plurality of cluster centers (cluster centers may be identified by vectors) that is a predetermined distance from the digital content feature, and using the index of the first cluster center to represent the digital content feature. In other words, the first data may be used to indicate the index of the first cluster center. The plurality of cluster centers are used to classify the digital content feature. The plurality of cluster centers may be obtained through pre-training, and the indexes of the plurality of cluster centers may also be obtained through pre-training. The specific training process will be described later.
[0153] Exemplarily, one or more first cluster centers that are at a preset distance from the digital content feature may be searched from a plurality of cluster centers; correspondingly, the first data may be used to indicate indexes of the one or more first cluster centers.
[0154] For example, the index of the cluster center can be a binary string; thus, the obtained first data can be a binary string. It should be understood that the index of the cluster center can also be a decimal string or a hexadecimal string, and this application does not limit this; this application uses the binary string as an example for explanation.
[0155] For example, the digital content feature can be input into a quantization processing model, which outputs first data. The quantization processing model can include multiple cluster centers. The quantization processing model searches for a first cluster center that is a preset distance from the digital content feature from the multiple cluster centers and outputs an index of the first cluster center. The multiple cluster centers and their indexes can be trained by training the quantization processing model. The specific training process will be described later.
[0156] S204: Determine a digital content identifier of the media content according to the first data.
[0157] For example, the digital content identifier of the media content may be obtained by encoding the first data, for example, the digital content identifier is: CiHZ8av44Z5mc, CYUuraNV8atfk, CRUtHn1RdJxnC, CDK1EignVFTdg, etc.
[0158] In this way, digital content features are generated through feature extraction, and then digital content identifiers are generated based on the data content features, which can associate the digital content identifiers with media content, and thus be suitable for application scenarios such as fuzzy comparison and similarity queries such as copyright queries and metadata queries.
[0159] Secondly, quantization processing can reduce the amount of data, and the digital content identifier is generated based on the digital content characteristics after quantization processing; this can reduce the complexity of generating the digital content identifier; it can also reduce the amount of digital content identifier data, thereby reducing the storage space occupied by the digital content identifier.
[0160] First, the training process of the feature extraction model is explained.
[0161] FIG3 a is a schematic diagram showing an exemplary training process of a feature extraction model.
[0162] S301, obtain multiple training sets; the multiple training sets correspond one-to-one to the multiple scene types, and one training set includes: first training data, second training data, and third training data. The scene type to which the first training data belongs is the same as the scene type to which the third training data belongs. The third training data is different from the first training data, and the second training data is adversarial data for the first training data.
[0163] For example, a training set may be generated based on a public data set, wherein the public data set may include multiple pieces of data, each piece of data being a piece of media content.
[0164] In one possible approach, the scene type to which each piece of data in the public dataset belongs may be determined based on a label (such as a type label) of each piece of data in the public dataset.
[0165] In one possible approach, a classifier may be used to classify each piece of data in the public data set to determine the scene type to which each piece of data in the public data set belongs.
[0166] For example, data of different content types may correspond to different scene types. For example, the scene types corresponding to text may include: literature, biology, electronics, medicine, chemistry, etc. For example, the scene types corresponding to images may include: people, scenery, objects, animals, architecture, etc. For example, the scene types corresponding to videos may include: art, action, romance, etc. For example, the scene types corresponding to audio may include: pop music, opera, rock, folk music, etc.
[0167] Next, a piece of data is selected from the multiple pieces of data corresponding to a scene type as the first training data; then, the first training data can be subjected to adversarial processing or adversarial transformation to obtain second training data; then, data other than the first training data is selected from the multiple pieces of data corresponding to the scene type as the third training data; in this way, a triple data group consisting of the first training data, the second training data, and the third training data can be obtained. Similarly, multiple pieces of first training data can be selected from the multiple pieces of data corresponding to the scene type, and multiple triple data groups can be generated in the above manner; wherein, these multiple triple data groups can form a training set, which corresponds to the scene type. Furthermore, multiple training sets can be generated based on the data corresponding to multiple scene types; these multiple training sets correspond one-to-one to multiple scene types.
[0168] For example, in some scenarios, the first training data may be called an anchor, the second training data may be called a positive, and the third training data may be called a negative; that is, a triple data set may be expressed as (anchor, positive, negative).
[0169] Exemplarily, when the first training data is text, the adversarial processing may include operations such as synonym conversion; that is, the second training data may be obtained by performing synonym conversion on part of the text in the first training data.
[0170] For example, when the first training data is an image, adversarial processing can include operations such as noise addition, rotation, shearing, and compression; that is, the second training data can be obtained by performing noise addition, rotation, shearing, or compression operations on the first training data. For example, the first training data can be input into Stirmark Benchmark (an image modification tool), and the modification operations (or adversarial operations) provided by Stirmark Benchmark can be used to modify the first training data (also called adversarial processing) to obtain the second training data.
[0171] Exemplarily, when the first training data is a video, the adversarial processing may include operations such as frame extraction, flipping, and blurring; that is, the second training data may be obtained by performing operations such as frame extraction, flipping, and blurring on the first training data.
[0172] Exemplarily, when the first training data is audio, the adversarial processing may include operations such as frequency reduction and audio coding format conversion; that is, the second training data may be obtained by performing operations such as frequency reduction and audio coding format conversion on the first training data.
[0173] For example, assuming that the public dataset includes 10,000 data points corresponding to scenario type A, 1,000 first training data points and 1,000 third training data points can be selected from these 10,000 data points. If different adversarial processing methods are applied to one first training data point, 108 second training data points are obtained. Then, adversarial processing can be applied to the 1,000 first training data points to obtain 108,000 second training data points. In this way, 108,000 triple data sets can be generated, and the training set corresponding to scenario type A can include 108,000 triple data sets.
[0174] S302, training multiple feature extraction models based on multiple training sets; the multiple feature extraction models correspond one-to-one to the multiple scene types.
[0175] For example, a neural network model can be selected for a scene type as the feature extraction model corresponding to the scene type; and then the feature extraction model corresponding to the scene type is trained using a training set corresponding to the scene type.
[0176] FIG3b is an exemplary model training diagram. Referring to FIG3b , assuming that there are R training sets (R is a positive integer) (e.g., training set 1, training set 2, ..., training set R), then R feature extraction models can be trained (e.g., feature extraction model 1, feature extraction model 2, ..., feature extraction model R). Feature extraction model 1 is trained using training set 1, feature extraction model 2 is trained using training set 2, ..., and feature extraction model R is trained using training set R.
[0177] For example, a neural network model with good feature extraction performance for data corresponding to a specific scene type can be selected from existing neural network models as the feature extraction model for that scene type. For example, ResNet50 performs well in feature extraction for people in images; therefore, ResNet50 can be used as the feature extraction model for people. In other words, a feature extraction model for each scene type can be trained using a training set corresponding to that scene type.
[0178] The following describes an example of using one training set (hereinafter referred to as the first training set) from among multiple training sets to train a feature extraction model (hereinafter referred to as the first feature extraction model) corresponding to a scene type (hereinafter referred to as the first scene type) to which the first training set belongs. Please refer to S3021 to S3022 below.
[0179] For example, the triple data sets in the first training set can be divided into N1 (N1 is a positive integer) batches; N2 (N2 is a positive integer) batches are selected from the N1 batches as the first validation set, and N3 (N3 is a positive integer) batches are selected from the other (N1-N2) batches as the first test set; in this case, the first training set includes (N1-N2-N3) batches. Next, the first feature extraction model is trained using the batches in the first training set, and after each batch is used to train the first feature extraction model, the first feature extraction model is verified using the batches in the first validation set to select the optimal first feature extraction model; finally, the optimal first feature extraction model is tested using the batches in the first test set; as shown in Figure 3c.
[0180] For example, the first training set corresponding to the above-mentioned scenario type A includes 108,000 triple data groups. The 108 triple data groups generated by adversarial processing for a first training data can be called a family (that is, the triple data groups belonging to the same family contain the same first training data); in this way, the first training set corresponding to scenario type A includes 108,000 triple data groups, which can correspond to 1,000 families, that is, the first training set includes 1,000 families. Then, the first training set including 1,000 families can be randomly shuffled in families (that is, each family is not interspersed with data from other families), and every 4 families are regarded as a batch. The first training set can be divided into 250 batches. Afterwards, 25 batches can be selected from the 250 batches as the first validation set, and 25 batches can be selected from the other 225 batches as the first test set; in this way, the first training set includes 200 batches. It should be understood that the number of batches in the first training set, the first validation set, and the first test set can be set as required, and this application does not impose any restrictions on this.
[0181] S3021, input the first training set into a first feature extraction model to obtain a first digital content feature of the first training data in the first training set, a second digital content feature of the second training data in the first training set, and a third digital content feature of the third training data in the first training set.
[0182] S3022: Training a first feature extraction model based on a first similarity between the first digital content feature and the second digital content feature, and a second similarity between the first digital content feature and the third digital content feature.
[0183] For example, one batch in the first training set may be used each time to train the first feature extraction model. The following describes the training process of the first feature extraction model by taking one batch in the first training set as an example.
[0184] Exemplarily, a batch in the first training set can be input into the first feature extraction model, and the first feature extraction model extracts the first digital content features of the first training data in each triple data group of the batch, the second digital content features of the second training data in each triple data group of the batch, and the third digital content features of the third training data in each triple data group of the batch.
[0185] Next, for each triple data group, a first similarity between the first digital content feature of the first training data in the triple data group and the second digital content feature of the second training data in the triple data group can be calculated. Also, a second similarity between the first digital content feature of the first training data in the triple data group and the third digital content feature of the third training data in the triple data group can be calculated. The first similarity and the second similarity can be Euclidean distance, Manhattan distance, etc., which is not limited in this application.
[0186] Afterwards, the first similarities corresponding to all triplet data groups in the batch can be summed to obtain a first similarity sum value; and the second similarities corresponding to all triplet data groups in the batch can be summed to obtain a second similarity sum value. Subsequently, the first feature extraction model is trained with the goal of minimizing the first similarity sum value and maximizing the second similarity sum value. In other words, the ultimate goal is to narrow the distance between the digital content features of the first training data and the digital content features of the second training data, and to widen the distance between the digital content features of the first training data and the digital content features of the third training data.
[0187] In one possible implementation, the loss function of the following formula (1) is used to calculate the value of the loss function; then, based on the value of the loss function, a gradient descent mechanism is used for backpropagation to make the loss value tend to 0, so as to achieve the goal of minimizing the first similarity sum and maximizing the second similarity sum. Loss = Max(dis(a,p)-dis(a,n)+margin,0) (1)
[0188] Wherein, margin is an interval parameter, which can be set to 1.0; the specific setting can be based on the requirements and is not limited by this application. dis(a,p) is the first similarity sum value, and dis(a,n) is the second similarity sum value.
[0189] Figure 3d is a schematic diagram of an exemplary training process. In Figure 3d, a triple data set is used as an example for explanation. After the triple data set (anchor, positive, negative) is input into the first feature extraction model, the first feature extraction model inputs the anchor feature (i.e., the first digital content feature of the first training data), the positive feature (i.e., the second digital content feature of the second training data), and the negative feature (i.e., the third digital content feature of the third training data). Then, the Euclidean distance (distance(a,p)) between the anchor feature and the positive feature can be calculated, as well as the Euclidean distance (distance(a,n)) between the anchor feature and the negative feature can be calculated. Then, the loss function value can be calculated based on the above formula (1), distance(a,p) and distance(a,n), and back propagation can be performed according to the loss function value.
[0190] In addition, you can also set the learning rate, for example, set the learning rate to Adam (1e-4); the specific setting can be based on demand, and this application does not impose any restrictions on this. It should be noted that the purpose of setting the learning rate and margin is to enable the feature extraction model to converge in a faster time: among them, a suitable margin can improve the feature extraction effect of the feature extraction model, and a suitable learning rate will accelerate the training speed and improve the training effect.
[0191] Subsequently, according to the above method, the next batch in the first training set is used to train the first feature extraction model after the previous training; and so on, which will not be repeated here.
[0192] Exemplarily, after completing the training of a batch in the first training set, the trained first feature extraction model can be verified. Specifically, the first verification set can be input into the first feature extraction model, and the Loss value can be calculated according to the above formula (1), and then multiple Loss values can be obtained; wherein the multiple Loss values correspond one-to-one to the multiple batches in the first verification set. Afterwards, the mean of these multiple Loss values can be calculated to obtain the verification Loss value. In this way, after training the first feature extraction model using multiple batches in the first training set, multiple verification Loss values can be obtained in the above manner, and the multiple verification Loss values correspond one-to-one to the first feature extraction model trained using multiple batches in the first training set. Then, from these multiple verification Loss values, the first feature extraction model corresponding to the minimum verification Loss value is selected as the final model obtained by the entire training.
[0193] For example, after determining the first feature extraction model ultimately obtained through the entire training, the first feature extraction model can be tested using a first test set to determine the feature extraction effect of the first feature extraction model. For example, parameters such as accuracy, precision, and regression rate can be used to measure the feature extraction effect of the first feature extraction model ultimately obtained. When the feature extraction effect of the first feature extraction model does not meet the requirements, the first training set can be generated using other public data sets or regenerated based on the above-mentioned public data sets. The regenerated first training set can then be used to train the first feature extraction model again. This cycle repeats until the first feature extraction model meets the requirements.
[0194] Next, the training process of the quantization processing model is explained.
[0195] FIG4 a is a schematic diagram illustrating an exemplary training process of a quantization processing model.
[0196] S401, obtaining S digital content features, where the digital content features are obtained by performing feature extraction on data.
[0197] In one possible approach, the trained feature extraction model can be used to extract features from S pieces of data (one piece of data can be a piece of media content, for example, the S pieces of data can be S pieces of data in the public dataset mentioned above) to obtain S digital content features. The S pieces of data correspond one-to-one to the S digital content features. For example, the S pieces of data all belong to the same scene type; for example, the scene type of the S pieces of data is scene type A.
[0198] S402: Input the S digital content features into a quantization processing model, and cluster the S digital content features by the quantization processing model to determine M cluster centers.
[0199] Exemplarily, S digital content features may be input into a quantization processing model, and the quantization processing model clusters the S digital content features to determine M cluster centers, where M is a positive integer.
[0200] Exemplarily, in the process of training the quantitative processing model for the first time, clustering the S digital content features to determine M cluster centers can mean that, for a digital content feature, the quantitative processing model can determine the cluster center to which the digital content feature belongs from the M pre-set cluster centers. Specifically, the quantitative processing model can calculate the distance (such as Euclidean distance, Manhattan distance, etc.) between the digital content feature and the M cluster centers; then, from the M cluster centers, the cluster center closest to the digital content feature is used as the cluster center to which the digital content feature belongs. In the process of training the quantitative processing model each subsequent time, clustering the S digital content features to determine M cluster centers can mean that, for a digital content feature, the quantitative processing model can determine the cluster center to which the digital content feature belongs from the M cluster centers obtained in the last training; for details, please refer to the above description and will not be repeated here.
[0201] In one possible approach, the quantitative processing model can directly cluster the S digital content features to determine M cluster centers. In this case, a cluster center group can be obtained, which includes M cluster centers, and the dimensions of these M cluster centers are the same as the dimensions of the digital content features. For example, if the dimension of the digital content features is 128 (i.e., the digital content features are 1*128 vectors), then the dimension of the cluster centers can be 128 (i.e., the cluster centers are 1*128 vectors); where M can be equal to 2 to the power of 128.
[0202] In one possible approach, the quantization processing model can perform feature transformation on S digital content features to obtain S sub-feature groups; wherein, a sub-feature group includes W sub-features, and W is a positive integer. Then, the k-th sub-feature of each sub-feature group in the S sub-feature groups is clustered to determine G cluster centers; k is an integer between 1 and W. In this case, W cluster center groups can be obtained, and each cluster center group includes G cluster centers, M=W*G. The dimension of each cluster center is the same as the dimension of each sub-feature, and G can be equal to 2 to the power of W. In this way, the memory occupied by storing cluster centers can be reduced, and the efficiency of quantization processing can be improved.
[0203] That is, feature transformation is performed on each of the S digital content features to obtain a sub-feature group containing W sub-features; this results in S sub-feature groups. Then, the k-th sub-feature is selected from each of the S sub-feature groups, resulting in S sub-features. These S sub-features are then clustered to determine G cluster centers (these G cluster centers can form the k-th cluster center group).
[0204] For example, assuming W = 128, the dimension of the sub-feature can be 8; in this case, the dimension of a cluster center can be 8. Among them, G can be set as required, for example, it can be determined according to the index of the cluster center. For example, if the index of the cluster center is represented by 8-bit binary, then G can be 256, in which case M can be 256*128; for example, if the index of the cluster center is represented by 4-bit binary, then G can be 32, in which case M can be 32*128. This application does not impose any restrictions on this.
[0205] Exemplarily, the feature transformation may be feature division. Specifically, feature division may be performed on each of the S digital content features to obtain S sub-feature groups.
[0206] Exemplarily, feature transformation may include the following operations: homogenization and feature segmentation. Specifically, homogenization may be performed on S digital content features to obtain S first intermediate features. This can diffuse the concentration of the digital content features, resulting in a uniform energy distribution. Next, feature segmentation is performed on each of the S first intermediate features to obtain S sub-feature groups.
[0207] Exemplarily, the homogenization process refers to using all elements in the digital content feature to determine each element in the first intermediate feature.
[0208] One way to implement the homogenization processing may be to multiply the S digital content features by the first matrix respectively to obtain S second intermediate features; and multiply the S second intermediate features by the second matrix respectively to obtain S first intermediate features; wherein the first matrix is a random matrix, and the second matrix is a matrix required for training the quantization processing model.
[0209] When the quantization processing model is trained for the first time, the elements in the second matrix are all preset elements. When the quantization processing model is trained subsequently, the elements in the second matrix are obtained from the previous training.
[0210] Optionally, both the first matrix and the second matrix are orthogonal matrices, that is, the first matrix is a random orthogonal matrix, and the second matrix is an orthogonal matrix required to be trained in the process of training the quantization processing model.
[0211] FIG4 b is a schematic diagram illustrating an exemplary training process.
[0212] Referring to FIG4b , for example, assume that a digital content feature has a dimension of 128, and S = 1000. After inputting 1000 digital content features into the quantization processing model, the quantization processing model can multiply each digital content feature by a 1024-dimensional first matrix (wherein the first matrix is 1024*1024, and each 1*128 digital content feature can be multiplied by a 128*1024 sub-matrix in the first matrix) to obtain a second intermediate feature (wherein the dimension of the second intermediate feature is 1024, and the second intermediate feature can be a 1*1024 vector). Next, the second intermediate feature is multiplied by a 1024-dimensional second matrix (wherein the second matrix is 1024*1024), to obtain a first intermediate feature (wherein the dimension of the second intermediate feature is 1024, and the first intermediate feature can be a 1*1024 vector). Thereafter, the first intermediate feature can be divided into 128 sub-feature groups, each sub-feature group including 1000 8-dimensional sub-features (wherein the sub-features can be 1*8 vectors). Then, the kth sub-feature is selected from the 128 sub-feature groups for clustering, and finally a cluster center group can be obtained, which can include 256*128 cluster centers. In this way, 128 cluster center groups can be obtained.
[0213] S403: Training a quantization processing model based on the M cluster centers and the indexes of the M cluster centers.
[0214] Illustratively, after determining M cluster centers, the index of each of the M cluster centers may be determined.
[0215] Exemplarily, the quantization processing model can be trained by constraining the distance between the index of the i-th cluster center and the index of the j-th cluster center to be proportional to the distance between the i-th cluster center and the j-th cluster center, and constraining the distance between the p-th cluster center and the digital content feature (or sub-feature) belonging to the p-th cluster center; wherein i, j, and p are integers between 1 and M. Training the quantization processing model includes training M cluster centers and the indexes of the M cluster centers.
[0216] The digital content feature (or sub-feature) belonging to the p-th cluster center may refer to the digital content feature (or sub-feature) that is closest to the p-th cluster center.
[0217] For example, during the first training of the quantization processing model, the indexes of the M pre-set cluster centers are adjusted, and the M pre-set cluster centers are adjusted. During the subsequent training of the quantization processing model, the indexes of the M cluster centers obtained from the previous training are adjusted, and the M cluster centers obtained from the previous training are adjusted.
[0218] For example, the distance between the index of the i-th cluster center and the index of the j-th cluster center and the distance L between the i-th cluster center and the j-th cluster center can be determined by referring to the following formula (2): diff :
[0219] in, Represents the i-th cluster center c in the k-th cluster center group i,k and the jth cluster center c j,k Euclidean distance after regularization; Represents the Hamming distance between the index i of the i-th cluster center in the k-th cluster center group and the index j of the j-th cluster center after normalization.
[0220] That is, the closer the cluster centers are, the closer their cluster center indices are. For example, the distance between the cluster center with index 1 (binary string "00000001") and the cluster center with index 3 (binary string "00000011") is closer than the distance between the cluster center with index 1 and the cluster center with index 254 (binary number "11111110").
[0221] For example, the distance L between the p-th cluster center and the digital content features in the set belonging to the p-th cluster center can be determined by the following formula (3): dist : L dist =∑ r,k min p (f r,k -c p,k ) (3)
[0222] Among them, c p,k represents the pth cluster center c in the kth cluster center group p,k , f r,k It represents the rth sub-feature (or digital content feature) belonging to the pth cluster center in the kth cluster center group.
[0223] That is, the distance between each sub-feature (or digital content feature) and its corresponding cluster center is limited to ensure that sub-features (digital content features) with similar distances can be grouped into the same cluster center.
[0224] For example, the value of the loss function of the quantization processing model can be determined by referring to the following formula (4): L = λ dist *L dist +λ diff *L diff (4)
[0225] Among them, λdist ,λ diff It is a hyperparameter and can be set according to specific requirements. This application does not impose any restrictions on this.
[0226] Next, the quantization processing model is trained by minimizing L, constraining the distance between the index of the i-th cluster center and the index of the j-th cluster center to be proportional to the distance between the i-th cluster center and the j-th cluster center, and constraining the distance between the p-th cluster center and the digital content feature (or sub-feature) belonging to the p-th cluster center.
[0227] In addition, when the feature transformation includes homogenization and feature partitioning, the orthogonality of the second matrix can also be constrained; wherein the orthogonality of the second matrix can be determined by the following formula (5): L reg =||M2 T M2-E|| F 2 (5)
[0228] In this case, the value of the loss function of the quantization processing model can be determined by referring to the following formula (6): L = L reg +λ dist *L dist +λ diff *L diff (6)
[0229] Next, the quantization processing model is trained by minimizing L, constraining the distance between the index of the i-th cluster center and the index of the j-th cluster center to be proportional to the distance between the i-th cluster center and the j-th cluster center, constraining the distance between the p-th cluster center and the digital content feature (or sub-feature) belonging to the p-th cluster center, and constraining the orthogonality of the second matrix. In this case, training the quantization processing model may further include training the second matrix.
[0230] It should be understood that the S digital feature contents can be used as a batch to train the quantization processing model, or can be divided into multiple batches to train the quantization processing model. This application does not impose any restrictions on this.
[0231] Similarly, S1 (S1 is a positive integer) digital content features can be selected to generate a validation set, and S2 (S2 is a positive integer) digital content features can be selected to generate a test set. The validation set is then used to validate the quantization processing model, and the test set is used to test the quantization processing model. For details, please refer to the above description and will not be repeated here.
[0232] Thus, when the feature transformation is performed as feature partitioning, the quantization processing model is trained to obtain a cluster center group, which may include M cluster centers, where the dimensions of the M cluster centers are the same as the dimensions of the digital content features; and a second orthogonal matrix is obtained by training. M can be set as required, for example, based on the index of the cluster center. For example, if the cluster center index is represented in 8-bit binary, then M can be 256.
[0233] When the feature transformation includes homogenization and feature partitioning, the quantization processing model is trained to obtain W cluster center groups, each cluster center group can include G cluster centers, and the dimensions of these G cluster centers are the same as the dimensions of the sub-features; and the second orthogonal matrix is obtained by training. Among them, W and G can be set as required, for example, G can be determined according to the index of the cluster center. For example, if the index of the cluster center is represented by 8-bit binary, then G can be 256, in this case, M=256*128; for example, if the index of the cluster center is represented by 4-bit binary, then G can be 32, in this case, M=32*128, and this application does not impose any restrictions on this.
[0234] Furthermore, through the trained quantization processing model, the dimension of the index output by quantizing the digital content data is smaller than the dimension of the digital content features; that is, after quantizing the digital content features, the dimension of the digital content features can be reduced.
[0235] Compared with directly clustering S digital content features, clustering the S digital content features after feature transformation can, on the one hand, reduce clustering complexity and improve clustering efficiency, and on the other hand, reduce the memory space occupied by the cluster center; in addition, it is also conducive to the convergence of the quantitative processing model and improves the convergence rate of the quantitative processing model.
[0236] It should be noted that, in one possible manner, the quantization processing model may include a feature classification model and an index mapping model. In this case, S digital content features may be input into the feature classification model, and the S digital content features may be clustered to determine M cluster centers; and the index mapping model may be used to determine the index of each cluster center in the M cluster centers. The training of the quantization processing model may include the training of the feature classification model (which may be trained to obtain M cluster centers) and the training of the index mapping model (which may be trained to obtain the index of the M cluster centers). Exemplarily, the feature classification model and the index mapping model may be a whole or independent models, and this application does not impose any restrictions on this.
[0237] In one possible manner, the quantization processing model may include a feature transformation model, a feature classification model, and an index mapping model. In this case, S digital content features may be input into the feature transformation model, which performs feature transformation on the S digital content features, outputs S sub-feature groups to the feature classification model, clusters the S sub-feature groups to determine M cluster centers; and the index mapping model determines the index of each cluster center in the M cluster centers. The training of the quantization processing model may include the training of the feature transformation model (which may be trained to obtain a second matrix), the training of the feature classification model, and the training of the index mapping model. Exemplarily, the feature transformation model, the feature classification model, and the index mapping model may be a whole or independent models, and this application does not impose any restrictions on this.
[0238] In one possible approach, the trained feature extraction model and quantization processing model can be deployed on a server. Thus, when a user needs to generate a digital content identifier for a piece of media content, they can upload the media content to the server through an identifier generation client (such as an app, mini-program, or webpage). The server then executes the identifier generation method of this application to generate a digital content identifier for the media content and returns it to the identifier generation client, which then displays it.
[0239] In one possible approach, the above-mentioned trained feature extraction model and quantization processing model can be deployed in a terminal device. In this way, when a user needs to generate a digital content identifier for a certain media content, the media content can be entered in an identifier generation client (such as an APP, mini-program or web page), and the identifier generation client executes the identifier generation method of this application to generate a digital content identifier for the media content and display it.
[0240] It should be understood that one of the feature extraction model and the quantization processing model can be deployed on the server and the other on the terminal device, and the server and the terminal device can collaboratively generate the digital content identifier. This application does not impose any restrictions on this.
[0241] That is to say, this application does not limit whether the electronic device that executes the identification generation method involved in this application is a terminal device or a server.
[0242] The following is the logo generation based on the trained feature extraction model and quantization processing model.
[0243] Figure 5a is a schematic diagram illustrating an exemplary identification generation process. In the training process of the quantization processing model used in the embodiment of Figure 5a, the S digital content features are not subjected to feature transformation, but are directly clustered.
[0244] S501: Acquire media content.
[0245] S502: Classify the media content to determine the scene type to which the media content belongs.
[0246] For example, the media content may be classified according to its content type and in accordance with a classification method corresponding to the content type of the media content to determine the scene type to which the media content belongs.
[0247] In one possible approach, the media content may be classified in the same manner as that used to generate type labels for the data in the aforementioned public dataset to determine the scene type to which the media content belongs.
[0248] In one possible approach, a classifier used to classify data in the aforementioned public dataset can be used to classify media content and determine the scene type to which the media content belongs. Different classifiers can correspond to different content types, and a classifier corresponding to the content type of the media content can be selected to classify the media content and determine the scene type to which the media content belongs.
[0249] S503: Input the media content into a first feature extraction model, and output digital content features of the media content; wherein the first feature extraction model corresponds to the scene type to which the media content belongs.
[0250] For example, in the embodiment of FIG3a above, different feature extraction models are trained for different scene types; then, based on the scene type to which the media content belongs, a first feature extraction model corresponding to the scene type to which the media content belongs can be selected from the multiple trained feature extraction models; then, the media content is input into the first feature extraction model, and the digital content features of the media content are output.
[0251] For example, when the media content has multiple content types, multiple first feature extraction models corresponding to multiple scene types of the media content can be selected from multiple trained feature extraction models. When the media content has only one content type, one first feature extraction model corresponding to one scene type of the media content can be selected from multiple trained feature extraction models.
[0252] Next, the first feature extraction model extracts features from the media content and outputs digital content features of the media content. The data type of the digital content features can be a floating point type; for example, the digital content features are 128-dimensional floating point numbers.
[0253] Afterwards, the digital content features may be input into the trained quantization processing model, and the quantization processing model may perform quantization processing to obtain the first data.
[0254] Because the first feature extraction model corresponding to the scene type to which the media content belongs is more effective at extracting features from the media content within the scene type to which the media content belongs than feature extraction models corresponding to other scene types, using the first feature extraction model corresponding to the scene type to which the media content belongs for feature extraction can improve the accuracy of digital content features. This can improve query accuracy.
[0255] In one possible approach, when, in the process of training the quantization processing model in the embodiment of FIG4a , the S digital content features are not subjected to feature transformation but are directly clustered, the quantization processing process may be as follows S504 to S505:
[0256] S504: Classify the digital content features and determine one or more first cluster centers.
[0257] Exemplarily, the digital content features may be classified using a trained feature classification model to determine one or more first cluster centers. Exemplarily, one or more first cluster centers corresponding to the digital content features may be selected from M cluster centers included in a cluster center group obtained by training the feature classification model.
[0258] For example, the digital content features can be classified using the trained quantization processing model to determine one or more first cluster centers. For example, one or more first cluster centers corresponding to the digital content features can be selected from the M cluster centers included in a cluster center group obtained by training the quantization processing model.
[0259] Exemplarily, one or more cluster centers with a preset distance from the digital content feature may be selected from the M cluster centers included in a cluster center group as the one or more first cluster centers.
[0260] In one possible manner, one or more cluster centers that are farthest from the digital content feature may be selected from the M cluster centers included in a cluster center group as one or more first cluster centers.
[0261] In one possible approach, one or more cluster centers that are closest to the digital content feature may be selected from the M cluster centers included in a cluster center group as one or more first cluster centers.
[0262] It should be understood that the preset distance can be set as required and this application does not impose any restrictions on this.
[0263] It should be understood that different cluster centers can represent different classifications. Classification of digital content features may not output the specific classification of the digital content features, but only determine one or more first cluster centers corresponding to the digital content features, where the first cluster centers correspond to the categories of the digital content features.
[0264] S505: Determine first data according to the index of one or more first cluster centers.
[0265] Exemplarily, the indexes of one or more first cluster centers can be determined by the trained index mapping model; wherein, the indexes of one or more first cluster centers can be determined from the indexes of M cluster centers obtained by training the index mapping model.
[0266] Exemplarily, the indexes of one or more first cluster centers can be determined by the trained quantization processing model; wherein, the indexes of one or more first cluster centers can be determined from the indexes of M cluster centers obtained by training the quantization processing model.
[0267] For example, when there is one first cluster center, the index of the first cluster center can be used as the first data. When there are multiple first cluster centers, the indexes of the multiple first cluster centers can be processed (eg, concatenated) to obtain the first data.
[0268] It should be noted that S505 can be executed by the quantization processing model or by other modules, and this application does not limit this.
[0269] FIG5 b is a schematic diagram illustrating an exemplary quantization process.
[0270] In FIG5b(1), the dimension of the digital content feature is 128. When there is one first cluster center and the index of the first cluster center is “0000000011011100…”, the first data is “0000000011011100…”.
[0271] In Figure 5b (2), the dimension of the digital content feature is 128. When there are two first cluster centers, where the index of one first cluster center is "0000000011011100......", and the index of the other first cluster center is "0000000011011111......", the first data is "00000000110111......000000000011011111......".
[0272] It can be seen that the data volume of the first data is much smaller than the data volume of the digital content feature.
[0273] S506: Encode the first data to obtain a digital content identifier of the media content.
[0274] Exemplarily, the first data may be encoded using encoding algorithms such as Base64, Base58, and UTF-8 to obtain a digital content identifier of the media content.
[0275] Compared with the digital content features, the index dimension and data volume of the first cluster center are smaller, which can greatly reduce the computational cost and time effect in the query process and improve query efficiency.
[0276] Figure 6a is a schematic diagram illustrating an exemplary identification generation process. In the embodiment of Figure 6a, the quantization processing model used in the training process performs feature transformation on S digital content features before clustering.
[0277] S601: Acquire media content.
[0278] S602: Classify the media content to determine the scene type to which the media content belongs.
[0279] S603: Input the media content into a first feature extraction model, and output digital content features of the media content; wherein the first feature extraction model corresponds to the scene type to which the media content belongs.
[0280] For example, S601 to S603 may refer to the description of S501 to S503 above, which will not be repeated here.
[0281] In one possible approach, when the quantization processing model is trained in the embodiment of FIG4a , the S digital content features are subjected to feature transformation and then clustering, and the quantization processing process may be as follows S604 to S606:
[0282] S604: Perform feature transformation on the digital content features to obtain a plurality of second data.
[0283] The amount of the second data may be W.
[0284] For example, if in the embodiment of FIG. 4a , the feature transformation in the training process of the quantization processing model is feature division, then in the embodiment of FIG. 6a , the quantization processing model can perform feature division on the digital content features and divide the digital content features into W second data.
[0285] For example, if, in the embodiment of FIG4a , the feature transformation during the training of the quantization processing model includes homogenization and feature partitioning, then in the embodiment of FIG6a , the quantization processing model can perform homogenization on the digital content features to obtain a third intermediate feature. This can diffuse the concentration of the digital content features, resulting in a uniform energy distribution. Next, feature partitioning is performed on the third intermediate feature to obtain W second data. Specifically, the digital content features can be multiplied by a first matrix to obtain a fourth intermediate feature, and the third intermediate feature can be multiplied by a second matrix to obtain a third intermediate feature. The first matrix is a random matrix, and the second matrix is a matrix trained during the training of the quantization processing model described above.
[0286] Optionally, both the first matrix and the second matrix are orthogonal matrices, that is, the first matrix is a random orthogonal matrix, and the second matrix is an orthogonal matrix obtained by training in the process of training the quantization processing model.
[0287] S605: Classify the plurality of second data and determine a plurality of first cluster centers, where the first cluster center is a cluster center with a preset distance from the second data to the plurality of cluster centers.
[0288] Exemplarily, the plurality of second data may be classified using a trained feature classification model to determine a plurality of first cluster centers. Exemplarily, a plurality of first cluster centers corresponding to the plurality of second data may be selected from W cluster center groups (each cluster center group may include G cluster centers) obtained by training the feature classification model.
[0289] Exemplarily, the plurality of second data may be classified by the trained quantitative processing model to determine the plurality of first cluster centers. Exemplarily, the plurality of first cluster centers corresponding to the plurality of second data may be selected from the W cluster center groups obtained by training the quantitative processing model.
[0290] Specifically, for the kth second data among the W second data, the distance between the kth second data and the G cluster centers included in the kth cluster center group can be calculated. Then, from the G cluster centers included in the kth cluster center group, a cluster center that is a preset distance away from the group of second data can be selected as the first cluster center. In this way, W first cluster centers can be determined from the W second data.
[0291] It should be understood that the cluster center closest to the group of second data can be selected from the G cluster centers included in the k-th cluster center group as the first cluster center. Alternatively, the cluster center farthest from the group of second data can be selected from the G cluster centers included in the k-th cluster center group as the first cluster center.
[0292] It should be understood that different cluster centers can represent different classifications. Classifying the second data may not output the classification of the second data, but only determine one or more second cluster centers corresponding to the second data, and the second cluster centers correspond to the categories of the second data.
[0293] S606: Determine first data according to the indexes of the plurality of first cluster centers.
[0294] Exemplarily, the first data may be determined using the indexes of the W first cluster centers.
[0295] Exemplarily, the indexes of the plurality of first cluster centers may be determined by the trained index mapping model; wherein the indexes of the plurality of first cluster centers may be determined from the indexes of the W*G cluster centers obtained by the trained index mapping model.
[0296] Exemplarily, the indexes of one or more first cluster centers can be determined by the trained quantization processing model; wherein the indexes of multiple first cluster centers can be determined from the indexes of W*G cluster centers obtained by training the quantization processing model.
[0297] In one possible approach, the indexes of the W first cluster centers may be concatenated in the order of feature division to obtain the first data.
[0298] In one possible approach, the indexes of the W first cluster centers may be concatenated in a preset order to obtain the first data.
[0299] That is to say, the present application does not limit the method of determining the first data according to the index of the first cluster center.
[0300] It should be noted that S606 can be executed by the quantization processing model or by other modules, and this application does not impose any restrictions on this.
[0301] FIG6 b is a schematic diagram illustrating an exemplary quantization process.
[0302] Referring to Figure 6b, illustratively, the digital content feature is a 128-dimensional vector, the first matrix is a 1024-dimensional random orthogonal matrix, and the second matrix is a trained 1024-dimensional orthogonal matrix. After the digital content feature is input into the quantization processing model, the quantization processing model can multiply the digital content feature by the 1024-dimensional first matrix to obtain a 1024-dimensional fourth intermediate feature. Next, the fourth intermediate feature is multiplied by the 1024-dimensional second matrix to obtain a 1024-dimensional third intermediate feature. Thereafter, the third intermediate feature can be divided into 128 groups of 8-dimensional second data. Then, for the k-th group of second data, the closest cluster center can be selected from the 256 cluster centers included in the k-th cluster center group as the first cluster center; in this way, 128 first cluster centers can be obtained. Thereafter, the indices of these 128 first cluster centers are sequentially spliced. For example, the index of the first cluster center is 0000000, the index of the second cluster center is 00010000, ..., the index of the 128th first cluster center is 01100011, then the first data may be "000000000010000......01100011".
[0303] S607: Encode the first data to obtain a digital content identifier of the media content.
[0304] Compared with the embodiment of FIG5a, the embodiment of FIG6a has a lower dimension of cluster centers, thereby reducing the amount of classification calculation and increasing classification efficiency; thereby improving the efficiency of quantization processing and thus the efficiency of generating digital content identifiers.
[0305] In addition, by selecting the first cluster center with a smaller granularity, the selected first cluster center is more accurate, and thus the obtained first data is also more accurate, thereby improving the accuracy of the query.
[0306] For example, in order to verify the model used in this application for generating digital content identifiers (such as the feature extraction model and the quantization processing model), all input data can be recorded when training the model used for generating digital content identifiers, for example:
[0307] 1. Model type. For example, the model of the feature extraction model such as ResNet50, VGG16, etc.
[0308] 2. Methods for generating the second training data in the dataset and training set. For example, the dataset can be a public dataset, such as ImageNet or Cifar100 for image media. For example, for images, the second training data can be generated using the Stirmark Benchmark.
[0309] 3. Random parameters. Random parameters include the model's initial weights, batch selection order, and other randomly generated parameters. To ensure ease of model validation for all users, a random seed is agreed upon before model training. A pseudo-random number generator (such as the Mersenne Twister) is then used to generate a random number sequence based on this random seed, which is then used to assign values to the random parameters. Once the model and parameters are determined, the number and specifications of the required random parameters are also determined. Using the same random seed to generate a random number sequence ensures that each random parameter is identical.
[0310] 4. Empirical parameters. During training, some empirical parameters may be needed to ensure model effectiveness and convergence. For example, learning rate, interval parameter, epoch (iteration period), etc.
[0311] Based on these input data, the verification user can reshape the publicly released feature extraction model and quantitative processing model, thereby achieving the verifiability of the model.
[0312] Based on the identifier generation method in the above embodiment, the application shown in FIG. 1 a is described in detail.
[0313] FIG. 7 is a schematic diagram illustrating an exemplary query process.
[0314] S701: Receive query data, where the query data includes first media content and / or a first digital content identifier of the first media content.
[0315] Exemplarily, referring to the description of FIG. 1 a , the query data input by the user may be the first media content and / or the first digital content identifier of the first media content.
[0316] S702: Determine first data of first media content and a plurality of first data of second media content.
[0317] For example, when the query data input by the user is a first digital content identifier of a first media content, the first digital content identifier can be decoded to obtain the first data of the first media content. Furthermore, a pre-stored second digital content identifier of a second media content can be obtained and decoded to obtain the first data of the second media content.
[0318] Exemplarily, when the query data input by the user is first media content, some steps of the identifier generation method in the above embodiment may be executed to generate first data of the first media content; and to generate multiple pieces of first data of second media content.
[0319] S703 : Determine, based on the first data of the first media content and the first data of the plurality of second media content, the matching degree between the plurality of second digital content pieces and the first media content.
[0320] Exemplarily, the Hamming distance between the first data corresponding to the first media content and the first data corresponding to the plurality of second media contents may be used as the matching degree between the first media content and the plurality of second media contents.
[0321] S704: Output the top N pieces of second media content with the highest matching degree, where N is a positive integer.
[0322] Afterwards, the top N pieces of second media content with the highest matching degree may be output; N may be set as required, and this application does not impose any limitation thereto.
[0323] It should be noted that when S702 and S703 are executed by the terminal device, the output of S704 may refer to display. When S702 to S703 are executed by the server, the output of S704 may refer to outputting the top N pieces of second media content with the highest matching degree to the terminal device, and then the terminal device displays the top N pieces of second media content with the highest matching degree.
[0324] Compared to existing techniques that match by calculating the Euclidean distance of floating-point numbers, this application calculates the Hamming distance of binary strings, which reduces computational complexity and improves query efficiency. Furthermore, the correlation between the first data and the media content allows accurate retrieval of second media content that matches the first media content queried by the user, thus improving the user experience.
[0325] Based on the identifier generation method in the above embodiment, the application shown in FIG. 1 b is described in detail.
[0326] FIG8 is a schematic diagram illustrating an exemplary query process.
[0327] S801: Receive query data, where the query data includes first media content and / or a first digital content identifier of the first media content.
[0328] Exemplarily, referring to the description of FIG. 1 a , the query data input by the user may be the first media content and / or the first digital content identifier of the first media content.
[0329] S802: Determine first data of first media content and a plurality of first data of second media content.
[0330] For example, when the query data input by the user is a first digital content identifier of a first media content, the first digital content identifier can be decoded to obtain the first data of the first media content. Furthermore, a pre-stored second digital content identifier of a second media content can be obtained and decoded to obtain the first data of the second media content.
[0331] Exemplarily, when the query data input by the user is first media content, some steps of the identifier generation method in the above embodiment may be executed to generate first data of the first media content; and to generate multiple pieces of first data of second media content.
[0332] S803 : Determine, from the plurality of second media contents, second media contents that match the first media contents according to the first data of the first media contents and the first data of the plurality of second media contents.
[0333] Exemplarily, the Hamming distance between the first data corresponding to the first media content and the first data corresponding to the plurality of second media contents may be calculated; and the second media content corresponding to the smallest Hamming distance may be determined as the second media content matching the first media content.
[0334] S804: Output metadata of second media content that matches the first media content.
[0335] Afterwards, metadata of the second media content that matches the first media content may be output; N may be set as required, and this application does not impose any restrictions on this.
[0336] It should be noted that when S802 to S803 are executed by a terminal device, the output of S804 may refer to display. When S802 to S803 are executed by a server, the output of S804 may refer to outputting metadata of the second media content that matches the first media content to the terminal device, and then the terminal device displays the metadata of the second media content that matches the first media content.
[0337] Compared to existing techniques that match by calculating the Euclidean distance of floating-point numbers, this application calculates the Hamming distance of binary strings, which reduces computational complexity and improves query efficiency. Furthermore, the first data is associated with the media content, allowing for accurate retrieval of the metadata for the first media content, thus enhancing the user experience.
[0338] Figure 9 is a schematic diagram of an exemplary identification generating device. The identification generating device can be used to execute the method of the aforementioned embodiment. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects of the corresponding method provided above, and will not be repeated here.
[0339] 9 , illustratively, the identification generating device may include:
[0340] Acquisition module 901, used to acquire media content;
[0341] The feature extraction module 902 is used to extract features from the media content to obtain digital content features of the media content;
[0342] Quantization processing module 903, used to perform quantization processing on the digital content feature to obtain first data;
[0343] The identifier generating module 904 is configured to determine a digital content identifier of the media content according to the first data.
[0344] Exemplarily, the first data indicates indexes of one or more first cluster centers, where the one or more first cluster centers are one or more of a plurality of cluster centers, and the plurality of cluster centers are used for classifying digital content features.
[0345] Exemplarily, the one or more first cluster centers are one or more cluster centers at a preset distance from the digital content feature to the multiple cluster centers.
[0346] Exemplarily, the one or more first cluster centers are one or more cluster centers that are closest or farthest from the digital content feature to the multiple cluster centers.
[0347] Exemplarily, the quantization processing module 903 is specifically configured to classify the digital content features and determine one or more first cluster centers; and determine the first data according to the indexes of the one or more first cluster centers.
[0348] Exemplarily, the plurality of first cluster centers are a plurality of cluster centers with preset distances from the plurality of second data to the plurality of cluster centers, and the plurality of second data are data obtained by performing feature transformation according to features of digital content.
[0349] Exemplarily, the quantization processing module 903 is specifically used to perform feature transformation on digital content features to obtain multiple second data; classify the multiple second data to determine multiple first cluster centers, where the first cluster center is the cluster center at a preset distance from the second data to the multiple cluster centers; and determine the first data based on the indexes of the multiple first cluster centers.
[0350] Exemplarily, the digital content feature is multi-dimensional data, and the dimension of the second data is smaller than the dimension of the digital content feature.
[0351] Exemplarily, the indexes of different first cluster centers are used to measure the similarity between different media contents.
[0352] Exemplarily, the feature extraction module 902 is specifically configured to input the media content into the first feature extraction model and output digital content features of the media content.
[0353] Exemplarily, the scene type to which the media content belongs corresponds to the first feature extraction model, the first feature extraction model is one or more of a plurality of feature extraction models, and the plurality of feature extraction models correspond one-to-one to a plurality of scene types.
[0354] Exemplarily, the identifier generating apparatus further includes: a scene classification module, configured to classify the media content and determine the scene type to which the media content belongs.
[0355] Exemplarily, the identifier generating module 904 is specifically configured to encode the first data to obtain a digital content identifier of the media content.
[0356] Exemplarily, the media content includes at least one of the following: text, video, graphics, audio, image, or 3D model.
[0357] Exemplarily, the digital content feature includes a digital fingerprint.
[0358] Exemplarily, the first feature extraction model is a trained neural network model, and the training set of the first feature extraction model includes: first training data, second training data, and third training data; wherein, the scene type to which the first training data belongs and the scene type to which the third training data belongs are the same as the scene type to which the media content belongs; the third training data is different from the first training data; and the second training data is adversarial data of the first training data.
[0359] Exemplarily, the data type of the digital content feature is a floating point type, and the first data is a binary string.
[0360] Exemplarily, the data volume of the first data is smaller than the data volume of the digital content feature.
[0361] In an example, FIG10 shows a schematic block diagram of a device 1000 according to an embodiment of the present application. The device 1000 may include: a processor 1001 and a transceiver / transceiver pin 1002 , and optionally, a memory 1003 .
[0362] The various components of the device 1000 are coupled together via a bus 1004. The bus 1004 includes a data bus, a power bus, a control bus, and a status signal bus. However, for clarity, all buses are referred to as bus 1004 in the figure.
[0363] Optionally, the memory 1003 may be used to store instructions in the aforementioned method embodiment. The processor 1001 may be used to execute the instructions in the memory 1003 and control the receiving pin to receive a signal and control the transmitting pin to send a signal.
[0364] The apparatus 1000 may be the electronic device or a chip of the electronic device in the above method embodiment.
[0365] Among them, all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.
[0366] The present application also provides a chip comprising one or more interface circuits and one or more processors. The one or more processors receive or send data via the one or more interface circuits. When the one or more processors execute computer instructions, the electronic device implements the identifier generation method described in the above embodiment by performing the above-mentioned related method steps. The interface circuit is a transceiver / transceiver pin 1002.
[0367] This embodiment further provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the identification generation method in the above-mentioned embodiment.
[0368] This embodiment further provides a computer program product, which includes computer instructions. When the computer instructions are executed by a computer or a processor, the computer executes the above-mentioned related steps to implement the identifier generation method in the above-mentioned embodiment.
[0369] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor can execute the computer-executable instructions stored in the memory to enable the chip to execute the identification generation method in the above-mentioned method embodiments.
[0370] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0371] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0372] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0373] Units described as separate components may or may not be physically separate, and components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0374] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0375] Any content of each embodiment of this application, as well as any content of the same embodiment, can be freely combined. Any combination of the above content is within the scope of this application.
[0376] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0377] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
[0378] The steps of the method or algorithm described in conjunction with the disclosure of the embodiments of the present application can be implemented in a hardware manner, or can be implemented by a processor executing a software instruction. The software instruction can be composed of corresponding software modules, and the software module can be stored in a random access memory (Random Access Memory, RAM), a flash memory, a read-only memory (Read Only Memory, ROM), an erasable programmable read-only memory (Erasable Programmable ROM, EPROM), an electrically erasable programmable read-only memory (Electrically EPROM, EEPROM), a register, a hard disk, a mobile hard disk, a read-only compact disc (CD-ROM) or any other form of storage medium well known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.
[0379] Those skilled in the art will appreciate that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer-readable storage media and communication media, wherein communication media include any media that facilitates the transmission of computer programs from one place to another. The storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0380] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
Claims
1. A method for generating an identifier, characterized in that: The method comprises: Get media content; Extracting features from the media content to obtain digital content features of the media content; Quantifying the digital content feature to obtain first data; A digital content identifier of the media content is determined according to the first data.
2. The method according to claim 1, characterized in that The first data indicates indexes of one or more first cluster centers, where the one or more first cluster centers are one or more of a plurality of cluster centers, and the plurality of cluster centers are used for classifying the digital content features.
3. The method according to claim 2, characterized in that The one or more first cluster centers are one or more cluster centers at a preset distance from the digital content feature to the multiple cluster centers.
4. The method according to claim 3, characterized in that The one or more first cluster centers are one or more cluster centers that are closest to or farthest from the digital content feature among the multiple cluster centers.
5. The method according to claim 3 or 4, characterized in that: The step of quantifying the digital content feature to obtain first data includes: Classifying the digital content features to determine the one or more first cluster centers; The first data is determined according to the indexes of the one or more first cluster centers.
6. The method according to claim 2, characterized in that The plurality of first cluster centers are a plurality of cluster centers with preset distances from the plurality of second data to the plurality of cluster centers, and the plurality of second data are data obtained by performing feature transformation according to the features of the digital content.
7. The method according to claim 6, characterized in that The step of quantifying the digital content feature to obtain first data includes: Performing feature transformation on the digital content feature to obtain a plurality of second data; Classifying the plurality of second data to determine the plurality of first cluster centers, where the first cluster center is a cluster center at a preset distance from the second data to the plurality of cluster centers; The first data is determined according to the indexes of the plurality of first cluster centers.
8. The method according to claim 6 or 7, characterized in that: The digital content feature is multi-dimensional data, and the dimension of the second data is smaller than the dimension of the digital content feature.
9. The method according to any one of claims 2 to 8, characterized in that: The indexes of different first cluster centers are used to measure the similarities between different media contents.
10. The method according to any one of claims 1 to 9, characterized in that: The extracting features of the media content to obtain digital content features of the media content includes: The media content is input into a first feature extraction model, and digital content features of the media content are output.
11. The method according to claim 10, characterized in that The scene type to which the media content belongs corresponds to the first feature extraction model, and the first feature extraction model is one or more of a plurality of feature extraction models, and the plurality of feature extraction models correspond one-to-one to a plurality of scene types.
12. The method according to any one of claims 1 to 11, characterized in that: The method further comprises: The media content is classified to determine the scene type to which the media content belongs.
13. The method according to any one of claims 1 to 12, characterized in that: Determining the digital content identifier of the media content according to the first data includes: The first data is encoded to obtain a digital content identifier of the media content.
14. The method according to any one of claims 1 to 13, characterized in that: The media content includes at least one of the following: text, video, graphics, audio, image or 3D model.
15. The method according to any one of claims 1 to 14, characterized in that The digital content characteristics include digital fingerprints.
16. The method according to claim 10 or 11, characterized in that The first feature extraction model is a trained neural network model, and the training set of the first feature extraction model includes: first training data, second training data and third training data; The scene type to which the first training data belongs and the scene type to which the third training data belongs are the same as the scene type to which the media content belongs; the third training data is different from the first training data; and the second training data is adversarial data of the first training data.
17. The method according to any one of claims 1 to 16, characterized in that: The data type of the digital content feature is a floating point type, and the first data is a binary string.
18. The method according to any one of claims 1 to 17, characterized in that The data volume of the first data is smaller than the data volume of the digital content feature.
19. A query method, characterized in that: The method comprises: receiving query data, the query data including first media content and / or a digital content identifier of the first media content, metadata of the first media content being lost; Determine, from the plurality of second media contents, according to the first data of the first media content and the first data of the plurality of second media contents, the second media content matching the first media content; wherein the first data of the first media content is obtained by quantizing the digital content features of the first media content or decoding the first digital content identifier, and the first data of the second media content is obtained by quantizing the digital content features of the second media content or decoding the digital content identifier of the second media content; Metadata of second media content matching the first media content is output.
20. The method according to claim 19, characterized in that The determining, according to the first data of the first media content and the first data of the plurality of second media contents, second media contents matching the first media contents from the plurality of second media contents comprises: determining a Hamming distance between first data of the first media content and first data of the plurality of pieces of second media content; The second media content corresponding to the smallest Hamming distance is determined as the second media content matching the first media content.
21. A query method, characterized in that: The method comprises: receiving query data, the query data including first media content and / or a digital content identifier of the first media content; Determine the degree of matching between the plurality of second digital contents and the first media content according to the first data of the first media content and the first data of the plurality of second digital contents; wherein the first data of the first media content is obtained by quantizing the digital content features of the first media content or decoding the digital content identifier of the first media content, and the first data of the second media content is obtained by quantizing the digital content features of the second media content or decoding the digital content identifier of the second media content; Output the top N pieces of second media content with the highest matching degree, where N is a positive integer.
22. The method according to claim 21, characterized in that The determining, according to the first digital content identifier of the first media content and the second digital content identifiers of the plurality of second media contents, the matching degree between the plurality of second digital contents and the first media content comprises: The Hamming distance between the first data of the plurality of second media contents and the first data of the first media content is used as the matching degree between the plurality of second media contents and the first media content.
23. A device for generating an identification, characterized in that: Used to execute the identification generation method described in any one of claims 1 to 18 above.
24. A query device, characterized in that: Used to execute the query method described in any one of claims 19 to 22.
25. An electronic device, characterized in that: include: a memory and a processor, the memory being coupled to the processor; The memory stores program instructions, and when the program instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 18.
26. A chip, characterized in that: The electronic device comprises one or more interface circuits and one or more processors; the one or more processors receive or send data through the one or more interface circuits, and when the one or more processors execute computer instructions, the electronic device executes the method as described in any one of claims 1 to claim 18.
27. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program runs on a computer or a processor, the computer or the processor executes the method according to any one of claims 1 to 18.
28. A computer program product, characterized in that The computer program product comprises computer instructions, which, when executed by a computer or a processor, cause the steps of the method according to any one of claims 1 to 18 to be performed.
Citation Information
Patent Citations
Massive image retrieval method based on multi-characteristic signature
CN101859320A
Video query method and device
CN105468781A
Video retrieval method and device, electronic equipment and storage medium
CN111241345A
Video library index table establishing method and device, server and storage medium
CN111368133A
Identification generation method and electronic equipment
CN116578867A
