# US 2022/0292348 A1 · Distance-based pairs generation for training metric neural networks

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

- Number: US 2022/0292348 A1
- Document ID: US20220292348A1
- Status: Published application
- Kind: A1
- Application number: 17/495,642
- Filed: 2021-10-06
- Published: 2022-09-15
- Earliest claimed: 2021-03-15
- Assignees: Smart Engines Service, LLC
- Applicants: Smart Engines Service, LLC
- Inventors: Ivan Vladimirovich KONDRASHEV; Alexander Vladimirovich SHESHKUS; Vladimir Viktorovich ARLAZAROV
- Web page: https://patentgrep.com/patent/US20220292348A1

## CPC

- G06N 3/08: Learning methods
- G06N 3/084: Backpropagation, e.g. using gradient descent
- G06F 17/16: Matrix or vector computation {, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization (matrix transposition G06F7/78)}
- G06N 3/0464: Convolutional networks [CNN, ConvNet]
- G06N 3/09: Supervised learning
- G06N 3/045: Combinations of networks
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Distance-based pairs generation for training metric neural networks. In an embodiment, a training batch is generated by generating a vector of distances between pairs of elements of different classes, sorting the vector, splitting the vector into blocks, assigning a coefficient to each block, and selecting pairs from the blocks based on the assigned coefficients. The training batch can then be used to train a metric neural network.

## Claims

### Claim 1

A method comprising using at least one hardware processor to, over one or more iterations:
generate a training batch comprising a plurality of pairs of elements from source data, wherein each pair of elements in at least a subset of the plurality of pairs of elements comprises two elements of different classes in a plurality of classes, and wherein generating the training batch comprises
generating a vector of distances between pairs of elements of potentially different classes in the source data,
sorting the vector of distances,
splitting the vector of distances into a plurality of blocks,
assigning a coefficient to each of the plurality of blocks, and
selecting pairs from the plurality of blocks based on the assigned coefficients; and
train a metric neural network using the training batch.

### Claim 2 (depends on 1)

The method of claim 1, wherein the vector of distances is split into K blocks, and wherein assigning a coefficient to each of the plurality of blocks comprises:
selecting a main block at a position m within the K blocks; and
assigning a coefficient C to each block at position k in the K blocks according to
C
⁡
(
k
)
=
{
1
-
(
m
-
k
)
*
back
,
k
<
m
1
,
k
=
m
1
-
(
k
-
m
)
*
f
⁢
o
⁢
r
⁢
w
,
k
>
m
wherein ƒ orw is a coefficient indicating a forward step from the position m of the main block, and back is a coefficient indicating a backward step from the position m of the main block.

### Claim 3 (depends on 2)

The method of claim 2, wherein assigning a coefficient to each of the plurality of blocks further comprises normalizing each coefficient C using softmax.

### Claim 4 (depends on 3)

The method of claim 3, wherein assigning a coefficient to each of the plurality of blocks further comprises multiplying each coefficient C by a number of pairs set for a current one of the one or more iterations.

### Claim 5 (depends on 4)

The method of claim 4, wherein selecting pairs from the plurality of blocks based on the assigned coefficients comprises selecting a number of pairs Ppairs from each block k according to:
P
pairs
(
k
)
=
e
C
⁡
(
k
)
Σ
K
i
=
1
⁢
e
C
⁡
(
i
)
*
l
i
⁢
m
⁢
p
wherein limp is the number of pairs set for the current iteration, and wherein e is an exponential constant.

### Claim 6 (depends on 1)

The method of claim 1, wherein the one or more iterations are a plurality of iterations.

### Claim 7 (depends on 6)

The method of claim 6, wherein the plurality of iterations overlap in time, such that the generation of training batches and the training of the metric neural network are performed in parallel.

### Claim 8

A system comprising:
at least one hardware processor; and
one or more software modules that are configured to, when executed by the at least one hardware processor,
generate a training batch comprising a plurality of pairs of elements from source data, wherein each pair of elements in at least a subset of the plurality of pairs of elements comprises two elements of different classes in a plurality of classes, and wherein generating the training batch comprises
generating a vector of distances between pairs of elements of potentially different classes in the source data,
sorting the vector of distances,
splitting the vector of distances into a plurality of blocks,
assigning a coefficient to each of the plurality of blocks, and
selecting pairs from the plurality of blocks based on the assigned coefficients, and
train a metric neural network using the training batch.

### Claim 9

A non-transitory computer-readable medium having instructions stored thereon, wherein the instructions, when executed by a processor, cause the processor to:
generate a training batch comprising a plurality of pairs of elements from source data, wherein each pair of elements in at least a subset of the plurality of pairs of elements comprises two elements of different classes in a plurality of classes, and wherein generating the training batch comprises
generating a vector of distances between pairs of elements of potentially different classes in the source data,
sorting the vector of distances,
splitting the vector of distances into a plurality of blocks,
assigning a coefficient to each of the plurality of blocks, and
selecting pairs from the plurality of blocks based on the assigned coefficients; and
train a metric neural network using the training batch.
