A continuous hash learning retrieval method and device for streaming data

By introducing a continuous learning framework, a combination of residual network and convolutional neural network in the hash retrieval method, the problem of difficulty in real-time update of hash functions in the existing technology is solved, and efficient retrieval of convective data and improvement of hash code quality is achieved.

CN119474019BActive Publication Date: 2025-04-22CENT SOUTH UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510036163.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-09
Publication Date
2025-04-22
Estimated Expiration
2045-01-09

AI Technical Summary

Technical Problem

Existing hash retrieval methods are difficult to adapt to streaming data scenarios, and they cannot learn and update hash functions on new arrival data in real time. Especially when facing unknown new classes, it is difficult to accurately characterize and learn new class data, which affects retrieval performance.

Method used

A continuous hash learning retrieval method for streaming data is proposed. By introducing a continuous learning framework, it uses residual networks and convolutional neural networks to continuously learn features, and effectively connects with the hash function to update the hash code in real time to adapt to the data characteristics of time-changing.

Benefits of technology

This method can process real-time streaming data, adapt to the data characteristics of time-changing, avoid forgetting old data knowledge, maintain the retrieval performance of new and old data, and continuously improve the quality of generated hash codes and improve the retrieval performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119474019B_ABST
    Figure CN119474019B_ABST
Patent Text Reader

Abstract

The present application relates to a continuous hash learning retrieval method and device for streaming data. The method constructs a hash retrieval model. A continuous learning framework is introduced into the hash retrieval model training process. First, a first feature is extracted from unlabeled training streaming data based on self-supervised learning through a residual network. A convolutional neural network can use the first feature to quickly learn labeled sample data, and feed back the learned second feature to the residual network to consolidate the residual network. The training streaming data includes first real-time streaming data collected in real time and pre-stored streaming data in a database, so that the model can continuously learn new real-time streaming data while avoiding forgetting old pre-stored streaming data knowledge. Moreover, the continuous learning framework is effectively connected with the hash function, and the features extracted by continuous learning of the residual network and the convolutional neural network are used to guide the learning of the hash function, thereby continuously improving the quality of the generated hash code and further improving the retrieval performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of hash retrieval technology, and in particular to a method and device for continuous hash learning retrieval for streaming data. Background Art

[0002] Hash retrieval is widely used in the field of data storage and retrieval. Its core is to map data into a fixed-length hash code through a specific hash function. When retrieving data, for a given query data, its hash code is first calculated, and then the area that may contain the target data is queried based on this code to achieve fast retrieval.

[0003] Most existing hash retrieval methods are based on batch training mode and perform well when processing fixed data sets. Because the data distribution and characteristics are relatively stable at this time, the hash function can be learned and optimized for the entire data set to achieve good retrieval results. However, in the real world, data mostly exists in the form of streaming data, which is sequential, large, fast, continuous, and grows infinitely over time. Hash retrieval methods based on batch training mode are difficult to adapt to streaming data scenarios and cannot learn and update hash functions for newly arrived data in real time.

[0004] In order to solve the problem of streaming data processing, some online hash retrieval methods have emerged. These methods try to update the hash function in real time when processing streaming data. However, although these methods can process streaming data to a certain extent, they still have some limitations. One of the key issues is that they cannot effectively handle unknown new classes that continue to appear with streaming data blocks. When new data categories appear, these online hash retrieval methods find it difficult to accurately represent and learn the new class data, which affects the retrieval performance. Summary of the invention

[0005] The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.

[0006] The main purpose of the embodiment of the present invention is to propose a continuous hash learning and retrieval method for stream data, which can improve the quality of generated hash codes.

[0007] To achieve the above object, a first aspect of an embodiment of the present invention provides a continuous hash learning retrieval method for stream data, the method comprising:

[0008] Get target flow data;

[0009] The target stream data is input into a trained hash retrieval model to obtain a target hash code output by the hash retrieval model; wherein the hash retrieval model includes a residual network, a convolutional neural network and a hash function, and the training process of the hash retrieval model includes:

[0010] The hash retrieval model is trained for multiple rounds until the hash retrieval model converges; wherein the t-th round of training process includes:

[0011] Input the training stream data into the residual network, so that the residual network extracts a first feature from the training stream data based on self-supervised learning, and calculates a first loss according to a preset first loss function and the first feature; the training stream data includes first real-time stream data collected in real time and pre-stored stream data in a database, and the pre-stored stream data in the database is the real-time stream data collected during the previous t-1 round of training;

[0012] Inputting the labeled training stream data into the convolutional neural network, so that the convolutional neural network extracts a second feature from the labeled training stream data based on supervised learning and the first feature, and calculates a second loss according to a preset second loss function and the second feature; the labeled training stream data includes the labeled first real-time stream data and the pre-stored stream data in the database;

[0013] Performing a gradient update on the residual network based on the first loss and the second loss, and performing a gradient update on the convolutional neural network based on the second loss;

[0014] fusing the first feature and the second feature to obtain a final feature;

[0015] The final feature is input into the hash function to obtain a hash code output by the hash function, a third loss is calculated based on the hash code, and a gradient of the hash function is updated according to the third loss.

[0016] The present application provides a continuous hash learning and retrieval method for stream data, which has at least the following beneficial effects:

[0017] (1) In order to overcome the limitations of existing hash retrieval methods when processing streaming data, a continuous learning framework is introduced. By introducing this framework, the hash retrieval method can process real-time streaming data and adapt to the time-varying data characteristics. While continuously learning new real-time streaming data, it avoids forgetting the old pre-stored streaming data knowledge and maintains the retrieval performance of new and old data. Moreover, the continuous learning framework is also effectively connected with the hash function, using the residual network and convolutional neural network to continuously learn and extract features to guide the learning of the hash function, continuously improve the quality of the generated hash code, and further enhance the retrieval performance.

[0018] (2) The residual network can learn the first feature by optimizing the self-supervised learning loss. The convolutional neural network can use the first feature of the residual network to quickly learn labeled sample data, and can feed back the learned second feature to the residual network to consolidate the first feature extracted by the residual network.

[0019] In some embodiments, the residual network and the convolutional neural network have the same number of layers;

[0020] The extracting the second feature from the training stream data carrying the label includes:

[0021] Fusing the jth first feature output by the jth layer of the residual network with the jth second feature output by the jth layer of the convolutional neural network to obtain a fused feature; j is a positive integer less than L, L is the total number of layers of the residual network, and L is a positive integer greater than 1;

[0022] The fused feature is input into the j+1th layer of the convolutional neural network to obtain the j+1th second feature output by the j+1th layer of the convolutional neural network, and so on, until the Lth second feature output by the Lth layer of the convolutional neural network is obtained.

[0023] The fusing the first feature and the second feature to obtain a final feature includes:

[0024] The Lth first feature output by the residual network and the Lth second feature output by the convolutional neural network are fused to obtain a final feature.

[0025] In some embodiments, the first loss function comprises:

[0026] ;

[0027] ;

[0028] in, represents the first loss function, represents the identity, express The value of the mth dimension in , It represents the feature matrix output by the residual network for the b training stream data after the data transformation in mode A. express The value of the nth dimension in , It represents the feature matrix output by the residual network for the b training stream data after the data transformation in mode B. represents the trade-off factor, represents the cross-correlation matrix, Denotes the diagonal elements of the cross-correlation matrix.

[0029] In some embodiments, the second loss function comprises:

[0030] ;

[0031] in, represents the second loss function, Represents the mapping function of the cross entropy loss function, Represents the convolutional neural network for the first real-time stream data with labels The second feature of the output, Represents the mapping function of the softmax function. The temperature coefficient corresponding to the softmax function is , express The corresponding label, Indicates the amount of pre-stored stream data. Represents the convolutional neural network for pre-stored streaming data The second feature of the output, express The corresponding label, Represents the convolutional neural network learning After the task is completed, the pre-stored stream data The second feature of the output, represents the trade-off factor, Represents the mapping function of KL divergence loss.

[0032] In some embodiments, calculating the third loss based on the hash code includes:

[0033] Based on the preset loss function and the hash code to calculate the third loss; wherein the loss function include:

[0034] ;

[0035] in, Indicates that it has parameters The hash function of represents the regularization parameter, Indicates the number of sample categories of the training stream data.

[0036] In some embodiments, the hash function comprises:

[0037] ;

[0038] in, Indicates that it has parameters The hash function of Indicates that the hash function is used in round t for The extracted hash code, Indicates the feature matrix of pre-stored streaming data during the tth round of training, Indicates that the hash function is trained in the tth round for The extracted hash code, represents the feature matrix of the first real-time stream data in the tth round of training, represents the parameters in the tth round of training, represents the hyperparameter of the balanced regularization term.

[0039] In some embodiments, calculating the third loss based on the hash code includes:

[0040] Based on the preset loss function , loss function and the hash code to calculate a third loss; wherein the loss function include:

[0041] ;

[0042] in, Indicates that it has parameters The hash function of represents the regularization parameter, Represents the number of sample categories of the training stream data;

[0043] The loss function include:

[0044] ;

[0045] ;

[0046] ;

[0047] ;

[0048] ;

[0049] in, Indicates the length of the hash code, Indicates the number of samples of the first real-time stream data in the tth round of training, Indicates that the hash function is trained in the tth round for The extracted hash code, represents the feature matrix of the first real-time stream data in the tth round of training, represents the matrix transpose, Indicates that the hash function is trained in the tth round for The extracted hash code, Indicates the feature matrix of pre-stored streaming data during the tth round of training, represents the label enhancement matrix of the first real-time stream data in the tth round of training, Indicates the label enhancement matrix of the pre-stored streaming data during the tth round of training, represents the overall embedding matrix of the first real-time stream data and the pre-stored stream data labels in the tth round of training, express The corresponding label matrix, express The i-th column of express The i-th column of Indicates the length of a vector.

[0050] To achieve the above object, a second aspect of an embodiment of the present invention provides a continuous hash learning and retrieval device for stream data, the device comprising:

[0051] A data acquisition module, used to acquire target stream data;

[0052] A hash generation module is used to input the target stream data into a trained hash retrieval model to obtain a target hash code output by the hash retrieval model; wherein the hash retrieval model includes a residual network, a convolutional neural network and a hash function, and the training process of the hash retrieval model includes:

[0053] The hash retrieval model is trained for multiple rounds until the hash retrieval model converges; wherein the t-th round of training process includes:

[0054] Input the training stream data into the residual network, so that the residual network extracts a first feature from the training stream data based on self-supervised learning, and calculates a first loss according to a preset first loss function and the first feature; the training stream data includes first real-time stream data collected in real time and pre-stored stream data in a database, and the pre-stored stream data in the database is the real-time stream data collected during the previous t-1 round of training;

[0055] Inputting the labeled training stream data into the convolutional neural network, so that the convolutional neural network extracts a second feature from the labeled training stream data based on supervised learning and the first feature, and calculates a second loss according to a preset second loss function and the second feature; the labeled training stream data includes the labeled first real-time stream data and the pre-stored stream data in the database;

[0056] Performing a gradient update on the residual network based on the first loss and the second loss, and performing a gradient update on the convolutional neural network based on the second loss;

[0057] fusing the first feature and the second feature to obtain a final feature;

[0058] The final feature is input into the hash function to obtain a hash code output by the hash function, a third loss is calculated based on the hash code, and a gradient of the hash function is updated according to the third loss.

[0059] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present invention provides an electronic device, comprising: at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions that can be executed by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can execute the above-mentioned continuous hash learning retrieval method for streaming data.

[0060] To achieve the above-mentioned purpose, a fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the above-mentioned continuous hash learning and retrieval method for stream data.

[0061] It can be understood that the beneficial effects of the second to fourth aspects compared with the related art are the same as the beneficial effects of the first aspect compared with the related art. Please refer to the relevant description in the first aspect, and no further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0063] Figure 1 It is a schematic diagram of a continuous hash learning and retrieval method for stream data provided in an embodiment of the present application;

[0064] Figure 2 It is a schematic diagram of the training process of the hash retrieval model provided in the embodiment of the present application;

[0065] Figure 3 It is a schematic diagram of the data processing flow of the hash retrieval model provided in an embodiment of the present application;

[0066] Figure 4 It is a schematic diagram of a process of obtaining a final feature by fusing a first feature of a residual network and a second feature of a convolutional neural network, provided in an embodiment of the present application;

[0067] Figure 5 It is a schematic diagram of a continuous hash learning and retrieval device for stream data provided by an embodiment of the present application;

[0068] Figure 6 It is a schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0069] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0070] Hash retrieval is widely used in the field of data storage and retrieval. Its core is to map data into a fixed-length hash code through a specific hash function. When retrieving data, for a given query data, its hash code is first calculated, and then the area that may contain the target data is queried based on this code to achieve fast retrieval.

[0071] Most existing hash retrieval methods are based on batch training mode and perform well when processing fixed data sets. Because the data distribution and characteristics are relatively stable at this time, the hash function can be learned and optimized for the entire data set to achieve good retrieval results. However, in the real world, data mostly exists in the form of streaming data, which is sequential, large, fast, continuous, and grows infinitely over time. Hash retrieval methods based on batch training mode are difficult to adapt to streaming data scenarios and cannot learn and update hash functions for newly arrived data in real time.

[0072] In order to solve the problem of streaming data processing, some online hash retrieval methods have emerged. These methods try to update the hash function in real time when processing streaming data. However, although these methods can process streaming data to a certain extent, they still have some limitations. One of the key issues is that they cannot effectively handle unknown new classes that continue to appear with streaming data blocks. When new data categories appear, these online hash retrieval methods find it difficult to accurately represent and learn the new class data, which affects the retrieval performance.

[0073] For this reason, Figure 1 The present application provides an embodiment, providing a continuous hash learning and retrieval method for stream data, the method comprising the following steps:

[0074] Step S110, obtaining target stream data;

[0075] Step S120, input the target stream data into the trained hash retrieval model to obtain the target hash code output by the hash retrieval model.

[0076] In some embodiments of the present application, the hash retrieval model includes a residual network, a convolutional neural network and a hash function, and the training process of the hash retrieval model includes the following steps:

[0077] The hash retrieval model is trained for multiple rounds until the hash retrieval model converges; the process of the tth round of training includes:

[0078] Step S210, inputting the training stream data into the residual network, so that the residual network extracts the first feature from the training stream data based on self-supervised learning, and calculates the first loss according to the preset first loss function and the first feature; the training stream data includes the first real-time stream data collected in real time and the pre-stored stream data in the database, and the pre-stored stream data in the database is the real-time stream data collected during the previous t-1 round of training;

[0079] Step S220, inputting the labeled training stream data into the convolutional neural network, so that the convolutional neural network extracts a second feature from the labeled training stream data based on supervised learning and the first feature, and calculates a second loss according to a preset second loss function and the second feature; the labeled training stream data includes the labeled first real-time stream data and the pre-stored stream data in the database;

[0080] Step S230, performing a gradient update on the residual network based on the first loss and the second loss, and performing a gradient update on the convolutional neural network based on the second loss;

[0081] Step S240, fusing the first feature and the second feature to obtain a final feature;

[0082] Step S250: input the final feature into the hash function to obtain a hash code output by the hash function, calculate the third loss based on the hash code, and perform a gradient update on the hash function according to the third loss.

[0083] In step S110, the target stream data refers to the stream data to be processed, which is used to generate a hash code according to the data, and then realize retrieval based on the hash code.

[0084] In step S120, the hash retrieval model is a model for converting input data into hash codes, that is, the input data is the target stream data, and the output data is the hash code corresponding to the target stream data.

[0085] The following describes the application scenarios of the hash retrieval model:

[0086] For example, in the e-commerce field, new products are constantly being put on the shelves and user reviews are flowing in in real time, which means that the data stored in the database will continue to increase. By adopting this hash retrieval model, the platform can efficiently process product information and user behavior flow data. When users search for products, they can quickly retrieve products that meet their needs and similar recommendations.

[0087] For example, in the field of scientific research, the output of literature is growing, and new achievements and theories continue to emerge. By applying this hash retrieval model to the literature retrieval system, it is possible to process literature stream data in real time, and quickly analyze label features such as keywords, research directions, authors, and common features in the academic field. When researchers search for literature on specific topics, the system quickly screens relevant literature and cutting-edge research to help them grasp research trends, avoid duplication of work, accelerate the process of scientific research innovation, and promote academic exchanges and knowledge dissemination.

[0088] In this example, the hash retrieval model includes a residual network, a convolutional neural network, and a hash function, wherein the residual network and the convolutional neural network are used to learn features from the input stream data, and the hash function is used to generate corresponding hash codes according to the features learned by the residual network and the convolutional neural network.

[0089] The following is an explanation of the training process of the hash retrieval model:

[0090] Before introducing step S210 to step S250, firstly, the training stream data is obtained. In this embodiment, the training stream data includes two parts:

[0091] The first part is real-time collection of streaming data, here referred to as the first real-time streaming data, which is the streaming data collected at the current moment. For example, if the model has 10 training iterations, then the corresponding real-time streaming data will be collected in real time each time.

[0092] The second part is the pre-stored stream data, which is called pre-stored stream data here. This data is stored in the database. It can be composed of used real-time stream data. For example, if the current training number is the 5th time, then the pre-stored stream data can be composed of any real-time stream data collected in the previous 4 times. For example, if there are 100, then the corresponding number is selected from the previous 4 times according to a certain rule. The rules here are detailed in the description of the subsequent embodiments.

[0093] The training stream data set here is representative and timely, and can provide a suitable data basis for subsequent model learning.

[0094] In step S210, the unlabeled training stream data is input into the residual network. Since there is no label, the residual network uses self-supervised learning to extract the first feature from the training stream data. Then the residual network can calculate the first loss using the first feature and a preset first loss function, where the first loss function can be a self-supervised loss.

[0095] In step S220, the labeled training stream data is input into the convolutional neural network. The labeled training stream data includes the first real-time stream data with labels and the pre-stored stream data in the database.

[0096] The convolutional neural network extracts the second feature from the labeled training stream data based on supervised learning and the first feature. In this embodiment, the first feature learned by the residual network in step S210 is input into the convolutional neural network together. The purpose here is to enable the convolutional neural network in step S220 to better learn the features in the labeled training stream data based on the first feature, and then use this feature to better react to the residual network in step S210, so that the residual model after parameter optimization can learn a more accurate first feature.

[0097] In step S230, the residual network is gradient updated based on the first loss and the second loss, and the convolutional neural network is gradient updated based on the second loss.

[0098] Through the above steps S210 to S230, the residual network can learn the first feature by optimizing the self-supervised learning loss, the convolutional neural network can use the first feature of the residual network to quickly learn the labeled sample data, and feed back the learned second feature to the residual network for consolidating the first feature extracted by the residual network.

[0099] In step S240, the first feature and the second feature are fused to obtain a final feature, and the final feature is used as an input value of the hash function.

[0100] In step S250, the final feature is input into the hash function to obtain the hash code output by the hash function, completing the process from stream data to hash code. Then, the third loss can be calculated based on the hash code, and the gradient of the hash function can be updated according to the third loss.

[0101] The method of this embodiment has at least the following beneficial effects:

[0102] (1) In order to overcome the limitations of existing hash retrieval methods when processing streaming data, this embodiment introduces a continuous learning framework. By introducing this framework, the hash retrieval method can process real-time streaming data and adapt to the characteristics of data that change over time. While continuously learning new real-time streaming data, it avoids forgetting the old pre-stored streaming data knowledge, and maintains the retrieval performance of new and old data. Moreover, the continuous learning framework is also effectively connected with the hash function, using the residual network and convolutional neural network to continuously learn and extract features to guide the learning of the hash function, continuously improve the quality of the generated hash code, and further improve the retrieval performance.

[0103] (2) The residual network can learn the first feature by optimizing the self-supervised learning loss. The convolutional neural network can use the first feature of the residual network to quickly learn labeled sample data, and can feed back the learned second feature to the residual network to consolidate the first feature extracted by the residual network.

[0104] In some embodiments of the present application, the residual network and the convolutional neural network have the same number of layers;

[0105] Extracting the second feature from the training stream data carrying the label in step S220 includes:

[0106] Step S310, fusing the j-th first feature output by the j-th layer of the residual network with the j-th second feature output by the j-th layer of the convolutional neural network to obtain a fused feature; j is a positive integer less than L, and L is the total number of layers of the residual network;

[0107] Step S320, input the fused features into the j+1th layer of the convolutional neural network, obtain the j+1th second feature output by the j+1th layer of the convolutional neural network, and so on, until the Lth second feature output by the Lth layer of the convolutional neural network is obtained.

[0108] Step S240, fusing the first feature and the second feature to obtain a final feature, includes:

[0109] Step S410, fusing the Lth first feature output by the residual network and the Lth second feature output by the convolutional neural network to obtain a final feature.

[0110] For ease of understanding, Figure 3 to Figure 4 This embodiment provides a continuous hash learning and retrieval method for stream data, including steps S910 to S960:

[0111] Step S910, obtaining training stream data;

[0112] The training stream data includes the first real-time stream data collected in real time and the pre-stored stream data. The following describes how to obtain the pre-stored stream data of the database:

[0113] The real-time streaming data that is continuously input is sampled into the database, and the pre-stored streaming data is managed from the category level. Specifically, 100 samples of each category are stored as pre-stored streaming data. For the newly input streaming data, sampling operations are performed according to the category to which it belongs.

[0114] If there are already 100 samples in the database for the category to which the stream data belongs, then a decision on whether to replace a sample in the database is made based on the timeliness and usage frequency of the sample.

[0115] If the number of samples in this category is less than 100, the stream data samples are directly stored in the database to continuously enrich the pre-stored stream data in the database so that it can better adapt to the learning scenario. This data sampling and updating strategy can ensure that the pre-stored stream data in the database has a certain degree of representativeness and timeliness, providing a suitable data foundation for subsequent learning.

[0116] In this embodiment, the hash retrieval model includes a residual network, a convolutional neural network and a hash function.

[0117] Step S920, constructing a residual network;

[0118] The pre-stored stream data sampled in step S910 is further processed. In the representation learning stage, the training stream data (the first real-time stream data collected in real time and the pre-stored stream data stored in the database) is input into the residual network to learn the universal representation of the stream data (ie, the first feature).

[0119] The first loss function of the residual network is the self-supervised learning loss (SSL Loss). The residual network has sufficient depth and width to capture the complex patterns and features in the first real-time streaming data and pre-stored streaming data, and is trained to optimize the self-supervised learning loss.

[0120] In order to ensure that the first feature can be learned while minimizing additional computing resources, the self-supervised learning loss is considered and implemented when building the residual network. Barlow wins is a common self-supervised learning method that can achieve excellent results with minimal computing overhead.

[0121] Assume that the training stream data is D. Formally, Barlow Twins obtains two views by applying two different data transformations to D: and Different data transformation methods include, but are not limited to, random cropping and rotation.

[0122] By default, D contains samples from the first real-time streaming data and samples from the pre-stored streaming data in the database to maximize the number of samples for self-supervised learning, and then D is passed to the residual network to obtain the first feature and The first loss function of BarlowTwins includes:

[0123] ;

[0124] in, represents the trade-off factor, represents the cross-correlation matrix, and is the vector dimension index. By encouraging the learned features to be consistent within their own view and limiting the correlation between different views, the residual network can learn more meaningful features. The cross-correlation matrix C is defined as:

[0125] ;

[0126] in, represents a mini-batch index, and Represents the vector dimension index.

[0127] yes For a specific example, suppose there is After data transformation, the stream data is input into the residual network. Then the output of these data after the residual network is , is a matrix, each row of which corresponds to the feature vector extracted by the residual network for each data. Then That means this The first feature vector extracted from the corresponding stream data The value of the dimension.

[0128] By transforming the cross-correlation matrix Optimized to the identity matrix, the Barlow Twins loss forces the residual network to learn key information that is invariant to distortion (unit elements on the diagonal) while eliminating redundant information in the data (zero elements elsewhere).

[0129] During the optimization process, due to the update mechanism of the pre-stored stream data, only a small number of samples (i.e., predicted stream data) are stored in the database, which causes the data distribution in the database to drift after each iteration. Therefore, in order to quickly learn the knowledge of the current pre-stored stream data samples before replacing them with new samples, the Look-ahead optimizer is used to optimize the residual network. The optimization process is as follows:

[0130] ;

[0131] ;

[0132] in, Represents the Look-ahead learning rate, Represents the Look-ahead SGD learning rate. When , the optimization is simplified to the traditional method of using SGD optimization. represents the initial parameter value, is initialized to , and then iterative updates are started. This is performed using the standard SGD optimizer Updates, look-ahead weight Used to perform momentum updates on residual networks. The purpose is to allow the network to better utilize previous learning experience (reflected by weights) during the optimization process, so that parameter updates are not only based on current gradient information, but also take into account previous update trends, so as to converge more stably and quickly toward the optimal solution. Residual networks can explore traditionally undiscovered areas through look-ahead optimization and have faster training convergence speed.

[0133] Step S930, constructing a convolutional neural network;

[0134] The convolutional neural network uses the first feature learned by the residual network and uses a feature adaptation mechanism to quickly learn labeled sample data (i.e., training stream data with labels). The feature adaptation mechanism is a method based on linear transformation, which can adjust the first feature learned by the residual network into a form that is more suitable for learning labeled sample data.

[0135] Given a labeled sample stream data ,in, represents a sample in the first real-time stream data, Indicates the corresponding label.

[0136] The goal of the convolutional neural network is to use the first feature learned by the residual network to learn the labeled sample through a feature adaptation mechanism.

[0137] In terms of form, For data In the feature maps of each layer of the residual network, such as Figure 4 , the goal of the feature adaptation mechanism is to Get the adaptation characteristics .

[0138] The number of layers of the convolutional neural network is Layers, the same as the number of layers in the residual network.

[0139] Adaptation characteristics The way to obtain is:

[0140] ;

[0141] where ⊙ represents element-wise multiplication, Represents the convolutional neural network The output of the layer and the features of the corresponding slow network output have the same dimensions.

[0142] The goals of convolutional neural networks include;

[0143] In order to facilitate the acquisition of feature information of the convolutional neural network during supervised learning, samples in the first real-time streaming data are mixed with sample data of the streaming data pre-stored in the database.

[0144] Given an incoming labeled sample and small batches of data that are pre-stored stream data in the database , consider using the soft label loss (i.e., the second loss function) for the supervised learning stage:

[0145] ;

[0146] in, represents the cross entropy loss, represents the KL divergence, represents the softmax function, and the corresponding temperature coefficient is , Represents a trade-off factor. Indicates the first real-time data After the output of the fast network, Representation data The corresponding label, Indicates the pre-stored stream data in the database After the output of the convolutional neural network, Represents a pre-stored stream The corresponding label, It means that the convolutional neural network has learned After the task, for the pre-stored stream data Output of the convolutional neural network.

[0147] The convolutional neural network feeds the learned knowledge (i.e., the second feature) back to the residual network to ensure that it can learn representations useful for supervised learning, which is achieved by optimizing the supervised loss.

[0148] After the convolutional neural network learns the labeled sample data (i.e., the training stream data with labels), it feeds back the learned information about the labels to the residual network, which can further adjust the first feature it has learned based on this information to make it more accurate and stable. It should be noted that the way to feed back the learned information about the labels to the residual network is based on the gradient update of the loss.

[0149] Step S940, constructing a hash function;

[0150] The first feature and the second feature learned by the residual network and the convolutional neural network are fused to obtain the final feature.

[0151] The convolutional neural network is composed of a simple CNN, and the residual network is composed of a residual network with the same number of layers. When the input training stream data passes through the convolutional neural network and the residual network respectively, the feature map obtained will be fused by element-by-element multiplication to obtain the final feature, which will then be input into the hash function. Here, a simple and efficient linear mapping is used to design an adaptive update hash function;

[0152] ;

[0153] in, represents the number of sample categories, represents the input sample, Indicates the corresponding label, represents a hash function with parameters, represents the parameter matrix, Represents the regularization parameter, which is used to control the complexity of the hash function and prevent overfitting.

[0154] The goal of this formula is to find the optimal parameters , so that the error between the predicted value of the input training stream data and the target value (label) is minimized, and the parameters are constrained by the regularization term. The hash function is defined as:

[0155] ;

[0156] For the definition of hash function, since the data is input in the form of stream, In the round, the number of old samples (i.e., prediction flow data) considered is , the number of new samples (i.e., the first real-time stream data) is ,in represents the parameter matrix, represents the hyperparameter of the balanced regularization term, Represents the feature matrix of old sample data, Represents the feature matrix of the new sample data. Indicates for The learned hash code, Indicates for The learned hash code, Indicates the length of the hash code, represents the Frobenius norm.

[0157] Using this hash function has two advantages:

[0158] 1) Reduce the quantization loss between the learned hash code and the real-valued mapping result;

[0159] 2) The catastrophic forgetting problem can be alleviated by considering both the first real-time stream data and the pre-stored stream data.

[0160] This embodiment also introduces a label enhancement matrix. The label enhancement matrix is ​​defined as:

[0161] ;

[0162] in, express No. List, express No. List, express The corresponding label, Indicates the amount of the first real-time stream data, Indicates the amount of pre-stored stream data. represents the overall embedding of the first real-time stream data and the pre-stored stream data tags, Indicates the length of a vector.

[0163] The pairwise semantic similarity is defined by converting each column of the label augmentation matrix into a unit vector as follows:

[0164] ;

[0165] ;

[0166] ;

[0167] in, Represents the label enhancement matrix of the pre-stored stream data, A label enhancement matrix representing the first real-time stream data, and represents the pairwise semantic similarity between the pre-stored stream data and the first real-time stream data sample, Represents the pairwise semantic similarity between the first real-time streaming data samples.

[0168] The corresponding loss function is defined according to the pairwise semantic similarity of the first real-time stream data and the pre-stored stream data samples as follows:

[0169] ;

[0170] in, Indicates the length of the hash code, Represents the number of first real-time streaming data. In this equation, the knowledge of both new and old classes can be embedded and can constructively guide the learning of hash functions to effectively handle the problem of unknown new classes that continue to appear as streaming data blocks.

[0171] Step S950, using an alternating optimization strategy to guide hash function learning;

[0172] The features obtained by the convolutional neural network and the residual network are fused to obtain the final features, which are used to guide the learning of the hash function in this step.

[0173] Specifically, the final feature is used as a constraint to optimize the hash function. In the process of optimizing the hash function, the final feature is associated with the parameters of the hash function, and the performance of the hash function is optimized by adjusting the influence of the final feature on the parameters of the hash function.

[0174] The alternating optimization strategy adopted by this method is an iterative process. Considering the above loss function, we get the final loss function:

[0175] ;

[0176] in represents the trade-off factor, Used to balance the degree of guidance of label information on the learning of convolutional neural networks and residual networks. Used to adjust the degree of guidance of pairwise semantic similarity on hash function learning.

[0177] Specifically, at the beginning of each iteration, the parameters of the hash function are fixed.

[0178] According to the optimization method of the residual network in step S920, the parameters of the residual network are updated using relevant operations such as Look-ahead. For the residual network, its goal is to learn universal representation by optimizing the first loss of Barlow Twins. In this process, since the hash function parameters are fixed, it mainly focuses on the parameter adjustment within its own network structure to better capture the complex patterns and features in the data.

[0179] At the same time, according to the feature adaptation mechanism and loss function of the convolutional neural network in step S930 The convolutional neural network uses the first feature learned by the residual network to quickly learn the labeled sample data through the feature adaptation mechanism, and feeds the learned knowledge back to the residual network to ensure that it can learn representations that are useful for supervised learning.

[0180] Then the network structure parameters of the residual network and convolutional neural network are fixed, and the parameters of the hash function are optimized.

[0181] According to the above total loss function, the parameters are updated by calculating the gradient. Stochastic gradient descent (SGD) is used to calculate the gradient and update the parameters. When calculating the gradient, the terms related to the final features in the loss function are considered through the trade-off factor, so that the parameter update direction of the hash function is affected by the final features, thereby optimizing the performance of the hash function.

[0182] Through this alternating optimization strategy, on the one hand, the residual network and convolutional neural network can continuously learn and adapt to the characteristics of the data, and improve their ability to represent the data. This allows the residual network to better capture the complex patterns and features in the data, and the convolutional neural network to learn labeled sample data more accurately.

[0183] On the other hand, the optimization of hash functions can generate higher quality hash codes, which is manifested in reducing the quantization loss between the learned hash codes and the real-valued mapping results, and at the same time, by considering new and old data to alleviate the catastrophic forgetting problem, thereby improving the performance of hash retrieval and enabling more accurate data retrieval when facing streaming data.

[0184] Step S960, repeat S920-S950 until the hash retrieval model converges.

[0185] The steps S920 to S950 are continuously repeated. During each repetition, the hash retrieval model is adjusted and optimized according to the new first real-time stream data and the previously learned pre-stored stream data until the convergence judgment criterion is met.

[0186] This ensures that the hash retrieval model can fully learn the information in the data and generate high-quality hash codes for efficient hash retrieval.

[0187] like Figure 5 In one embodiment, a continuous hash learning and retrieval device for streaming data is provided, the device comprising:

[0188] The data acquisition module 1100 is used to acquire target stream data;

[0189] The hash generation module 1200 is used to input the target stream data into the trained hash retrieval model to obtain the target hash code output by the hash retrieval model; wherein the hash retrieval model includes a residual network, a convolutional neural network and a hash function, and the training process of the hash retrieval model includes:

[0190] The hash retrieval model is trained for multiple rounds until the hash retrieval model converges; the process of the tth round of training includes:

[0191] The training stream data is input into the residual network, so that the residual network extracts the first feature from the training stream data based on self-supervised learning, and calculates the first loss according to the preset first loss function and the first feature; the training stream data includes the first real-time stream data collected in real time and the pre-stored stream data in the database, and the pre-stored stream data in the database is the real-time stream data collected during the previous t-1 rounds of training;

[0192] Inputting the labeled training stream data into the convolutional neural network, so that the convolutional neural network extracts a second feature from the labeled training stream data based on supervised learning and the first feature, and calculates a second loss according to a preset second loss function and the second feature; the labeled training stream data includes the labeled first real-time stream data and the pre-stored stream data in the database;

[0193] Performing a gradient update on the residual network based on the first loss and the second loss, and performing a gradient update on the convolutional neural network based on the second loss;

[0194] The first feature and the second feature are combined to obtain the final feature;

[0195] The final feature is input into the hash function to obtain the hash code output by the hash function, the third loss is calculated based on the hash code, and the gradient of the hash function is updated according to the third loss.

[0196] It should be noted that the continuous hash learning and retrieval device for streaming data provided in this embodiment and the above-mentioned continuous hash learning and retrieval method for streaming data are based on the same inventive concept, so the relevant content of the above-mentioned continuous hash learning and retrieval method for streaming data is also applicable to the content of the continuous hash learning and retrieval device for streaming data, and therefore, it will not be repeated here.

[0197] The device of this embodiment has at least the following beneficial effects:

[0198] (1) In order to overcome the limitations of existing hash retrieval methods when processing streaming data, this embodiment introduces a continuous learning framework. By introducing this framework, the hash retrieval method can process real-time streaming data and adapt to the characteristics of data that change over time. While continuously learning new real-time streaming data, it avoids forgetting the old pre-stored streaming data knowledge, and maintains the retrieval performance of new and old data. Moreover, the continuous learning framework is also effectively connected with the hash function, using the residual network and convolutional neural network to continuously learn and extract features to guide the learning of the hash function, continuously improve the quality of the generated hash code, and further improve the retrieval performance.

[0199] (2) The residual network can learn the first feature by optimizing the self-supervised learning loss. The convolutional neural network can use the first feature of the residual network to quickly learn labeled sample data, and can feed back the learned second feature to the residual network to consolidate the first feature extracted by the residual network.

[0200] like Figure 6 The present application also provides an electronic device, which includes:

[0201] at least one memory;

[0202] at least one processor;

[0203] at least one program;

[0204] The program is stored in the memory, and the processor executes at least one program to implement the above-mentioned continuous hash learning and retrieval method for stream data implemented in the present disclosure.

[0205] The electronic device may be any intelligent terminal including a mobile phone, a tablet computer, a personal digital assistant (PDA), a vehicle-mounted computer, etc.

[0206] The electronic device according to the embodiment of the present application is described in detail below.

[0207] The processor 1600 may be implemented by a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present invention.

[0208] The memory 1700 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1700 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 1700, and the processor 1600 calls and executes the continuous hash learning and retrieval method for stream data in the embodiment of the present invention.

[0209] Input / output interface 1800, used to implement information input and output;

[0210] Communication interface 1900, used to realize communication interaction between the device and other devices, which can be realized through wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);

[0211] Bus 2000 , which transmits information between various components of the device (e.g., processor 1600 , memory 1700 , input / output interface 1800 , and communication interface 1900 );

[0212] The processor 1600 , the memory 1700 , the input / output interface 1800 , and the communication interface 1900 are connected to each other in communication within the device via the bus 2000 .

[0213] An embodiment of the present invention further provides a storage medium, which is a computer-readable storage medium. The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the above-mentioned continuous hash learning and retrieval method for stream data.

[0214] The memory is a non-transitory computer-readable storage medium that can be used to store non-transitory software programs and non-transitory computer executable programs. In addition, the memory may include a high-speed random access memory and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device.

[0215] In some embodiments, the memory may include a memory remotely located relative to the processor, and the remote memory may be connected to the processor via a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0216] The embodiments described in the present invention are intended to more clearly illustrate the technical solutions of the embodiments of the present invention and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.

[0217] Those skilled in the art will appreciate that the technical solutions shown in the figures do not limit the embodiments of the present invention and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0218] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0219] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0220] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0221] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0222] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0223] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0224] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0225] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable an electronic device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store programs.

[0226] The above is a specific description of the preferred implementation of the embodiments of the present application, but the embodiments of the present application are not limited to the above-mentioned implementation methods. Technical personnel familiar with the field can also make various equivalent modifications or substitutions without violating the spirit of the embodiments of the present application. These equivalent modifications or substitutions are all included in the scope defined by the claims of the embodiments of the present application.

Claims

1. A continuous hash learning retrieval method for streaming data, characterized in that: The method comprises: Obtaining target flow data; the target flow data is commodity information and user behavior flow data, or document flow data; Input the target stream data into the trained hash retrieval model to obtain the target hash code output by the hash retrieval model; the target hash code is the hash code of the commodity information and user behavior stream data, or the hash code of the document stream data; When the target stream data is commodity information and user behavior stream data, the method further includes: Based on the product information and the hash code of the user behavior stream data, obtain related products and recommendations; When the target stream data is document stream data, the method further includes: Based on the document stream data hash code, obtain relevant documents and cutting-edge research; The hash retrieval model includes a residual network, a convolutional neural network and a hash function, and the training process of the hash retrieval model includes: The hash retrieval model is trained for multiple rounds until the hash retrieval model converges; wherein the t-th round of training includes: Input the training stream data into the residual network, so that the residual network extracts a first feature from the training stream data based on self-supervised learning, and calculates a first loss according to a preset first loss function and the first feature; the training stream data includes first real-time stream data collected in real time and pre-stored stream data in a database, and the pre-stored stream data in the database is the real-time stream data collected during the previous t-1 round of training; Inputting the labeled training stream data into the convolutional neural network, so that the convolutional neural network extracts a second feature from the labeled training stream data based on supervised learning and the first feature, and calculates a second loss according to a preset second loss function and the second feature; the labeled training stream data includes the labeled first real-time stream data and the pre-stored stream data in the database; Performing a gradient update on the residual network based on the first loss and the second loss, and performing a gradient update on the convolutional neural network based on the second loss; fusing the first feature and the second feature to obtain a final feature; The final feature is input into the hash function to obtain a hash code output by the hash function, a third loss is calculated based on the hash code, and a gradient of the hash function is updated according to the third loss.

2. The continuous hash learning and retrieval method for stream data according to claim 1 is characterized in that: The residual network and the convolutional neural network have the same number of layers; The extracting the second feature from the training stream data carrying the label includes: Fusing the jth first feature output by the jth layer of the residual network with the jth second feature output by the jth layer of the convolutional neural network to obtain a fused feature; j is a positive integer less than L, L is the total number of layers of the residual network, and L is a positive integer greater than 1; Inputting the fused feature into the j+1th layer of the convolutional neural network to obtain the j+1th second feature output by the j+1th layer of the convolutional neural network, and so on, until obtaining the Lth second feature output by the Lth layer of the convolutional neural network; The fusing the first feature and the second feature to obtain a final feature includes: The Lth first feature output by the residual network and the Lth second feature output by the convolutional neural network are fused to obtain a final feature.

3. The continuous hash learning and retrieval method for stream data according to claim 1 is characterized in that: The first loss function includes: ; ; in, represents the first loss function, represents the identity, express The value of the mth dimension in , It represents the feature matrix output by the residual network for the b training stream data after the data transformation in mode A. express The value of the nth dimension in , It represents the feature matrix output by the residual network for the b training stream data after the data transformation in mode B. represents the trade-off factor, represents the cross-correlation matrix, Denotes the diagonal elements of the cross-correlation matrix.

4. The continuous hash learning and retrieval method for stream data according to claim 1 is characterized in that: The second loss function includes: ; in, represents the second loss function, Represents the mapping function of the cross entropy loss function, Represents the convolutional neural network for the first real-time stream data with labels The second feature of the output, is the mapping function of the softmax function, and the temperature coefficient corresponding to the softmax function is , express The corresponding label, Indicates the amount of pre-stored stream data. Represents the convolutional neural network for pre-stored streaming data The second feature of the output, express The corresponding label, Represents the convolutional neural network learning After the task is completed, the pre-stored stream data The second feature of the output, represents the trade-off factor, Represents the mapping function of KL divergence loss.

5. The continuous hash learning and retrieval method for stream data according to claim 4 is characterized in that: The calculating the third loss based on the hash code comprises: Based on the preset loss function and the hash code to calculate the third loss; wherein the loss function include: ; in, represents a hash function with parameters, represents the regularization parameter, represents the number of sample categories of the training stream data, represents the parameter matrix.

6. The continuous hash learning and retrieval method for stream data according to claim 1 is characterized in that: The hash function includes: ; in, represents a hash function with parameters, Indicates that the hash function is used in round t for The extracted hash code, Indicates the feature matrix of pre-stored streaming data during the tth round of training, Indicates that the hash function is trained in the tth round for The extracted hash code, represents the feature matrix of the first real-time stream data in the tth round of training, represents the parameter matrix at the tth round of training, represents the hyperparameter of the balanced regularization term.

7. The continuous hash learning and retrieval method for stream data according to claim 4 is characterized in that: The calculating the third loss based on the hash code comprises: Based on the preset loss function , loss function and the hash code to calculate a third loss; wherein the loss function include: ; in, Indicates that it has parameters The hash function of represents the regularization parameter, Represents the number of sample categories of the training stream data; The loss function include: ; ; ; ; ; in, Indicates the length of the hash code, Indicates the number of samples of the first real-time stream data in the tth round of training, Indicates that the hash function is trained in the tth round for The extracted hash code, represents the feature matrix of the first real-time stream data in the tth round of training, represents the matrix transpose, Indicates that the hash function is trained in the tth round for The extracted hash code, Indicates the feature matrix of pre-stored streaming data during the tth round of training, represents the label enhancement matrix of the first real-time stream data in the tth round of training, Indicates the label enhancement matrix of the pre-stored streaming data during the tth round of training, represents the overall embedding matrix of the first real-time stream data and the pre-stored stream data labels in the tth round of training, express The corresponding label matrix, express The i-th column of express The i-th column of Indicates the length of a vector.

8. A continuous hash learning and retrieval device for streaming data, characterized in that: The device comprises: A data acquisition module is used to acquire target flow data; the target flow data is commodity information and user behavior flow data, or document flow data; A hash generation module is used to input the target stream data into the trained hash retrieval model to obtain a target hash code output by the hash retrieval model; the target hash code is a hash code of product information and user behavior stream data, or a hash code of document stream data; When the target stream data is product information and user behavior stream data, the hash generation module is further used to: obtain related products and recommendations based on the product information and user behavior stream data hash codes; When the target stream data is document stream data, the hash generation module is further used for: Based on the document stream data hash code, obtain relevant documents and cutting-edge research; The hash retrieval model includes a residual network, a convolutional neural network and a hash function, and the training process of the hash retrieval model includes: The hash retrieval model is trained for multiple rounds until the hash retrieval model converges; wherein the t-th round of training includes: Input the training stream data into the residual network, so that the residual network extracts a first feature from the training stream data based on self-supervised learning, and calculates a first loss according to a preset first loss function and the first feature; the training stream data includes first real-time stream data collected in real time and pre-stored stream data in a database, and the pre-stored stream data in the database is the real-time stream data collected during the previous t-1 round of training; Inputting the labeled training stream data into the convolutional neural network, so that the convolutional neural network extracts a second feature from the labeled training stream data based on supervised learning and the first feature, and calculates a second loss according to a preset second loss function and the second feature; the labeled training stream data includes the labeled first real-time stream data and the pre-stored stream data in the database; Performing a gradient update on the residual network based on the first loss and the second loss, and performing a gradient update on the convolutional neural network based on the second loss; fusing the first feature and the second feature to obtain a final feature; The final feature is input into the hash function to obtain a hash code output by the hash function, a third loss is calculated based on the hash code, and a gradient of the hash function is updated according to the third loss.

9. An electronic device, characterized in that: include: at least one control processor and a memory for communicatively coupling with the at least one control processor; The memory stores instructions that can be executed by the at least one control processor, and the instructions are executed by the at least one control processor to enable the at least one control processor to execute the continuous hash learning and retrieval method for stream data as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the continuous hash learning and retrieval method for stream data as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and computing environment for creating and applying a test algorithm for computational processes

    CA3181271A1

  • Rapid cross-modal retrieval method and system for incremental data carrying new categories

    CN113326289A