Image position identification method based on twin width hash network

Through the method based on the twin width hash network, the problems of appearance changes and high computational cost in visual position recognition are solved, efficient image retrieval and position recognition are achieved, and hash codes with high semantic consistency are generated.

CN119444859APending Publication Date: 2025-02-14CHONGQING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411559415.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-04
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The prior art has problems such as appearance changes, large-scale computing costs and hash code correlation in visual position recognition, resulting in inefficient image retrieval and position recognition.

Method used

Using the image position recognition method based on the twin width hash network, the network nodes are added by building a width hash network and incrementally learning to reduce the computational amount of backpropagation; the width hash network is used as a branch of the twin neural network, and the loss is compared Function training generates hash codes with high semantic consistency.

Benefits of technology

Efficient image retrieval and visual position recognition are realized, which reduces training overhead and improves the quality of hash codes, avoids the problem of excessive computational costs and reduced correlation of similar hash codes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119444859A_ABST
    Figure CN119444859A_ABST
Patent Text Reader

Abstract

The invention discloses an image position identification method based on a twin width hash network. In the offline stage, firstly, a plurality of reference points are deployed in a target area, and 80%, 10% and 10% are taken to divide a training set, a verification set and a test set; then, constructing a Hash width network, and transversely increasing feature nodes through incremental learning so as to expand the width of the network; then, dividing positive and negative sample pairs, taking a width hash network as two branches of a twin network framework, and sharing weights and network parameters; and finally, keeping the similarity of the original samples to the greatest extent by shortening the Hash distance of similar features and shortening the Hash distance of dissimilar features. In the online stage, a query picture is input into the constructed model, a hash code with high semantic consistency with an original image is obtained, a most similar retrieval image is obtained through retrieval in a database, and the RP position corresponding to the retrieval image serves as a visual position recognition result. The invention provides an image position identification method based on a twin width Hash network by utilizing width learning transverse expansion nodes and fully considering intra-group correlation and inter-group exclusiveness, and the positioning precision is ensured while the system overhead is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to visual position recognition technology, and specifically relates to an image position recognition method based on a twin width hashing network. Background Art

[0002] Place recognition has received extensive attention from both academia and industry in recent years. For a query image, visual place recognition is to identify the location where the image was captured based on a set of previously collected images, possibly with some form of label information, such as text labels provided by people or GPS data captured by sensors. Visual place recognition is a core technology for many important applications such as simultaneous localization and mapping (SLAM), autonomous navigation, etc. However, place recognition has always been a challenge in computer vision and machine learning due to the large variations in the appearance of places, such as changes in viewpoint, seasons, lighting, weather, and irrelevant objects such as trees and cars.

[0003] If various types of label information are provided, location recognition can be transformed into an image retrieval problem or a classification problem. Image retrieval generally includes text-based retrieval and content-based retrieval. Compared with image content-based image retrieval, text-based retrieval performs keyword annotation on all images uploaded to the Internet. It is easy to design but time-consuming and labor-intensive in the early stage. Image content-based image retrieval does not require manual annotation. Instead, it extracts features from the user-input image for similarity matching, thereby retrieving images with similar feature distribution to the original input image. Therefore, retrieving similar images can be equivalent to a nearest neighbor search problem. Using traversal or tree-based retrieval algorithms is easy to exhaustively search, resulting in excessive computational cost. Therefore, a large number of studies use approximate nearest neighbor search (ANN) instead of nearest neighbor search. In the approximate nearest neighbor method, the hash retrieval method uses a set of hash functions to map high-dimensional image content features to low-dimensional compact binary hash codes, and measures the similarity between two images by comparing the Hamming distance between the binary hash codes of the images.

[0004] At present, hashing methods can be divided into two categories: traditional hashing methods and deep hashing methods. Traditional hashing methods first use artificial feature extraction methods to extract features from images, and then learn the semantic information reflected by the extracted features and train hash functions. However, the semantic information expressed by the image features extracted by artificial feature extraction methods is limited, which becomes the bottleneck of image retrieval by traditional hashing methods. Deep hashing methods can alleviate this bottleneck by using the ability of deep learning networks to extract rich and representative features from complex and high-dimensional images. However, due to its complex deep learning network structure and a large number of hyperparameters, training deep hashing networks is time-consuming and occupies a large amount of memory. In addition, traditional deep hashing algorithms cannot fully utilize pairwise label information to guide hash code learning. Considering the intra-group correlation and inter-group mutual exclusion characteristics of hash codes, this will lead to the problem of reduced correlation of similar hash codes, which ultimately affects the retrieval results.

[0005] Therefore, in response to the above two challenges, the present invention proposes an image position recognition method based on a twin width hash network. First, a width hash network is constructed, and feature nodes are added horizontally through incremental learning to expand the network width, avoiding the connection weight calculation between multi-layer networks and reducing the challenges brought by adjustment and time consumption; then, a twin neural network model based on the width hash network is constructed, and the width hash network is used as a branch of the twin network framework to generate a hash code with high semantic consistency with the original sample. Finally, efficient image retrieval and visual position recognition are achieved through the Hamming metric between hash codes. Summary of the invention

[0006] The purpose of the present invention is to provide an image position recognition method based on a twin width hash network. At the present stage, an image database is constructed, and positive and negative sample pairs are divided and input into two completely identical width hash networks with shared weights. By adding network nodes through incremental learning, only one layer of network is needed to extract feature information, that is, the full feature layer composed of feature mapping layer and enhancement layer, which avoids the back propagation of deep network occupying a large amount of memory and time; the width hash network is used as a branch of the twin network framework, and the similarity of the original sample is maintained to the greatest extent by shortening the hash distance of similar features and extending the hash distance of dissimilar features.

[0007] The present invention provides an image position recognition method based on twin width hashing network, Figure 1 and Figure 2 The flow chart and system framework diagram of the present invention include the following steps:

[0008] Step 1: Deploy 48 reference points (Access Points, APs) with known locations in the corridors and offices of Chongqing University of Posts and Telecommunications, denoted as AP1, L, AP m , the jth AP is denoted as AP j(j≤m, j is an integer), and mark the corresponding global coordinate information on each image.

[0009] Step 2: Use a handheld camera to take a certain number of images at each reference point, including 45° downward, horizontal, and 45° upward. These images are used to build an image database, of which 80% of the images are used as training sets, 10% of the images are used as validation sets, and 10% of the images are used as test sets. All training images and test images have a resolution of 640*480 pixels.

[0010] Step 3: Build a wide hash network to improve the hash network training efficiency. Figure 3 The following is a diagram of the hash learning network framework, which includes the following steps:

[0011] Step 3 (a) constructs the full feature layer of the wide hash network, which consists of a shallow mapping layer and an enhancement layer. When data arrives from the input layer, the shallow mapping layer nodes are first extracted, and the feature vector set X is mapped α times, and each mapping generates α nodes. The specific mapping process is shown as follows:

[0012] S i =f(XW si +β si ),i=1,2,...,α (1)

[0013] In the formula, S i represents a set of nodes obtained by mapping the feature vector X for the i-th time, W si represents the weight of the randomly generated i-th mapping, β si represents the deviation of the randomly generated i-th mapping, f represents the activation function that maps the vector from the input layer to the shallow mapping layer; the α groups of nodes (i.e., α×α nodes) obtained by α mappings are merged into a shallow mapping layer, denoted as S α =[S1,S2,...,S α ].

[0014] In order to obtain richer semantic information, the group a nodes of the shallow mapping layer are remapped to the enhancement layer to obtain enhanced nodes. The specific enhancement process is as follows:

[0015] E j =g(S α W ej +β ej ),j=1,2,...,c (2)

[0016] In the formula, E j represents a set of nodes obtained by the jth mapping of the shallow mapping layer, with a total of c mappings, W ej represents the weight of the randomly generated j-th mapping, βej represents the deviation of the randomly generated j-th mapping, g represents the activation function that maps the shallow mapping layer nodes to the enhancement layer; the c groups of nodes obtained by c mappings are merged into the enhancement layer, denoted by E α =[E1,E2,...,E c ];

[0017] The shallow mapping layer S α With enhancement layer E c Merge into the full feature layer, denoted as

[0018] Step 3 (ii) constructs the hash layer B of the wide hash network to learn compact hash codes. The hash layer consists of the hash code corresponding to each vector in X, which is The binary hash code matrix after hashing through the hash network is represented by:

[0019]

[0020] Where W h The weight matrix of the wide hash network BH, i.e. the hash mapping matrix, consists of r hash functions, i.e. r column vectors. Therefore, the resulting binary hash code matrix consists of n rows of r-bit hash codes, and B is represented as follows:

[0021]

[0022] In the formula, B i Represents X i The hash code B obtained by first mapping to the full feature layer and then hashing should be as close to the ideal hash code U as possible; therefore, when constructing a wide hash network, the value of the ideal hash code U is used as the hash layer of the wide hash network;

[0023] Step 3 (iii) Calculate the width hash network weight matrix W h The purpose of the width hashing network weight is to learn the training sample data feature vector X i Its corresponding hash code U i In order to reduce the quantization loss that occurs when hashing from high-dimensional space to binary Hamming space for training, that is, to minimize the quantization loss caused by sign() to maintain the original local features of the data, the loss function is established as follows:

[0024]

[0025] In the formula, λ represents a regularization parameter, Represents the solution of W h Make the expression minimum. Based on the ridge regression theory, the width hash weight matrix W h The solution calculation formula is as follows:

[0026]

[0027] In the formula, I is the unit matrix, and the width hashing network constructed at this time is called the basic width hashing network.

[0028] Step 4: Build a hash learning model based on the twin neural network to generate a hash code with high semantic consistency. The specific steps include:

[0029] Step 4 (a) Create positive and negative sample pairs of image samples through the data preprocessing module. Specifically, the images in the data set are labeled as similar or dissimilar. A positive sample pair represents a high similarity between two images, while a negative sample pair represents a low similarity between two images. Select a pair of images from the data set and regard them as a sample pair. Different images from the same reference point are regarded as positive sample pairs, and different images from different reference points are regarded as negative sample pairs. Y represents the similarity between positive and negative sample pairs. If images X1 and X2 are a positive sample pair, then Y=1, and the label of the sample pair is set to (X1, X2, 1), otherwise it is (X1, X2, 0). The division of sample pairs not only simplifies the model and reduces data requirements, but also improves the performance and generalization ability of the model, which can ensure that useful features are learned and similar and dissimilar images are distinguished.

[0030] Step 4 (ii), input positive and negative sample pairs, and use the width hash learning network as two branches of the twin neural network. The twin neural network is a network framework, and its main feature is that it contains two completely identical network channels with shared structure, weights and biases. This channel can be a convolutional neural network or a pre-trained network. The present invention uses the width hash network constructed in step 3. The divided positive and negative sample pairs are respectively input into two completely identical width hash networks. By training the comparison loss function, the distance between the hash codes output by the positive sample pair is shortened, and the distance between the hash codes output by the negative sample pair is extended, so as to improve the intra-group correlation and inter-group mutual exclusivity, and obtain a hash code with high semantic consistency.

[0031] Step 4 (iii) Generate a hash code with high semantic consistency through loss function training to achieve efficient image retrieval and visual location recognition. Let L be a sample set, and our goal is to find a suitable mapping function H to transform sample I n Projection to k-bit hash code b n In the process of extracting the original sample, the similarity of the original sample is maintained. Considering the intra-group correlation and inter-group mutual exclusivity of the hash code, the objective function proposed in the present invention uses the approximate contrast loss form to avoid the collapse situation. The objective function can be defined as:

[0032]

[0033] In the formula, L1 is the contrast constraint term, H d (·,·) are two hash codes b i ,b j The Hamming distance between them is , and m is the boundary threshold parameter. In order to make full use of the category-level semantic information to enhance the intra-group correlation and inter-group mutual exclusivity of the hash code, more potential semantic information can be utilized through point-by-point label information, and the above objective function is redefined as:

[0034]

[0035] Where λ is the trade-off parameter, L i , L j For sample I i ,I j The intra-group correlation enhancement term, y i and j Sample I i and I j point-wise marking information; σ is a nonlinear function, i.e., tanh function, sigmoid function or softmax function; W i , W j For sample I i ,I j The weight parameters of the nonlinear function can be learned by the optimizer.

[0036] Step 5: Input the hash codes of the online image and the offline image, implement image retrieval of the online image through the Hamming distance, and use the RP corresponding to the offline image as the result of image position recognition.

[0037] Beneficial Effects

[0038] The present invention starts from reducing training overhead and improving hash code quality. First, multiple reference points are deployed in the target area and 80%, 10%, and 10% are taken to divide the training set, verification set, and test set; secondly, a wide hash network is constructed, and network nodes are added for horizontal expansion, which avoids the long-term training of traditional deep learning and reduces the challenges brought by adjustment and time consumption; finally, a twin neural network framework is constructed, and the wide hash network is used as two branches of the model to make full use of category-level semantic information, enhance the intra-group correlation and inter-group mutual exclusivity of hash codes, generate highly semantically consistent hash codes, and realize efficient image retrieval and image location recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 It is a flow chart of the present invention;

[0040] Figure 2 This is a system framework diagram of the present invention;

[0041] Figure 3 Width hashing network framework diagram Specific implementation plan

[0042] The purpose of the present invention is to provide an image position recognition method based on a twin width hash network. At the present stage, an image database is constructed, and positive and negative sample pairs are divided and input into two completely identical width hash networks with shared weights. By adding network nodes through incremental learning, only one layer of network is needed to extract feature information, that is, the full feature layer composed of feature mapping layer and enhancement layer, which avoids the back propagation of deep network occupying a large amount of memory and time; the width hash network is used as a branch of the twin network framework, and the similarity of the original sample is maintained to the greatest extent by shortening the hash distance of similar features and extending the hash distance of dissimilar features.

[0043] The present invention provides an image position recognition method based on twin width hashing network, Figure 1 and Figure 2 The flow chart and system framework diagram of the present invention include the following steps:

[0044] Step 1: Deploy 48 reference points (Access Points, APs) with known locations in the corridors and offices of Chongqing University of Posts and Telecommunications, denoted as AP1, L, AP m , the jth AP is denoted as AP j (j≤m, j is an integer), and mark the corresponding global coordinate information on each image.

[0045] Step 2: Use a handheld camera to take a certain number of images at each reference point, including 45° downward, horizontal, and 45° upward. These images are used to build an image database, of which 80% of the images are used as training sets, 10% of the images are used as validation sets, and 10% of the images are used as test sets. All training images and test images have a resolution of 640*480 pixels.

[0046] Step 3: Build a wide hash network to improve the hash network training efficiency. Figure 3 The following is a diagram of the hash learning network framework, which includes the following steps:

[0047] Step 3 (a) constructs the full feature layer of the wide hash network, which consists of a shallow mapping layer and an enhancement layer. When data arrives from the input layer, the shallow mapping layer nodes are first extracted, and the feature vector set X is mapped α times, and each mapping generates α nodes. The specific mapping process is shown as follows:

[0048] S i =f(XW si +β si ),i=1,2,...,α (1)

[0049] In the formula, S i represents a set of nodes obtained by mapping the feature vector X for the i-th time, W si represents the weight of the randomly generated i-th mapping, β si represents the deviation of the randomly generated i-th mapping, f represents the activation function that maps the vector from the input layer to the shallow mapping layer; the α groups of nodes (i.e., α×α nodes) obtained by α mappings are merged into a shallow mapping layer, denoted as S α =[S1,S2,...,S α ].

[0050] In order to obtain richer semantic information, the group a nodes of the shallow mapping layer are remapped to the enhancement layer to obtain enhanced nodes. The specific enhancement process is as follows:

[0051] E j =g(S α W ej +β ej ),j=1,2,...,c (2)

[0052] In the formula, E j represents a set of nodes obtained by the jth mapping of the shallow mapping layer, with a total of c mappings, W ej represents the weight of the randomly generated j-th mapping, β ej represents the deviation of the randomly generated j-th mapping, g represents the activation function that maps the shallow mapping layer nodes to the enhancement layer; the c groups of nodes obtained by c mappings are merged into the enhancement layer, denoted by E α =[E1,E2,...,E c ];

[0053] The shallow mapping layer S α With enhancement layer E c Merge into the full feature layer, denoted as

[0054] Step 3 (ii) constructs the hash layer B of the wide hash network to learn compact hash codes. The hash layer consists of the hash code corresponding to each vector in X, which is The binary hash code matrix after hashing through the hash network is represented by:

[0055]

[0056] Where W h The weight matrix of the wide hash network BH, i.e. the hash mapping matrix, consists of r hash functions, i.e. r column vectors. Therefore, the resulting binary hash code matrix consists of n rows of r-bit hash codes, and B is represented as follows:

[0057]

[0058] In the formula, B i Represents X i The hash code B obtained by first mapping to the full feature layer and then hashing should be as close to the ideal hash code U as possible; therefore, when constructing a wide hash network, the value of the ideal hash code U is used as the hash layer of the wide hash network;

[0059] Step 3 (iii) Calculate the width hash network weight matrix W h The purpose of the width hashing network weight is to learn the training sample data feature vector X i Its corresponding hash code U i In order to reduce the quantization loss that occurs when hashing from high-dimensional space to binary Hamming space for training, that is, to minimize the quantization loss caused by sign() to maintain the original local features of the data, the loss function is established as follows:

[0060]

[0061] In the formula, λ represents a regularization parameter, argmin Wh Represents the solution of W h Make the expression minimum. Based on the ridge regression theory, the width hash weight matrix W h The solution calculation formula is as follows:

[0062]

[0063] In the formula, I is the unit matrix, and the width hashing network constructed at this time is called the basic width hashing network.

[0064] Step 4: Build a hash learning model based on the twin neural network to generate a hash code with high semantic consistency. The specific steps include:

[0065] Step 4 (a) Create positive and negative sample pairs of image samples through the data preprocessing module. Specifically, the images in the data set are labeled as similar or dissimilar. A positive sample pair represents a high similarity between two images, while a negative sample pair represents a low similarity between two images. Select a pair of images from the data set and regard them as a sample pair. Different images from the same reference point are regarded as positive sample pairs, and different images from different reference points are regarded as negative sample pairs. Y represents the similarity between positive and negative sample pairs. If images X1 and X2 are a positive sample pair, then Y=1, and the label of the sample pair is set to (X1, X2, 1), otherwise it is (X1, X2, 0). The division of sample pairs not only simplifies the model and reduces data requirements, but also improves the performance and generalization ability of the model, which can ensure that useful features are learned and similar and dissimilar images are distinguished.

[0066] Step 4 (ii), input positive and negative sample pairs, and use the width hash learning network as two branches of the twin neural network. The twin neural network is a network framework, and its main feature is that it contains two completely identical network channels with shared structure, weights and biases. This channel can be a convolutional neural network or a pre-trained network. The present invention uses the width hash network constructed in step 3. The divided positive and negative sample pairs are respectively input into two completely identical width hash networks. By training the comparison loss function, the distance between the hash codes output by the positive sample pair is shortened, and the distance between the hash codes output by the negative sample pair is extended, so as to improve the intra-group correlation and inter-group mutual exclusivity, and obtain a hash code with high semantic consistency.

[0067] Step 4 (iii) Generate a hash code with high semantic consistency through loss function training to achieve efficient image retrieval and visual location recognition. Let L be a sample set, and our goal is to find a suitable mapping function H to transform sample I n Projection to k-bit hash code b n In the process of extracting the original sample, the similarity of the original sample is maintained. Considering the intra-group correlation and inter-group mutual exclusivity of the hash code, the objective function proposed in the present invention uses the approximate contrast loss form to avoid the collapse situation. The objective function can be defined as:

[0068]

[0069] In the formula, L1 is the contrast constraint term, H d (·,·) are two hash codes b i ,b j The Hamming distance between them is , and m is the boundary threshold parameter. In order to make full use of the category-level semantic information to enhance the intra-group correlation and inter-group mutual exclusivity of the hash code, more potential semantic information can be utilized through point-by-point label information, and the above objective function is redefined as:

[0070]

[0071] Where λ is the trade-off parameter, L i , L j For sample I i ,I j The intra-group correlation enhancement term, y i and j Sample I i and I j point-wise marking information; σ is a nonlinear function, i.e., tanh function, sigmoid function or softmax function; W i , W j For sample I i ,I jThe weight parameters of the nonlinear function can be learned by the optimizer.

[0072] Step 5: Input the hash codes of the online image and the offline image, implement image retrieval of the online image through the Hamming distance, and take the RP corresponding to the offline image as the result of image position recognition.

Claims

1. An image position recognition method based on twin width hashing network, characterized in that The following steps are involved: Step 1: Deploy 48 reference points (Access Point, AP) with known locations in the corridors and offices of Chongqing University of Posts and Telecommunications, denoted as AP1, L, AP m , the jth AP is denoted as AP j (j≤m, j is an integer), and mark the corresponding global coordinate information on each image. Step 2: Use a handheld camera to take a certain number of images at each reference point, including 45° downward, horizontal, and 45° upward. These images are used to build an image database, of which 80% of the images are used as training sets, 10% of the images are used as validation sets, and 10% of the images are used as test sets. All training images and test images have a resolution of 640*480 pixels. Step 3: Build a wide hash network to improve the efficiency of hash network training. Step 4: Build a hash learning model based on the twin neural network to generate hash codes with high semantic consistency. Step 5: Input the hash codes of the online image and the offline image, implement image retrieval of the online image through the Hamming distance, and use the RP corresponding to the offline image as the result of image position recognition.

2. The image position recognition method based on twin width hashing network according to claim 1 is characterized in that The step three comprises the following steps: Step 3: Build a wide hash network to improve the hash network training efficiency. Figure 3 shows the hash learning network framework, which includes the following steps: Step 3 (a) constructs the full feature layer of the wide hash network, which consists of a shallow mapping layer and an enhancement layer. When data arrives from the input layer, the shallow mapping layer nodes are first extracted, and the feature vector set X is mapped α times, and each mapping generates α nodes. The specific mapping process is shown as follows: S i =f(XW si +b si ),i=1,2,...,a (1) In the formula, S i represents a set of nodes obtained by mapping the feature vector X for the i-th time, W si represents the randomly generated weight of the i-th mapping, β si represents the deviation of the randomly generated i-th mapping, f represents the activation function that maps the vector from the input layer to the shallow mapping layer; the α groups of nodes (i.e., α×α nodes) obtained by α mappings are merged into a shallow mapping layer, denoted as S α =[S1,S2,...,S α ]. In order to obtain richer semantic information, the group a nodes of the shallow mapping layer are remapped to the enhancement layer to obtain enhanced nodes. The specific enhancement process is as follows: E j =g(S α W ej +b ej ),j=1,2,...,c (2) In the formula, E j represents a set of nodes obtained by the jth mapping of the shallow mapping layer, with a total of c mappings, W ej represents the weight of the randomly generated j-th mapping, β ej represents the deviation of the randomly generated j-th mapping, g represents the activation function that maps the shallow mapping layer nodes to the enhancement layer; the c groups of nodes obtained by c mappings are merged into the enhancement layer, denoted by E α =[E1,E2,...,E c ]; The shallow mapping layer S α With enhancement layer E c Merge into the full feature layer, denoted as Step 3 (ii) constructs the hash layer B of the wide hash network to learn compact hash codes. The hash layer consists of the hash code corresponding to each vector in X, which is The binary hash code matrix after hashing through the hash network is represented by: Where W h The weight matrix of the wide hash network BH, i.e. the hash mapping matrix, consists of r hash functions, i.e. r column vectors. Therefore, the resulting binary hash code matrix consists of n rows of r-bit hash codes, and B is represented as follows: In the formula, B i Represents X i The hash code B obtained by first mapping to the full feature layer and then hashing should be as close to the ideal hash code U as possible; therefore, when constructing a wide hash network, the value of the ideal hash code U is used as the hash layer of the wide hash network; Step 3 (iii) Calculate the width hash network weight matrix W h The purpose of the width hashing network weight is to learn the training sample data feature vector X i Its corresponding hash code U i In order to reduce the quantization loss caused by hashing from high-dimensional space to binary Hamming space for training, that is, to minimize the quantization loss caused by sign(·) to maintain the original local features of the data, the loss function is established as follows: In the formula, λ represents a regularization parameter, Represents the solution of W h Make the expression minimum. Based on the ridge regression theory, the width hash weight matrix W h The solution calculation formula is as follows: In the formula, I is the unit matrix, and the width hashing network constructed at this time is called the basic width hashing network.

3. The image position recognition method based on twin width hashing network according to claim 1 is characterized in that The step 4 comprises the following steps: Step 4: Build a hash learning model based on the twin neural network to generate a hash code with high semantic consistency. The specific steps include: Step 4 (a) Create positive and negative sample pairs of image samples through the data preprocessing module. Specifically, the images in the data set are labeled as similar or dissimilar. A positive sample pair represents a high similarity between two images, while a negative sample pair represents a low similarity between two images. Select a pair of images from the data set and regard them as a sample pair. Different images from the same reference point are regarded as positive sample pairs, and different images from different reference points are regarded as negative sample pairs. Y represents the similarity between positive and negative sample pairs. If images X1 and X2 are a positive sample pair, then Y=1, and the label of the sample pair is set to (X1, X2, 1), otherwise it is (X1, X2, 0). The division of sample pairs not only simplifies the model and reduces data requirements, but also improves the performance and generalization ability of the model, which can ensure that useful features are learned and similar and dissimilar images are distinguished. Step 4 (ii), input positive and negative sample pairs, and use the width hash learning network as two branches of the twin neural network. The twin neural network is a network framework, and its main feature is that it contains two completely identical network channels with shared structure, weights and biases. This channel can be a convolutional neural network or a pre-trained network. The present invention uses the width hash network constructed in step 3. The divided positive and negative sample pairs are respectively input into two completely identical width hash networks. By training the comparison loss function, the distance between the hash codes output by the positive sample pair is shortened, and the distance between the hash codes output by the negative sample pair is extended, so as to improve the intra-group correlation and inter-group mutual exclusivity, and obtain a hash code with high semantic consistency. Step 4 (iii) Generate a hash code with high semantic consistency through loss function training to achieve efficient image retrieval and visual location recognition. Let L be a sample set, and our goal is to find a suitable mapping function H to transform sample I n Projection to k-bit hash code b n In the process of extracting the original sample, the similarity of the original sample is maintained. Considering the intra-group correlation and inter-group mutual exclusivity of the hash code, the objective function proposed in the present invention uses the approximate contrast loss form to avoid the collapse situation. The objective function can be defined as: In the formula, L1 is the contrast constraint term, H d (·,·) are two hash codes b i ,b j The Hamming distance between them is , and m is the boundary threshold parameter. In order to make full use of the category-level semantic information to enhance the intra-group correlation and inter-group mutual exclusivity of the hash code, more potential semantic information can be utilized through point-by-point label information, and the above objective function is redefined as: Where λ is the trade-off parameter, L i , L j For sample I i ,I j The intra-group correlation enhancement term, y i and j Sample I i and I j point-wise marking information; σ is a nonlinear function, i.e., tanh function, sigmoid function or softmax function; W i , W j For sample I i ,I j The weight parameters of the nonlinear function can be learned by the optimizer.