Commodity classification method and device, electronic equipment and storage medium
By performing feature extraction and semantic enhancement on product data, combined with contextual probability prediction and gating signal sequence processing, the problem of classification errors caused by contextual ambiguity was solved, thereby improving the accuracy and robustness of product classification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- MACAU INTERNET MEDIA DEV CO LTD
- Filing Date
- 2026-01-14
- Publication Date
- 2026-06-05
AI Technical Summary
When dealing with products with "contextual ambiguity", existing technologies cannot flexibly understand contextual information, leading to classification errors. In particular, the same product text has different semantics in different contexts, and existing hard-coded splicing methods cannot achieve accurate classification.
By acquiring target product data for feature extraction, using a bidirectional long short-term memory network for semantic enhancement, weighted separation based on contextual probability, and transforming it into a gated signal sequence, which is then multiplied element-wise with the product feature sequence to achieve dynamic adjustment and fusion of contextual features and product features.
It improves the accuracy and robustness of product classification, can dynamically adjust the influence of contextual information based on input content, eliminate category ambiguity, retain global semantic structure information and enhance product semantic features, and improve the fine-grainedness of classification and risk identification capabilities.
Smart Images

Figure CN122153054A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a product classification method, apparatus, electronic device, and storage medium. Background Technology
[0002] In product management systems of e-commerce and local services platforms, accurate and automated classification of massive amounts of goods is crucial. However, existing technologies face significant challenges when dealing with products exhibiting "contextual ambiguity." The same product text can have drastically different semantics in different contexts, and classification models are prone to errors if they ignore contextual information. Some solutions attempt to simply concatenate contextual information with the product text before inputting it into the classification model, but this hard-coded concatenation method fails to allow the classification model to flexibly understand the dynamic adjustment effect of contextual information on the product text, thus still failing to achieve accurate product classification. Summary of the Invention
[0003] This invention aims to at least solve one of the technical problems existing in the prior art. To this end, this invention proposes a product classification method, apparatus, electronic device, and storage medium, which can flexibly utilize contextual information to dynamically adjust the product text classification, thereby improving the accuracy of product classification.
[0004] In a first aspect, embodiments of the present invention provide a product classification method, including: Acquire target product data and extract features to obtain an initial feature sequence. The target product data includes context text and product text. The initial feature sequence is semantically enhanced to obtain an enhanced feature sequence; The enhanced feature sequence is subjected to context probability prediction, and the enhanced feature sequence is weighted and separated based on the predicted context probability to obtain a context feature sequence and a product feature sequence; The context feature sequence is converted into a gated signal sequence, and the gated signal sequence is multiplied element-wise with the product feature sequence to obtain a fused feature sequence; The enhanced feature sequence and the fused feature sequence are concatenated and then used for classification prediction to output the product classification probability.
[0005] According to some embodiments of the present invention, the content of the context text is empty, and the step of obtaining target product data and performing feature extraction to obtain an initial feature sequence includes: Obtain the target product text and extract its features to obtain the initial feature sequence.
[0006] According to some embodiments of the present invention, the semantic enhancement processing of the initial feature sequence to obtain an enhanced feature sequence includes: The initial feature sequence is semantically enhanced using a bidirectional long short-term memory network to obtain an enhanced feature sequence.
[0007] According to some embodiments of the present invention, the context probability prediction of the enhanced feature sequence includes: The context probability of each word is obtained by predicting the context probability of the enhanced feature sequence at each time step based on the first fully connected layer.
[0008] According to some embodiments of the present invention, the weighted separation of the enhanced feature sequence based on the predicted context probability to obtain a context feature sequence and a product feature sequence includes: The enhanced feature sequence is weighted, summed, and normalized based on the predicted context probabilities to obtain the context feature sequence. The enhanced feature sequence is weighted, summed, and normalized based on the difference between the numerical value and the context probability to obtain the product feature sequence.
[0009] According to some embodiments of the present invention, converting the context feature sequence into a gating signal sequence includes: The context feature sequence is transformed into a gated signal sequence based on the second fully connected layer.
[0010] According to some embodiments of the present invention, the commodity classification method further includes: The enhanced feature sequence is classified and predicted, and the risk category probability is output.
[0011] Secondly, embodiments of the present invention provide a commodity sorting device, comprising: The feature extraction module is used to acquire target product data and extract features to obtain an initial feature sequence. The target product data includes context text and product text. The semantic enhancement module is used to perform semantic enhancement processing on the initial feature sequence to obtain an enhanced feature sequence; The information separation module is used to predict the context probability of the enhanced feature sequence and perform weighted separation on the enhanced feature sequence based on the predicted context probability to obtain the context feature sequence and the product feature sequence. A gated modulation module is used to convert the context feature sequence into a gated signal sequence, and multiply the gated signal sequence element-wise with the product feature sequence to obtain a fused feature sequence; The classification prediction module is used to concatenate the enhanced feature sequence and the fused feature sequence to perform classification prediction and output the product classification probability.
[0012] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores a computer program, and the processor, when running the computer program, implements the above-mentioned commodity classification method.
[0013] Fourthly, embodiments of the present invention provide a storage medium storing a computer program that, when run, implements the above-described commodity classification method.
[0014] The embodiments of the present invention have at least the following beneficial effects: By extracting features from target product data containing both contextual and product text and performing semantic enhancement, the semantic boundary representation between the contextual and product texts is effectively strengthened, thus providing a more discriminative sequence representation for subsequent contextual probability prediction. Contextual probability prediction based on the enhanced feature sequence, and weighted separation of the enhanced feature sequence based on contextual probability, can clearly decouple contextual and product text features, improving the accuracy and interpretability of feature separation. Transforming contextual features into a gated signal sequence and multiplying it element-wise with the product feature sequence can dynamically determine the influence of contextual information based on the input content, flexibly enhancing or suppressing specific semantic features in the product text, thereby obtaining a highly context-aware fusion feature sequence. The enhanced and fusion feature sequences are then concatenated for product classification prediction, preserving global sequence structure information to support overall semantic understanding while incorporating context-adaptive modulated product semantic features to eliminate category ambiguity, thus improving the accuracy of product classification.
[0015] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0016] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which: Figure 1 This is a flowchart illustrating the steps of the commodity classification method according to an embodiment of the present invention; Figure 2 This is an architectural diagram of the commodity classification model according to an embodiment of the present invention; Figure 3 This is a schematic block diagram of a commodity sorting device according to an embodiment of the present invention; Figure 4 This is a schematic block diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0017] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0018] In the description of this invention, "several" means one or more, "multiple" means two or more, "greater than," "less than," "exceeding," etc. are understood to exclude the stated number, and "above," "below," "within," etc. are understood to include the stated number. If "first," "second," etc. are used in the description, they are only for the purpose of distinguishing technical features and should not be construed as indicating or implying relative importance or implicitly indicating the number of indicated technical features or the order of the indicated technical features.
[0019] In e-commerce and local service platforms, accurate and automated product categorization is crucial for managing massive amounts of goods. The accuracy of product categorization directly impacts the platform's search and recommendation performance, compliance and risk control levels, and user experience. Currently, most mainstream product categorization methods employ deep learning models, predicting categories by analyzing textual information such as product titles.
[0020] However, existing technologies face significant challenges when handling products with "contextual ambiguity." The same product title can have drastically different meanings in different contexts. For example, "apple" should be classified as "fruit" in a "fresh food supermarket" store, but in a "electronics" store, it is highly likely to be classified as "mobile phone." If the model ignores this crucial contextual information of "store category" and relies solely on the product title for judgment, errors are highly likely to occur. Such misclassification can have serious consequences in certain business scenarios. For instance, incorrectly classifying pet supplies into human food or supplies not only harms the user experience but may also trigger compliance risks.
[0021] Some existing solutions attempt to simply concatenate contextual text (such as store category) with product text (such as product title) before inputting it into the classification model. However, this hard-coded concatenation method fails to allow the model to flexibly understand the dynamic adjustment effect of context on product titles. For example, in the context of "baking shop," "Strawberry Bear Cake" is an artistic description of the cake's shape, not a product category. In this case, the store context information becomes crucial.
[0022] Therefore, please refer to Figure 1This embodiment discloses a product classification method applied to a product classification model. The product classification method includes steps S100 to S500. It should be noted that the numbering of the steps in this embodiment is only for ease of review and understanding, and does not limit the execution order of the steps. The content of each step is described in detail below: S100. Obtain target product data and perform feature extraction to obtain an initial feature sequence. Target product data includes context text and product text. For example, target product data refers to product record data to be classified. For any product record, the corresponding text record can be obtained from the product database or business system as target product data. Typically, target product data includes context text and product text, which are connected by a preset delimiter to form structured mixed text. For example, target product data can be represented as "Supermarket Convenience - Xiangyin Facial Tissue 150 Sheets (Unscented Classic)". Here, "Supermarket Convenience" represents context information such as sales scenario, store type, or business label, which constitutes the context text; "-" is a predefined delimiter, and symbols such as "+", "|", colon, space, or other business-agreed symbols can also be used as delimiters; "Xiangyin Facial Tissue 150 Sheets (Unscented Classic)" represents core information such as product name, specifications, and attributes, which constitutes the product text, i.e., the target text.
[0023] It is worth noting that in some application scenarios, the target product data may only contain product text without context text. In such cases, the context text is considered null or an empty string, meaning the target product data contains product text. Accordingly, step S100 includes: acquiring the target product text and performing feature extraction to obtain an initial feature sequence.
[0024] In step S100, regardless of whether the target product data contains context text, feature extraction processing can be performed on the target product data. For example, the target product data is input into the feature encoding module, which can use a pre-trained language representation model (such as BERT). After word embedding and context encoding, the module outputs the initial feature sequence corresponding to each input unit. This enables the product classification model in this embodiment to have heterogeneous input compatibility, that is, it can handle both composite inputs containing display context text and product text, and single inputs containing only product text.
[0025] S200. Perform semantic enhancement processing on the initial feature sequence to obtain the enhanced feature sequence; For example, using "Supermarket Convenience Store - Xiangyin Facial Tissue 150 Sheets (Unscented Classic)" as the target product data, the initial feature sequence is represented as follows: Among them, h ij Let be the feature sequence of the i-th word, with dimension d. The initial feature sequence is obtained after feature encoding extraction based on the overall text content of the target product data. Since the context text and product text are presented continuously in a concatenated form in the input, there is a lack of explicit semantic separation between them, resulting in a relatively vague boundary representation between the context fragments and product fragments in the initial feature sequence, making it difficult to use directly for accurate semantic decoupling. Therefore, semantic enhancement processing can be performed on the initial feature sequence to strengthen the semantic boundary between the context text and product text. In a specific application example, semantic enhancement processing is implemented through a bidirectional long short-term memory network (Bi-LSTM), that is, step S200 includes: performing semantic enhancement processing on the initial feature sequence based on the bidirectional long short-term memory network to obtain the enhanced feature sequence. Bidirectional Long Short-Term Memory (BSSM) networks can model forward temporal sequences (e.g., from "super" to the final right parenthesis) and backward temporal sequences (e.g., from the final right parenthesis to "super"), capturing the dependencies between each position in the sequence and its historical and future contexts. Especially in the region near separators, the bidirectional information flow of BSSM networks can effectively perceive abrupt changes in the semantic field, thus forming significant feature gradients or representational differences near separators. This semantic jump phenomenon caused by structural separation makes the enhanced feature sequences more discriminative at the boundary between contextual and product text, thereby providing more accurate local and global semantic cues for subsequent contextual probability prediction, assigning each lexical unit a prediction probability that matches its semantic role (e.g., context or product).
[0026] S300. Perform context probability prediction on the enhanced feature sequence, and perform weighted separation on the enhanced feature sequence based on the predicted context probability to obtain the context feature sequence and the product feature sequence. For example, unlike existing technologies that directly concatenate or rigidly merge context text and product text, this embodiment introduces a "soft separation" mechanism based on context probability. Specifically, context probability prediction is performed on each token in the enhanced feature sequence, and the probability value of each token belonging to context information is output. Subsequently, based on the predicted probability distribution, the enhanced feature sequence is weighted and separated to achieve differentiable and continuous semantic decoupling of the original sequence representation, i.e., "soft separation".
[0027] Compared to hard-connection methods, which cannot distinguish the semantic contribution of context in different input scenarios, the soft separation mechanism in this embodiment can adaptively adjust the influence of contextual information based on the input content. For example, when the product text itself is highly discriminative (e.g., "red wine" is sufficient to determine its category), the interference of contextual information such as store classification on product representation can be weakened by using a lower contextual probability; conversely, when the semantics of the product text are ambiguous (e.g., "classic") but the context is clear (e.g., "supermarket convenience"), a higher contextual weight is assigned to assist in discrimination. Furthermore, when the semantic relationship between the contextual text and the product text is weak or noisy, the soft separation mechanism effectively suppresses the negative impact of irrelevant context on the product feature sequence by reducing the weight of irrelevant context. Further, since the separation process uses probability weighting rather than hard truncation, the semantic continuity of the original sequence can be preserved, avoiding local semantic breaks caused by rigid segmentation, thus providing a more robust feature foundation for subsequent gating modulation and classification prediction.
[0028] In some application examples, step S300 involves predicting the context probability of the enhanced feature sequence, including: predicting the context probability of the enhanced feature sequence at each time step based on the first fully connected layer to obtain the context probability of each word.
[0029] In the enhanced feature sequence, each word corresponds to a time step according to its order of arrangement in the input sequence, thus forming an ordered temporal feature representation. The information separation module independently predicts the context attribution of the feature vector corresponding to each time step in the enhanced feature sequence through the first fully connected layer (Dense). The output dimension of the first fully connected layer is 1, and a sigmoid activation function is used, so that each time step outputs a real number between 0 and 1, which represents the probability that the corresponding word belongs to the context information.
[0030] In step S300, the enhanced feature sequence is weighted and separated based on the predicted context probabilities to obtain the context feature sequence and the product feature sequence, including: The enhanced feature sequence is obtained by weighted summation and normalization based on the predicted context probabilities; The enhanced feature sequence is obtained by weighted summation and normalization based on the difference between the numerical value and the context probability.
[0031] For example, let the enhanced feature sequence be H=[h1, h2, ..., h i ], h i Let p = [p1, p2, ..., p] represent the enhanced feature vector corresponding to the i-th time step (i.e., the i-th word), where i ∈ [1, L]. Let the probability sequence obtained by context probability prediction be p = [p1, p2, ..., p].i ], where p i ∈[0,1], used to represent the probability that the i-th word belongs to the context information.
[0032] The context feature sequence (denoted as c) is obtained by summing and normalizing the enhanced feature sequence according to the context probability, and the mathematical relationship is: The denominator is a normalization factor to ensure that the sum of the weights is 1, thus avoiding feature decay due to the overall probability amplitude being too small. The product feature sequence (denoted as s) is based on "non-contextual probability" (i.e., 1-p). i The enhanced feature sequences are weighted, summed, and normalized. The product feature sequence, also known as the target text feature, has the following mathematical relationship: For example, for the i-th word, if the enhanced feature vector of the word is hi=[h i1 h i2 ,....,h id ], corresponding to a context probability of p i Then the contribution of this lexical element to the context text features is p. i · h i The contribution to the textual features of the product is (1-p). i )· h i By traversing all time steps and performing the weighted aggregation described above, we can obtain the context feature sequence representing the global context semantics and the product feature sequence representing the product ontology semantics, respectively.
[0033] The original sequence is "softly separated" by weighted separation: each word is dynamically assigned to the context or product semantic space according to its own contextual belonging probability, which not only preserves the continuity of the original semantics, but also achieves adaptive differentiation of semantic roles.
[0034] S400. The context feature sequence is converted into a gated signal sequence, and the gated signal sequence is multiplied element-wise with the product feature sequence to obtain the fused feature sequence. For example, the context feature value sequence is transformed into a gating signal sequence, aiming to adaptively modulate the semantic components of each dimension in the product feature sequence based on the context and i content. Specifically, the gating signal sequence can dynamically generate a set of adjustment coefficients in the range [0, 1] through nonlinear mapping according to the inherent semantics of the context features. These coefficients are used to perform element-wise multiplication on the product feature sequence, thereby selectively enhancing or suppressing the semantic features of the product. For example, when the context text is "supermarket convenience", the transformed gating signal sequence outputs a higher value (close to 1) in the semantic dimension related to daily necessities, while outputting a lower value (close to 0) in the semantic dimensions unrelated to food, adult products, etc. After element-wise multiplication with the product feature sequence, the proportion of daily necessities-related features in the fused feature sequence is retained or even enhanced, while the proportion of unrelated features is effectively attenuated, thereby improving the semantic focus and accuracy of subsequent classification.
[0035] In some application examples, the context feature sequence is transformed into a gated signal sequence, including: transforming the context feature sequence into a gated signal sequence based on a second fully connected layer. That is, the context feature sequence is taken as input, linearly transformed by the second fully connected layer, and non-linearly compressed using the Sigmoid activation function, outputting a gated signal sequence with the same dimensions as the product feature sequence. Each dimension in the gated signal sequence corresponds to the modulation weight of the corresponding semantic dimension in the product feature sequence, ensuring that the modulation operation is aligned within the feature space.
[0036] S500: After concatenating the enhanced feature sequence and the fused feature sequence, perform classification prediction and output the product classification probability.
[0037] For example, the enhanced feature sequence represents the global semantic information of the entire input sequence, including the context text and the product text, and has a complete context structure awareness capability. The fused feature sequence, on the other hand, is a product ontology feature obtained through dynamic modulation of contextual semantics, focusing on the core semantics of the product that fits the current context and suppressing irrelevant or interfering semantic components. Concatenating the enhanced and fused feature sequences for classification prediction allows the classification prediction process to simultaneously utilize the contextual integrity information derived from the global sequence structure, facilitating the grasp of the overall semantic pattern of the input, and the context-adaptively modulated fine-grained semantic features of the product, facilitating accurate identification of product categories. This approach balances global semantic consistency and local semantic focus, thereby significantly improving the accuracy and robustness of fine-grained product classification.
[0038] Therefore, by extracting features from target product data containing both contextual and product texts and performing semantic enhancement, the semantic boundary representation between the contextual and product texts is effectively strengthened, thus providing a more discriminative sequence representation for subsequent contextual probability prediction. Contextual probability prediction based on the enhanced feature sequence, and weighted separation of the enhanced feature sequence based on contextual probability, can clearly decouple contextual and product text features, improving the accuracy and interpretability of feature separation. Converting contextual features into a gating signal sequence and multiplying it element-wise with the product feature sequence can dynamically determine the influence of contextual information based on the input content, flexibly enhancing or suppressing specific semantic features in the product text, thereby obtaining a highly context-aware fusion feature sequence. The enhanced feature sequence and the fusion feature sequence are then concatenated for product classification prediction, preserving global sequence structure information to support overall semantic understanding while incorporating context-adaptive modulated product semantic features to eliminate category ambiguity, thus improving the accuracy of product classification.
[0039] In some application examples, product classification methods also include: performing classification prediction on enhanced feature sequences and outputting risk category probabilities.
[0040] For example, the product classification method in this embodiment is designed with dual task branches to improve the overall performance of the product separation model in fine-grained classification and risk identification.
[0041] Specifically, the classification prediction task in step S500 corresponds to the main task branch, used to predict the fine-grained category of the product, such as distinguishing whether the product belongs to "toilet paper" or "tissue paper". The main task branch classifies the product by concatenating the enhanced feature sequence and the fused feature sequence, achieving accurate identification of the specific category of the product. The risk category probability prediction task belongs to the auxiliary task branch, used to predict the risk category of the product in coarse-grained classification, such as determining the probability of the product being misclassified as a daily necessity, adult product, or pet product. The main role of the auxiliary task branch is to force the model to learn and distinguish core risk signals during the training phase, and to feed the learned risk knowledge back to the feature extraction process of the global features, thereby guiding the model to generate feature representations that are more sensitive to risk.
[0042] During model training, this embodiment employs a composite loss function oriented towards business constraints to jointly optimize the product classification model. This composite loss function is composed of multiple mutually synergistic sub-loss terms weighted together, aiming to balance multiple objectives such as fine-grained classification accuracy, risk sensitivity, semantic decoupling quality, and feature space structuring.
[0043] Specifically, please refer to Figure 2The composite loss function comprises four core components: the main task loss, the asymmetric cost-sensitive loss (or auxiliary task loss), the supervised contrastive learning loss (or simply contrastive learning loss), and the sequence labeling subtask loss (or simply sequence labeling loss). The main task loss supervises the accuracy of fine-grained product classification results (e.g., "toilet paper" or "tissue paper"), ensuring the product classification model possesses basic classification capabilities. The asymmetric cost-sensitive loss operates on the auxiliary task branch (i.e., risk category prediction). By introducing predefined "prohibited misclassification pairs" (e.g., predicting "daily necessities" when the actual label is "pet supplies") and applying a high penalty coefficient, it forces the model to avoid unacceptably high-risk misclassifications during training. Simultaneously, it combines with the focus loss mechanism to alleviate the sample imbalance problem between risk categories. The focus loss focuses on difficult-to-classify samples, especially those in minority classes. In classification tasks, categories are often imbalanced. For example, there are far more "daily necessities" samples than "adult products" samples, and the model may tend to predict samples from the more numerous categories. By using focus loss, smaller weights can be applied to samples with a predicted probability close to 1, while larger weights can be applied to samples with a low predicted probability, forcing the model to pay more attention to difficult samples and minority class samples.
[0044] The supervised contrastive learning loss operates on the shared global feature layer (i.e., the enhanced feature sequence), using the coarse-grained risk categories output by the auxiliary task as supervisory signals. This narrows the representational distance between similar risk samples and widens the representational distance between dissimilar risk samples in the feature space, guiding the model to learn a structured feature space clearly divided by risk categories. Furthermore, the sequence labeling sub-task loss is used for the "soft separation" process in the supervised information separation stage. By optimizing the context probability prediction for each word, it improves the semantic decoupling accuracy between the context text and the product text. Finally, the total loss is the weighted sum of the above four sub-losses. The weight coefficients can be dynamically adjusted according to actual business needs, enabling the model to simultaneously optimize classification performance, risk robustness, and semantic representation quality during end-to-end training, significantly reducing the critical misclassification rate, and providing a more discriminative and structured feature foundation for downstream main and auxiliary tasks.
[0045] Please refer to Figure 3 This embodiment also provides a commodity sorting device, including: Feature extraction module 110 is used to acquire target product data and perform feature extraction to obtain an initial feature sequence. The target product data includes context text and product text. The semantic enhancement module 120 is used to perform semantic enhancement processing on the initial feature sequence to obtain an enhanced feature sequence; The information separation module 130 is used to predict the context probability of the enhanced feature sequence and perform weighted separation on the enhanced feature sequence based on the predicted context probability to obtain the context feature sequence and the product feature sequence. The gated modulation module 140 is used to convert the context feature sequence into a gated signal sequence, and multiply the gated signal sequence with the product feature sequence element by element to obtain a fused feature sequence; The classification prediction module 150 is used to concatenate the enhanced feature sequence and the fused feature sequence for classification prediction and output the product classification probability.
[0046] The inventive concept of this product classification device embodiment is the same as that of the product classification method embodiment described above. Contents not covered in this product classification device embodiment can be referred to in the product classification method embodiment described above, and will not be repeated here. By extracting features from target product data containing context text and product text and performing semantic enhancement processing, the semantic boundary representation between context text and product text is effectively strengthened, thus providing a more discriminative sequence representation for subsequent context probability prediction. Context probability prediction based on the enhanced feature sequence, and weighted separation of the enhanced feature sequence based on context probability, can clearly decouple context text features and product text features, improving the accuracy and interpretability of feature separation. Converting context features into a gating signal sequence and multiplying it element-wise with the product feature sequence can dynamically determine the influence of context information according to the input content, flexibly enhancing or suppressing specific semantic features in the product text, thereby obtaining a highly context-aware fusion feature sequence. The enhanced feature sequence and the fusion feature sequence are then concatenated for product classification prediction, preserving global sequence structure information to support overall semantic understanding, and fusing context-adaptive modulated product semantic features to eliminate category ambiguity, which is beneficial for improving the accuracy of product classification.
[0047] Please refer to Figure 4This embodiment also provides an electronic device, including a processor 210 and a memory 220. The memory 220 stores a computer program, and the processor 210 executes the computer program to implement the above-described commodity classification method. The specific details of the commodity classification method are described above and will not be repeated here. By extracting features from target product data containing both contextual and product text and performing semantic enhancement, the semantic boundary representation between the contextual and product texts is effectively strengthened, thus providing a more discriminative sequence representation for subsequent contextual probability prediction. Contextual probability prediction based on the enhanced feature sequence, and weighted separation of the enhanced feature sequence based on contextual probability, can clearly decouple contextual and product text features, improving the accuracy and interpretability of feature separation. Transforming contextual features into a gated signal sequence and multiplying it element-wise with the product feature sequence can dynamically determine the influence of contextual information based on the input content, flexibly enhancing or suppressing specific semantic features in the product text, thereby obtaining a highly context-aware fusion feature sequence. The enhanced and fusion feature sequences are then concatenated for product classification prediction, preserving global sequence structure information to support overall semantic understanding while incorporating context-adaptive modulated product semantic features to eliminate category ambiguity, thus improving the accuracy of product classification.
[0048] This embodiment also provides a storage medium storing a computer program that implements the aforementioned product classification method when the computer program is run. The specific details of the product classification method are described above and will not be repeated here. By extracting features from target product data containing context text and product text and performing semantic enhancement processing, the semantic boundary representation between the context text and product text is effectively strengthened, thus providing a more discriminative sequence representation for subsequent context probability prediction. Context probability prediction based on the enhanced feature sequence, and weighted separation of the enhanced feature sequence based on the context probability, can clearly decouple the context text features and product text features, improving the accuracy and interpretability of feature separation. Converting the context features into a gating signal sequence and multiplying it element-wise with the product feature sequence can dynamically determine the influence of context information based on the input content, flexibly enhancing or suppressing specific semantic features in the product text, thereby obtaining a highly context-aware fusion feature sequence. The enhanced feature sequence and the fusion feature sequence are then concatenated for product classification prediction, preserving global sequence structure information to support overall semantic understanding, and integrating context-adaptive modulated product semantic features to eliminate category ambiguity, which is beneficial for improving the accuracy of product classification.
[0049] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.
Claims
1. A method for classifying commodities, characterized in that, include: Acquire target product data and extract features to obtain an initial feature sequence. The target product data includes context text and product text. The initial feature sequence is semantically enhanced to obtain an enhanced feature sequence; The enhanced feature sequence is subjected to context probability prediction, and the enhanced feature sequence is weighted and separated based on the predicted context probability to obtain a context feature sequence and a product feature sequence; The context feature sequence is converted into a gated signal sequence, and the gated signal sequence is multiplied element-wise with the product feature sequence to obtain a fused feature sequence; The enhanced feature sequence and the fused feature sequence are concatenated and then used for classification prediction to output the product classification probability.
2. The commodity classification method according to claim 1, characterized in that, The context text is empty. The process of acquiring target product data and extracting features to obtain an initial feature sequence includes: Obtain the target product text and extract its features to obtain the initial feature sequence.
3. The commodity classification method according to claim 1, characterized in that, The semantic enhancement processing of the initial feature sequence to obtain the enhanced feature sequence includes: The initial feature sequence is semantically enhanced using a bidirectional long short-term memory network to obtain an enhanced feature sequence.
4. The commodity classification method according to claim 1, characterized in that, The context probability prediction of the enhanced feature sequence includes: The context probability of each word is obtained by predicting the context probability of the enhanced feature sequence at each time step based on the first fully connected layer.
5. The commodity classification method according to claim 1 or 4, characterized in that, The weighted separation of the enhanced feature sequence based on the predicted context probability to obtain the context feature sequence and the product feature sequence includes: The enhanced feature sequence is weighted, summed, and normalized based on the predicted context probabilities to obtain the context feature sequence. The enhanced feature sequence is weighted, summed, and normalized based on the difference between the numerical value and the context probability to obtain the product feature sequence.
6. The commodity classification method according to claim 1, characterized in that, The step of converting the context feature sequence into a gated signal sequence includes: The context feature sequence is transformed into a gated signal sequence based on the second fully connected layer.
7. The commodity classification method according to claim 1, characterized in that, The commodity classification method also includes: The enhanced feature sequence is classified and predicted, and the risk category probability is output.
8. A commodity sorting device, characterized in that, include: The feature extraction module is used to acquire target product data and extract features to obtain an initial feature sequence. The target product data includes context text and product text. The semantic enhancement module is used to perform semantic enhancement processing on the initial feature sequence to obtain an enhanced feature sequence; The information separation module is used to predict the context probability of the enhanced feature sequence and perform weighted separation on the enhanced feature sequence based on the predicted context probability to obtain the context feature sequence and the product feature sequence. A gated modulation module is used to convert the context feature sequence into a gated signal sequence, and multiply the gated signal sequence element-wise with the product feature sequence to obtain a fused feature sequence; The classification prediction module is used to concatenate the enhanced feature sequence and the fused feature sequence to perform classification prediction and output the product classification probability.
9. An electronic device comprising a processor and a memory, wherein the memory stores a computer program, characterized in that, When the processor runs the computer program, it is used to implement the commodity classification method as described in any one of claims 1 to 7.
10. A storage medium storing a computer program, characterized in that, When the computer program is run, it implements the commodity classification method as described in any one of claims 1 to 7.