A deep variable-length hash retrieval method with adaptive bit selection

By using an adaptive bit-selection deep variable-length hash retrieval method, combined with a deep convolutional neural network and a bit-selection agent, the problem of wasted training resources for multiple models is solved, and efficient image retrieval under different resource configurations is achieved, improving retrieval accuracy and adaptability.

CN119597946BActive Publication Date: 2025-12-16ARTIFICIAL INTELLIGENCE RES INST OF HEFEI COMPREHENSIVE NAT SCI CENT (ANHUI ARTIFICIAL INTELLIGENCE LAB)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411568417.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-05
Publication Date
2025-12-16
Estimated Expiration
2044-11-05

AI Technical Summary

Technical Problem

Existing deep learning compact feature representation methods require training multiple deep models for different retrieval scenarios, resulting in wasted memory and computational resources. Meanwhile, traditional hash bit selection methods lack a comprehensive consideration of retrieval performance and bit attributes, leading to limited retrieval performance.

Method used

A deep variable-length hash retrieval method with adaptive bit selection is adopted. Through alternating iterative training of bit pool generation and adaptive bit selection, an optimization metric that balances retrieval performance and bit attributes is designed. A deep convolutional neural network and a bit selection agent are used to realize a variable-length compact feature representation.

Benefits of technology

It improves the accuracy and adaptability of image retrieval, reduces training and storage costs, and can output binary codes with the optimal bit length under different computing resource configurations, thereby improving retrieval performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597946B_ABST
    Figure CN119597946B_ABST
Patent Text Reader

Abstract

The application discloses a deep variable-length hash retrieval method with adaptive bit selection, and relates to the technical field of image retrieval. The image is input into a trained retrieval model to generate a query image binary code, the Hamming distance between the query image binary code and the image binary code in an image database is calculated, and the database images are returned in order of distance from small to large as retrieval results. The training process of the retrieval model comprises the following steps: step one, each image in the constructed image training set is sequentially input into a deep hash network to output the binary code corresponding to each image, the deep hash network is trained by optimizing the metric, and a bit pool is generated; step two, the bit pool is input into a bit selection agent for bit selection, and the same optimization metric as that in step one is used as an environmental reward; and step three, steps one and two are alternately iterated until the retrieval model converges. The retrieval method realizes compact feature expression with variable length and improves retrieval precision.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image retrieval, and particularly relates to a deep variable-length hash retrieval method with adaptive bit selection. BACKGROUND

[0002] In large-scale image retrieval systems, compact feature representation learning can preserve the discriminativeness of original high-dimensional image representation and reduce memory consumption and online retrieval time. Existing compact feature representation methods mainly include two categories, which are quantization method and binary hash method. The quantization method first learns a codebook, and then quantizes the original feature to the nearest codebook word in the codebook. Only the corresponding codebook word index needs to be saved in the database, which can greatly reduce the memory overhead. And by pre-computing the distance lookup table between two codebook words, the online retrieval time can be significantly reduced. On the other hand, the binary hash method projects the original feature into a low-dimensional space by learning a hash function, and then directly binarizes the projected feature to obtain a binary code. Using binary code as feature representation can significantly reduce memory consumption, and the Hamming distance between binary codes can be calculated at high speed by existing CPU architecture, which can significantly reduce the online retrieval time overhead.

[0003] In recent years, with the rise of deep learning technology, deep learning technology has been introduced into compact feature representation learning, achieving better semantic discriminativeness. Although existing deep learning-based quantization and binary hash methods have achieved potential retrieval performance, different deep models usually need to be trained separately for different retrieval scenarios, including different computing and memory resources. In other words, multiple deep models need to be trained separately to generate compact representations of different lengths. This way requires storing multiple deep models and corresponding database image representations, resulting in a huge waste of memory resources. In addition, training multiple deep models also consumes a lot of time and computing resources. To solve the above problems, a variable-length compact feature representation method is proposed to output a set of compact representations of different lengths with one model, where longer representations contain shorter representations.

[0004] Existing variable-length deep hash methods are currently less studied, and generally select bits of different lengths by bit importance weighting. The optimization objective is generally quantization loss or pairwise discriminativeness, which still has a large gap with the ultimate goal of image retrieval, i.e. optimizing retrieval performance.

[0005] On the other hand, traditional hash bit selection methods usually output binary codes of fixed bit length, and need to train bit selection models separately for different computing resource configurations of application scenarios. In addition, the optimization objective of existing bit selection methods is generally pairwise similarity preservation, which lacks comprehensive consideration of retrieval performance and bit properties, so the retrieval performance is usually limited during testing. SUMMARY

[0006] Based on the technical problems existing in the background art, the application provides a deep variable-length hash retrieval method with adaptive bit selection, realizes compact feature expression of variable length, and improves retrieval accuracy.

[0007] The deep variable-length hash retrieval method with adaptive bit selection provided by the application generates a query image binary code by inputting an image into a trained retrieval model, calculates the Hamming distance between the query image binary code and image binary codes in an image database, and returns database images in order of distance from small to large as retrieval results.

[0008] The training process of the retrieval model is as follows:

[0009] Step one, bit pool generation: input each image in the constructed image training set into the deep hash network in turn to output the binary code corresponding to each image, train the deep hash network by optimizing the metric, and generate a bit pool composed of all binary codes.

[0010] Step two, adaptive bit selection: input the bit pool into the bit selection agent for bit selection, use the same optimization metric as in step one as the environment reward, and when the preset bit length is reached, the bit selection agent obtains the environment reward, uses the environment reward, environment state and action as training data to train the bit selection agent, updates the bit selection state based on the interaction between the bit selection agent and the environment, and feeds back the bit selection state to the bit pool to obtain the selected bits, and based on the selected bits, continue to train the deep hash network in step one.

[0011] Step three, alternately iterate step one and step two until the retrieval model converges, and after training is completed, use the bit selection agent as a bit selector arranged after the deep hash network to select the binary code output by the deep hash network for storage in the image database.

[0012] Further, the deep hash network is based on a deep convolutional neural network, removes the classification layer of the deep convolutional neural network, and sequentially adds a linear layer as a hash layer, and adds a hyperbolic tangent activation layer and a classification layer in parallel after the hash layer, the hash layer outputs an L-dimensional vector x, and the hyperbolic tangent activation layer outputs a binary code b L .

[0013] Further, the environment state s t at time t is defined as the indicator of the currently selected bit, i.e. t s L =1 if the kth bit is selected as the final binary code, otherwise s t,k =0. t,k= 0, s t,k a representation of the kth bit at time t;

[0014] The bit selection agent includes a policy network and a value network, and both the policy network and the value network include two linear layers, and a ReLU activation layer is additionally arranged after each linear layer;

[0015] In the policy network, a linear layer and a softmax layer are sequentially arranged after the ReLU activation layer to output action probability;

[0016] In the value network, a linear layer is arranged after the ReLU activation layer to map the state representation into a real number state value estimate.

[0017] Further, the optimization metric has two forms, the first form is to comprehensively consider the retrieval performance and the bit attribute, and is defined as an RPBP metric, and the second form is to directly use the loss function of an existing hash method as the optimization metric;

[0018] In the first form, the RPBP metric M rpbp is defined as follows:

[0019] M rpbp (W, {Θ, Φ}) = -L map (B) + αL q (B) + βL d (B).

[0020] Wherein, L map (.) is the average precision mean metric loss, L q (.) and L d (.) respectively represent the binary quantization loss and the independence metric loss, and α and β respectively represent corresponding hyperparameters, and B represents a bit pool.

[0021] Further, the total optimization target of the retrieval model is:

[0022] minL(W, {Θ, Φ}) = minL C (W) + M(W, {Θ, Φ});

[0023] Wherein, W represents the deep hash network parameter in step one, L C (.) is the classification loss, M(.) is the optimization metric, {Θ, Φ} represents the policy network Θ and the value network Φ parameters of the bit selection agent in step two, and L(W, {Θ, Φ}) is the loss of the network parameters W, {Θ, Φ} to be learned.

[0024] Further, in the bit pool generation process optimization of step one, the bit selection agent is fixed, and the total optimization target is represented as follows:

[0025] minL(W)=minL c (W)+M(W);

[0026] In the adaptive bit selection optimization in step two, the depth hashing network is fixed, and the overall optimization objective is expressed as follows:

[0027] minL({Θ,Φ})=max-M({Θ,Φ});

[0028] Where L(W) is the loss of W; L({Θ,Φ}) is the loss of {Θ,Φ}; and max is the inverse operation of min, which means finding the maximum value of -M({Θ,Φ}), i.e., used to calculate the maximum reward.

[0029] Furthermore, in the bit pool generation process optimization in step one, the optimization metric M adopts the RPBP metric M. rpbp At that time, L q (B),L d (B),L c The gradients of the loss function (W) are all directly calculated, and the retrieval model is updated through backpropagation;

[0030] L map (B) Optimization is performed using the policy gradient algorithm, which is as follows:

[0031] For the i-th input image, the hash layer output vector x of the deep hash network is... i The probability of converting to an output bit "1"

[0032] The binarization process is viewed as an action u i Then the probability distribution of the output bit "1" is P. W u i For the i-th vector x i Actions:

[0033]

[0034] Perform R Monte Carlo samplings based on probability, and the policy gradient... The calculation is as follows:

[0035]

[0036] Among them, u i,k For the i-th vector x i The action of the k-th bit, For the i-th vector x i In the r-th Monte Carlo sampling action, r takes values ​​from 1 to R.

[0037] Further, in step two, when the preset bit length is reached, the bit selection agent obtains an environment reward, specifically:

[0038] The reward r obtained by the agent at time t t (Θ) is calculated by accumulating the discounted reward, r t+l is the environment reward at the t+l time, r t+l is a non-zero value on the user-specified variable-length bit length setting set, otherwise, r t+l = 0, Θ is the policy network, t and l are time.

[0039] A computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor executes the computer program to implement the retrieval method as described above.

[0040] A computer-readable storage medium has a plurality of classification programs stored thereon, and the plurality of classification programs are used to be called by a processor and execute the retrieval method as described above.

[0041] The self-adaptive bit selection deep variable-length hash retrieval method provided by the present application has the advantages that: the self-adaptive bit selection deep variable-length hash retrieval method provided in the structure of the present application designs a novel variable-length adaptive deep hash bit selection framework technology, alternately iteratively generates a bit pool and performs adaptive bit selection, optimizes the metric considering the retrieval performance and bit properties by design, optimizes the metric during the training process, realizes variable-length hash bit selection considering the retrieval performance and bit properties, and further improves the retrieval accuracy during testing. BRIEF DESCRIPTION OF DRAWINGS

[0042] Fig. 1 is a structural flowchart of the present application;

[0043] Fig. 2 is a structural flowchart of adaptive bit selection. DETAILED DESCRIPTION

[0044] In the following description, many specific details are set forth in order to fully understand the present application. However, the present application can be practiced in many different ways beyond the specific details disclosed herein. It is therefore contemplated that the present application covers any and all modifications, variations, or equivalents of the present application.

[0045] In this embodiment, the network framework is optimized by alternately iterating two steps:

[0046] The variable-length adaptive deep hash bit selection framework proposed in this embodiment includes two alternately iterated training steps, namely bit pool generation and adaptive bit selection. The first step is to generate a large bit pool for the training set images, and the second step is to select the most effective bit set from the bit pool.

[0047] As shown in Figs. 1-2 The adaptive bit selection deep variable-length hash retrieval method proposed by the application generates a query image binary code by passing the image through the trained retrieval model, calculates the Hamming distance between the query image binary code and the image binary code in the image database, and returns the database images in order of distance from small to large as the retrieval result.

[0048] The training process of the retrieval model is as follows:

[0049] Step one, bit pool generation: input each image in the constructed image training set into the deep hash network in turn to output the binary code corresponding to each image, and train the deep hash network by optimizing the metric to generate a bit pool, which is composed of all binary codes;

[0050] Step two, adaptive bit selection: input the bit pool into the bit selection agent for bit selection, using the same optimization metric as the environment reward in step one, when the preset bit length is reached, the bit selection agent obtains the environment reward, and the environment reward, environment state and action are used as training data to train the bit selection agent, the bit selection state is updated based on the interaction between the bit selection agent and the environment, and the selected bits are fed back to the bit pool to obtain the selected bits, and the deep hash network in step one is further trained based on the selected bits;

[0051] Step three, alternately iterate steps one and two until the retrieval model converges, after training is completed, use the bit selection agent as the bit selector set after the deep hash network to select the binary code output by the deep hash network for storage in the image database.

[0052] For the agent involved in this embodiment, it is composed of two networks, namely the policy network and the value network, which are described in detail in (B) adaptive bit selection.

[0053] This embodiment designs a novel variable-length adaptive deep hash bit selection framework technology to address the problems existing in existing binary hash methods, alternately iterates bit pool generation and adaptive bit selection, designs an optimization metric that takes into account retrieval performance and bit properties, and optimizes the metric during the training process. The two alternately iterated steps, realize variable-length hash bit selection that takes into account retrieval performance and bit properties, and further improve the retrieval accuracy during testing.

[0054] That is, the embodiment aims at the problems in the prior art, and proposes a novel and general variable-length deep hashing bit selection framework technology, and realizes variable-length compact feature expression through adaptive bit selection. In particular, the framework includes two alternately iterative steps, namely bit pool generation and adaptive bit selection. To ensure the consistency of the optimization process of the variable-length compact expression, the two steps adopt the same optimization metric. The embodiment proposes a novel RPBP metric, which simultaneously considers the explicit retrieval performance and bit property. Through the alternately optimization of the two steps, the framework is instantiated as a new variable-length binary hashing method, which can significantly improve the retrieval accuracy of the existing variable-length hashing method. In addition, the framework can be instantiated as a general variable-length extension tool, which adopts the optimization objective of the existing hashing method as the optimization metric, and alternately iterates the two steps to optimize the optimization metric, converts the existing hashing method into the corresponding variable-length hashing method, and reduces the training time and storage consumption while not causing significant retrieval performance loss.

[0055]

[0056] A bit pool generation

[0057] The deep convolutional neural network is used as the deep hashing network to generate a relatively long binary code for each input image. Specifically, the embodiment removes the classification layer of the existing deep convolutional neural network, and adds a linear layer as a hashing layer, which includes L output units. Then, a hyperbolic tangent activation layer is attached to constrain the deep convolutional neural network output in the numerical range of [-1, 1]. For each input image I, the deep hashing network directly outputs an L-dimensional vector which is then directly binarized into a binary code b ∈ {-1, 1} L For the training set The deep hashing network outputs the binary code of each image, and then forms a large bit pool N is the number of images in the image training set. To further constrain the semantic distinguishability of the bit pool, a classification layer W c is attached after the hashing layer of the deep hashing network, and a classification loss L C (W) is constructed.

[0058] B adaptive bit selection

[0059] In step two, the embodiment models the bit selection problem as a Markov decision process, and then solves it through a reinforcement learning algorithm. In particular, the embodiment uses the bit pool generated in step one as the environment, learns an agent through interaction with the environment, and realizes the hashing bit selection. The environment state s t at time t is defined as the current selected bit indicator, that is, s t ​∈ {0,1} L if the kth bit is selected as the final binary code, s t,k = 1, otherwise s t,k = 0, s t,k is the indicator of the kth bit at time t.

[0060] As Fig. 2 shown, the bit selection agent constructed in this embodiment contains two networks, which are policy network and value network respectively. The policy network Θ takes the environment state s t as input, and outputs the probability of different actions, i.e. π(a t = a | s t , Θ) = Θ(s t ). The action a t = a represents the a-th bit is selected at time t. Further, the environment state s t+1,a = 1 is set when the a-th bit is selected at time t+1. The value network Φ takes the state s t as input, and outputs the state value estimate v = Φ(s t ). Both networks contain two linear layers, and a ReLU activation layer is attached after each linear layer. In the policy network, a linear layer and a softmax layer are still attached after the network, which outputs the action probability. In the value network, a linear layer is attached after the network, which maps the state representation to a real number state value estimate.

[0061] In each sequence bit selection (action) process, once the preset bit length is reached, the agent can obtain the environment reward. In other words, the t reward r t (Θ) obtained by the agent at time t is calculated by accumulating the discounted reward, r t+l is the environment reward at the t+1 time, and r t+l is non-zero when the user specifies a variable-length bit length setting set (e.g. when the variable-length bit length setting set is set to t+1 = {12, 24, 32, 48}, r 12 , r 24 , r 32 , r 48 are non-zero), otherwise r t+l = 0, t and l are time. Specifically, the specific form of the reward can be calculated by two optimization metrics, and different optimization metric methods realize different instantiations of the variable-length adaptive deep hash bit selection framework proposed in this embodiment. By optimizing the rewards of different bit lengths at the same time, the hash bit selection framework of this embodiment becomes a variable-length hash method, which can output binary codes of different bit lengths at the same time.

[0062] An alternating two-step optimization algorithm is proposed to optimize the adaptive bit selection framework. First, a deep hashing network is trained to generate a large bit pool by minimizing the classification loss and optimizing the proposed optimization metric. Then, based on the generated bit pool, a bit selection agent is learned by interacting with the environment using the same optimization metric as the environment reward. Next, the agent outputs the final state vector representing the selected bit positions, and the corresponding selected bits can be further optimized in the deep hashing network. These two steps are iterated alternately until convergence. The total optimization objective of the retrieval model is:

[0063] minL(W,{Θ,Φ})=minL C (W)+M(W,{Θ,Φ}); (1)

[0064] where W represents the deep hashing network parameters in step one, L C (.) is the classification loss, M(.) is the optimization metric, {Θ,Φ} represents the policy network Θ and value network Φ parameters of the bit selection agent in step two, and L(W,{Θ,Φ}) is the loss of the network parameters W,{Θ,Φ} to be learned.

[0065] b1) Optimization metric

[0066] The optimization metric M(·) in the adaptive hashing bit selection framework proposed in this embodiment has two different forms, corresponding to two different instantiation methods of the proposed framework. The first form of the optimization metric considers both retrieval performance and bit properties, and is named the RPBP metric. The second form of the optimization metric directly uses the loss function of existing hashing methods as the optimization metric. This embodiment is instantiated as a general conversion tool that can convert existing hashing methods into corresponding variable-length hashing methods.

[0067] In the first form of the optimization metric, the retrieval performance is measured by the average precision mean metric, which considers both precision and recall. The bit properties include binary quantization loss and bit independence loss, which ensure the compactness and information amount of the binary code. Therefore, the proposed RPBP metric can be defined as:

[0068] M rpbp (W,{Θ,Φ})=-L map (B)+αL q (B)+βL d (B); (2)

[0069] where L map (.) is the average precision mean metric loss, L q (.) and L d(.) respectively denote the binary quantization loss and the independence measure loss, and a, b respectively denote the corresponding hyperparameters, B denotes the bit pool, q, d are only an identifier to distinguish the two loss functions; wherein, X=[x1,x2,…,x N ]and B=[b1,b2,…,b N ]respectively denote the continuous features and binary codes of the image training set, x N is the L-dimensional vector output by the deep hashing network for the Nth image, b N is the binary code corresponding to the Nth image, ‖·‖ F is the norm calculation, and F denotes the adoption of the Frobenius norm.

[0070] In order to accelerate the calculation of the average precision mean measure L map (·), a subset of the image training set can be randomly sampled as a retrieval database during the training process, that is:

[0071]

[0072] wherein, B s denotes the subset of the selected image training data set as the retrieval database. denotes the average precision obtained by taking b i as the query to retrieve the database B s , P i,j denotes the precision of the jth returned position, rel i,j ∈{0,1} denotes the true relevance between the jth returned image and the query image, N r is the total number of images related to the query image in the retrieval database of the selected image training set, and N s is the total number of images in the retrieval database.

[0073] Taking the RPBP measure as the optimization measure, the adaptive bit selection framework proposed in the embodiment becomes a variable-length hashing method, which realizes better compact representation and online retrieval performance by directly optimizing the RPBP measure.

[0074] In the second optimization measure, the framework proposed in the embodiment directly uses the loss function of the existing hashing method as the optimization measure, and converts the existing hashing method into a corresponding variable-length hashing method. Therefore, under the definition of the second optimization measure, the framework proposed in the embodiment is instantiated as a general variable-length conversion tool.

[0075] b2) In the bit pool generation process optimization of step one, the bit selection agent is fixed, and the total optimization target of formula (1) is represented as follows:

[0076] minL(W)=minLc (W) + M(W); (4)

[0077] When the existing hash method objective function is used as the optimization metric M(·), equation (4) can update the retrieval model by backpropagation. When the optimization metric M(·) uses the RPBP metric M rpbp (·), the loss function gradient in equation (4) except L map (·) can be directly calculated, and then the network is updated by backpropagation. As for the discontinuous L map (·) metric, a policy gradient algorithm can be used for optimization.

[0078] L map (B) When the policy gradient algorithm is used for optimization, the policy gradient algorithm is as follows:

[0079] The hash layer output vector x i of the deep hash network is converted into the probability of outputting a bit "1"

[0080]

[0081] The binarization process is regarded as an action u i , and the probability distribution of outputting a bit "1" is P W , and u i is the action of the kth bit in the ith vector x i :

[0082]

[0083] According to the probability, R times of Monte Carlo sampling is performed, and the policy gradient is calculated as follows:

[0084]

[0085] where u i,k is the action of the kth bit in the ith vector x i , and u i is the action of the ith vector x in the rth Monte Carlo sampling, and r takes a value from 1 to R.

[0086] The logarithmic probability is calculated by the binary cross entropy of the Bernoulli distribution. Then the policy gradient is combined with other loss function gradients in equation (4) to update the deep hash network by backpropagation. After the adaptive bit selection step is optimized, the optimization metric M(·) is further optimized on the selected bits.

[0087] b3) In the adaptive bit selection optimization of step two, the deep hash network is fixed, and the total optimization objective is represented as follows:

[0088] minL({Θ,Φ}) = max-M({Θ,Φ}); (7)

[0089] where L(W) is the loss of W; L({Θ,Φ}) is the loss of {Θ,Φ}, max is the inverse operation of min, representing the maximum of -M({Θ,Φ}), i.e. for calculating the maximum reward.

[0090] The objective function of formula (7) only contains the optimization metric, which is also used as the reward of the Markov decision process. When the RPBP metric is adopted, maximizing the reward -M(·) is equivalent to maximizing the average precision mean and minimizing the quantization error and independence constraint. When the loss function of the existing hash method is adopted as the optimization metric, maximizing the reward -M(·) is equivalent to minimizing the objective loss function of the existing hash method. By constantly interacting with the environment, the obtained state, action and reward are put into the training data buffer, and then the approximate policy optimization algorithm is used to iteratively train the policy network and the value network.

[0091] Online retrieval process after the C retrieval model training is completed

[0092] After the training is completed, the bit selection agent is used to generate the final state vector, which represents the selected bit position. As shown in the following formula: Fig. 1 As shown in the part in the dashed box, for each database image, the deep hash network is used to generate its binary code, but only the bits selected by the bit selection agent are stored in the image database. In particular, the binary code with the longest bit length is stored to support variable-length online retrieval. For different online retrieval scenarios, the user selects the required bit length, and the deep hash network is used to generate the binary code of the query image. Then, the Hamming distance between the binary code of the query image and the binary code of the database image is calculated, and the database images are returned in order of distance from small to large as the retrieval results.

[0093] Through the above A to C, the embodiment proposes a variable-length deep hash framework, which realizes variable-length hash coding through adaptive bit selection. The framework includes two alternately iterative steps, namely bit pool generation and adaptive bit selection. The two steps are trained using the same optimization metric. Through different optimization metric methods, the proposed framework can be instantiated in two different ways. In the first instantiation, a novel RPBP metric is defined, which takes into account the retrieval performance and bit properties, so that the proposed framework is instantiated as a novel variable-length hash method. Since the retrieval performance and bit properties are directly optimized, the online retrieval performance is significantly improved, and the method has the advantages of variable-length hash methods, i.e. a model can be trained to adapt to various user computing resource application scenarios, output binary codes of different lengths to compactly represent images, and significantly reduce storage and training time.

[0094] In the second instantiation method, the proposed framework directly adopts the objective function of the existing hash method as the optimization metric, and the existing hash method can be converted into the corresponding variable-length hash method. Therefore, in this instantiation, the proposed framework becomes a general variable-length converter that converts the existing hash method into the corresponding variable-length hash method, and because the bit pool generation and the bit selection agent learning are alternately performed, this instantiation method can reduce the training time and storage overhead of the existing hash method, maintain the retrieval performance of the original hash method, and greatly improve the scene adaptability and training efficiency of the existing hash method.

[0095] The above merely provides the preferred embodiments of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art, according to the technical solution and the inventive concept of the present application, can make equivalent replacements or changes within the technical range disclosed by the present application, which should be covered within the protection scope of the present application.

Claims

1. A method of adaptive bit selection for deep variable length hash retrieval, comprising: The image is input into the trained retrieval model to generate a query image binary code, the Hamming distance between the query image binary code and the image binary code in the image database is calculated, and the database images are returned as retrieval results in order of distance from small to large; The training process of the retrieval model is as follows: Step one, bit pool generation: each image in the constructed image training set is input into the deep hash network in turn to output the binary code corresponding to each image, and the deep hash network is trained by optimizing the metric, thereby generating a bit pool composed of all binary codes; Step two, adaptive bit selection: input the bit pool into the bit selection agent for bit selection, and use the same optimization metric as in step one as the environment reward, when the preset bit length is reached, the bit selection agent obtains the environment reward, and the environment reward, environment state and action are used as training data to train the bit selection agent, the bit selection state is updated based on the interaction between the bit selection agent and the environment, and the selected bits are fed back to the bit pool to obtain the selected bits, and the deep hash network in step one is further trained based on the selected bits; Step three, alternately iterate step one and step two until the retrieval model converges, after training, use the bit selection agent as the bit selector set after the deep hash network to select the binary code output by the deep hash network for storage in the image database. 2.The method of claim 1, wherein, The deep hashing network is based on a deep convolutional neural network, removes a classification layer of the deep convolutional neural network, and sequentially adds a linear layer as a hashing layer, adds a hyperbolic tangent activation layer and a classification layer in parallel after the hashing layer, and the hashing layer outputs a vector , the hyperbolic tangent activation layer outputs a binary code . 3.The method of claim 1, wherein, Time environmental conditions Defined as the representation of the currently selected bit, i.e. If the first One bit is selected to be used as the final binary code. ,otherwise , For a moment The A bit-based representation; The bit selection agent includes a policy network and a value network, and both the policy network and the value network include two linear layers, each of which is followed by a ReLU activation layer; In the policy network, a linear layer and a softmax layer are sequentially arranged after the ReLU activation layer to output action probability; In the value network, a linear layer is arranged after the ReLU activation layer to map the state representation to a real number state value estimate.

4. The adaptive bit selection depth variable length hash retrieval method of claim 2, wherein, There are two forms of optimization metrics, the first form is to consider the retrieval performance and bit properties comprehensively, defined as RPBP metric, and the second form is to directly use the loss function of existing hash method as the optimization metric; In a first form, the RPBP metric is defined as follows: wherein, is the average precision mean metric loss, and denote the binary quantization loss and the independence metric loss, respectively, denote the corresponding hyperparameters, denotes the bit pool, denotes the policy network of the bit selection agent in step two and the value network parameters, are the network parameters to be learned.

5. The adaptive bit selection depth variable length hash retrieval method of claim 4, wherein, The total optimization target of the retrieval model is: wherein, denotes the parameters of the deep hashing network in step one, is the classification loss, is the optimization metric, is the loss of the network parameters to be learned.

6. The adaptive bit selection depth variable length hash retrieval method of claim 5, wherein, In the bit pool generation process of step one, the bit selection agent is fixed, and the total optimization target is represented as follows: ; In the adaptive bit selection optimization of step two, the deep hash network is fixed, and the total optimization target is represented as follows: ; wherein, is loss; is loss, is the inverse operation, denoting the maximum over to compute the maximized reward.

7. The adaptive bit selection depth variable length hash retrieval method of claim 6, wherein, In the bit pool generation process optimization of step one, the optimization metric Adopting the RPBP metric Time, The loss function gradient of the retrieval model is directly calculated, and the retrieval model is updated by back propagation; The policy gradient algorithm is used for optimization, which is specifically as follows: For the first For the first The probability of converting the output vector of the hash layer of the deep hash network , ; Consider the binarization process as an action The probability distribution of output bits "1" is then , is the action of the first vector ​ ; According to the probabilities Sub Monte Carlo sampling, policy gradient Is calculated as follows: ; wherein, is the th vector of actions, is the th vector of actions, is the th action in the th Monte Carlo sample, takes the value 1.

8. The adaptive bit selection depth variable length hash retrieval method of claim 3, wherein, In step two, when the preset bit length is reached, the bit selection agent obtains the environment reward, which is specifically: the reward obtained by the agent at time step is computed by summing the discounted rewards, , is the environment reward for the time step, for non-zero values, otherwise, , is the policy network, and is the time step.

9. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to realize the retrieval method of any one of claims 1-8.

10. A computer readable storage medium, characterized in that, The computer readable storage medium stores a plurality of classification programs, and the plurality of classification programs are used to be called and executed by the processor to realize the retrieval method of any one of claims 1-8.

Citation Information

Patent Citations

  • Image retrieval method based on deep learning and hash coding

    CN107330074A

  • Image retrieval method based on weighted deep convolutional hash

    CN117828117A