Patent Description:
The output of each hidden layer is used as input to one or more other layers in the network, e.g., the next hidden layer, the output layer, or both.

Convolutional neural networks are neural networks that include one or more convolutional layers. Convolutional layers are generally sparsely-connected neural network layers. That is, each node in a convolutional layer receives an input from a portion of, i.e., less than all of, the nodes in the preceding neural network layer or, if the convolutional layer is the lowest layer in the sequence, a portion of an input to the neural network, and produces an activation from the input. Generally, convolutional layers have nodes that produce an activation by convolving received inputs in accordance with a set of weights for each node. In some cases, nodes in a convolutional layer may be configured to share weights. That is, all of or a portion of the nodes in the layer may be constrained to always have the same weight values as the other nodes in the layer. Convolutional layers are generally considered to be well-suited for processing images because of their ability to extract features from an input image that depend on the relative location of the pixel data in the input image. <NPL> describes a triplet sampling algorithm to learn models with distributed asynchronised stochastic gradient.

In general, one innovative aspect of the subject matter described in this specification can be embodied in methods that include the actions of obtaining a plurality of training images, wherein the training images have been classified as images of objects of a particular object type; generating a plurality of triplets of training images, wherein each of the triplets comprises a respective anchor image, a respective positive image, and a respective negative image, and wherein, for each triplet, the anchor image and the positive image have both been classified as images of the same object of the particular object type and the negative image has been classified as an image of a different object of the particular object type; and training a neural network on each of the triplets to determine trained values of a plurality of parameters of the neural network, wherein the neural network is configured to receive an input image of an object of the particular object type and to process the input image to generate a numeric embedding of the input image, wherein training the neural network comprises, for each of the triplets: processing the anchor image in the triplet using the neural network in accordance with current values of the parameters of the neural network to generate a numeric embedding of the anchor image; processing the positive image in the triplet using the neural network in accordance with the current values of the parameters of the neural network to generate a numeric embedding of the positive image; processing the negative image in the triplet using the neural network in accordance with the current values of the parameters of the neural network to generate a numeric embedding of the negative image; computing a triplet loss from the numeric embedding of the anchor image, the positive image, and the negative image; and adjusting the current values of the parameters of the neural network using the triplet loss.

The foregoing and other embodiments can each optionally include one or more of the following features, alone or in combination.

The particular object type may be faces of people.

The neural network may be a deep convolutional neural network.

The neural network may be configured to generate a vector of floating point values for the input image.

The method may comprise using the vector of floating point values as the numeric embedding of the input image.

The method may comprise normalizing the vector of floating point values to generate a normalized vector; and using the normalized vector as the numeric embedding of the input image.

The method may comprise normalizing the vector of floating point values to generate a normalized vector; quantizing the normalized vector to generate a quantized vector; and using the quantized vector as the numeric embedding of the input image.

Adjusting the current values of the parameters may comprise adjusting the current values of the parameters to minimize the triplet loss.

The triplet loss may satisfy, for each of the triplets: <MAT> wherein f(xa) is the numeric embedding of the anchor image in the triplet, f(xp) is the numeric embedding of the positive image in the triplet, f(xn) is the numeric embedding of the negative image in the triplet, and α is a predetermined value.

The method may further comprise receiving a first image and a second image; processing the first image using the neural network in accordance with the trained values of the parameters of the neural network to determine a numeric embedding of the first image; processing the second image using the neural network in accordance with the trained values of the parameters of the neural network to determine a numeric embedding of the second image; and determining whether the first image and the second image are images of the same object from a distance between the numeric embedding of the first image and the numeric embedding of the second image.

The method may further comprise processing each of a plurality of images using the neural network in accordance with the trained values of the parameters of the neural network to determine a respective numeric embedding of each of the plurality of images; receiving a new image; processing the new image using the neural network in accordance with the trained values of the parameters of the neural network to determine a numeric embedding of the new image; and classifying the new image as being an image of the same object as one or more of the plurality of images from distances between the numeric embedding of the new image and numeric embeddings of images from the plurality of images.

The method may further comprise processing each of a plurality of images using the neural network in accordance with the trained values of the parameters of the neural network to determine a respective numeric embedding of each of the plurality of images; clustering the numeric embedding of the plurality of images into a plurality of clusters; and for each cluster, classifying the images having numeric embeddings that are in the cluster as being images of the same object.

Numeric embeddings of objects of a particular object type, e.g., faces of people, can be effectively generated such that the distance between the numeric embeddings of all images of a particular object, independent of imaging conditions, is small, whereas the distance between the numeric embeddings of a pair of images of different objects is large. The numeric embeddings can be generated by training a deep convolutional network to directly optimize the embedding itself, rather than an intermediate bottleneck layer. Triplets used in training the neural network can be effectively selected to decrease training time and improve the accuracy of the embeddings generated by the trained neural network.

<FIG> shows an example numeric embedding system <NUM>. The numeric embedding system <NUM> is an example of a system implemented as computer programs on one or more computers in one or more locations, in which the systems, components, and techniques described below can be implemented.

The numeric embedding system <NUM> generates numeric embeddings of input images by processing each image using a neural network <NUM>. The input images are images of objects from a particular object type. For example, the particular object type may be faces of people. Thus, in this example, each input image is an image of the face of a person. The numeric embedding of an input image is a numeric representation of the input image, e.g., a Euclidean embedding of the input image.

The neural network <NUM> is a neural network having multiple parameters, e.g., a deep convolutional neural network, that is configured to receive an input image and to process the input image to generate a fixed-dimensionality vector of numeric values, e.g., of floating point values. An example deep convolutional neural network that can generate such a vector is described in more detail in <NPL>. Another example deep convolutional neural network that can generate such a vector is described in more detail in <NPL>.

The numeric embedding system <NUM> can receive an input image <NUM> and process the input image <NUM> using the neural network <NUM> to generate an output vector <NUM>. In some implementations, the numeric embedding system <NUM> treats the output vector <NUM> as a numeric embedding <NUM> of the input image <NUM>. In some other implementations, the numeric embedding system <NUM> normalizes, quantizes, or both, the output vector <NUM> and treats the normalized, quantized or both vector as the numeric embedding <NUM> of the input image <NUM>.

In order to accurately generate numeric embeddings of input images, the numeric embedding system <NUM> trains the neural network <NUM> on training images to determine trained values of the parameters of the neural network <NUM>. The training images are images that have been classified as being images of objects of the particular object type. For example, if the particular object type is faces of people, the training images can include images of the faces of many different people. Training the neural network <NUM> on the training images is described in more detail below with reference to <FIG>.

Once the neural network <NUM> has been trained, the numeric embeddings generated by the numeric embedding system <NUM> can be used in various image processing tasks.

For example, the numeric embeddings can be used for an image verification task. In this example, the numeric embedding system <NUM> receives two input images of objects of the particular object type. The numeric embedding system <NUM> processes each of the input images using the neural network <NUM> in order to generate a respective numeric embedding of each of the two images. The numeric embedding system <NUM> then compares the numeric embeddings of the two images to determine whether the two images are of the same object. For example, the numeric embedding system <NUM> may determine that the two images are of the same object when the distance between the numeric embeddings of the two images is less than a threshold distance.

As another example, the numeric embeddings can be used for an image recognition task. In this example, the numeric embedding system <NUM> processes each image in a set of multiple images of objects of the particular object type using the neural network <NUM> to determine a respective numeric embedding of each of the images. The numeric embedding system <NUM> then receives a new image and processes the new image using the neural network <NUM> to determine a numeric embedding of the new image. The numeric embedding system <NUM> then determines whether the new image is an image of the same object as any of the images in the set of multiple images by comparing the numeric embedding of the new image with the numeric embeddings of the images in the set of images. For example, the numeric embedding system <NUM> can determine that the new image is an image of the same object as another image in the set of images if the distance between the numeric embedding of the new image and the numeric embedding of the other image is less than a threshold distance.

As another example, the numeric embeddings can be used for an image clustering task. In this example, the numeric embedding system <NUM> processes each image in a set of multiple images of objects of the particular object type using the neural network <NUM> to determine a respective numeric embedding of each of the images. The numeric embedding system <NUM> then clusters the numeric embeddings into multiple clusters, e.g., using a conventional clustering technique. The numeric embedding system <NUM> then determines, for each cluster, that the images whose embeddings are in the cluster are images of the same object and, optionally, that two images whose embeddings are in different clusters are images of different objects.

<FIG> is a flow diagram of an example process <NUM> for training a neural network to generate numeric embeddings. For convenience, the process <NUM> will be described as being performed by a system of one or more computers located in one or more locations. For example, a numeric embedding system, e.g., the numeric embedding system <NUM> of <FIG>, appropriately programmed, can perform the process <NUM>.

The system receives a set of training images (step <NUM>). The training images in the set of training images are images that have been classified as being images of objects from the particular object type. For example, when the particular object type is faces, the training images are various images that have been classified as being images of the faces of various people.

The system generates a set of triplets from the set of training images (step <NUM>). Each triplet includes a respective anchor image, a respective positive image, and a respective negative image. In particular, for each triplet, the anchor image and the positive image are images that have both been classified as being images of the same object of the particular object type, e.g., as images of the face of the same person. The negative image is an image that has been classified as being an image of a different object of the particular object type from the anchor image and the positive image, e.g., an image of the face of a different person.

The system trains the neural network on each of the triplets to determine trained values of the parameters of the neural network (step <NUM>). The system trains the neural network on the triplets to adjust the values of the parameters of the neural network so that the distance between the numeric embeddings of all images of a particular object is small, whereas the distance between the numeric embeddings of a pair of images of different objects is large. Training the neural network on a triplet is described below with reference to <FIG>.

<FIG> is a flow diagram of an example process <NUM> for training a neural network on a triplet. For convenience, the process <NUM> will be described as being performed by a system of one or more computers located in one or more locations. For example, a numeric embedding system, e.g., the numeric embedding system <NUM> of <FIG>, appropriately programmed, can perform the process <NUM>.

The system processes the anchor image in the triplet using the neural network in accordance with current values of the parameters of the neural network to generate a numeric embedding of the anchor image (step <NUM>).

The system processes the positive image in the triplet using the neural network in accordance with the current values of the parameters of the neural network to generate a numeric embedding of the positive image (step <NUM>).

The system processes the negative image in the triplet using the neural network in accordance with the current values of the parameters of the neural network to generate a numeric embedding of the negative image (step <NUM>).

The system computes a triplet loss from the numeric embedding of the anchor image, the positive image, and the negative image (step <NUM>). Generally, the triplet loss depends on the distance between the numeric embedding of the anchor image and the numeric embedding of the positive image and on the distance between the numeric embedding of the anchor image and the numeric embedding of the negative image.

For example, in some implementations, the triplet loss L satisfies: <MAT> where f(xa) is the numeric embedding of the anchor image in the triplet, f(xp) is the numeric embedding of the positive image in the triplet, f(xn) is the numeric embedding of the negative image in the triplet, and α is a predetermined value greater than or equal to <NUM>. Thus, the triplet loss is expressed such that it is minimized when an image of a specific object has an embedding that is closer to the embeddings of all other images of the specific object than it is to the embedding of any other image of any other object, with a margin between positive and negative pairs of at least α.

The system adjusts the current values of the parameters of the neural network using the triplet loss (step <NUM>). That is, the system adjusts the current values of the parameters of the neural network to minimize the triplet loss. The system can adjust the current values of the parameters of the neural network using conventional neural network training techniques, e.g., stochastic gradient descent with backpropagation.

In some implementations, the set of triplets is the complete set of triplets to be used in training the neural network. In some other implementations, the system receives multiple batches of training images and, for each batch, generates a set of triplets from the training images in the batch and trains the neural network on the set of triplets as described above.

The system can generate a set of triplets from a batch of training images in any of variety of ways. Generally, the system processes each training image using the neural network to generate a respective numeric embedding of each image in accordance with the current values of the parameters of the neural network.

In some implementations, for a given image of a given object, the system generates a triplet with the given image as the anchor image, the image of the given object having the numeric embedding that is the farthest from the numeric embedding from the given image among all of the images of the given object in the batch as the positive image, and an image of an object different from the given object having the numeric embedding that is the closest to the numeric embedding of the given image among all of the images of objects other than the given object in the batch as the negative image.

In some other implementations, the system generates multiple triplets with the given image as the anchor image and the image of an object different from the given object having the numeric embedding that is the closest from the numeric embedding from the given image among all of the images of objects other than the given object in the batch as the negative image. That is, the system generates multiple triplets, each having the same anchor image and the same negative image, but with each having a different positive image.

In yet other implementations, the system generates multiple triplets with the given image as the anchor image by generating triplets such that the negative image in the triplet has a numeric embedding that is the closest to the numeric embedding of the given image among all of the possible negative images in the batch, i.e., all images in the batch that are of objects different from the given object, that have numeric embeddings that are farther from the numeric embedding of the given image than the numeric embedding of the positive image in the triplet is from the numeric embedding of the given image.

Embodiments of the subject matter described in this specification can be implemented as one or more computer programs, i.e., one or more modules of computer program instructions encoded on a tangible non transitory program carrier for execution by, or to control the operation of, data processing apparatus. The computer storage medium is not, however, a propagated signal.

While operations are depicted in the drawings in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order, or that all illustrated operations be performed, to achieve desirable results.

Claim 1:
A computer-implemented method for training a neural network (<NUM>) to process images, comprising:
obtaining a plurality of training images (<NUM>) that include an anchor image being an image of a first object of a first object type, a positive image that differs from the anchor image and shows the first object, and a negative image being an image of a second object of the first object type, wherein the first object differs from the second object; and training the neural network on the plurality of training images (<NUM>, <NUM>) to determine numeric embeddings of images;
processing each of a plurality of images (<NUM>) using the neural network (<NUM>) in accordance with the trained neural network to determine a respective numeric embedding (<NUM>) of each of the plurality of images;
clustering the numeric embeddings of the plurality of images into a plurality of clusters; and for each cluster, classifying the images having numeric embeddings that are in the cluster as being images of the same object.