Object attribute acquisition method, device, electronic device and storage medium
By combining the matching degree of attribute names and values, the attribute information is directly extracted from the product description text, solving the problems of inefficiency and low accuracy in the prior art, and achieving efficient and accurate attribute acquisition.
Patent Information
- Application Number
- CN202110310137.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-23
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2041-03-23
AI Technical Summary
The prior art is inefficient and has low accuracy when extracting attribute values from product description text, especially when the attribute name does not match the attribute value, resulting in a cumbersome attempt-by-one process.
The initial model is trained by training samples that mark the real attribute names and values. Combining the matching degree of attribute name prediction results and value recognition results, the information recognition model is trained to directly obtain the attribute name and matching attribute value of the object description text.
It improves the efficiency and accuracy of object attribute acquisition, avoids the problem of mismatch between attribute names and values, and realizes efficient and accurate extraction of attribute information from object description text.
Smart Images

Figure CN115115423B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method, device, electronic device and storage medium for acquiring object attributes. Background Art
[0002] The attribute information of objects such as commodities and animals is very important in many fields. The following takes commodities as an example. Commodity attribute information is indispensable key information in many e-commerce tasks such as commodity recommendation and commodity retrieval. It mainly includes attribute names and their corresponding attribute values. However, in many cases, the attribute values corresponding to the attribute names are not recorded, that is, they are missing.
[0003] The mainstream technology in the industry is to try to extract the corresponding attribute value directly from the product description text for each attribute name with missing attribute value. Trying one by one is cumbersome and inefficient, and there may be a problem that the extracted attribute value does not match the attribute name, and the accuracy is not high. Summary of the invention
[0004] The present application provides a method, device, electronic device and storage medium for acquiring object attributes.
[0005] According to a first aspect of the present application, a method for obtaining object attributes is provided, comprising:
[0006] Acquire training samples; the training samples are annotated with real attribute names of objects described by the samples and real attribute values matching the real attribute names;
[0007] Obtaining the attribute name prediction result and the attribute value recognition result output by the initial model to be trained for the training sample;
[0008] Calculating the matching degree between the attribute name prediction result and the attribute value recognition result;
[0009] The initial model is trained according to the real attribute name, the real attribute value, the attribute name prediction result, the attribute value recognition result, and the degree of matching between the attribute name prediction result and the attribute value recognition result to obtain an information recognition model, so as to obtain the attribute name corresponding to the object description text and the attribute value matching the attribute name according to the information recognition model.
[0010] According to a second aspect of the present application, a device for acquiring object attributes is provided, the device comprising:
[0011] A sample acquisition module is used to acquire training samples; the training samples are annotated with real attribute names of the objects described by the samples and real attribute values matching the real attribute names;
[0012] A result acquisition module, used to obtain the attribute name prediction result and attribute value recognition result output by the initial model to be trained for the training sample;
[0013] A matching calculation module, used to calculate the matching degree between the attribute name prediction result and the attribute value recognition result;
[0014] An attribute acquisition module is used to train the initial model according to the real attribute name, the real attribute value, the attribute name prediction result, the attribute value recognition result, and the degree of matching between the attribute name prediction result and the attribute value recognition result to acquire an information recognition model, so as to acquire the attribute name corresponding to the object description text and the attribute value matching the attribute name according to the information recognition model.
[0015] According to a third aspect of the present application, an electronic device is provided, including:
[0016] at least one processor; and,
[0017] a memory communicatively connected to the at least one processor; wherein,
[0018] The memory has instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the object attribute acquisition method described in the first aspect of the present application.
[0019] According to a fourth aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the object attribute acquisition method described in the first aspect of the present application.
[0020] According to a fifth aspect of the present application, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the object attribute acquisition method according to the first aspect is implemented.
[0021] According to the technical solution provided in the present application, the initial model is trained by training samples labeled with real attribute names and matching real attribute values, and the matching degree between the attribute name prediction results and the attribute value recognition results output by the initial model is fully considered during the training process. The initial model is then trained in combination with the real attribute names and the real attribute values, so that the information recognition model finally obtained through the training method can directly obtain the attribute names of the object description text and the matching attribute values, that is, the attribute names and attribute values corresponding to the object description text can be obtained at the same time, and there is no need to try one by one for each attribute name of the attribute value to be extracted to see if the corresponding attribute value can be extracted from the product description text, thereby improving the efficiency of obtaining object attributes; in addition, since the information recognition model is trained based on the matching degree between the attribute name prediction results and the attribute value recognition results, it can output attribute values that match the attribute names, effectively improving the accuracy of obtaining object attributes.
[0022] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.
[0024] Figure 1 is a flow chart of a method for obtaining object attributes provided in an embodiment of the present application;
[0025] Figure 2 It is a flow chart of a method for obtaining an information recognition model provided in an embodiment of the present application;
[0026] Figure 3 is a flow chart of another method for obtaining an information recognition model provided in an embodiment of the present application;
[0027] Figure 4 It is a structural block diagram of an object attribute acquisition device provided in an embodiment of the present application;
[0028] Figure 5 It is a block diagram of an electronic device used to implement the object attribute acquisition method of the embodiment of the present application. DETAILED DESCRIPTION
[0029] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0030] Considering that the related technology is cumbersome, inefficient and inaccurate when supplementing the missing attribute values of the object, in order to improve at least one of the above problems, the embodiment of the present application provides an object attribute acquisition method, device, electronic device and storage medium. The information recognition model obtained through training can directly output the attribute name corresponding to the object description text and the attribute value matching the attribute name. This method can extract the object attribute information from the object description text more efficiently and accurately. The information recognition model provided by the embodiment of the present application can be applied to any scenario where object attribute information needs to be extracted from the object description text, which is not limited here. The object attribute acquisition method provided in this embodiment can be applied to electronic devices, such as mobile phones, computers, robots, etc., which have data processing capabilities, and are not limited here.
[0031] For ease of understanding, the embodiments of the present application are described in detail below.
[0032] See first Figure 1 The flowchart of a method for obtaining object attributes is shown, which can be executed by an electronic device and mainly includes the following steps S102 to S108:
[0033] Step S102, obtaining training samples; the training samples are annotated with real attribute names of the objects described by the samples and real attribute values matching the real attribute names.
[0034] In some specific implementations, the training sample may be an unstructured text described in natural language, containing relevant descriptive information of an object. The object in the embodiment of the present application may be a commodity, or an article, a person, an animal, etc., which is not limited here. Attribute names such as color, size, power, variety, material, etc., which characterize the characteristics of an object, and attribute values are specific manifestations of the object attributes, such as the attribute value of the "color" attribute may be white, black, blue, etc., and the attribute value of the "material" attribute may be metal, plastic, etc.
[0035] The above training samples may include multiple texts, each of which may be just one sentence or a paragraph, which is not limited here. The training samples are annotated with (carry) the real attribute name of the object described by the sample and the real attribute value that matches the real attribute name. For example, in the training sample, there is a shoe description text "This pair of shoes is white", which is also annotated with the following attribute information: color-white; among which, "color" is the real attribute name of the shoes described in the text, and "white" is the real attribute value that matches the "color" attribute name in the text.
[0036] Step S104, obtaining the attribute name prediction results and attribute value recognition results output by the initial model to be trained for the training sample.
[0037] The initial model is a pre-built untrained machine learning model. In some embodiments, the initial model can be a neural network model. The training sample is input into the initial model, and the initial model recognizes the training sample and outputs the corresponding attribute name prediction result and attribute value recognition result. In some specific embodiments, the initial model can analyze the training sample at the sentence level to predict the attribute name that each sentence may represent, and classify each word in each sentence at the word level, so as to extract the attribute value contained in each sentence.
[0038] Step S106, calculating the matching degree between the attribute name prediction result and the attribute value recognition result.
[0039] For example, for the training sample "This pair of shoes is white", if the attribute name prediction result output by the model is "color" and the attribute value recognition result is "white", the two are completely matched. If the attribute name prediction result output by the model is "size" and the attribute value recognition result is "white", the two do not match. In one embodiment, a loss function for measuring the degree of matching between the attribute name prediction result and the attribute value recognition result can be pre-set, and the degree of matching between the attribute name prediction result and the attribute value recognition result can be objectively characterized by the loss function value. In addition, the degree of matching between the attribute name prediction result and the attribute value recognition result can also be measured by related algorithms such as the cosine similarity algorithm, which is not limited here. During the training process, the correlation between the attribute name prediction results obtained by the model performing the attribute prediction task and the attribute value recognition task is fully considered, so that the possible mismatch between the attribute name prediction results and the attribute value recognition results obtained by the model performing two independent tasks can be effectively avoided.
[0040] Step S108, training the initial model according to the real attribute name, the real attribute value, the attribute name prediction result, the attribute value recognition result, and the matching degree between the attribute name prediction result and the attribute value recognition result to obtain the information recognition model, so as to obtain the attribute name corresponding to the object description text and the attribute value matching the attribute name according to the information recognition model.
[0041] For example, by comparing the real attribute names with the attribute name prediction results output by the initial model, comparing the real attribute values with the attribute value recognition results output by the initial model, and combining the matching degree of the attribute name prediction results and the attribute value recognition results, the initial model is trained using the back propagation algorithm, and the parameters of the initial model are repeatedly adjusted until the initial model can output the expected attribute name prediction results and attribute value recognition results, and the training is terminated. The trained initial model is used as the information recognition model obtained through training, which can simultaneously and accurately output the attribute name of the object described by the object description text to be recognized and the attribute value matching the attribute name.
[0042] The above-mentioned object attribute acquisition method provided in the embodiment of the present application trains the initial model through training samples marked with real attribute names and matching real attribute values, and fully considers the matching degree between the attribute name prediction results and the attribute value recognition results output by the initial model during the training process, and then trains the initial model in combination with the real attribute names and the real attribute values, so that the information recognition model finally obtained through the training method can directly obtain the attribute names of the object description text and the matching attribute values, that is, the attribute names and attribute values corresponding to the object description text can be obtained at the same time, and there is no need to try one by one for each attribute name of the attribute value to be extracted to see if the corresponding attribute value can be extracted from the product description text, thereby improving the efficiency of obtaining object attributes; in addition, since the information recognition model is trained based on the matching degree between the attribute name prediction results and the attribute value recognition results, it can output attribute values that match the attribute names, effectively improving the accuracy of obtaining object attributes.
[0043] As described above, the attribute name and attribute value output by the information recognition model in the embodiment of the present application for the object description text are matched, that is, the information recognition model obtained through training can directly output accurate object attribute information for the object description text, which can avoid the problem of mismatch between attribute name and attribute value that may occur when the related technology directly extracts attribute value based on attribute name. For example, for "This is a white size 39 sneaker", if the object attribute information of this sentence is correctly recognized, it should be obtained: attribute name "color" and the attribute value "white" that matches it, attribute name "size" and the attribute value "size" that matches it. If the parsing is wrong, the attribute name "color" may have an attribute value corresponding to "size 39" and an attribute name "size" may have an attribute value corresponding to "white". The reason why the information recognition model in the embodiment of the present application can directly output correct object attribute information is mainly because the matching degree between the attribute name prediction result and the attribute value recognition result output by the model is fully considered during the training process, so that the task execution process of obtaining the attribute name prediction result and the attribute value recognition result is not independent, but mutually constrained to make the two match as much as possible. The model is trained through the matching degree of the two, and finally an information recognition model that can accurately output attribute names and attribute values matching them is obtained, so as to further obtain the attribute information of the object description text to be identified through the information recognition model.
[0044] For ease of understanding, based on the above-mentioned embodiment of the object attribute acquisition method, the embodiment of the present application further provides a method for acquiring the information recognition model required in the object attribute acquisition method. This embodiment focuses on a specific implementation method of training the initial model into an information recognition model. Figure 2 The flowchart of a method for obtaining an information recognition model shown mainly includes the following steps S202 to S214:
[0045] Step S202, obtaining training samples; the training samples are annotated with real attribute names of the objects described by the samples and real attribute values matching the real attribute names.
[0046] Step S204, obtaining the attribute name prediction results and attribute value recognition results output by the initial model to be trained for the training sample.
[0047] In one implementation, the attribute name prediction result is obtained by the initial model using a sentence classification algorithm to process the training sample; the attribute value recognition result is obtained by the initial model using a sequence labeling algorithm to process the training sample.
[0048] Step S206, inputting the attribute name prediction result and the attribute value recognition result into a preset first loss function to obtain a matching degree loss function value for measuring the matching degree between the attribute name prediction result and the attribute value recognition result.
[0049] By introducing the first loss function during the training process, the attribute name prediction results obtained by the model performing the attribute prediction task and the attribute value recognition results obtained by the model performing the attribute value recognition task can be constrained for consistency, that is, the attribute value recognition results output by the model have a certain correlation with the attribute name prediction results, rather than being independent of each other, thereby further ensuring that the attribute value recognition results match the attribute name prediction results. In a specific embodiment, the first loss function may include a KL (Kullback-Leibler) loss function, which can also be called a KL divergence loss function. The KL loss function is mainly used to compare the degree of closeness of two probability distributions, so the function can be applied to the embodiments of the present application to measure the degree of matching between the attribute name prediction results and the attribute value recognition results. The two are measured by the KL loss function. The closer the KL loss function indicates, the more the two are matched. The use of the KL loss function can more objectively measure the degree of matching between the attribute name prediction results and the attribute value recognition results.
[0050] Step S208: input the real attribute name and the attribute name prediction result into a preset second loss function to obtain an attribute name loss function value.
[0051] In a specific implementation, the second loss function may include a cross entropy function, which is used to measure the difference between the predicted value (attribute name prediction result) and the actual value (real attribute name). It can be understood that the smaller the attribute name loss function value, the closer the attribute name prediction result is to the real attribute name.
[0052] Step S210: input the true attribute value and the attribute value recognition result into a preset third loss function to obtain an attribute value loss function value.
[0053] In a specific implementation, the third loss function may also include a cross entropy function, which measures the difference between the predicted value (attribute value recognition result) and the actual value (true attribute value) through the cross entropy function. It can be understood that the smaller the value of the attribute value loss function, the closer the attribute value recognition result is to the true attribute value.
[0054] It should be noted that the first loss function, the second loss function and the third loss function may be the same or different, and this embodiment does not limit this.
[0055] Step S212, calculating the total loss function value according to the attribute name loss function value, the attribute value loss function value and the matching degree loss function value.
[0056] In a specific implementation, weights can be assigned to the attribute name loss function value, the attribute value loss function value, and the matching degree loss function value, respectively, and then the total loss function value is obtained by weighted method. The weight assignment method can be flexibly set, such as setting the weights of the attribute name loss function value, the attribute value loss function value, and the matching degree loss function value to be the same.
[0057] Step S214, training the initial model according to the total loss function value to obtain an information recognition model.
[0058] Through the above method provided in the embodiment of the present application, three loss functions are used to measure the matching degree between the attribute name prediction result and the attribute value recognition result, the proximity between the attribute name prediction result and the actual attribute name, and the proximity between the attribute value recognition result and the actual attribute value. Then, the initial model is trained according to the total loss function value, so that the information recognition model finally obtained by training can output the expected attribute name prediction results and attribute value recognition results, thereby improving the efficiency and accuracy of object attribute acquisition through the information recognition model.
[0059] Based on the above-mentioned embodiment of obtaining the information recognition model, the embodiment of the present application further provides an example of obtaining the information recognition model, see Figure 3 Another method for obtaining an information recognition model shown in the flowchart mainly includes the following steps S302 to S316:
[0060] Step S302, obtaining training samples; the training samples are annotated with real attribute names of the objects described by the samples and real attribute values matching the real attribute names.
[0061] Step S304: Process the training samples using the sentence classification algorithm through the initial model to obtain attribute name prediction results.
[0062] In the embodiment of the present application, the initial model can predict the attribute name of the training text by performing the sentence classification task, and obtain the attribute name corresponding to the text, that is, obtain the attribute name prediction result. That is, the initial model predicts the attribute name contained in the sentence by classifying the attributes of the sentence. For ease of understanding, this embodiment provides a specific implementation method:
[0063] The training text is encoded using BERT (Bidirectional Encoder Representations from Transformers) to obtain the following semantic representation of the training text: h = (h0, h1, h2, …, h N), where h can also be understood as a sentence sequence vector, which is composed of multiple semantic vectors, where each word in the sentence corresponds to a semantic vector. N is the total length of the input text. h0 is the [CLS] vector, where CLS is the abbreviation of classification. The initial model classifies the text based on the [CLS] vector in the sentence sequence vector, and obtains the attribute name corresponding to the attribute value contained in the text. In one implementation, the initial model can predict the attribute name y corresponding to the text based on the following formula a :
[0064] y a =σ(W1h0)
[0065] Among them, W1 is a learnable parameter, y a Represented in vector form. σ() is the sigma function. In practical applications, the correspondence between vectors and attribute names can be established in advance, and the corresponding specific attribute name can be directly obtained based on the obtained vector.
[0066] The sentence classification algorithm can more directly and efficiently predict the attribute name that each sentence may represent at the sentence level.
[0067] Step S306, using the initial model to process the training samples using a sequence labeling algorithm to obtain an attribute value recognition result.
[0068] In the embodiment of the present application, the initial model can realize the attribute value recognition of the training text by performing the sequence labeling task to obtain the attribute value corresponding to the text. The attribute value recognition process can also be understood as the process of identifying each semantic vector h in the sentence sequence vector. i Classify and get the semantic vector h i The initial model can determine the semantic vector h corresponding to each word in the text based on the following formula: i The probability of an attribute value matching the attribute name
[0069]
[0070] Among them, W3 is a learnable parameter, and softamx() is a normalized exponential function. In practical applications, each identified attribute value can be further labeled with the letter B or the letter I to indicate whether it belongs to the starting word or the middle word, wherein B represents the starting word (begin) and I represents the middle word (In). Assuming that the initial model identifies and labels the attribute value of "This is a white shoe", the attribute value "white" can be labeled as "color B", which is the starting word of the color attribute, and the attribute value "color" can be labeled as "color I", which is the middle word of the color attribute. In one embodiment, the attribute value recognition result y that is most likely to match the attribute name can be further obtained according to the following formula: v→a :
[0071]
[0072] in, Represents the semantic vector h corresponding to each word i is the maximum probability of the attribute value starting word matching the attribute name, Represents the semantic vector h corresponding to each word i is the maximum probability of the middle word of the attribute value matching the attribute name, y v→a This is the attribute value identification result that is most likely to match the attribute name.
[0073] The sequence labeling algorithm can more accurately extract the attribute values that may be contained in each sentence.
[0074] Step S308, inputting the attribute name prediction result and the attribute value recognition result into a preset KL loss function to obtain a matching degree loss function value for measuring the matching degree between the attribute name prediction result and the attribute value recognition result.
[0075] Among them, the matching degree loss function Loss KL Characterized in the following form:
[0076] Loss KL =KL(y a ||y v→a )
[0077] y a The predicted result of the attribute name output by the model, y v→a is the attribute value recognition result that is most likely to match the attribute name, that is, the attribute value recognition result that can be output by the model, which can also be directly expressed as y v .
[0078] Step S310, inputting the real attribute name and the attribute name prediction result into a preset cross entropy loss function to obtain the attribute name loss function value.
[0079] Among them, the attribute name loss function Loss a Characterized in the following form:
[0080]
[0081] y a The predicted result of the attribute name output by the model, The true attribute names annotated for the training samples.
[0082] Step S312: input the true attribute value and the attribute value recognition result into a preset cross entropy loss function to obtain the attribute value loss function value.
[0083] Among them, the attribute value loss function Loss v Characterized in the following form:
[0084]
[0085] y v is the attribute value recognition result output by the model, The true attribute values labeled for training samples.
[0086] Step S314, summing the attribute name loss function value, the attribute value loss function value and the matching degree loss function value to obtain a total loss function value.
[0087] That is, the total loss function Loss is represented as follows:
[0088] Loss=Loss a +Loss v +Loss KL
[0089] Step S316, training the initial model based on the total loss function value, adjusting the initial model parameters, until the training is completed to obtain the information recognition model.
[0090] In the above training method, the KL loss function is used to measure the matching degree between the attribute name prediction result and the attribute value recognition result, and the cross entropy loss function is used to measure the proximity between the attribute name prediction result and the actual attribute name, and the proximity between the attribute value recognition result and the actual attribute value. The three loss function values are then summed up, and the initial model is trained based on the sum value. This can more quickly and efficiently train an information recognition model that meets the requirements, so as to further accurately obtain the attribute information of the object description text to be recognized based on the information recognition model, thereby improving the efficiency and accuracy of object attribute acquisition.
[0091] After obtaining the information recognition model through any of the above-mentioned training methods, the information recognition model can be used to obtain the attribute name and attribute value of the object described by the object description text to be recognized. In specific implementation, the object description text to be recognized is input into the information recognition model, and then the object description text is predicted by the information recognition model and the attribute name and attribute value recognition are performed to obtain the attribute name corresponding to the object description text and the attribute value matching the attribute name.
[0092] For ease of understanding, a specific example to which the embodiments of the present application can be applied is given below for illustration. An e-commerce platform needs to obtain relevant attribute information of a certain product (taking an air conditioner as an example). Assume that the e-commerce platform wants to determine the six attributes of the air conditioner, but the existing attribute information of the air conditioner is shown in Table 1 below:
[0093] Property Name Brand Name model Number of pieces color Energy efficiency Energy efficiency rating Property Value XX brand 35GW / 81 1.5 5.2
[0094] Table 1
[0095] As shown in Table 1, the color attribute and energy efficiency grade attribute of the air conditioner are both missing the attribute values that match them, and a paragraph of text describing the air conditioner (that is, the description text of the air conditioner) is obtained through crawling technology. The object attribute acquisition method provided in the embodiment of the present application is used to identify the paragraph of text, and the attribute information of the air conditioner recorded in the text can be extracted. Assuming that the description text of the air conditioner contains a sentence "This air conditioner is white, beautiful and generous", by applying the object attribute acquisition method provided in the embodiment of the present application, it can be directly identified to obtain the attribute information corresponding to the sentence as "attribute name: color; attribute value: white", thereby completing the attribute value corresponding to the color in Table 1. In addition, assuming that the description text of the air conditioner also contains a sentence "This air conditioner is a new first-level energy efficiency, which is very energy-saving and environmentally friendly", by applying the object attribute acquisition method provided in the embodiment of the present application, it can be directly parsed to obtain the attribute information corresponding to the sentence as "attribute name: energy efficiency grade; attribute value: new first-level energy efficiency", thereby completing the attribute value corresponding to the energy efficiency grade in Table 1, and finally completing the attribute information table of the air conditioner. That is, by inputting the air conditioner description text into the information recognition model, the attribute name and attribute value corresponding to the text can be directly obtained. In the related art, it may be necessary to determine whether the attribute value corresponding to the attribute name "color" and the attribute value corresponding to the attribute name "energy efficiency level" can be extracted for each crawled sentence, which is rather cumbersome and not only inefficient, but also may extract the "new first-level energy efficiency" attribute value that does not match the "color" attribute, and the accuracy is not high. In contrast, the object attribute acquisition method provided in the embodiment of the present application, through training, can accurately output the attribute name and the real attribute value that matches it at the same time, which not only improves the efficiency of object attribute acquisition, but also improves the accuracy of object attribute acquisition.
[0096] It should be understood that the above is only for ease of understanding, and the object attribute acquisition method provided in the embodiment of the present application is an application example and should not be regarded as a limitation. In actual applications, any scenario that needs to obtain the attribute information contained in the object description text can adopt the object attribute acquisition method provided in the embodiment of the present application, and is not limited here.
[0097] Corresponding to the aforementioned object attribute acquisition method, the present application embodiment further provides an object attribute acquisition device, see Figure 4 The structure block diagram of a device for acquiring object attributes is shown, and the device mainly includes:
[0098] The sample acquisition module 42 is used to acquire training samples; the training samples are annotated with the real attribute names of the objects described by the samples and the real attribute values matching the real attribute names;
[0099] A result acquisition module 44 is used to obtain the attribute name prediction result and attribute value recognition result output by the initial model to be trained for the training sample;
[0100] A matching calculation module 46, used to calculate the matching degree between the attribute name prediction result and the attribute value recognition result;
[0101] The attribute acquisition module 48 is used to train the initial model according to the real attribute name, the real attribute value, the attribute name prediction result, the attribute value recognition result, and the matching degree between the attribute name prediction result and the attribute value recognition result to obtain the information recognition model, so as to obtain the attribute name corresponding to the object description text and the attribute value matching the attribute name according to the information recognition model.
[0102] The above-mentioned object attribute acquisition device provided in the embodiment of the present application trains the initial model through training samples marked with real attribute names and matching real attribute values, and fully considers the matching degree between the attribute name prediction results and the attribute value recognition results output by the initial model during the training process, and then trains the initial model in combination with the real attribute names and the real attribute values, so that the information recognition model finally obtained through the training method can directly obtain the attribute names of the object description text and the matching attribute values, that is, the attribute names and attribute values corresponding to the object description text can be obtained at the same time, and there is no need to try one by one for each attribute name of the attribute value to be extracted to see if the corresponding attribute value can be extracted from the product description text, thereby improving the efficiency of obtaining object attributes; in addition, since the information recognition model is trained based on the matching degree between the attribute name prediction results and the attribute value recognition results, it can output attribute values that match the attribute names, effectively improving the accuracy of obtaining object attributes.
[0103] In some embodiments, the matching calculation module 46 is further configured to:
[0104] The attribute name prediction result and the attribute value recognition result are input into a preset first loss function to obtain a matching degree loss function value for measuring the matching degree between the attribute name prediction result and the attribute value recognition result.
[0105] In some embodiments, the attribute acquisition module 48 is further configured to:
[0106] Input the real attribute name and the attribute name prediction result into the preset second loss function to obtain the attribute name loss function value;
[0107] Inputting the true attribute value and the attribute value recognition result into a preset third loss function to obtain an attribute value loss function value;
[0108] Calculate the total loss function value based on the attribute name loss function value, attribute value loss function value and matching degree loss function value;
[0109] The initial model is trained according to the total loss function value to obtain the information recognition model.
[0110] In some embodiments, the first loss function comprises a KL loss function.
[0111] In some embodiments, the attribute name prediction result is obtained by the initial model using a sentence classification algorithm to process the training sample; the attribute value recognition result is obtained by the initial model using a sequence labeling algorithm to process the training sample.
[0112] In some embodiments, the attribute acquisition module 48 is further configured to:
[0113] Inputting the description text of the object to be identified into the information identification model;
[0114] The information recognition model is used to predict the attribute names and recognize the attribute values of the object description text, so as to obtain the attribute names corresponding to the object description text and the attribute values matching the attribute names.
[0115] The implementation principle and technical effects of the device provided in this embodiment are the same as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference can be made to the corresponding contents in the aforementioned method embodiment, which will not be repeated here.
[0116] Based on the embodiments of the present application, the present application also provides an electronic device, at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any of the aforementioned object attribute acquisition methods.
[0117] Based on the embodiments of the present application, the present application also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute any of the aforementioned object attribute acquisition methods provided according to the embodiments of the present application.
[0118] Based on the embodiments of the present application, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the aforementioned object attribute acquisition methods provided in the embodiments of the present application.
[0119] Figure 5 A schematic block diagram of an example electronic device 500 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0120] like Figure 5 As shown, the device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0121] A number of components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0122] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above, such as the object attribute acquisition method. For example, in some embodiments, the object attribute acquisition method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the method XXX described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to execute the object attribute acquisition method in any other appropriate manner (e.g., by means of firmware).
[0123] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0124] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0125] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0126] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0127] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.
[0128] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0129] According to the object attribute acquisition method provided by the embodiment of the present application, the initial model is trained by training samples marked with real attribute names and matching real attribute values, and the matching degree between the attribute name prediction results and the attribute value recognition results output by the initial model is fully considered during the training process. The initial model is then trained in combination with the real attribute names and the real attribute values, so that the information recognition model finally obtained through the training method can directly obtain the attribute names of the object description text and the matching attribute values, that is, the attribute names and attribute values corresponding to the object description text can be obtained at the same time, and there is no need to try one by one for each attribute name of the attribute value to be extracted to see if the corresponding attribute value can be extracted from the product description text, thereby improving the efficiency of obtaining object attributes; in addition, since the information recognition model is trained based on the matching degree between the attribute name prediction results and the attribute value recognition results, it can output attribute values that match the attribute names, effectively improving the accuracy of obtaining object attributes.
[0130] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution disclosed in this application can be achieved, and this document is not limited here.
[0131] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A method for obtaining object attributes, characterized in that: include: Get training samples; The training samples are annotated with real attribute names of the objects described by the samples and real attribute values matching the real attribute names; Obtaining the attribute name prediction result and the attribute value recognition result output by the initial model to be trained for the training sample; Calculating the matching degree between the attribute name prediction result and the attribute value recognition result; The initial model is trained according to the real attribute name, the real attribute value, the attribute name prediction result, the attribute value recognition result, and the degree of matching between the attribute name prediction result and the attribute value recognition result to obtain an information recognition model, so as to obtain the attribute name corresponding to the object description text and the attribute value matching the attribute name according to the information recognition model.
2. The method according to claim 1, characterized in that The step of calculating the matching degree between the attribute name prediction result and the attribute value recognition result comprises: The attribute name prediction result and the attribute value recognition result are input into a preset first loss function to obtain a matching degree loss function value for measuring the matching degree between the attribute name prediction result and the attribute value recognition result.
3. The method according to claim 2, characterized in that The step of training the initial model according to the real attribute name, the real attribute value, the attribute name prediction result, the attribute value recognition result, and the matching degree between the attribute name prediction result and the attribute value recognition result to obtain the information recognition model includes: Inputting the real attribute name and the attribute name prediction result into a preset second loss function to obtain an attribute name loss function value; Inputting the true attribute value and the attribute value recognition result into a preset third loss function to obtain an attribute value loss function value; Calculate a total loss function value according to the attribute name loss function value, the attribute value loss function value and the matching degree loss function value; The initial model is trained according to the total loss function value to obtain an information recognition model.
4. The method according to claim 2, characterized in that: The first loss function includes a KL loss function.
5. The method according to claim 1, characterized in that The attribute name prediction result is obtained by the initial model using a sentence classification algorithm to process the training sample; the attribute value recognition result is obtained by the initial model using a sequence labeling algorithm to process the training sample.
6. The method according to any one of claims 1 to 5, characterized in that: The step of acquiring the attribute name corresponding to the object description text and the attribute value matching the attribute name according to the information recognition model comprises: Inputting a description text of the object to be identified into the information identification model; The object description text is predicted by the information recognition model and the attribute value is recognized to obtain the attribute name corresponding to the object description text and the attribute value matching the attribute name.
7. An object attribute acquisition device, characterized in that: The device comprises: A sample acquisition module is used to acquire training samples; the training samples are annotated with real attribute names of the objects described by the samples and real attribute values matching the real attribute names; A result acquisition module, used to obtain the attribute name prediction result and attribute value recognition result output by the initial model to be trained for the training sample; A matching calculation module, used to calculate the matching degree between the attribute name prediction result and the attribute value recognition result; An attribute acquisition module is used to train the initial model according to the real attribute name, the real attribute value, the attribute name prediction result, the attribute value recognition result, and the degree of matching between the attribute name prediction result and the attribute value recognition result to acquire an information recognition model, so as to acquire the attribute name corresponding to the object description text and the attribute value matching the attribute name according to the information recognition model.
8. The device according to claim 7, characterized in that The matching calculation module is further used for: The attribute name prediction result and the attribute value recognition result are input into a preset first loss function to obtain a matching degree loss function value for measuring the matching degree between the attribute name prediction result and the attribute value recognition result.
9. The device according to claim 8, characterized in that The attribute acquisition module is further used for: Inputting the real attribute name and the attribute name prediction result into a preset second loss function to obtain an attribute name loss function value; Inputting the true attribute value and the attribute value recognition result into a preset third loss function to obtain an attribute value loss function value; Calculate a total loss function value according to the attribute name loss function value, the attribute value loss function value and the matching degree loss function value; The initial model is trained according to the total loss function value to obtain an information recognition model.
10. The device according to claim 8, characterized in that The first loss function includes a KL loss function.
11. The device according to claim 7, characterized in that The attribute name prediction result is obtained by the initial model using a sentence classification algorithm to process the training sample; the attribute value recognition result is obtained by the initial model using a sequence labeling algorithm to process the training sample.
12. The device according to any one of claims 7 to 11, characterized in that The attribute acquisition module is further used for: Inputting a description text of the object to be identified into the information identification model; The object description text is predicted by the information recognition model and the attribute value is recognized to obtain the attribute name corresponding to the object description text and the attribute value matching the attribute name.
13. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.
14. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-6.
15. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 6.
