# US 2021/0342643 A1 · Method, apparatus, and electronic device for training place recognition model

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0342643 A1
- Document ID: US20210342643A1
- Status: Published application
- Kind: A1
- Application number: 17/374,810
- Filed: 2021-07-13
- Published: 2021-11-04
- Earliest claimed: 2019-05-10
- Assignees: Tencent Technology (Shenzhen) Company Limited
- Applicants: Tencent Technology (Shenzhen) Company Limited
- Inventors: Dongdong Bai; Yonggen Ling; Wei Liu
- Web page: https://patentgrep.com/patent/US20210342643A1

## CPC

- G06V 10/454: {Integrating the filters into a hierarchical structure, e.g. convolutional neural networks [CNN]}
- G06F 18/21343: {using decorrelation or non-stationarity, e.g. minimising lagged cross-correlations}
- G06F 18/2135: based on approximation criteria, e.g. principal component analysis
- G06F 18/2148: {characterised by the process organisation or structure, e.g. boosting cascade}
- G06N 3/045: Combinations of networks
- G06N 3/0464: Convolutional networks [CNN, ConvNet]
- G06N 3/0495: Quantised networks; Sparse networks; Compressed networks
- G06N 3/08: Learning methods
- G06N 3/084: Backpropagation, e.g. using gradient descent
- G06N 3/09: Supervised learning
- G06N 20/10: using kernel methods, e.g. support vector machines [SVM]
- G06V 10/7715: {Feature extraction, e.g. by transforming the feature space, e.g. multi-dimensional scaling [MDS]; Mappings, e.g. subspace methods}
- G06V 10/7747: {Organisation of the process, e.g. bagging or boosting}
- G06V 10/82: using neural networks
- G06V: IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

A computer device extracts local features of sample images based on a first part of a convolutional neural network (CNN) model. The sample images comprise a plurality of images taken at the same place. The device; aggregates the local features into feature vectors having a first dimensionality based on a second part of the CNN model. The device obtains compressed representation vectors of the feature vectors based on a third part of the CNN model. The compressed representation vectors have a second dimensionality less than the first dimensionality. The device trains the CNN model, and obtains a trained CNN mode satisfying a preset condition in accordance with the training.

## Claims

### Claim 1

A method for training neural networks, performed by a computer device, the method comprising:
extracting local features of sample images based on a first part of a convolutional neural network (CNN) model, the sample images comprising a plurality of images taken at the same place;
aggregating the local features into feature vectors having a first dimensionality based on a second part of the CNN model;
obtaining compressed representation vectors of the feature vectors based on a third part of the CNN model, the compressed representation vectors having a second dimensionality less than the first dimensionality; and
training the CNN model, including adjusting model parameters of the first, second, and third parts of the CNN model; and
obtaining a trained CNN model satisfying a preset condition in accordance with the training.

### Claim 2 (depends on 1)

The method according to claim 1, wherein training the CNN model comprises minimizing respective distances between the compressed representation vectors.

### Claim 3 (depends on 1)

The method according to claim 1, wherein obtaining the compressed representation vectors further:
projecting the feature vectors onto a unit orthogonal space based on the third part to obtain the compressed representation vectors.

### Claim 4 (depends on 3)

The method according to claim 3, wherein the third part is a fully connected layer in the CNN model that receives the feature vectors, the fully connected layer comprising a quantity of neurons, the quantity being equal to the second dimensionality, a weight matrix of each of the neurons being a unit vector and having the first dimensionality, the weight matrices of the neurons satisfying an orthogonal relationship.

### Claim 5 (depends on 4)

The method according to claim 4, wherein adjusting the model parameters of the first part, the second part, and the third part comprises:
constructing a loss function of the CNN model based on an orthogonal constraint term of the weight matrices, the orthogonal constraint term being obtained based on the weight matrices of the neurons and a known unit vector.

### Claim 6 (depends on 1)

The method according to claim 1, wherein:
the sample images comprise a first image, a plurality of second images taken at the same place as the first image, and a plurality of third images taken at a different place from the first image;
the feature vectors comprise a first feature vector corresponding to the first image, second feature vectors corresponding to the second images, and third feature vectors corresponding to the third images, and
adjusting the model parameters of the first part, the second part, and the third part further comprises:
constructing a loss function of the CNN model based on first distances and second distances, the first distances being distances between the first feature vector and the second feature vectors, and the second distances being distances between the first feature vector and the third feature vectors; and
back propagating the loss function through the CNN model to update the model parameters until the CNN model satisfies a preset convergence condition.

### Claim 7 (depends on 6)

The method according to claim 6, wherein constructing the loss function comprises constructing the loss function as
L
=
∑
j
⁢
l
⁡
(
min
i
⁢
⁢
d
2
⁡
(
q
,
p
i
q
)
+
m
-
d
2
⁡
(
q
,
n
j
q
)
)
wherein L is the loss function, l is a maximum boundary loss, q is the first feature vector, piq is an ith one of the second feature vectors, njq is a jth one of the third feature vectors, m is a boundary constant, d represents vector distance calculation, and min represents minimum value calculation.

### Claim 8 (depends on 1)

The method according to claim 1, wherein extracting the local features of sample images comprises:
extracting the local features of the sample images by using a visual geometry group network (VGGNet) structure.

### Claim 9 (depends on 1)

The method according to claim 1, wherein aggregating the local features into feature vectors comprises:
aggregating the local features into the feature vectors by using a vector of locally aggregated descriptors network (NetVLAD) structure.

### Claim 10

A computer device, comprising:
one or more processors; and
memory storing one or more programs, that, when executed by the one or more processors, cause the one or more processors to perform operations comprising:
extracting local features of sample images based on a first part of a convolutional neural network (CNN) model, the sample images comprising a plurality of images taken at the same place;
aggregating the local features into feature vectors having a first dimensionality based on a second part of the CNN model;
obtaining compressed representation vectors of the feature vectors based on a third part of the CNN model, the compressed representation vectors having a second dimensionality less than the first dimensionality; and
training the CNN model, including adjusting model parameters of the first, second, and third parts of the CNN model; and
obtaining a trained CNN model satisfying a preset condition in accordance with the training.

### Claim 11 (depends on 10)

The computer device according to claim 10, wherein training the CNN model comprises minimizing respective distances between the compressed representation vectors.

### Claim 12 (depends on 10)

The computer device according to claim 10, wherein obtaining the compressed representation vectors further:
projecting the feature vectors onto a unit orthogonal space based on the third part to obtain the compressed representation vectors.

### Claim 13 (depends on 12)

The computer device according to claim 12, wherein the third part is a fully connected layer in the CNN model that receives the feature vectors, the fully connected layer comprising a quantity of neurons, the quantity being equal to the second dimensionality, a weight matrix of each of the neurons being a unit vector and having the first dimensionality, the weight matrices of the neurons satisfying an orthogonal relationship.

### Claim 14 (depends on 13)

The computer device according to claim 13, wherein adjusting the model parameters of the first part, the second part, and the third part comprises:
constructing a loss function of the CNN model based on an orthogonal constraint term of the weight matrices, the orthogonal constraint term being obtained based on the weight matrices of the neurons and a known unit vector.

### Claim 15 (depends on 10)

The computer device according to claim 10, wherein:
the sample images comprise a first image, a plurality of second images taken at the same place as the first image, and a plurality of third images taken at a different place from the first image;
the feature vectors comprise a first feature vector corresponding to the first image, second feature vectors corresponding to the second images, and third feature vectors corresponding to the third images, and
adjusting the model parameters of the first part, the second part, and the third part further comprises:
constructing a loss function of the CNN model based on first distances and second distances, the first distances being distances between the first feature vector and the second feature vectors, and the second distances being distances between the first feature vector and the third feature vectors; and
back propagating the loss function through the CNN model to update the model parameters until the CNN model satisfies a preset convergence condition.

### Claim 16 (depends on 15)

The computer device according to claim 15, wherein constructing the loss function comprises constructing the loss function as
L
=
∑
j
⁢
l
⁡
(
min
i
⁢
⁢
d
2
⁡
(
q
,
p
i
q
)
+
m
-
d
2
⁡
(
q
,
n
j
q
)
)
wherein L is the loss function, l is a maximum boundary loss, q is the first feature vector, piq is an ith one of the second feature vectors, njq is a jth one of the third feature vectors, m is a boundary constant, d represents vector distance calculation, and min represents minimum value calculation.

### Claim 17

A non-transitory computer readable storage medium storing instructions that, when executed by one or more processors of a computer device, cause the one or more processors to perform operations comprising:
extracting local features of sample images based on a first part of a convolutional neural network (CNN) model, the sample images comprising a plurality of images taken at the same place;
aggregating the local features into feature vectors having a first dimensionality based on a second part of the CNN model;
obtaining compressed representation vectors of the feature vectors based on a third part of the CNN model, the compressed representation vectors having a second dimensionality less than the first dimensionality; and
training the CNN model, including adjusting model parameters of the first, second, and third parts of the CNN model; and
obtaining a trained CNN model satisfying a preset condition in accordance with the training.

### Claim 18 (depends on 17)

The non-transitory computer readable storage medium according to claim 17, wherein training the CNN model comprises minimizing respective distances between the compressed representation vectors.

### Claim 19 (depends on 17)

The non-transitory computer readable storage medium according to claim 17, wherein obtaining the compressed representation vectors further:
projecting the feature vectors onto a unit orthogonal space based on the third part to obtain the compressed representation vectors.

### Claim 20 (depends on 19)

The non-transitory computer readable storage medium according to claim 19, wherein the third part is a fully connected layer in the CNN model that receives the feature vectors, the fully connected layer comprising a quantity of neurons, the quantity being equal to the second dimensionality, a weight matrix of each of the neurons being a unit vector and having the first dimensionality, the weight matrices of the neurons satisfying an orthogonal relationship.
