Patent Publication Number: US-2023138302-A1

Title: Multiple scenario-oriented item retrieval method and system

Description:
CROSS REFERENCE TO RELATED APPLICATION 
     This patent application claims the benefit and priority of Chinese Patent Application No. 202111286401.4, filed on Nov. 2, 2021, the disclosure of which is incorporated by reference herein in its entirety as part of the present application. 
     TECHNICAL FIELD 
     The present disclosure relates to the technical field of image processing, in particular to a multiple scenario-oriented item retrieval method and system. 
     BACKGROUND ART 
     Item retrieval is an important research topic in the field of computer vision, which is intended to process, analyze and understand images captured by the camera using a computer or a robot, so as to identify targets and items in different modes. 
     Multiple scenarios include scenarios of easily-confused samples, scenarios of multi-label samples, and scenarios of zero samples. For example, in a scenario of multi-label samples, an image has multiple category labels, at this time, the criterion for judging whether the image and another image are of the same category is that the two images have at least one identical category. In a scenario of zero samples, the categories in a test set and those in a training set are mutually exclusive, for example, there are four categories in the training set, such as dogs, mice, horses and sheep, while other categories such as cats and snakes in the test set. In this case, it is necessary to train a model to learn general classification knowledge, so that the model can judge an item does not fall within some known categories even if it has never seen the item before. Such scenarios where the model finds it difficult to learn samples are called scenarios of hard samples. 
     Nowadays, it is already feasible to collect images in a real-environment using a robot, and obtain a classifier via training. For simple images, it is easy to acquire an appropriate feature representation to distinguish them from samples with different semantics, while in a scenario of hard samples, such as a scenario of easily-confused samples, or a scenario of multi-label samples, obtaining an appropriate feature representation often requires more attention, given the hard-to-learn images contained. In a scenario of hard samples, the similarity relationship between images is hard to acquire. Moreover, the performance of the model is highly dependent on the similarity relationship among images, while existing item retrieval methods use predefined similarity relationship, without accurately reflecting the real similarity relationship between images, resulting in poor retrieval performance. 
     In addition, for a scenario of zero samples, since it is impossible to acquire all kinds of images in the world as training sets, there are inevitably items of categories that do not exist in the training set in practical application. In this situation, it is required to find semantic embedding space to transfer the knowledge learned in the training process from the visible category to the invisible category. However, popular item retrieval methods may excessively learn the knowledge of the visible category, which leads to relatively poor generalization performance of the item retrieval method in the scenario of zero samples. 
     To sum up, item retrieval methods have at least the following technical problems. 
     First, most of the existing item retrieval methods are based on learning of a data similarity matrix which is predefined by supervised labels or distance measurement types. This predefined similarity matrix, however, fails to accurately reflect the real similarity relationship between images. In a scenario of hard samples, such as a scenario of easily-confused samples, or a scenario of multi-label samples, items under retrieval cover a large number of easily-confused entities, which generally have similar feature representations. Therefore, it is necessary to mine the true similarity relationship between images more accurately to guide the generation of image features. Existing item retrieval methods have considered neither the scenario of hard samples nor the similarity relationship of images. 
     Second, in the scenario of zero samples, existing item retrieval methods, when adopted to train a model, may introduce special labels, such as special monitoring information like semantic vectors or attribute labels; semantic vectors refer to the vectors converted from the image category names through natural language processing (NLP), and such supervisory information is not directly available; attribute labels are configured to indicate whether there are some predefined parts in an image, such as whether there are wings, or whether it is black. This kind of label information usually exists only in data sets of zero samples, and is difficult to obtain in a real environment. 
     Third, since a traditional similarity matrix can learn the relationship between visible data, when item search is conducted in the scenario of zero samples using the traditional similarity matrix, overfitting may occur on the relationship between the visible data, making it impossible to integrate invisible data knowledge. Therefore, the symmetric similarity matrix for item search in a traditional scenario is not suitable for item retrieval in a scenario of zero samples. 
     SUMMARY 
     To resolve the foregoing problem, the present disclosure provides a multiple scenario-oriented item retrieval method and system, thereby achieving item retrieval in multiple scenarios such as a scenario of hard samples, and a scenario of zero samples. In a scenario of hard samples, an adaptive similarity matrix is introduced to distinguish the easily-confused entities and obtain an accurate image similarity relationship; and in a scenario of zero samples, the asymmetric similarity matrix is introduced, and instead of special supervisory information, only the easily-accessible category label information is adopted. 
     To achieve the above objective, the present disclosure adopts the following technical solutions. 
     In a first aspect, the present disclosure provides a multiple scenario-oriented item retrieval method, including:
         extracting, by Hashing learning, image features from an obtained image training set, and training a pre-built item retrieval model;   when an image is in a scenario of hard samples, introducing an adaptively optimized similarity matrix into Hashing learning, optimizing the similarity matrix by an image transfer matrix, and constructing an adaptive similarity matrix objective function with the optimized similarity matrix and an image category label; constructing a quantization loss objective function between the image and a Hash code according to the image transfer matrix; and conducting nonlinear Hashing mapping on the adaptive similarity matrix objective function and the quantization loss objective function to obtain a model objective function;   when the image is in a scenario of zero samples, introducing into Hashing learning an asymmetric similarity matrix configured to constrain the generation of Hash codes, constructing an objective function by taking an image category label as supervisory information in combination with equilibrium and decorrelation constraints of a Hash code, and conducting nonlinear Hashing mapping on the objective function to obtain a model objective function; and   training the item retrieval model based on the model objective function, and obtaining a retrieved result of a to-be-retrieved target item image based on the trained item retrieval model.       

     As an alternative implementation, the adaptive similarity matrix objective function is as follows: 
     
       
         
           
             
               
                 min 
                 
                   W 
                   , 
                   S 
                 
               
               
                 
                   ∑ 
                   
                     i 
                     , 
                     j 
                   
                 
                 
                   ( 
                   
                     
                       
                         
                            
                           
                             
                               
                                 W 
                                 T 
                               
                               ⁢ 
                               
                                 x 
                                 i 
                               
                             
                             - 
                             
                               
                                 W 
                                 T 
                               
                               ⁢ 
                               
                                 x 
                                 j 
                               
                             
                           
                            
                         
                         2 
                         2 
                       
                       ⁢ 
                       
                         s 
                         ij 
                       
                     
                     + 
                     
                       α 
                       ⁢ 
                       
                         s 
                         ij 
                         2 
                       
                     
                   
                   ) 
                 
               
             
             + 
             
               β 
               ⁢ 
               
                 
                   ∑ 
                   
                     i 
                     , 
                     j 
                   
                 
                 
                   
                     
                        
                       
                         
                           y 
                           i 
                         
                         - 
                         
                           y 
                           j 
                         
                       
                        
                     
                     2 
                     2 
                   
                   ⁢ 
                   
                     s 
                     ij 
                   
                 
               
             
           
         
       
       
         
           
             
               s 
               . 
               t 
               . 
                   
               
                 ∀ 
                 i 
               
             
             , 
             
               
                 
                   s 
                   i 
                   T 
                 
                 ⁢ 
                 
                   1 
                   n 
                 
               
               = 
               1 
             
             , 
             
               0 
               ≤ 
               
                 s 
                 ij 
               
               ≤ 
               1 
             
           
         
       
     
     where 1 n  denotes an all-ones vector of n×1, and n denotes a sample size; s ij  denotes an element of a similarity matrix S, with a value being a similarity weight of image x i  and image x j , and s i  denotes an ith row vector of the matrix S; W denotes a transfer matrix; y i  and y i  denote category labels; and α and β denote positive parameters. 
     As an alternative implementation, the quantization loss objective function is as follows: 
     
       
         
           
             
               
                 min 
                 
                   W 
                   , 
                   B 
                 
               
               λ 
               ⁢ 
               
                 
                    
                   
                     
                       
                         W 
                         T 
                       
                       ⁢ 
                       X 
                     
                     - 
                     B 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               γ 
               ⁢ 
               
                 
                    
                   P 
                    
                 
                 F 
                 2 
               
             
           
         
       
       
         
           
             
               s 
               . 
               t 
               . 
                   
               B 
             
             ∈ 
             
               
                 { 
                 
                   
                     - 
                     1 
                   
                   , 
                   
                     + 
                     1 
                   
                 
                 } 
               
               
                 k 
                 × 
                 n 
               
             
           
         
       
     
     where W denotes a transfer matrix between an image and a Hash code, P denotes a transfer matrix between an image and nonlinear Hashing, X denotes an image training set, B denotes a Hash code, λ and γ denote positive parameters, k denotes a length of a Hash code, n denotes a sample size, and ∥⋅∥ F  denotes an f norm. 
     As an alternative implementation, said nonlinear Hashing mapping includes expanding the objective function into nonlinear Hashing through a kernel function, which is expressed as: 
       φ( X )=[φ( x   1 ),φ( x   2 ), . . . ,φ( x   n )] T ,
 
     where φ:xϵR d →φ(x)ϵR d′  denotes nonlinear mapping, d denotes a feature dimension of image x n , d′ denotes a dimension after mapping, X denotes an image training set, and n denotes a sample size. 
     As an alternative implementation, the model objective function in the scenario of hard samples is as follows: 
     
       
         
           
             
               
                 min 
                 
                   P 
                   , 
                   S 
                   , 
                   B 
                 
               
               
                 
                   ∑ 
                   
                     i 
                     , 
                     j 
                   
                 
                 
                   ( 
                   
                     
                       
                         
                            
                           
                             
                               
                                 P 
                                 T 
                               
                               ⁢ 
                               
                                 φ 
                                 ⁡ 
                                 ( 
                                 
                                   x 
                                   i 
                                 
                                 ) 
                               
                             
                             - 
                             
                               
                                 P 
                                 T 
                               
                               ⁢ 
                               
                                 φ 
                                 ⁡ 
                                 ( 
                                 
                                   x 
                                   j 
                                 
                                 ) 
                               
                             
                           
                            
                         
                         2 
                         2 
                       
                       ⁢ 
                       
                         s 
                         ij 
                       
                     
                     + 
                     
                       α 
                       ⁢ 
                       
                         s 
                         ij 
                         2 
                       
                     
                   
                   ) 
                 
               
             
             + 
             
               β 
               ⁢ 
               
                 
                   ∑ 
                   
                     i 
                     , 
                     j 
                   
                 
                 
                   
                     
                        
                       
                         
                           y 
                           i 
                         
                         - 
                         
                           y 
                           j 
                         
                       
                        
                     
                     2 
                     2 
                   
                   ⁢ 
                   
                     s 
                     ij 
                   
                 
               
             
             + 
             
               λ 
               ⁢ 
               
                 
                    
                   
                     
                       
                         P 
                         T 
                       
                       ⁢ 
                       
                         φ 
                         ⁡ 
                         ( 
                         X 
                         ) 
                       
                     
                     - 
                     B 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               γ 
               ⁢ 
               
                 
                    
                   P 
                    
                 
                 F 
                 2 
               
             
           
         
       
       
         
           
             	 
             
               
                 s 
                 . 
                 t 
                 . 
                     
                 
                   ∀ 
                   i 
                 
               
               , 
               
                 
                   
                     s 
                     i 
                     T 
                   
                   ⁢ 
                   
                     1 
                     n 
                   
                 
                 = 
                 1 
               
               , 
               
                 0 
                 ≤ 
                 
                   s 
                   ij 
                 
                 ≤ 
                 1 
               
               , 
               
                 
                   B 
                   ∈ 
                   
                     
                       { 
                       
                         
                           - 
                           1 
                         
                         , 
                         
                           + 
                           1 
                         
                       
                       } 
                     
                     
                       k 
                       × 
                       n 
                     
                   
                 
                 ; 
               
             
           
         
       
     
     where n denotes a sample size, W denotes a transfer matrix between an image and a Hash code, and P denotes a transfer matrix between an image and nonlinear Hashing; X denotes an image training set, B denotes a Hash code, 1 n  denotes an all-ones vector of n×1, s ij  denotes an element of a similarity matrix S, with a value being a similarity weight of image x i  and image x j , and s i  denotes an ith row vector of the matrix S; φ( ) denotes nonlinear mapping; y i  and y i  denote category labels; and α, β, λ and γ denote positive parameters, and k denotes a length of a Hash code. 
     As an alternative implementation, the model objective function in the scenario of zero samples is as follows: 
     
       
         
           
             
               
                 min 
                 
                   B 
                   , 
                   P 
                   , 
                   W 
                   , 
                   Z 
                 
               
               
                 
                    
                   
                     
                       k 
                       · 
                       S 
                     
                     - 
                     
                       BZ 
                       T 
                     
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               λ 
               ⁢ 
               
                 
                    
                   
                     
                       
                         φ 
                         ⁡ 
                         ( 
                         X 
                         ) 
                       
                       ⁢ 
                       P 
                     
                     - 
                     B 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               α 
               ⁢ 
               
                 
                    
                   
                     B 
                     - 
                     Z 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               β 
               ⁢ 
               
                 
                    
                   P 
                    
                 
                 F 
                 2 
               
             
             + 
             
               γ 
               ⁢ 
               
                 
                    
                   
                     YW 
                     - 
                     B 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               μ 
               ⁢ 
               
                 
                    
                   W 
                    
                 
                 F 
                 2 
               
             
           
         
       
       
         
           
             	 
             
               
                 
                   s 
                   . 
                   t 
                   . 
                       
                   B 
                 
                 ∈ 
                 
                   
                     { 
                     
                       
                         - 
                         1 
                       
                       , 
                       
                         + 
                         1 
                       
                     
                     } 
                   
                   
                     n 
                     × 
                     k 
                   
                 
               
               , 
               
                 
                   
                     Z 
                     T 
                   
                   ⁢ 
                   
                     1 
                     n 
                   
                 
                 = 
                 
                   0 
                   k 
                 
               
               , 
               
                 
                   
                     Z 
                     T 
                   
                   ⁢ 
                   Z 
                 
                 = 
                 
                   n 
                   · 
                   
                     E 
                     k 
                   
                 
               
             
           
         
       
     
     where n denotes a sample size, k denotes a length of a Hash code, S denotes a similarity matrix, B denotes a Hash code, Z denotes an auxiliary variable, α, β, λ and γ denote positive parameters, W denotes a transfer matrix between an image and a Hash code, and P denotes a transfer matrix between an image and nonlinear Hashing; and Y denotes an image category label, E k  denotes a unit matrix, ∥⋅∥ F  denotes an f norm, φ( ) denotes nonlinear mapping, and X denotes an image training set. 
     As an alternative implementation, equilibrium and decorrelation constraints of a Hash code include:
         the equilibrium constraint indicates that the number of Hash codes with a value of +1 is equal to the number of Hash codes with a value of −1, which is expressed as:       

         B   T 1 n =0 k            the decorrelation constraint indicates that Hash codes of various bits are uncorrelated, which is expressed as:       
     
       
      
       B 
       T 
       B=n·E 
       k  
      
         
         
           
             where n denotes a sample size, k denotes a length of a Hash code, B denotes a Hash code, and E k  denotes a unit matrix; and 
             the asymmetric similarity matrix denotes that a similarity weight produced when image pairs are similar is not equal to a similarity weight produced when image pairs are dissimilar. 
           
         
       
    
     As an alternative implementation, after the model objective function is obtained, the method further includes optimizing the model objective function by updating an individual optimization variable while keeping other optimization variables constant, that is, alternating minimization solving and iterating until convergence. 
     As an alternative implementation, when an image is in the scenario of zero samples, Hash codes of the model objective function are optimized by adopting equilibrium strategies of standard normalization, average normalization and max-min normalization. 
     In a second aspect, the present disclosure provides a multiple scenario-oriented item retrieval system, including:
         an image preprocessing module configured to extract, by Hashing learning, image features from an obtained image training set, and train a pre-built item retrieval model;   a first scenario-based training module configured to, when an image is in a scenario of hard samples, introduce an adaptively optimized similarity matrix into Hashing learning, optimize the similarity matrix by an image transfer matrix, and construct an adaptive similarity matrix objective function with the optimized similarity matrix and an image category label; construct a quantization loss objective function between the image and a Hash code according to the image transfer matrix; and conduct nonlinear Hashing mapping on the adaptive similarity matrix objective function and the quantization loss objective function to obtain a model objective function;   a second scenario-based training module configured to, when the image is in a scenario of zero samples, introduce into Hashing learning an asymmetric similarity matrix configured to constrain the generation of Hash codes, construct an objective function by taking an image category label as supervisory information in combination with equilibrium and decorrelation constraints of a Hash code, and conduct nonlinear Hashing mapping on the objective function to obtain a model objective function; and   a retrieval module configured to train the item retrieval model based on the model objective function, and obtain a retrieved result of a to-be-retrieved target item image based on the trained item retrieval model.       

     Compared with the prior art, the present disclosure has the following beneficial effects. 
     The multiple scenario-oriented item retrieval method and system achieve item retrieval in multiple scenarios such as a scenario of hard samples, and a scenario of zero samples. By adoption of artificial intelligence technology, the item retrieval of image samples in multiple scenarios collected by the robot vision platform is realized. 
     According to the multiple scenario-oriented item retrieval method and system, in a scenario of hard samples, image features are extracted by Hashing learning based on a convolutional neural network (CNN), and an adaptive similarity matrix is introduced. In this way, a predefined fixed similarity matrix is avoided, easily-confused entities are distinguished, and a more accurate image similarity relationship is obtained, so as to better resolve the problem of item retrieval in the scenario of hard samples. 
     According to the multiple scenario-oriented item retrieval method and system, in a scenario of zero samples, image features are extracted by Hashing learning based on a convolutional neural network (CNN). Besides, instead of special supervisory information, only the easily-accessible category label information is adopted; and the asymmetric similarity matrix is introduced to better resolve the problem of item retrieval in the scenario of zero samples. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       The accompanying drawings which constitute a part of the description of the present disclosure are intended to provide further understanding of the present disclosure. The exemplary examples of the present disclosure and descriptions thereof are intended to explain the present disclosure and do not constitute an inappropriate limitation to the present disclosure. In the drawings: 
         FIG.  1    is a flowchart of a multiple scenario-oriented item retrieval method according to Embodiment 1 of the present disclosure; 
         FIG.  2    is a diagram illustrating results of verification on item retrieval in a scenario of hard samples according to Embodiment 1 of the present disclosure; 
         FIG.  3    is a diagram illustrating results of verification I on item retrieval in a scenario of zero samples according to Embodiment 1 of the present disclosure; 
         FIG.  4    is a diagram illustrating results of verification II on item retrieval in a scenario of zero samples according to Embodiment 1 of the present disclosure; and 
         FIG.  5    is a diagram illustrating results of experimental verification on a linear Hashing method for using an equilibrium strategy in an AWA2 dataset according to Embodiment 1 of the present disclosure. 
     
    
    
     DETAILED DESCRIPTION OF THE EMBODIMENTS 
     The present disclosure will be described in more detail with reference to the accompanying drawings and embodiments. 
     It should be pointed out that the following detailed description is illustrative and is intended to provide further explanation of the present disclosure. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those generally understood by those of ordinary skill in the art to which the present disclosure pertains. 
     It should be noted that the terms used herein are merely used for describing the specific implementations, but are not intended to limit exemplary implementations of the present disclosure. As used herein, unless the context clearly indicates otherwise, the singular forms are intended to include the plural forms as well. Moreover, it should be understood that the terms “include”, “have” and any other variants mean to cover a non-exclusive inclusion, for example, a process, method, system, product, or device that includes a list of steps or units is not necessarily limited to those expressly listed steps or units, but may include other steps or units not expressly listed or inherent to such a process, method, system, product, or device. 
     In addition, the embodiments in the present disclosure and the features in the embodiments can be combined with each other in a non-conflicting situation. 
     Embodiment 1 
     As shown in  FIG.  1   , this embodiment provides a multiple scenario-oriented item retrieval method, including:
         S 1 : extracting, by Hashing learning, image features from an obtained image training set, and training a pre-built item retrieval model;   S 2 : when an image is in a scenario of hard samples, introducing an adaptively optimized similarity matrix into Hashing learning, optimizing the similarity matrix by an image transfer matrix, and constructing an adaptive similarity matrix objective function with the optimized similarity matrix and an image category label; constructing a quantization loss objective function between the image and a Hash code according to the image transfer matrix; and conducting nonlinear Hashing mapping on the adaptive similarity matrix objective function and the quantization loss objective function to obtain a model objective function;   S 3 : when the image is in a scenario of zero samples, introducing into Hashing learning an asymmetric similarity matrix configured to constrain the generation of Hash codes, constructing an objective function by taking an image category label as supervisory information in combination with equilibrium and decorrelation constraints of a Hash code, and conducting nonlinear Hashing mapping on the objective function to obtain a model objective function; and   S 4 : training the item retrieval model based on the model objective function, and obtaining a retrieved result of a to-be-retrieved target item image based on the trained item retrieval model.       

     According to this embodiment, image data are derived from the images of items collected by the robot vision platform in the real world, such as images of digital equipment, deep-sea fish, land wildlife, landmark buildings, etc.; then the images are preprocessed, including background removal with weak supervision, random erasure, standardization, and random rotation. Conventional preprocessing methods may be adopted as the preprocessing technology in this embodiment, which is not limited herein. 
     According to this embodiment, an item retrieval model is constructed based on a convolutional neural network to conduct feature extraction on preprocessed images. Image feature x i ϵR d  is obtained from image I i  using a convolutional neural network, where d denotes a dimension of the image feature x i . 
     The backbone network used in this embodiment is CNN-F, a relatively mature multi-tasking learning framework is used as the basic model, and the CNN-F convolutional neural network is used as the feature extractor. 
     In step S 2 , when an image is in a scenario of hard samples, artificial intelligence technology is adopted to process image samples in the complex scenario collected by the robot vision platform. Based on the convolutional neural network, image features are extracted using the Hashing method, and the adaptive similarity matrix is introduced to better deal with the item retrieval in the a scenario of hard samples. The objective loss function is designed using supervised Hashing learning, during which similarity matrix learning is introduced; and the objective function is expanded to nonlinear Hashing through a kernel function. 
     According to this embodiment, category label y i  of image I i  is used during training. The category label is a single hot spot label, which can be obtained directly in all supervised data sets, mainly indicating that an image belongs to a certain category; and 
     secondly, a Hash code of image I i  is defined as b i  by using Hashing method; and an image training set used in training is expressed as: 
         X={x   i } i=1   n   ϵR   d×n    
     a label of the image training set is expressed as: 
         Y={y   i } i=1   n ϵ{0,1} c×n  
 
     the Hash code is expressed as: 
         B={b   i } i=1   n ϵ{+1,−1} k×n  
 
     where d denotes a dimension of an image feature x i , c denotes a number of image categories, k denotes a length of a Hash code, and n denotes a sample size, namely a number of Hash codes; 
     a similarity matrix is defined as: 
         S={s   ij } i,j=1   n    
     where s ij  denotes a similarity weight of image x i  and image x j . 
     Different from the existing item retrieval method in which a similarity matrix with fixed values is predetermined, this embodiment achieves optimization on an adaptive similarity matrix in the process of Hashing learning, such that the adaptive similarity matrix can describe different similarities of samples, which is beneficial to Hashing learning and maintaining the consistency of the image data. Accordingly, in this embodiment, the similarity matrix is optimized by using the data consistency between different samples, and the adaptive similarity matrix is constrained as follows: 
     
       
         
           
             
               min 
               
                 W 
                 , 
                 S 
               
             
             
               
                 ∑ 
                 
                   i 
                   , 
                   j 
                 
               
               
                 
                   
                      
                     
                       
                         
                           W 
                           T 
                         
                         ⁢ 
                         
                           x 
                           i 
                         
                       
                       - 
                       
                         
                           W 
                           T 
                         
                         ⁢ 
                         
                           x 
                           j 
                         
                       
                     
                      
                   
                   2 
                   2 
                 
                 ⁢ 
                 
                   s 
                   ij 
                 
               
             
           
         
       
       
         
           
             
               s 
               . 
               t 
               . 
                   
               
                 ∀ 
                 i 
               
             
             , 
             
               
                 
                   s 
                   i 
                   T 
                 
                 ⁢ 
                 
                   1 
                   n 
                 
               
               = 
               1 
             
             , 
             
               0 
               ≤ 
               
                 s 
                 ij 
               
               ≤ 
               1 
             
             , 
           
         
       
     
     where 1 n  denotes an all-ones vector of n×1, s ij  denotes an element of a similarity matrix S, with a value being a similarity weight of image x i  and image x j , s i ϵ R     n×1    denotes an ith row vector of the matrix S, and WϵR d×k  denotes a transfer matrix. 
     Based on the above constraint condition, the similarity of two data points with larger differences can be reduced, and the similarity of two data points with smaller differences can be increased. ∀i, s i   T 1 n =1, 0≤s ij ≤1 is set to prevent s ij  from being equal to 0. 
     The adaptive similarity matrix in the above formula is different from a predefined similarity matrix. The similarity matrix is optimized in the process of Hashing learning, so that the obtained adaptive similarity matrix can better reflect the real similarity relationship than the predefined similarity matrix. However, there is a trivial solution to the above problem, that is, for x i , only the most similar data points have a similarity of 1, while the rest have a similarity of 0. In order to avoid the above trivial solution, a case in which no similar information is involved in data is included in this embodiment to resolve the problem: 
     
       
         
           
             
               min 
               
                 W 
                 , 
                 S 
               
             
             
               
                 ∑ 
                 
                   i 
                   , 
                   j 
                 
               
               
                 ( 
                 
                   
                     
                       
                          
                         
                           
                             
                               W 
                               T 
                             
                             ⁢ 
                             
                               x 
                               i 
                             
                           
                           - 
                           
                             
                               W 
                               T 
                             
                             ⁢ 
                             
                               x 
                               j 
                             
                           
                         
                          
                       
                       2 
                       2 
                     
                     ⁢ 
                     
                       s 
                       ij 
                     
                   
                   + 
                   
                     α 
                     ⁢ 
                     
                       s 
                       ij 
                       2 
                     
                   
                 
                 ) 
               
             
           
         
       
       
         
           
             
               s 
               . 
               t 
               . 
                   
               
                 ∀ 
                 i 
               
             
             , 
             
               
                 
                   s 
                   i 
                   T 
                 
                 ⁢ 
                 
                   1 
                   n 
                 
               
               = 
               1 
             
             , 
             
               0 
               ≤ 
               
                 s 
                 ij 
               
               ≤ 
               1 
             
             , 
           
         
       
     
     where α denotes a positive parameter. 
     In order to maintain the consistency between a feature space and a label space, and correctly extract label correlation from the label space, the following expression formula of the label information is added to the objective function: 
     
       
         
           
             
               
                 min 
                 
                   W 
                   , 
                   S 
                 
               
               
                 
                   ∑ 
                   
                     i 
                     , 
                     j 
                   
                 
                 
                   ( 
                   
                     
                       
                         
                            
                           
                             
                               
                                 W 
                                 T 
                               
                               ⁢ 
                               
                                 x 
                                 i 
                               
                             
                             - 
                             
                               
                                 W 
                                 T 
                               
                               ⁢ 
                               
                                 x 
                                 j 
                               
                             
                           
                            
                         
                         2 
                         2 
                       
                       ⁢ 
                       
                         s 
                         ij 
                       
                     
                     + 
                     
                       α 
                       ⁢ 
                       
                         s 
                         ij 
                         2 
                       
                     
                   
                   ) 
                 
               
             
             + 
             
               β 
               ⁢ 
               
                 
                   ∑ 
                   
                     i 
                     , 
                     j 
                   
                 
                 
                   
                     
                        
                       
                         
                           y 
                           i 
                         
                         - 
                         
                           y 
                           j 
                         
                       
                        
                     
                     2 
                     2 
                   
                   ⁢ 
                   
                     s 
                     ij 
                   
                 
               
             
           
         
       
       
         
           
             
               s 
               . 
               t 
               . 
                   
               
                 ∀ 
                 i 
               
             
             , 
             
               
                 
                   s 
                   i 
                   T 
                 
                 ⁢ 
                 
                   1 
                   n 
                 
               
               = 
               1 
             
             , 
             
               0 
               ≤ 
               
                 s 
                 ij 
               
               ≤ 
               1 
             
             , 
           
         
       
     
     where β denotes a positive parameter; and 
     
       
         
           
             
               ∑ 
               
                 i 
                 , 
                 j 
               
             
             
               
                 
                    
                   
                     
                       y 
                       i 
                     
                     - 
                     
                       y 
                       j 
                     
                   
                    
                 
                 2 
                 2 
               
               ⁢ 
               
                 s 
                 ij 
               
             
           
         
       
     
     is intended to maintain consistency between a feature space and a label space. However, a similarity matrix in Hashing method usually has a fixed value generated by a label, and therefore, this constraint condition is unnecessary. Moreover, a similarity matrix in this embodiment has adaptivity, which can be updated in same iterations; and therefore, supervised Hashing method is adopted in this embodiment. 
     In addition, regarding Hashing method, this embodiment establishes a relationship between original image data and a Hash code through a transfer matrix, which is sufficient to reduce the quantization loss between them; where the transfer matrix is configured to convert the original data into the Hash code. 
     To achieve these objectives, the following pattern is proposed: 
     
       
         
           
             
               min 
               
                 W 
                 , 
                 B 
               
             
             
               
                  
                 
                   
                     
                       W 
                       T 
                     
                     ⁢ 
                     X 
                   
                   - 
                   B 
                 
                  
               
               F 
               2 
             
           
         
       
       
         
           
             
               s 
               . 
               t 
               . 
                   
               B 
             
             ∈ 
             
               
                 
                   { 
                   
                     
                       - 
                       1 
                     
                     , 
                     
                       + 
                       1 
                     
                   
                   } 
                 
                 
                   k 
                   × 
                   n 
                 
               
               . 
             
           
         
       
     
     In previous study, a nonlinear Hashing function usually has a much better generalization performance than that of a common Hashing function, as the former can adapt to more complex patterns. Therefore, in this embodiment, the objective function is expanded to nonlinear Hashing through a kernel function: 
       ω( X )=[φ( x   1 ),φ( x   2 ), . . . ,φ( x   n )] T ,
 
     where φ:xϵR d →φ(x)ϵR d′  denotes nonlinear mapping, and d′ denotes a dimension after mapping. 
     Therefore, the above objective function can be expanded to: 
     
       
         
           
             
               min 
               
                 P 
                 , 
                 B 
               
             
             
               
                  
                 
                   
                     
                       P 
                       T 
                     
                     ⁢ 
                     
                       φ 
                       ⁡ 
                       ( 
                       X 
                       ) 
                     
                   
                   - 
                   B 
                 
                  
               
               F 
               2 
             
           
         
       
       
         
           
             
               
                 s 
                 . 
                 t 
                 . 
                     
                 B 
               
               ∈ 
               
                 
                   { 
                   
                     
                       - 
                       1 
                     
                     , 
                     
                       + 
                       1 
                     
                   
                   } 
                 
                 
                   k 
                   × 
                   n 
                 
               
             
             , 
           
         
       
     
     where PϵR d′×k  denotes a transfer matrix of nonlinear Hashing. 
     In order to avoid the maximum or minimum value in the transfer matrix and make the transfer matrix smoother, this embodiment adds regular terms and a parameter coordination loss function, which is expressed as follows: 
     
       
         
           
             
               
                 min 
                 
                   P 
                   , 
                   B 
                 
               
               λ 
               ⁢ 
               
                 
                    
                   
                     
                       
                         P 
                         T 
                       
                       ⁢ 
                       
                         φ 
                         ⁡ 
                         ( 
                         X 
                         ) 
                       
                     
                     - 
                     B 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               γ 
               ⁢ 
               
                 
                    
                   P 
                    
                 
                 F 
                 2 
               
             
           
         
       
       
         
           
             
               
                 s 
                 . 
                 t 
                 . 
                     
                 B 
               
               ∈ 
               
                 
                   { 
                   
                     
                       - 
                       1 
                     
                     , 
                     
                       + 
                       1 
                     
                   
                   } 
                 
                 
                   k 
                   × 
                   n 
                 
               
             
             , 
           
         
       
     
     where λ and γ denote positive parameters. 
     Similarly, the objective function using the adaptive similarity matrix is expanded to nonlinear Hashing, which is expressed as: 
     
       
         
           
             
               
                 min 
                 
                   P 
                   , 
                   S 
                 
               
               
                 
                   ∑ 
                   
                     i 
                     , 
                     j 
                   
                 
                 
                   ( 
                   
                     
                       
                         
                            
                           
                             
                               
                                 P 
                                 T 
                               
                               ⁢ 
                               
                                 φ 
                                 ⁡ 
                                 ( 
                                 
                                   x 
                                   i 
                                 
                                 ) 
                               
                             
                             - 
                             
                               
                                 P 
                                 T 
                               
                               ⁢ 
                               
                                 φ 
                                 ⁡ 
                                 ( 
                                 
                                   x 
                                   j 
                                 
                                 ) 
                               
                             
                           
                            
                         
                         2 
                         2 
                       
                       ⁢ 
                       
                         s 
                         ij 
                       
                     
                     + 
                     
                       α 
                       ⁢ 
                       
                         s 
                         ij 
                         2 
                       
                     
                   
                   ) 
                 
               
             
             + 
             
               β 
               ⁢ 
               
                 
                   ∑ 
                   
                     i 
                     , 
                     j 
                   
                 
                 
                   
                     
                        
                       
                         
                           y 
                           i 
                         
                         - 
                         
                           y 
                           j 
                         
                       
                        
                     
                     2 
                     2 
                   
                   ⁢ 
                   
                     s 
                     ij 
                   
                 
               
             
           
         
       
       
         
           
             
               s 
               . 
               t 
               . 
                   
               
                 ∀ 
                 i 
               
             
             , 
             
               
                 
                   s 
                   i 
                   T 
                 
                 ⁢ 
                 
                   1 
                   n 
                 
               
               = 
               1 
             
             , 
             
               0 
               ≤ 
               
                 s 
                 ij 
               
               ≤ 
               1 
             
             , 
           
         
       
     
     Finally, based on the above factors, the final objective loss function is expressed as follows: 
     
       
         
           
             
               
                 min 
                 
                   P 
                   , 
                   S 
                   , 
                   B 
                 
               
               
                 
                   ∑ 
                   
                     i 
                     , 
                     j 
                   
                 
                 
                   ( 
                   
                     
                       
                         
                            
                           
                             
                               
                                 P 
                                 T 
                               
                               ⁢ 
                               
                                 φ 
                                 ⁡ 
                                 ( 
                                 
                                   x 
                                   i 
                                 
                                 ) 
                               
                             
                             - 
                             
                               
                                 P 
                                 T 
                               
                               ⁢ 
                               
                                 φ 
                                 ⁡ 
                                 ( 
                                 
                                   x 
                                   j 
                                 
                                 ) 
                               
                             
                           
                            
                         
                         2 
                         2 
                       
                       ⁢ 
                       
                         s 
                         ij 
                       
                     
                     + 
                     
                       α 
                       ⁢ 
                       
                         s 
                         ij 
                         2 
                       
                     
                   
                   ) 
                 
               
             
             + 
             
               β 
               ⁢ 
               
                 
                   ∑ 
                   
                     i 
                     , 
                     j 
                   
                 
                 
                   
                     
                        
                       
                         
                           y 
                           i 
                         
                         - 
                         
                           y 
                           j 
                         
                       
                        
                     
                     2 
                     2 
                   
                   ⁢ 
                   
                     s 
                     ij 
                   
                 
               
             
             + 
             
               λ 
               ⁢ 
               
                 
                    
                   
                     
                       
                         P 
                         T 
                       
                       ⁢ 
                       
                         φ 
                         ⁡ 
                         ( 
                         X 
                         ) 
                       
                     
                     - 
                     B 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               γ 
               ⁢ 
               
                 
                    
                   P 
                    
                 
                 F 
                 2 
               
             
           
         
       
       
         
           
             	 
             
               
                 s 
                 . 
                 t 
                 . 
                     
                 
                   ∀ 
                   i 
                 
               
               , 
               
                 
                   
                     s 
                     i 
                     T 
                   
                   ⁢ 
                   
                     1 
                     n 
                   
                 
                 = 
                 1 
               
               , 
               
                 0 
                 ≤ 
                 
                   s 
                   ij 
                 
                 ≤ 
                 1 
               
               , 
               
                 B 
                 ∈ 
                 
                   
                     
                       { 
                       
                         
                           - 
                           1 
                         
                         , 
                         
                           + 
                           1 
                         
                       
                       } 
                     
                     
                       k 
                       × 
                       n 
                     
                   
                   . 
                 
               
             
           
         
       
     
     In this embodiment, the above loss function is optimized, which covers three optimization variables of B, P and S; the optimization procedure includes updating an individual variable while keeping other two variables constant (i.e., alternating minimization), and iterating the process until convergence. Specific steps are as follows: 
     (1) Optimize P, fix all variables except P, and obtain the optimization objective of P as follows: 
     
       
         
           
             
               
                 min 
                 P 
               
               
                 
                   ∑ 
                   
                     i 
                     , 
                     j 
                   
                 
                 
                   ( 
                   
                     
                       
                          
                         
                           
                             
                               P 
                               T 
                             
                             ⁢ 
                             
                               φ 
                               ⁡ 
                               ( 
                               
                                 x 
                                 i 
                               
                               ) 
                             
                           
                           - 
                           
                             
                               P 
                               T 
                             
                             ⁢ 
                             
                               φ 
                               ⁡ 
                               ( 
                               
                                 x 
                                 j 
                               
                               ) 
                             
                           
                         
                          
                       
                       2 
                       2 
                     
                     ⁢ 
                     
                       s 
                       ij 
                     
                   
                   ) 
                 
               
             
             + 
             
               λ 
               ⁢ 
               
                 
                    
                   
                     
                       
                         P 
                         T 
                       
                       ⁢ 
                       
                         φ 
                         ⁡ 
                         ( 
                         X 
                         ) 
                       
                     
                     - 
                     B 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               γ 
               ⁢ 
               
                 
                    
                   P 
                    
                 
                 F 
                 2 
               
             
           
         
       
     
     Convert the model to a matrix form as follows: 
     
       
         
           
             
               
                 min 
                 ⁢ 
                 
                   Tr 
                   ⁡ 
                   ( 
                   
                     
                       P 
                       T 
                     
                     ⁢ 
                     
                       φ 
                       ⁡ 
                       ( 
                       X 
                       ) 
                     
                     ⁢ 
                     L 
                     ⁢ 
                     
                       
                         φ 
                         ⁡ 
                         ( 
                         X 
                         ) 
                       
                       T 
                     
                     ⁢ 
                     P 
                   
                   ) 
                 
               
               + 
               
                 λ 
                 ⁢ 
                 
                   
                      
                     
                       
                         
                           P 
                           T 
                         
                         ⁢ 
                         
                           φ 
                           ⁡ 
                           ( 
                           X 
                           ) 
                         
                       
                       - 
                       B 
                     
                      
                   
                   F 
                   2 
                 
               
               + 
               
                 γ 
                 ⁢ 
                 
                   
                      
                     P 
                      
                   
                   F 
                   2 
                 
               
             
             , 
           
         
       
     
     where L denotes a Laplacian matrix, L=D−S, D denotes a diagonal matrix, an ith diagonal element is calculated as D ii =Σ j=1   n s ij , and at this moment, 0 is obtained by taking the derivative of P, which is expressed as: 
     
       
         
           
             
               P 
               = 
               
                 
                   
                     ( 
                     
                       
                         
                           φ 
                           ⁡ 
                           ( 
                           X 
                           ) 
                         
                         ⁢ 
                         
                           
                             φ 
                             ⁡ 
                             ( 
                             X 
                             ) 
                           
                           T 
                         
                       
                       + 
                       
                         
                           γ 
                           λ 
                         
                         ⁢ 
                         E 
                       
                       + 
                       
                         
                           1 
                           λ 
                         
                         ⁢ 
                         
                           φ 
                           ⁡ 
                           ( 
                           X 
                           ) 
                         
                         ⁢ 
                         L 
                         ⁢ 
                         
                           
                             φ 
                             ⁡ 
                             ( 
                             X 
                             ) 
                           
                           T 
                         
                       
                     
                     ) 
                   
                   
                     - 
                     1 
                   
                 
                 ⁢ 
                 
                   φ 
                   ⁡ 
                   ( 
                   X 
                   ) 
                 
                 ⁢ 
                 B 
               
             
             ; 
           
         
       
     
     where, E denotes a unit matrix. 
     (2) Optimize S, fix all variables except S, and obtain the optimization objective of S as follows: 
     
       
         
           
             
               
                 min 
                 S 
               
               
                 
                   ∑ 
                   
                     i 
                     , 
                     j 
                   
                 
                 
                   ( 
                   
                     
                       
                         
                            
                           
                             
                               
                                 P 
                                 T 
                               
                               ⁢ 
                               
                                 φ 
                                 ⁡ 
                                 ( 
                                 
                                   x 
                                   i 
                                 
                                 ) 
                               
                             
                             - 
                             
                               
                                 P 
                                 T 
                               
                               ⁢ 
                               
                                 φ 
                                 ⁡ 
                                 ( 
                                 
                                   x 
                                   j 
                                 
                                 ) 
                               
                             
                           
                            
                         
                         2 
                         2 
                       
                       ⁢ 
                       
                         s 
                         ij 
                       
                     
                     + 
                     
                       α 
                       ⁢ 
                       
                         s 
                         ij 
                         2 
                       
                     
                   
                   ) 
                 
               
             
             + 
             
               β 
               ⁢ 
               
                 
                   ∑ 
                   
                     i 
                     , 
                     j 
                   
                 
                 
                   
                     
                        
                       
                         
                           y 
                           i 
                         
                         - 
                         
                           y 
                           j 
                         
                       
                        
                     
                     2 
                     2 
                   
                   ⁢ 
                   
                     s 
                     ij 
                   
                 
               
             
           
         
       
       
         
           
             
               s 
               . 
               t 
               . 
                   
               
                 ∀ 
                 i 
               
             
             , 
             
               
                 
                   s 
                   i 
                   T 
                 
                 ⁢ 
                 
                   1 
                   n 
                 
               
               = 
               1 
             
             , 
             
               
                 0 
                 ≤ 
                 
                   s 
                   ij 
                 
                 ≤ 
                 1 
               
               ; 
             
           
         
       
     
     For simplicity of the matrix, the following definition is given: 
     
       
         
           
             
               M 
               ∈ 
               
                 R 
                 
                   n 
                   × 
                   n 
                 
               
             
             , 
             
               
                 
                   m 
                   ij 
                 
                 = 
                 
                   
                     - 
                     
                       1 
                       
                         2 
                         ⁢ 
                         α 
                       
                     
                   
                   ⁢ 
                   
                     ( 
                     
                       
                         
                            
                           
                             
                               
                                 P 
                                 T 
                               
                               ⁢ 
                               
                                 φ 
                                 ⁡ 
                                 ( 
                                 
                                   x 
                                   i 
                                 
                                 ) 
                               
                             
                             - 
                             
                               
                                 P 
                                 T 
                               
                               ⁢ 
                               
                                 φ 
                                 ⁡ 
                                 ( 
                                 
                                   x 
                                   j 
                                 
                                 ) 
                               
                             
                           
                            
                         
                         2 
                         2 
                       
                       + 
                       
                         β 
                         ⁢ 
                         
                           
                              
                             
                               
                                 y 
                                 i 
                               
                               - 
                               
                                 y 
                                 j 
                               
                             
                              
                           
                           2 
                           2 
                         
                       
                     
                     ) 
                   
                 
               
               ; 
             
           
         
       
     
     Then the above problems may be converted to the following: 
     
       
         
           
             
               min 
               S 
             
             
               
                 ∑ 
                 
                   i 
                   , 
                   j 
                 
               
               
                 
                    
                   
                     
                       s 
                       i 
                     
                     - 
                     
                       m 
                       i 
                     
                   
                    
                 
                 2 
                 2 
               
             
           
         
       
       
         
           
             
               s 
               . 
               t 
               . 
                   
               
                 ∀ 
                 i 
               
             
             , 
             
               
                 
                   s 
                   i 
                   T 
                 
                 ⁢ 
                 
                   1 
                   n 
                 
               
               = 
               1 
             
             , 
             
               
                 0 
                 ≤ 
                 
                   s 
                   ij 
                 
                 ≤ 
                 1 
               
               ; 
             
           
         
       
     
     In this embodiment, existing algorithms are used to solve the above problems. In the above formula, α is used to balance uniform distribution in the trivial solution and the total loss function. Assuming that a neighbor is defined for each instance, optimal α is as follows: 
     
       
         
           
             
               α 
               = 
               
                 
                   1 
                   n 
                 
                 ⁢ 
                 
                   
                     ∑ 
                     
                       i 
                       = 
                       1 
                     
                     n 
                   
                   
                     ( 
                     
                       
                         
                           e 
                           2 
                         
                         ⁢ 
                         
                           h 
                           
                             i 
                             , 
                             
                               e 
                               + 
                               1 
                             
                           
                         
                       
                       - 
                       
                         
                           1 
                           2 
                         
                         ⁢ 
                         
                           
                             ∑ 
                             
                               j 
                               = 
                               1 
                             
                             k 
                           
                           
                             h 
                             ij 
                           
                         
                       
                     
                     ) 
                   
                 
               
             
             , 
           
         
       
     
     where matrices HϵR n×n , h ij =∥P T φ(x i )−P T φ(x j )∥ 2   2 +β∥y i −y j ∥ 2   2 , h i1 , h i2 , . . . , h i,e+1  are arranged in an ascending order. 
     (3) Optimize B, fix all variables except B, and obtain the optimization objective of B as follows: 
     
       
         
           
             
               min 
               B 
             
             λ 
             ⁢ 
             
               
                  
                 
                   
                     
                       P 
                       T 
                     
                     ⁢ 
                     
                       φ 
                       ⁡ 
                       ( 
                       X 
                       ) 
                     
                   
                   - 
                   B 
                 
                  
               
               F 
               2 
             
           
         
       
       
         
           
             
               
                 s 
                 . 
                 t 
                 . 
                   
                 B 
               
               ∈ 
               
                 
                   { 
                   
                     
                       - 
                       1 
                     
                     , 
                     
                       + 
                       1 
                     
                   
                   } 
                 
                 
                   k 
                   × 
                   n 
                 
               
             
             , 
           
         
       
     
     Therefore, the optimal solution of the above formula is as follows: 
         B =sgn( P   T φ( X )).
 
     In this embodiment, the above item retrieval method in the scenario of hard samples is verified, and the experimental data are obtained from three data sets of CIFAR-10, NUS-WIDE and MS-COCO. The verification result is shown in  FIG.  2   , and SASH is adopted in the embodiment. According to this embodiment, mAP (accuracy rate) is used as the evaluation index. As can be seen, the accuracy of this embodiment is higher than that of other methods, and this embodiment has superior performance, especially on the two multi-label data sets of NUS-WIDE and MS-COCO. 
     In the meanwhile, the above method can be adopted to achieve item retrieval in a scenario of zero samples, and experimental data are obtained from three data sets of AWA2, CUB and CIFAR-10, where AWA2 and CUB are common zero-sample Hash data sets, with numbers of visible categories and invisible categories being 40/10 and 150/50, respectively; regarding the CIFAR-10 data set, 8 categories are taken as visible categories, and the other two categories are taken as invisible categories, and SASH is the method adopted in this embodiment. As can be seen from verification results shown in  FIG.  3   , excellent performance is also exhibited in zero-sample data sets. 
     According to this embodiment, in step S 3 , when images are in a scenario of zero samples, image features are generated by using Hashing method. Instead of special supervisory information, the asymmetric similarity matrix is used, and three equilibrium strategies are proposed. Meanwhile, the model has an intuitive structure, and is easy to transfer and deploy, which makes it easier to achieve item retrieval in a scenario of zero samples. 
     According to this embodiment, “equilibrium” and “decorrelation” constraints of Hash codes are added during the design of a loss function without introducing special supervisory information (only category labels are used), and the objective function is expanded to nonlinear Hashing through a kernel function. 
     The image training set, labels, Hash codes and similarity matrix in the scenario of zero samples are all consistent with those in the scenario of hard samples, and details are not described herein. 
     According to this embodiment, in order to obtain Hash codes and satisfy the retrieval performance while retaining more information, equilibrium and decorrelation constraints of a Hash code are added to the loss function in form of an inner product, which is expressed as: 
     
       
         
           
             
               min 
               B 
             
             
               
                  
                 
                   
                     k 
                     · 
                     S 
                   
                   - 
                   
                     BB 
                     T 
                   
                 
                  
               
               F 
               2 
             
           
         
       
       
         
           
             
               
                 s 
                 . 
                 t 
                 . 
                     
                 B 
               
               ∈ 
               
                 
                   { 
                   
                     
                       - 
                       1 
                     
                     , 
                     
                       + 
                       1 
                     
                   
                   } 
                 
                 
                   n 
                   × 
                   k 
                 
               
             
             , 
             
               
                 
                   B 
                   T 
                 
                 ⁢ 
                 
                   1 
                   n 
                 
               
               = 
               
                 0 
                 k 
               
             
             , 
             
               
                 
                   B 
                   T 
                 
                 ⁢ 
                 B 
               
               = 
               
                 n 
                 · 
                 
                   E 
                   k 
                 
               
             
             , 
           
         
       
     
     where 1 n  denotes an all-ones vector of n×1, 0 k  denotes an all-zeroes vector of k×1, E k  denotes a unit matrix of k×k, and ∥⋅∥ F  denotes an f norm; 
     where the equilibrium constraint indicates that the number of Hash codes with a value of +1 should be close to or equal to the number Hash codes with a value of −1 as much as possible, which is expressed as: 
         B   T 1 n =0 k    
     the decorrelation constraint indicates that Hash codes of various bits should be uncorrelated, which is expressed as: 
         B   T   B=n·E   k . 
     It should be noted that the similarity matrix S in the above objective function is an asymmetric similarity matrix, which denotes that a similarity weight produced when image pairs are similar is not equal to a similarity weight produced when image pairs are dissimilar. 
     The ultimate purpose of this embodiment is to learn a group of Hashing function from visible training data under supervision, so as to create high-quality binary codes for invisible data. In addition, this embodiment only uses category labels as supervisory information, instead of using special supervisory information. To achieve the above objectives, the following pattern is proposed: 
     
       
         
           
             
               
                 min 
                 
                   B 
                   , 
                   P 
                   , 
                   W 
                 
               
               
                 
                    
                   
                     
                       k 
                       · 
                       S 
                     
                     - 
                     
                       BB 
                       T 
                     
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               λ 
               ⁢ 
               
                 
                    
                   
                     XP 
                     - 
                     B 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               β 
               ⁢ 
               
                 
                    
                   P 
                    
                 
                 F 
                 2 
               
             
             + 
             
               γ 
               ⁢ 
               
                 
                    
                   
                     YW 
                     - 
                     B 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               μ 
               ⁢ 
               
                 
                    
                   W 
                    
                 
                 F 
                 2 
               
             
           
         
       
       
         
           
             
               
                 s 
                 . 
                 t 
                 . 
                     
                 B 
               
               ∈ 
               
                 
                   { 
                   
                     
                       - 
                       1 
                     
                     , 
                     
                       + 
                       1 
                     
                   
                   } 
                 
                 
                   n 
                   × 
                   k 
                 
               
             
             , 
             
               
                 
                   B 
                   T 
                 
                 ⁢ 
                 
                   1 
                   n 
                 
               
               = 
               
                 0 
                 k 
               
             
             , 
             
               
                 
                   B 
                   T 
                 
                 ⁢ 
                 B 
               
               = 
               
                 n 
                 · 
                 
                   E 
                   k 
                 
               
             
             , 
           
         
       
     
     where A denotes a positive parameter and a weight coefficient of quantization loss, which are configured to measure the relative importance of binary codes and Hashing functions; γ denotes a positive parameter configured to measure the relative importance of the relationship between binary codes and category labels; β and μ denote hyper-parameters, and PϵP d×k  and WϵR c×k  each denote a transfer matrix, both of them used for tuning the performance of the model. 
     In the above loss function, ∥k·S−BB T ∥ F   2  guides a Hash code using loss items in a form of an inner product, λ∥XP−B∥ F   2  is intended to learn a relationship between image features and a Hash code by matrix transfer, β∥P∥ F   2  is configured to constrain the transfer matrix from having an excessively big or small value, γ∥YW−B∥ F   2  has a built-in relationship between label information and a Hash code, and μ∥W∥ F   2  denotes a regular term for constraining W. 
     In this embodiment, an auxiliary variable ZϵR n×k  is introduced to approximate a real value of a discrete variable B, thus making the optimization objective easier to solve. Therefore, the overall objective function of the above factors can be expanded to: 
     
       
         
           
             
               
                 min 
                 
                   B 
                   , 
                   P 
                   , 
                   W 
                   , 
                   Z 
                 
               
               
                 
                    
                   
                     
                       k 
                       · 
                       S 
                     
                     - 
                     
                       BZ 
                       T 
                     
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               λ 
               ⁢ 
               
                 
                    
                   
                     XP 
                     - 
                     B 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               α 
               ⁢ 
               
                 
                    
                   
                     B 
                     - 
                     Z 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               β 
               ⁢ 
               
                 
                    
                   P 
                    
                 
                 F 
                 2 
               
             
             + 
             
               γ 
               ⁢ 
               
                 
                    
                   
                     YW 
                     - 
                     B 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               μ 
               ⁢ 
               
                 
                    
                   W 
                    
                 
                 F 
                 2 
               
             
           
         
       
       
         
           
                              
             
               
                 
                   s 
                   . 
                   t 
                   . 
                       
                   B 
                 
                 ∈ 
                 
                   
                     { 
                     
                       
                         - 
                         1 
                       
                       , 
                       
                         + 
                         1 
                       
                     
                     } 
                   
                   
                     n 
                     × 
                     k 
                   
                 
               
               , 
               
                 
                   
                     Z 
                     T 
                   
                   ⁢ 
                   
                     1 
                     n 
                   
                 
                 = 
                 
                   0 
                   k 
                 
               
               , 
               
                 
                   
                     Z 
                     T 
                   
                   ⁢ 
                   Z 
                 
                 = 
                 
                   n 
                   · 
                   
                     
                       E 
                       k 
                     
                     . 
                   
                 
               
             
           
         
       
     
     In previous study, a nonlinear Hashing function usually has a much better generalization performance than that of a common Hashing function, as the former can adapt to more complex patterns. Therefore, in this embodiment, the objective function is expanded to nonlinear Hashing through a kernel function: 
       φ( X )=[φ( x   1 ),φ( x   2 ), . . . ,φ( x   n )] T ,
 
     where φ:xϵR d →φ(x)ϵR d′  denotes nonlinear mapping, and d′ denotes a dimension after mapping. 
     Therefore, the overall objective function can be expanded to: 
     
       
         
           
             
               
                 min 
                 
                   B 
                   , 
                   P 
                   , 
                   W 
                   , 
                   Z 
                 
               
               
                 
                    
                   
                     
                       k 
                       · 
                       S 
                     
                     - 
                     
                       BZ 
                       T 
                     
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               λ 
               ⁢ 
               
                 
                    
                   
                     
                       
                         φ 
                         ⁡ 
                         ( 
                         X 
                         ) 
                       
                       ⁢ 
                       P 
                     
                     - 
                     B 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               α 
               ⁢ 
               
                 
                    
                   
                     B 
                     - 
                     Z 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               β 
               ⁢ 
               
                 
                    
                   P 
                    
                 
                 F 
                 2 
               
             
             + 
             
               γ 
               ⁢ 
               
                 
                    
                   
                     YW 
                     - 
                     B 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               μ 
               ⁢ 
               
                 
                    
                   W 
                    
                 
                 F 
                 2 
               
             
           
         
       
       
         
           
                              
             
               
                 
                   s 
                   . 
                   t 
                   . 
                       
                   B 
                 
                 ∈ 
                 
                   
                     { 
                     
                       
                         - 
                         1 
                       
                       , 
                       
                         + 
                         1 
                       
                     
                     } 
                   
                   
                     n 
                     × 
                     k 
                   
                 
               
               , 
               
                 
                   
                     Z 
                     T 
                   
                   ⁢ 
                   
                     1 
                     n 
                   
                 
                 = 
                 
                   0 
                   k 
                 
               
               , 
               
                 
                   
                     Z 
                     T 
                   
                   ⁢ 
                   Z 
                 
                 = 
                 
                   n 
                   · 
                   
                     E 
                     k 
                   
                 
               
             
           
         
       
     
     In this embodiment, the above loss function is optimized, which covers four optimization variables of B, P, W and Z; the optimization procedure includes updating an individual variable while keeping other three variables constant (i.e., alternating minimization), and iterating the process until convergence. 
     (1) Optimize P, fix all variables except P, and obtain the optimization objective of P as follows: 
     
       
         
           
             
               
                 min 
                 P 
               
               λ 
               ⁢ 
               
                 
                    
                   
                     
                       
                         φ 
                         ⁡ 
                         ( 
                         X 
                         ) 
                       
                       ⁢ 
                       P 
                     
                     - 
                     B 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               β 
               ⁢ 
               
                 
                    
                   P 
                    
                 
                 F 
                 2 
               
             
           
         
       
     
     0 is obtained by taking the derivative of P, which is expressed as: 
     
       
         
           
             P 
             = 
             
               
                 
                   ( 
                   
                     
                       
                         
                           φ 
                           ⁡ 
                           ( 
                           X 
                           ) 
                         
                         T 
                       
                       ⁢ 
                       
                         φ 
                         ⁡ 
                         ( 
                         X 
                         ) 
                       
                     
                     + 
                     
                       
                         β 
                         λ 
                       
                       ⁢ 
                       E 
                     
                   
                   ) 
                 
                 
                   - 
                   1 
                 
               
               ⁢ 
               
                 
                   φ 
                   ⁡ 
                   ( 
                   X 
                   ) 
                 
                 T 
               
               ⁢ 
               
                 B 
                 . 
               
             
           
         
       
     
     (2) Optimize W, fix all variables except W, and obtain the optimization objective of Was follows: 
     
       
         
           
             
               
                 min 
                 W 
               
               γ 
               ⁢ 
               
                 
                    
                   
                     YW 
                     - 
                     B 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               μ 
               ⁢ 
               
                 
                    
                   W 
                    
                 
                 F 
                 2 
               
             
           
         
       
     
     0 is obtained by taking the derivative of W, which is expressed as: 
     
       
         
           
             W 
             = 
             
               
                 
                   ( 
                   
                     
                       
                         Y 
                         T 
                       
                       ⁢ 
                       Y 
                     
                     + 
                     
                       
                         μ 
                         γ 
                       
                       ⁢ 
                       E 
                     
                   
                   ) 
                 
                 
                   - 
                   1 
                 
               
               ⁢ 
               
                 Y 
                 T 
               
               ⁢ 
               
                 B 
                 . 
               
             
           
         
       
     
     (3) Optimize B, fix all variables except B, and obtain the optimization objective of B as follows: 
     
       
         
           
             
               
                 min 
                 B 
               
               
                 
                    
                   
                     
                       k 
                       · 
                       S 
                     
                     - 
                     
                       BZ 
                       T 
                     
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               λ 
               ⁢ 
               
                 
                    
                   
                     
                       
                         φ 
                         ⁡ 
                         ( 
                         X 
                         ) 
                       
                       ⁢ 
                       P 
                     
                     - 
                     B 
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               α 
               ⁢ 
               
                 
                    
                   
                     B 
                     - 
                     Z 
                   
                    
                 
                 F 
                 2 
               
               ⁢ 
               γ 
               ⁢ 
               
                 
                    
                   
                     YW 
                     - 
                     B 
                   
                    
                 
                 F 
                 2 
               
             
           
         
       
       
         
           
             
               
                 s 
                 . 
                 t 
                 . 
                     
                 B 
               
               ∈ 
               
                 
                   { 
                   
                     
                       - 
                       1 
                     
                     , 
                     
                       + 
                       1 
                     
                   
                   } 
                 
                 
                   n 
                   × 
                   k 
                 
               
             
             ; 
           
         
       
     
     This equation is equivalent to the optimization problem: 
     
       
         
           
             
               max 
               B 
             
             
               Tr 
               ⁡ 
               ( 
               
                 
                   B 
                   T 
                 
                 ⁢ 
                 
                   { 
                   
                     
                       k 
                       · 
                       SZ 
                     
                     + 
                     
                       
                         λφ 
                         ⁡ 
                         ( 
                         X 
                         ) 
                       
                       ⁢ 
                       P 
                     
                     + 
                     
                       α 
                       ⁢ 
                       Z 
                     
                     + 
                     
                       γ 
                       ⁢ 
                       YW 
                     
                   
                   } 
                 
               
               ) 
             
           
         
       
       
         
           
             
               
                 s 
                 . 
                 t 
                 . 
                     
                 B 
               
               ∈ 
               
                 
                   { 
                   
                     
                       - 
                       1 
                     
                     , 
                     
                       + 
                       1 
                     
                   
                   } 
                 
                 
                   n 
                   × 
                   kK 
                 
               
             
             ; 
           
         
       
     
     where Tr(⋅) denotes a trace of a matrix. 
     Therefore, the optimal solution of the above formula is as follows: 
         B   T =sgn( k·SZ +λφ( X ) P+φZ+γYW )
 
     (4) Optimize Z, fix all variables except Z, and obtain the optimization objective of Z as follows: 
     
       
         
           
             
               
                 min 
                 Z 
               
               
                 
                    
                   
                     
                       k 
                       · 
                       S 
                     
                     - 
                     
                       BZ 
                       T 
                     
                   
                    
                 
                 F 
                 2 
               
             
             + 
             
               α 
               ⁢ 
               
                 
                    
                   
                     B 
                     - 
                     Z 
                   
                    
                 
                 F 
                 2 
               
             
           
         
       
       
         
           
             
               
                 
                   s 
                   . 
                   t 
                   . 
                       
                   
                     Z 
                     T 
                   
                 
                 ⁢ 
                 
                   1 
                   n 
                 
               
               = 
               
                 0 
                 k 
               
             
             , 
             
               
                 
                   Z 
                   T 
                 
                 ⁢ 
                 Z 
               
               = 
               
                 n 
                 · 
                 
                   E 
                   k 
                 
               
             
           
         
       
     
     The equation is further simplified as: 
     
       
         
           
             
               max 
               Z 
             
             
               Tr 
               ⁡ 
               ( 
               
                 
                   Z 
                   T 
                 
                 ⁢ 
                 L 
               
               ) 
             
           
         
       
       
         
           
             
               
                 
                   s 
                   . 
                   t 
                   . 
                       
                   
                     Z 
                     T 
                   
                 
                 ⁢ 
                 
                   1 
                   n 
                 
               
               = 
               
                 0 
                 k 
               
             
             , 
             
               
                 
                   Z 
                   T 
                 
                 ⁢ 
                 Z 
               
               = 
               
                 n 
                 · 
                 
                   E 
                   k 
                 
               
             
           
         
       
     
     where L=k·SB+αB 
     At this moment, a closed solution is as follows: 
         Z =√{square root over ( n )}[ U,Ū ][ V, V   ] T  
 
     where U and V can be obtained by conducting singular value decomposition on JL: 
     
       
         
           
             
               J 
               = 
               
                 
                   E 
                   n 
                 
                 - 
                 
                   
                     1 
                     n 
                   
                   ⁢ 
                   
                     1 
                     n 
                   
                   ⁢ 
                   
                     1 
                     n 
                     T 
                   
                 
               
             
             ; 
             
               JL 
               = 
               
                 
                   U 
                   ⁢ 
                   
                     ∑ 
                     V 
                   
                 
                 = 
                 
                   
                     ∑ 
                     
                       k 
                       = 
                       1 
                     
                     
                       K 
                       ′ 
                     
                   
                   
                     
                       σ 
                       k 
                     
                     ⁢ 
                     
                       u 
                       k 
                     
                     ⁢ 
                     
                       V 
                       k 
                       T 
                     
                   
                 
               
             
           
         
       
     
     Finally, Ū,  V  is obtained through Gram Schmidt processing. 
     During the optimization process, there always exists some items having varying orders of magnitudes. For example, in the process of optimizing Hash code B, optimization subitems have different orders of magnitudes, and in the final optimized Hash codes using a symbol function, only symbols of subitems with the maximum order of magnitude are obtained. Therefore, some subitems are invalid to optimization. In view of this, three equilibrium strategies are designed in this embodiment to resolve the above problem, so that information of all of the subitems are made full use of in the optimization process. The following is particularly expressed as follows: 
     Standard normalization: 
     
       
         
           
             
               std 
               ⁡ 
               ( 
               A 
               ) 
             
             = 
             
               
                 A 
                 - 
                 
                   MEAN 
                   ⁢ 
                       
                   
                     ( 
                     A 
                     ) 
                   
                 
               
               δ 
             
           
         
       
     
     Average normalization: 
     
       
         
           
             
               ave 
               ⁡ 
               ( 
               A 
               ) 
             
             = 
             
               
                 A 
                 - 
                 
                   MEAN 
                   ⁢ 
                       
                   
                     ( 
                     A 
                     ) 
                   
                 
               
               
                 
                   max 
                   ⁡ 
                   ( 
                   A 
                   ) 
                 
                 - 
                 
                   min 
                   ⁡ 
                   ( 
                   A 
                   ) 
                 
               
             
           
         
       
     
     Max-min normalization: 
     
       
         
           
             
               min 
               ⁢ 
                  
               
                 max 
                 ⁡ 
                 ( 
                 A 
                 ) 
               
             
             = 
             
               
                 A 
                 - 
                 
                   MIN 
                   ⁡ 
                   ( 
                   A 
                   ) 
                 
               
               
                 
                   max 
                   ⁡ 
                   ( 
                   A 
                   ) 
                 
                 - 
                 
                   min 
                   ⁡ 
                   ( 
                   A 
                   ) 
                 
               
             
           
         
       
     
     where A denotes a certain subitem, δ denotes a standard deviation, max(⋅) denotes a maximum function, min(⋅) denotes a minimum function, and output results are real values; and MEAN ( ) is a mean function, MIN ( ) is minimum function, and the output result is a real-valued matrix. Based on the equilibrium strategy, the problem that subitems vary in number is solved while making full use of the information of each subitem. 
     In this embodiment, as shown in  FIG.  4   , in a scenario of zero samples, verification results of the above item retrieval method are adopted, and experimental data are obtained from three data sets of AWA2, CUB and CIFAR-10, where AWA2 and CUB are common zero-sample Hash data sets, with numbers of visible categories and invisible categories being 40/10 and 150/50, respectively; regarding the CIFAR-10 data set, 8 categories are taken as visible categories, and the other two categories are taken as invisible categories. ASZH is adopted in this embodiment, evaluation index of which is mAP (accuracy rate). As can be seen, the accuracy rate in this embodiment is higher compared with other methods. 
       FIG.  5    shows an experiment on a linear Hashing method using an equilibrium strategy in an AWA2 data set, where std, ave and minmax respectively indicate the use of a standardization strategy, an average normalization strategy and a max-min normalization strategy, while without indicates that equilibrium strategy is not used. As can be seen, if subitems have no difference in the order of magnitudes, the balancing strategy will not work; on the contrary, if there exists a difference in the order of magnitudes, the balancing strategy can influence Hash codes use the information of each subitem. 
     Embodiment 2 
     This embodiment provides a multiple scenario-oriented item retrieval system, including:
         an image preprocessing module configured to extract, by Hashing learning, image features from an obtained image training set, and train a pre-built item retrieval model;   a first scenario-based training module configured to, when an image is in a scenario of hard samples, introduce an adaptively optimized similarity matrix into Hashing learning, optimize the similarity matrix by an image transfer matrix, and construct an adaptive similarity matrix objective function with the optimized similarity matrix and an image category label; construct a quantization loss objective function between the image and a Hash code according to the image transfer matrix; and conduct nonlinear Hashing mapping on the adaptive similarity matrix objective function and the quantization loss objective function to obtain a model objective function;   a second scenario-based training module configured to, when the image is in a scenario of zero samples, introduce into Hashing learning an asymmetric similarity matrix configured to constrain the generation of Hash codes, construct an objective function by taking an image category label as supervisory information in combination with equilibrium and decorrelation constraints of a Hash code, and conduct nonlinear Hashing mapping on the objective function to obtain a model objective function; and   a retrieval module configured to train the item retrieval model based on the model objective function, and obtain a retrieved result of a to-be-retrieved target item image based on the trained item retrieval model.       

     It should be noted herein that the foregoing modules correspond to the steps in Embodiment 1, and examples and application scenarios implemented by the foregoing modules are the same as those implemented by the corresponding steps, but are not limited to the content disclosed in Embodiment 1. It should be noted that, as part of the system, the above-mentioned modules can be executed in a computer system such as a set of computer-executable instructions. 
     The above describes the specific implementations of the present disclosure, but is not intended to limit the protection scope of the present disclosure. Those skilled in the art should understand that any modifications or variations made by those skilled in the art without creative efforts still fall within the protection scope of the present disclosure based on the technical solutions of the present disclosure.