Cross-transformer neural network system for few-shot similarity determination and classification

The neural network system addresses the challenge of recognizing unseen categories by generating embeddings and prototypes through attention maps, enhancing recognition accuracy and reducing resource demands.

JP2024153621AActive Publication Date: 2024-10-29ジーディーエム·ホールディング·エルエルシー
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
JP2024102341
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2020-06-16
Filing Date
2024-06-25
Publication Date
2024-10-29
Estimated Expiration
2041-06-07

AI Technical Summary

Technical Problem

Existing neural networks struggle to recognize data items from categories not seen during training without requiring retraining, especially when only a limited number of examples are available, leading to inefficiencies in memory, storage, and processing requirements.

Method used

A neural network system that generates key and value embeddings for query and support data items, uses attention maps to determine similarities, and aggregates embeddings to form prototypes, allowing recognition of novel categories without retraining, using a mechanism that includes self-supervised learning through transformed training episodes.

Benefits of technology

Enables accurate recognition of unseen categories with fewer supporting data items, reducing memory and processing requirements while improving comparison efficiency and generalizability, thus overcoming the limitations of conventional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024153621000001_ABST
    Figure 2024153621000001_ABST
Patent Text Reader

Abstract

To provide a neural network system for determining a similarity measure between a query data item and a set of support data items.SOLUTION: A neural network system receives a query data item and acquires a support set including a support key embedding and a support value embedding. A key embedding neural network subsystem for generation of key embedding is used to generate a query key embedding for the query data item. Further, an attention map is generated based on the similarity between the query key embedding and the support key embedding for the supporting data item. A value embedding neural network subsystem is used to generate a query value embedding for the query data item, and a similarity measure of similarity scale between the query data item and the support set is determined based on the attention map, the support value embedding, and the query value embedding.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS This application claims priority to U.S. Provisional Application No. 63 / 035,469, filed June 5, 2020, and No. 63 / 039,748, filed June 16, 2020. The disclosures of the prior applications are considered part of the disclosure of this application and are incorporated by reference into the disclosure of this application.

[0002] This document relates to a neural network system for few-shot similarity determination and classification. [Background technology]

[0003] A neural network is a machine learning model that uses one or more layers of nonlinear units to predict the output of a received input. Some neural networks contain one or more hidden layers in addition to an output layer. The output of each hidden layer is used as the input to the next layer in the network, i.e. the next hidden layer or the output layer. Each layer of the network generates an output from the received input according to the current values ​​of its respective set of parameters.

[0004] Some neural networks are recurrent neural networks. A recurrent neural network is a neural network that receives an input sequence and generates an output sequence from the input sequence. In particular, a recurrent neural network can use some or all of the internal state of the network from a previous time step in computing an output at a current time step. An example of a recurrent neural network is a long short-term memory (LSTM) neural network that includes one or more LSTM memory blocks. Each LSTM memory block can include one or more cells that each include an input gate, a forget gate, and an output gate that enable the cell to remember a previous state of the cell, for example, for use in generating a current activation or to be provided to other components of the LSTM neural network. [Prior art documents] [Non-patent literature]

[0005] [Non-Patent Document 1] He et al., "Deep Residual Learning for Image Recognition," arXiv:1512.03385, available at https: / / arxiv.org / abs / 1512.03385. [Non-Patent Document 2] Triantafillou et al., "Meta-Dataset: A Dataset of Datasets for Learning to Learn from Few Examples," arXiv:1903.03096, available at https: / / arxiv.org / abs / 1903.03096. Summary of the Invention [Means for solving the problem]

[0006] The present specification describes a system comprising one or more computers and one or more storage devices storing instructions that, when executed by the one or more computers, cause the one or more computers to implement a neural network system for determining a similarity measure between a query data item and a set of supporting data items. The neural network system is particularly suited for use in "few-shot" applications where only a limited number of examples of certain categories are available and the neural network system must be able to recognize data items from these categories based on the limited number of example data items. The exemplary data items may be referred to as the supporting set and the recognized data items may be referred to as the query data items. The neural network system described herein is capable of recognizing query data items in categories not seen during training and does not require retraining to recognize query data items in these novel categories. Rather, the neural network system provides an improved mechanism for determining similarity between query data items and supporting data items. Furthermore, the neural network system is trained to provide a representation of data items that is more generally applicable to all data items and can more easily transition to novel categories.

[0007] In an implementation, the following operations may be performed by one or more computers implementing a neural network system: A query data item may be received. A support set of one or more supporting data items may be obtained, comprising a supporting key embedding and a supporting value embedding for each supporting data item in the support set. A query key embedding for the query data item may be generated using a key embedding neural network subsystem configured to process the data items to generate a key embedding. An attention map may be generated based on a similarity between the query key embedding and the supporting key embedding for each supporting data item. A query value embedding may be generated for the query data item using a value embedding neural network subsystem configured to process the data items to generate a value embedding. A similarity measure between the query data item and the support set may be determined based on the attention map, the supporting value embedding for each supporting data item, and the query value embedding.

[0008] The key-value embedding may be a representation of the query data items and the supporting data items that allows for easier comparison of features of the query data items and the supporting data items. Thus, the similarity between the query key embedding and the supporting key embedding for each supporting data item may indicate whether a particular feature of the query data item is present in the supporting data items.

[0009] The attention map may be used to guide the system as to which parts of the supporting data items may be important for determining similarity between the query data item and the supporting data items.

[0010] The supporting key embeddings may be generated using a key embedding neural network subsystem. The supporting value embeddings may be generated using a value embedding neural network. That is, the same key embedding neural network subsystem may be used to generate the key embeddings of the query data items and the supporting data items, and similarly, the same value embedding neural network may be used to generate the value embeddings. In this way, both the query data items and the supporting data items are represented in the same feature space for comparison.

[0011] To improve efficiency, the supporting key embeddings and supporting value embeddings may be generated once and stored in a cache or other data store for future retrieval whenever new query data items are processed, or the supporting key embeddings and supporting value embeddings may be generated outside the system and provided to the system as needed.

[0012] The support data items may be associated with one or more categories. The support set may comprise support data items associated with a corresponding one or more of the multiple categories. In particular, each of the data support items may be associated with a corresponding one of the categories. Each support item may be associated with a label indicating which of the categories it is associated with, for example, a particular support item may be labeled with a first category to indicate that it is associated with that category. As mentioned above, the multiple categories may be categories that were not part of the training data set used to train the neural network system, and the number of support data items associated with each category in the support set may be limited. The query data items may be classified based on the similarity measure determined for each respective category.

[0013] The support value embeddings may be weighted based on the attention map. To generate a prototype for each category associated with the support set, the weighted support value embeddings of the support data items associated with the same category may be aggregated. That is, the weighted support value embeddings corresponding to the support data items labeled with the first category may be aggregated to form a prototype for the first category. The weighted support value embeddings corresponding to the support data items labeled with the second category may be aggregated to form a prototype for the second category, and so on for further categories.

[0014] The aggregation may be a sum, an average, or other suitable aggregation function. The aggregation may be such that a particular position in the prototype indicates whether the feature at the corresponding position in the query data item or query key embedding is present in the supporting data items or supporting key embeddings associated with the prototype category.

[0015] Determining the similarity measure may comprise determining a similarity measure between the query value embedding and the prototype. The similarity measure may be based on a distance between the query value embedding and the prototype. The distance may be based on Euclidean distance. Alternatively, other distances such as cosine distance may be used as appropriate. The distance may indicate the likelihood that the query data item belongs to a particular category of the support set. The distance or other similarity measure may be used as a logit of a softmax function for classification. Alternatively, a classifier such as a neural network-based classifier may be used to perform the classification. The classifier may perform the classification based on the query value embedding and the prototypes of each category, or other suitable combination of inputs.

[0016] The similarity between the query key embedding and the supporting key embedding for each supporting data item may be based on a dot product. For example, elements at corresponding positions in the embedding may be multiplied together. As mentioned above, the similarity between the query key embedding and the supporting key embedding for each supporting data item may be based on a similarity between features of the query key embedding and respective features of the supporting key embedding. The features may be spatial features. For example, regions of an image.

[0017] It should be understood that the similarity between the query key embedding and the supporting key embedding for each supporting data item may not require normalization or a normalization constant in the similarity calculation. For example, the similarity calculation may be a dot product between the query key embedding and the supporting key embedding. The result of the dot product may be normalized based on the L-2 norm of the query and the supporting key embedding. The L-2 norm may be considered as a normalization constant (or a scaling constant). However, such a normalization constant may not be necessary. By using raw (unscaled) similarity values, the attention map may exhibit sharper peaks, which helps to improve the accuracy of the similarity determination. Thus, the attention map may be generated based on an unscaled similarity measure between the query key embedding and the supporting key embedding for each supporting data item.

[0018] The attention map may be generated based on a softmax function that receives the similarity between the query key embedding and the supporting key embedding for each supporting data item of the same category. That is, the similarity of the supporting data items of the first category may be input into the softmax function to normalize the similarity value across the first category. The softmax function may further comprise a temperature parameter.

[0019] The key embedding neural network subsystem and / or the value embedding subsystem may each include a linear output layer. The key embedding neural network subsystem and / or the value embedding subsystem may each include a convolutional layer. The key embedding neural network subsystem and the value embedding neural network subsystem may share some of the same neural network layers. For example, both neural network subsystems may share an initial ResNet type neural network structure and place a separate linear output layer on top of the ResNet structure to generate the key embedding and the value embedding.

[0020] The query data items and the supporting data items may be images. The categories associated with the supporting data items may be categories of objects present in the images. Thus, the system may be used for object recognition. The system may also be used for other tasks such as object detection and segmentation. The data items may be video data. The categories may be actions being performed in the video data. The data items may be audio utterances and the system may be used for speech recognition.

[0021] In one exemplary implementation, the data items are images. A support set of images is provided to the system. The support set comprises images of objects that the neural network system is not trained to classify. A query image to be classified is received by the system. A ResNet type neural network is used to generate feature maps for the query image and the support image. A linear projection is used to generate a key embedding based on the feature maps for the query image and the support image. The key embeddings for the query image and the support image of a particular object category are compared using dot-product attention and normalized across all spatial locations and support images using a softmax function to create an attention map. A second linear projection is used to generate a value embedding from the query feature map and support feature map. The attention map is used to weight the support value embeddings, and the weighted support value embeddings are aggregated to form a prototype for each object category. A distance between the query value embedding and each of the object category prototypes is calculated. A softmax function on the distances is used to obtain a probability that the query image comprises an object belonging to one of the object categories in the support set. It should be understood that this implementation is exemplary and non-limiting, and that other implementations are possible in combination with the alternative features described above.

[0022] There is also provided a method of determining a similarity measure between a query data item and a set of supporting data items, comprising operations implemented by a neural network system as described above.

[0023] A method of training a neural network system for determining a similarity measure between a query data item and a set of supporting data items is further provided. The method can include receiving an episodic training dataset comprising training data items grouped into a plurality of training episodes. Each training episode can comprise training data items divided into a support set of supporting training data items and a query set. A training episode can be selected for modification. For each of a plurality of supporting training data items in the support set of the selected training episode, first and second transformed versions of the supporting training data item can be generated. The first and second transformed versions can be labeled with a label indicating the original supporting training data item. A new query set of the training episode can be generated based on the second transformed version of the supporting training data item. A modified episodic training dataset can be generated by replacing the query set of the selected training episode with the new query set. A neural network can be generated using a training set including the modified episodic training dataset.

[0024] In the modified training episode, the training task of the selected training episode is modified to be recognition of individual data items from the transformed versions of the data items by transforming the supporting training data items into first and second transformed versions and labeling them with a label indicative of the original training data item. By training in this manner, the neural network learns more generalizable features that can be used to distinguish data items that are outside the distribution of the training data set, including categories of data items not seen before, something that is often difficult for neural networks to do.

[0025] The modified training episodes are a form of self-supervised learning because they do not require external labels.

[0026] The modification of the training episodes is such that neural network training can be performed without the need to modify the underlying training algorithm. Thus, training of the neural network can be performed using a mixture of original and modified training episodes. For example, half of the modified episode training dataset (i.e., the dataset used for training the neural network) may comprise modified training episodes and the other half original unmodified training episodes. Thus, neural networks can be generated based on the same loss function for both modified and unmodified training episodes.

[0027] Each original training episode may be a supervised classification task that aims to classify data items in the query set based on the provided training data items in the support set. Thus, the loss function may be a classification loss function or a cross-entropy loss function. Training based on a mixture of modified and unmodified training episodes may mitigate the problem of "supervision collapse." In standard supervised training of neural networks, the neural network may retain only the information necessary to distinguish categories that appear in the training dataset and discard other useful information that may help distinguish data items of categories that do not appear in the training dataset. This is called supervision collapse. Training based on modified training episodes to distinguish individual data items from transformed versions encourages the neural network to learn general features of data items that are transferable between categories, and even to unseen categories. For example, objects may be composed of simpler components, and the neural network may learn to recognize these simpler components, which may be used in representing and recognizing novel objects.

[0028] The method may further comprise a step of modifying the support set of the selected training episode based on the first transformed version. For example, when a first transformed version of an original supporting training data item is generated, the original supporting training data item may be replaced or supplemented with the corresponding first transformed version to form a modified support set for the selected training episode. The support set may be further modified by deleting an original supporting training data item for which a first transformed version has not been generated.

[0029] In another example, a plurality of first transformed versions may be generated for each supporting training data item in the support set of the selected training episode (or for at least some of the supporting training data items in the support set of the selected training episode). A second transformed version of the supporting training data items may be generated for each subset of the supporting training data items in the support set of the selected training episode. The first transformed versions may form a permutation support set, and the second transformed versions may form a permutation query set for the selected training episode.

[0030] A training episode may comprise a support set with 50 to 500 labeled data items in 5 to 50 categories. A query set may comprise two data items per category. A new query set for a modified training episode may comprise the same number of data items as the original query set, and the support data items for the new query set may be randomly selected according to the same category distribution as the original query set.

[0031] The neural network parameter updates may be performed at the end of each training episode. However, it should be understood that the number of data items in the support set and the query set may be less or more, and updates to the neural network parameters may be performed at appropriate intervals, as deemed appropriate by those skilled in the art. The neural network may be generated based on a normalized stochastic gradient descent technique. That is, the global gradient may be scaled to have unit norm before applying the updates.

[0032] The selection of the training episode for modification may be performed randomly. A transformed version of the supporting training data item may be generated by applying a transformation based on a cropping operation, a color distortion operation, or a Gaussian blur operation. Generating the transformed version of the supporting training data item may comprise applying a random transformation function (e.g., a transformation function randomly selected from a class of transformation functions) to the supporting training data item to generate the transformed version of the supporting data item. That is, the transformation operation may be selected randomly, and any parameters of the transformation operation may also be selected randomly.

[0033] Different transformation operations and / or parameters may be used to generate each of the first transformed versions. Similarly, different transformation operations and / or parameters may be used to generate each of the second transformed versions. Alternatively, the method may further comprise determining a first transformation and a second transformation, where the first transformation is applied to each supporting data item to generate a first transformed version for the respective supporting data item, and the second transformation is applied to each supporting data item to generate a second transformed version for the respective supporting data item. That is, within each modified training episode, the first transformed versions may all be generated using the same first transformation, and similarly, the second transformed versions may all be generated using the same second transformation.

[0034] Prior to episodic training, a supervised pre-training phase may be performed, i.e., training data items may be grouped into episodes and classified individually on their own, rather than being split into support and query sets. The supervised pre-training phase may be performed until no further improvement is seen in the metrics evaluated on the validation set. Supervised tasks instead of classification may be used for pre-training if desired.

[0035] It will be appreciated that the operations for modifying training episodes may be performed in different orders to achieve the same effect: for example, it is possible to first select data items in a new query set, generate transformed versions of these new query data items, and then apply the first and second transformations to the supporting data items in the support set.

[0036] It will be further appreciated that the training method may generate a neural network having the characteristics described above with respect to a neural network system for determining a similarity measure between a query data item and a set of supporting data items, and thus the neural network generated by the training method may be used as one of the neural networks used to determine the similarity measure.

[0037] Another method for training a neural network to determine a similarity measure between a query data item and a set of supporting data items is further provided. The method may comprise receiving an episodic training dataset comprising training data items grouped into a plurality of training episodes. Each training episode may comprise training data items divided into a support set and a query set. A training episode may be selected for modification. For each supporting training data item in the support set of the selected training episode, a first and a second transformed version of the supporting data item may be generated. The first and the second transformed versions may be labeled with a label indicating the original training data item. One or more of the supporting data items may be selected to generate a new query set of the training episode based on the first and the second transformed versions of the selected supporting data item. The new query set may replace the original query set with the training episode. The neural network may be generated using a training set comprising the modified episodic training dataset. It will be understood that the features described above in the context of the previous training method may be combined with the features of this further training method.

[0038] The training method may be implemented by a system comprising one or more computers and one or more storage devices storing instructions that, when executed by the one or more computers, cause the one or more computers to perform the operations of the training method.

[0039] Additionally, one or more computer storage media are provided that store instructions that, when executed by one or more computers, cause the one or more computers to implement the above-described neural network system and / or perform operations of the above-described training method.

[0040] The neural network system may be used as part of a computer vision system, for example in a computer vision system for self-driving cars or robotic systems. Unfamiliar objects are almost ubiquitous in real-world vision applications due to the so-called "long tail" of objects occurring in real scenes. In another example, the system may be used as part of a photo organization software that needs to create new categories on the fly. In addition to object recognition, the system may perform other computer vision tasks such as object detection and segmentation. Rare and novel objects may also exist in other domains, such as video and audio, and the system may be used in combination with such other domains.

[0041] For example, neural network systems may be used in language modeling systems, image / video processing systems, or action selection systems. For example, tasks may include classification tasks, such as image processing tasks, speech recognition tasks, natural language processing tasks, word recognition tasks, or optical character recognition tasks. Additionally, tasks may include reinforcement learning tasks in which an agent interacts with one or more real or simulated environments to achieve one or more goals.

[0042] For language modeling tasks or translation of text from a source language to a target language using neural networks, the system may be configured to receive an input sequence of source embeddings representing a source sequence of words in a source natural language, and to generate an output sequence of target embeddings representing a target sequence of words that is a translation of the source sequence into the target natural language. More generally, the system may be applied to other sequence transformation applications in which a source sequence is mapped to a target sequence.

[0043] The input data may comprise, for example, one or more of image data, motion / video data, motion data, voice data, audio data, electronic documents, data representing a state of an environment, and / or data representing an action. For example, the image data may comprise color or monochrome pixel value data. Such image data may be obtained from an image sensor, such as a camera or a LIDAR sensor. The audio data may comprise data defining an audio waveform, such as a series of values ​​in the time and / or frequency domain that define a waveform, which may represent a speech in a natural language. The electronic document data may comprise text data representing words in a natural language. The data representing a state of an environment may comprise any kind of sensor data, including, for example, data characterizing a state of a robot or vehicle, such as pose data and / or position / velocity / acceleration data, or data characterizing a state of an industrial plant or data center, such as sensed electronic signals, such as sensed current and / or temperature signals. The data representing an action may comprise, for example, position, velocity, acceleration, and / or torque control data, or data for controlling the operation of one or more items of equipment in an industrial plant or data center. These data may generally relate to a real or virtual environment, for example a simulated environment.

[0044] Similarly, the output data may comprise any kind of data. For example, in a classification system, the output data may comprise class labels of the input data items. In a regression task, the output data may predict values ​​of continuous variables, such as control variables for controlling electronic or electromechanical systems, such as robots, vehicles, data centers, or plants. In another example of a regression task operating on image or audio data, the output data may define one or more locations in the data, such as the location of an object, or the location of one or more corners of an object's bounding box, or the time location of a sound feature in an audio waveform. In a reinforcement learning system, the output data may comprise data representing actions, such as actions performed by an agent operating in an environment, such as a mechanical agent, such as a robot or vehicle, as described above.

[0045] The data representing the action may comprise, for example, data defining an action value (Q-value) for the action, or data parameterizing a probability distribution from which the probability distribution is sampled to determine the action, or data directly defining the action, for example in a continuous action space. Thus, in a reinforcement learning system, a neural network system may directly parameterize a probability distribution for an action selection policy, or may learn to estimate the value of an action value function (Q-value). In the latter case, multiple memories and respective output networks may share a common embedded network to provide a Q-value for each available action.

[0046] Neural networks can be configured to receive any type of digital data input to generate any type of score, classification, or regression output based on the input.

[0047] For example, if the inputs to a neural network are images or features extracted from images, the output generated by the neural network for a given image may be a score for each of a set of object categories, with each score representing the estimated likelihood that the image contains an image of an object belonging to the category.

[0048] As another example, if the inputs to a neural network are Internet resources (e.g., web pages), documents, or portions of documents, or features extracted from Internet resources, documents, or portions of documents, the output generated by the neural network for a given Internet resource, document, or portion of a document may be a score for each of a set of topics, with each score representing an estimated likelihood that the Internet resource, document, or portion of a document is topical.

[0049] As another example, if the input to a neural network is features of the impression context of a particular ad, the output generated by the neural network may be a score representing the estimated likelihood that a particular ad will be clicked.

[0050] As another example, if the inputs to the neural network are features of a personalized recommendation for a user, e.g., features characterizing the context of the recommendation, e.g., features characterizing previous actions taken by the user, the output generated by the neural network can be a score for each of a set of content items, each score representing an estimated likelihood that the user will respond favorably to the content item being recommended.

[0051] As another example, if the input to a neural network is a sequence of text in one language, the output produced by the neural network may be a score for each of a set of texts in another language, with each score representing an estimated likelihood that the text in the other language is an appropriate translation of the input text into the other language.

[0052] As another example, if the input to a neural network is a sequence representing an utterance, the output produced by the neural network may be a score for each of a set of texts, with each score representing an estimated likelihood that the text is a correct transcript of the utterance.

[0053] The subject matter described herein can be implemented in particular embodiments to realize one or more of the following advantages.

[0054] As described above, the neural network system can recognize data items that belong to categories not seen by the neural network system during training. This can be done without the need for costly retraining, and can be performed with fewer supporting data items, if not more accurately, compared to other conventional techniques. Thus, the neural network system can reduce memory and storage requirements for processing query data items, and reduce processor and power requirements.

[0055] The neural network system provides an improved comparison mechanism compared to prior art methods and provides representations of the query and supporting data items that make it easier to compare features of the query and supporting data items.

[0056] Furthermore, the above-described training methods may achieve similar, if not better, performance than prior art methods at a faster rate, and thus the training methods reduce overall processor and power requirements. The training methods alleviate the problem of supervision collapse, allowing neural network systems to learn more generally applicable functions for recognizing any data item, such as a component part.

[0057] Throughout this specification, processing an image using, for example, a neural network refers to using a neural network to process intensity values ​​associated with pixels of the image. [Brief description of the drawings]

[0058] [Figure 1] FIG. 1 is a block diagram of an example of a neural network system. [Diagram 2] FIG. 2 is a schematic diagram of an exemplary operation of a neural network system. [Diagram 3] 1 is a flow diagram of an example process for determining similarity between a query data item and a set of supporting data items. [Figure 4] 1 is a flow diagram of an exemplary process for training a neural network system. [Diagram 5] FIG. 1 illustrates determined correspondences between example query images and support set images. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0059] This specification describes a neural network system for determining a similarity measure between a query data item and a set of supporting data items. The similarity measure can then be used to classify the query data item according to a category associated with the supporting set.

[0060] In general, neural network systems use key embeddings of query and supporting data items to generate one or more attention maps. The attention maps may indicate which parts (e.g., features, elements, etc.) of the supporting data items may be important for determining similarity between the query and supporting data items. For example, the attention maps may indicate the locations and likelihoods of corresponding possible parts of the query and supporting data items. Similarity comparisons between the query and supporting data items are performed in a value embedding space taking into account the attention maps. The similarity measure may be considered a local part-based comparison. The neural network system provides an improved mechanism for determining similarity between data items through this local part-based comparison, especially when there are limited categories of data items and data per category that may not have been seen during training of the neural network system. For example, there may be 10 or fewer supporting data items per category.

[0061] 1 illustrates an example of a neural network system 100. Neural network system 100 is an example of a system implemented as a computer program on one or more computers at one or more locations, in which the systems, components, and techniques described below may be implemented.

[0062] The neural network system 100 is configured to receive a query data item 101 and obtain a support set 102 of one or more data items to which the query data item 101 is compared and a similarity measure is determined. The support set 102 comprises a support key embedding 103 and a support value embedding 104 for each support data item in the support set 102. The support set 102 may be retrieved from a memory or data storage device, or may be received from a device external to the neural network system 100, or a combination of internal and external devices. For example, additional data items may be received that supplement an existing support set. The data items in the support set 102 may be associated with one or more categories. For example, if the data item is an image, the category may be the type of object present in the image.

[0063] The neural network system 100 comprises a key embedding neural network subsystem 105 configured to process the data items to generate a key embedding. In this case, the neural network system 100 is configured to generate a query key embedding 106 for the query data items 101 using the key embedding neural network subsystem 105. The neural network system 100 may also be configured to generate the supporting key embeddings 103 using the key embedding neural network subsystem 105. For example, if a data item in the supporting set was provided without a corresponding supporting key embedding 103, or if the supporting key embedding 103 required regeneration, such as during training of the neural network system 100. The key embedding may be a transformation of the query data items 101 and the supporting data items into an embedding space that allows for easier comparison of the data items.

[0064] The neural network system 100 further comprises an attention map subsystem 107. The neural network system 100 is configured to use the attention map subsystem 107 to generate an attention map 108 based on the similarity between the query key embedding 106 and the support key embedding 103 for the respective supporting data items. The attention map 108 may be used to focus or attend to particular features of the query data item and the supporting data items that may be particularly important for determining a similarity measure between the query data item 101 and the support set 102. The attention map 108 may indicate the location and likelihood of corresponding possible features of the query data item 101 and the supporting data items. For example, if the data items are images, the attention map may indicate the location of corresponding spatial features between the query image and the supporting image. Examples of features include the wheels of a car, the wings of an airplane, the petals of a flower, etc. This is illustrated in FIG. 5, which is described in more detail below.

[0065] The attention map 108 may be generated based on an unscaled similarity measure between the query key embedding 106 and the supporting key embedding 103 for each supporting data item. That is, the similarity measure may not require normalization and the calculated raw value may be used as described above. The similarity between the query key embedding 106 and the supporting key embedding 103 for each supporting data item may be based on a dot product. The similarity between the query key embedding 106 and the supporting key embedding 103 for each data item may be based on a similarity between the features of the query key embedding 106 and the respective features of the supporting key embedding 103. For example, for each feature of the query key embedding 106, an attention map 108 may be generated as a result of a similarity comparison between the features of the query key embedding 106 and the respective features of the features of the supporting key embedding 103.

[0066] The attention map 108 may further be generated based on a softmax function that receives a similarity measure between the query key embedding 106 and the supporting key embedding 103 for each supporting data item of the same category. In this way, the values ​​of the attention map 108 are normalized across supporting data items of a particular category. Furthermore, the softmax function may also receive a similarity between each feature of the query key embedding 106 and each feature of the supporting key embedding 103. Thus, the values ​​of the attention map (or map, if appropriate) may be normalized across features and within a particular category. Further details regarding the generation of the attention map 108 are described below.

[0067] 1, the neural network system 100 also comprises a value embedding neural network subsystem 109 configured to process the data items to generate value embeddings. The neural network system 100 is configured to generate a query value embedding 110 for the query data items 101 using the value embedding neural network subsystem 109. The neural network system 100 may also be configured to generate the support value embeddings 104 using the value embedding neural network subsystem 109. For example, if a data item of the support set is provided without a corresponding support value embedding 104 or if the support value embeddings 104 require regeneration, such as during training of the neural network system 100.

[0068] The neural network system 100 further comprises a similarity subsystem 111 configured to determine a similarity measure 112. The neural network system 100 is configured to determine a similarity measure 112 between the query data item 101 and the support set 102 based on the attention map 108, the support value embeddings 104 for each supporting data item, and the query value embeddings 110. The similarity measure 112 may be a measure of similarity between the query data item 101 and each supporting data item in the support set 102. For example, the support value embeddings 104 may be weighted based on the corresponding attention map 108, thus utilizing a form of soft attention. A similarity measure between the query value embeddings 110 and the weighted support value embeddings may be determined.

[0069] Alternatively, the similarity measure 112 may be a measure of similarity between the query data item 101 and aggregated support data items generated based on each supporting data item associated with the same category. For example, aggregated support data items, also known as prototypes, may be generated for each category by aggregating weighted support value embeddings of the supporting data items associated with the same category. A similarity measure between the query value embedding 110 and the prototype for each category may be determined.

[0070] The determined similarity measure 112 may indicate the likelihood that the query data item 101 belongs to a particular category associated with the supporting data item. The similarity measure 112 may be based on a distance. For example, the distance between the query value embedding and the respective prototype. A smaller distance may indicate a higher likelihood that the query data item belongs to the category associated with the respective prototype. This distance may be a Euclidean distance or any other distance deemed appropriate by a person skilled in the art.

[0071] Further details regarding determining the similarity measure 112 are described in more detail below. The neural network system 100 may also be configured to output the similarity measure 112.

[0072] The neural network system 100 may also comprise a classifier subsystem 113. The neural network system 100 may be configured to classify the query data item 101 based on the determined similarity measures 112. For example, the classification may be based on the determined similarity measures between the query data item 101 and the respective supporting data items, or the classification may be based on the determined similarity measures using a prototype for each category. The classifier subsystem 113 may implement any suitable type of classifier. For example, a softmax function may be used to convert the determined similarity measures into a probability distribution indicating the likelihood that the query data item belongs to the respective category. In another example, a logistic regression or a neural network classifier may be used. The classification may be performed using the classifier subsystem 113, which may provide an output classification 114.

[0073] The key embedding neural network subsystem 105 and the value embedding neural network subsystem 109 may comprise neural networks with linear output layers. They may also comprise neural networks with convolutional layers. The key embedding neural network subsystem 105 and the value embedding neural network subsystem 109 may comprise an initial set of shared neural network layers. In one example, all but the final respective output layers are shared. This is shown in more detail in FIG. 2.

[0074] 2, there is shown a schematic diagram of generating prototypes for each category using a neural network system 100. The following example is based on image data as the modality of the query data item 101 and the supporting data items. It should be understood that similar processing can be applied to other modalities and types of data items such as audio signals and video.

[0075] In Fig. 2, the query image x q is first transformed using a function φ(.). The function φ(.) may be implemented using a neural network configured to process the image to generate a feature map representation of the image. For example, φ(.) may be implemented based on a ResNet architecture, details of which can be found in He et al., "Deep Residual Learning for Image Recognition," arXiv:1512.03385, available at https: / / arxiv.org / abs / 1512.03385, which is incorporated by reference in its entirety.

[0076] Given an image x with height (H), width (W), and three color channels, φ(.) may generate image features with dimensions H'×W' and D channels. In one example, the image has a starting resolution of 224×224, and the output of the function φ(.) (implemented using a ResNet-34 architecture with an extended final block) has a 14×14 grid of 512 channels. The function φ(.) may also be applied to images in the support set 201, as shown at the top of Figure 2. The support set for category c is S c Shown as the supporting picture

[0077]

number

[0078] j is S c The index of supporting images in the

[0079] Support set image features

[0080]

number

[0081] is the support set image for each ("key k" as shown in Figure 2). c The key head may be further processed by the key head to generate a supporting key embedding 202 for each

[0082]

number

[0083] Thus, in this case, the support key embedding for a particular support image has dimensions H'×W'×d k In one example, d k =128, but it will be understood that other values ​​are possible.

[0084] Query image features φ(x q ) may be further processed by the query head to generate a query key embedding 203 (also called “query(q)” as shown in FIG. 2). The query head may implement a function Ω, which is a linear functional mapping

[0085]

number

[0086] Therefore, the query key embedding of the query image is also of dimensions H'×W'×d kThe query head and the key head may implement the same function, i.e., Γ=Ω. The query head and the key head may be considered as part of the key embedding neural network subsystem 105. The function φ(.) may be a shared initial part of the key embedding neural network subsystem 105, as described above. Alternatively, the image feature representation computed using the function φ(.) may be pre-computed externally and provided to the neural network system 100.

[0087] Then, in Fig. 2, multiple attention maps 204 are generated by determining, for each supporting image, the similarity between each spatial feature of the query key embedding and each spatial feature of the supporting key embedding. This process is illustrated for a particular spatial location p of the query key embedding in Fig. 2. In Fig. 2, the vector at location p of the query key embedding is compared to the vector at each spatial location of each of the supporting key embeddings by taking the dot product between the respective query key vector and the respective supporting key vector. This generates an attention map for each supporting image / key embedding of the query vector at location p.

[0088]

number

[0089] is generated to show the correspondence between the image features at location p and the supporting image features for all possible spatial locations.

[0090] More specifically, the following formula provides an exemplary calculation of the support key embedding:

[0091]

number

[0092] In the above formula,

[0093]

number

[0094] is the vector at spatial location m of the support key embedding of the jth support image belonging to category c,

[0095]

number

[0096] is the j-th supporting image belonging to category c. The following equation shows an exemplary computation of the query key embedding: q p =Ω φ(x q )p In the above equation, q p is a vector of spatial locations p of the query key embedding. The following equation shows an exemplary calculation of attention map values ​​corresponding to a spatial location pair p and m of the query key embedding and the supporting key embedding j.

[0097]

number

[0098] In the above formula,

[0099]

number

[0100] is the attention map value of the query key spatial location p and supporting key j at spatial location m.

[0101] Following the computation of attention map values ​​for all pairs of spatial locations and each support set image in a category, the attention map values ​​may be normalized by applying a softmax function to all spatial location pairs and attention maps that belong to the same support category, as shown in the following exemplary formula:

[0102]

number

[0103] In the above formula,

[0104]

number

[0105] and

[0106]

number

[0107] is the normalized attention map value.

[0108] It will be appreciated that the above process for generating the attention map may be implemented by the attention map subsystem 107.

[0109] As mentioned above, a prototype of a particular category c in the support set can be generated based on the attention map 108 and the support value embedding 104. In FIG.

[0110]

number

[0111] is the value of each support set image (as shown in Figure 2). c The value head may be further processed by the value head to generate a support value embedding 205 for each sigma-based sigma-based sigma (also called a linear function mapping

[0112]

number

[0113] Thus, in this case, the support value embedding of a particular support image has dimensions H'×W'×d v In one example, d v = 128, although it will be understood that other values ​​may be possible. The value head may be considered as part of the value embedding neural network subsystem 109.

[0114] As shown in Figure 2, an attention map may be used to weight the corresponding support value embeddings for each support image, and a weighted sum is performed to generate a vector of prototypes 206 at spatial location p. In this way, the attention map indicates which parts of the support images are most relevant based on the query image. The following example formula may be used to calculate the support value embedded at spatial location m of a support image j associated with category c:

[0115]

number

[0116] In the above formula,

[0117]

number

[0118] is a vector at spatial location m of the support value embedding of the j-th support image of category c. The prototype may be calculated as shown in the following exemplary formula:

[0119]

number

[0120] In the above formula,

[0121]

number

[0122] is the vector at spatial location p of prototype t of category c. Vectors at the remaining spatial locations of the prototypes may be determined in a similar manner. The prototypes may be considered to be "query-aligned" prototypes in that the data generated for a particular location of the prototype corresponds to a particular feature at the same location in the query image. In some conventional techniques, prototypes are generated independently of the query, and are generated solely based on the supporting data items themselves. In this case, each prototype is generated with the query in mind specifically, and thus the similarity between the query and prototypes of different categories can be better determined.

[0123] As mentioned above, the similarity measure 112 between the query data item 101 and the support set of data items may be determined based on prototypes of a particular category. For example, the similarity measure 112 may be determined based on the Euclidean distance between the query value embedding and the support value embedding. The query value embedding is calculated by using the value head Λ to embed the query image features φ(x q ) can be computed in a similar manner to the support value embedding. w p =Λ φ(x q ) p In the above formula, w p is a vector at spatial location p of the query value embedding. The similarity measure 112 may be calculated based on the Euclidean distance according to the following exemplary formula:

[0124]

number

[0125] In the above equation, d(x q ,S c) is the similarity measure between the query image and the support set of category c. It will be appreciated that the process for determining the similarity measure is implemented by the similarity subsystem 111.

[0126] The similarity measures may be used to determine the likelihood that a query image belongs to a particular category. For example, a softmax function may be applied to the similarity measures for each category to generate a probability distribution according to the following example equation:

[0127]

number

[0128] In the above equation, p(y=c|x q ) is the query image x q is the probability of belonging to category c. Alternatively, the similarity measures may be provided to a classifier to determine a set of scores for each category or to provide a classification of the query image. It will be appreciated that the process for generating the classification scores / probabilities may be implemented by the classifier subsystem 113.

[0129]

[0033] Referring now to Figure 3, a process for determining a similarity measure between a query data item and a set of supporting data items will now be described. It will be appreciated that the process may be implemented by the neural network system 100 of Figure 1.

[0130] A query data item is received at block 305. A supporting set of one or more supporting data items is received at block 310. The supporting set comprises a supporting key embedding and a supporting value embedding for each supporting data item in the supporting set.

[0131] At block 315, a query key embedding for the query data item is generated using a key embedding neural network subsystem. The key embedding neural network subsystem is configured to process the data item to generate the key embedding described above.

[0132] At block 320, an attention map is generated based on the similarity between the query key embedding and the supporting key embedding for each supporting data item, which may be performed using the attention map subsystem described above.

[0133] At block 325, a query value embedding of the query data item is generated using a value embedding neural network subsystem. The embedding neural network subsystem is configured to process the data item to generate an embedding value as described above.

[0134] In block 330, a similarity measure between the query data item and the support set is determined based on the attention map, the support value embeddings for each supporting data item, and the query value embedding, which may be performed using the similarity subsystem described above.

[0135]

[0036] Referring now to Figure 4, a process for training a neural network system for determining a similarity measure between a query data item and a set of supporting data items will now be described. It will be appreciated that the neural network system 100 of Figure 1 may be trained according to the process described.

[0136] At block 405, an episodic training dataset is received comprising training data items grouped into a number of training episodes. Each training episode comprises training data items divided into a support set of supporting training data items and a query set. The training episodes may be designed for a classification task in which data items in the query set are classified according to categories associated with data items in the support set. The number of data items per category in the support set may be limited. Suitable techniques for generating episodic datasets are described in "Meta-Dataset: A Dataset of Datasets for Learning to Learn from Few Examples" by Triantafillou et al., arXiv:1903.03096, available at https: / / arxiv.org / abs / 1903.03096, which is incorporated herein by reference in its entirety.

[0137] A training episode is selected for modification at block 410. The training episode may be randomly selected from a set of training episodes in an episodic training dataset.

[0138] At block 415, for each of a plurality of supporting training data items in the support set of the selected training episode, first and second transformed versions of the supporting training data item are generated, and the first and second transformed versions are labeled with a label indicating the original supporting training data item. The transformation may be based on a cropping operation, a color distortion operation, or a Gaussian blur operation. Other exemplary transformations may be based on rotation, posterization, solarization, color shift, contrast, brightness, sharpness, shearing, translation, and cutout. The particular transformation operation and any parameters of the transformation operation may be randomly selected from a set of suitable values.

[0139] In block 420, a new query set of training episodes is generated based on the second transformed versions of the supporting training data items. For example, a subset of the second transformed versions may be selected to form the new query set. The subset may have the same number of data items as the original query set and may be selected according to the same category distribution as the original query set. It should also be understood that it is possible to first select a subset of the supporting training data items of the new query set and generate only the second transformed version of the subset, rather than generating a second transformed version for each supporting data item.

[0140] In block 425, a modified episode training data set is formed by replacing the query set of the selected training episode with the new query set. The original support set may be modified based on the first transformed version, for example, by replacing the original support set with the first transformed version in the modified training episode.

[0141] To select additional training episodes for modification, the process from blocks 410 through 425 may be repeated. In one example, half of the training episodes in the training data set are modified according to the above process.

[0142] In block 430, a neural network is generated using a training set comprising the modified episodic training data set. The modifications performed on the training episodes above mean that the same loss function can still be used for both modified and unmodified training episodes. That is, in the modified training episodes, each supporting data item becomes its own class. The goal of the modified training episodes is to recognize the supporting data items from which each query data item is derived. This can be posed as a classification problem under the same episodic learning framework as the original training episodes, using the same classification or cross-entropy loss function. The neural network can then be trained using standard techniques of supervised learning, such as stochastic gradient descent, and in particular normalized stochastic gradient descent (using normalized gradients). The introduction of modified training episodes helps to prevent the problem of supervision collapse, where the neural network only learns representations that help to distinguish between classes present in the training set, but does not retain other information. Using modified training episodes with the goal of recognizing transformed versions of data items, the neural network now retains information about the data items, generating better representations that can generalize to unseen classes. For example, a neural network may learn to represent a data item based on local component parts, which may be useful for representing unseen classes of data items.

[0143] 4 above is described as generating first and second transformed versions of the supporting training data items, it will be appreciated that further transformed versions may be generated, and new query sets and / or support sets may be generated based on these further transformed versions as deemed appropriate by those skilled in the art.

[0144] FIG. 5 illustrates the correspondence between a portion of a query image and an image of a support set from an attention map generated by an exemplary neural network system. Corresponding portions, indicated by large attention values, are highlighted in the image. As can be seen from FIG. 5, semantically similar portions between the query image and the support image have a high degree of agreement. For example, the tail, wings / engine, and paint of the airplane in FIG. 5 are highlighted. Thus, the example of FIG. 5 illustrates the effectiveness of the technique for determining a similarity measure between the above query data item and a support set of data items.

[0145] In situations where the systems described herein utilize data that may include personal information, the data may be processed in one or more ways, such as by aggregation and anonymization, before it is stored or used, so that such personal information cannot be determined from the data that is stored or used. Further, the use of such information may be such that personally identifiable information cannot be determined from the output of a system that uses such information.

[0146] A system of one or more computers configured to perform particular operations or actions means that the system has installed thereon software, firmware, hardware, or a combination thereof that, when in operation, causes the system to perform the operations or actions. One or more computer programs configured to perform particular operations or actions means that the one or more programs contain instructions that, when executed by a data processing device, cause the device to perform the operations or actions.

[0147] The subject matter and functional operations described herein may be implemented in digital electronic circuitry, tangibly embodied computer software or firmware, computer hardware including the structures disclosed herein and their structural equivalents, or one or more combinations thereof. The subject matter described herein may 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 a data processing apparatus. Alternatively or additionally, the program instructions may be encoded on an artificially generated propagated signal, e.g., a machine-generated electrical, optical, or electromagnetic signal, that is generated to encode information for transmission to a suitable receiving device for execution by the data processing apparatus. The computer storage medium may be a machine-readable storage device, a machine-readable storage substrate, a random or serial access memory device, or a combination of one or more of them. However, the computer storage medium is not a propagating signal.

[0148] The term "data processing apparatus" encompasses all kinds of apparatus, devices, and machines for processing data, including, by way of example, a programmable processor, a computer, or multiple processors or computers. An apparatus may include special purpose logic circuitry, such as an FPGA (field programmable gate array) or an ASIC (application specific integrated circuit). An apparatus may also include, in addition to hardware, code that creates an execution environment for a given computer program, such as code constituting a processor firmware, a protocol stack, a database management system, an operating system, or a combination of one or more of these.

[0149] A computer program (which may also be referred to or written as a program, software, software application, module, software module, script, or code) may be written in any form of programming language, including compiled or interpreted languages, or declarative or procedural languages, and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment. A computer program may, but need not, correspond to a file in a file system. A program may be stored as part of a file that holds other programs or data, for example in one or more scripts stored in a markup language document, in a single file dedicated to the program in question, or in multiple cooperating files, for example in a file that stores one or more modules, subprograms, or portions of code. A computer program may be deployed to be executed on one computer, or on multiple computers located at one site or distributed across multiple sites and interconnected by a communications network.

[0150] As used herein, the term "engine" or "software engine" refers to a software-implemented input / output system that provides an output distinct from an input. An engine may be a block of coded functionality, such as a library, a platform, a software development kit ("SDK"), or an object. Each engine may be implemented on any suitable type of computing device, such as a server, a mobile phone, a tablet computer, a notebook computer, a music player, an e-book reader, a laptop or desktop computer, a PDA, a smartphone, or other fixed or portable device that includes one or more processors and computer-readable media. Furthermore, two or more engines may be implemented on the same computing device or on different computing devices.

[0151] The processes and logic flows described herein may be performed by one or more programmable computers executing one or more computer programs to perform functions by operating on input data to generate output. The processes and logic flows may also be performed by, and an apparatus may be implemented as, special purpose logic circuitry, such as, for example, an FPGA (field programmable gate array) or an ASIC (application specific integrated circuit). For example, the processes and logic flows may be performed by, and an apparatus may be implemented as, a graphics processing unit (GPU).

[0152] A computer suitable for executing a computer program may include and be based on, by way of example, a general-purpose or special-purpose microprocessor, or both, or other types of central processing units. Typically, the central processing unit receives instructions and data from a read-only memory or a random access memory, or both. The essential elements of a computer are a central processing unit for executing or carrying out instructions, and one or more memory devices for storing instructions and data. Typically, a computer includes one or more mass storage devices for storing data, e.g., magnetic, magneto-optical, or optical disks, or is operatively coupled to receive data from or transfer data to them, or both. However, a computer need not be equipped with such devices. Furthermore, a computer may be embedded in another device, such as, for example, a mobile phone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a global positioning system (GPS) receiver, or a portable storage device, e.g., a universal serial bus (USB) flash drive, to name just a few.

[0153] Computer-readable media suitable for storing computer program instructions and data include all forms of non-volatile memory, media, and memory devices, including, by way of example, semiconductor memory devices such as EPROM, EEPROM, and flash memory devices, magnetic disks, e.g., internal hard disks or removable disks, magneto-optical disks, and CD-ROM and DVD-ROM disks. The processor and memory may be supplemented by, or incorporated in, special purpose logic circuitry.

[0154] To provide for user interaction, embodiments of the subject matter described herein can be implemented on a computer having a display device, e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor for displaying information to the user, and a keyboard and pointing device, e.g., a mouse or trackball, by which the user can provide input to the computer. Other types of devices can also be used to provide for user interaction, e.g., feedback provided to the user can be any form of sensory feedback, such as visual feedback, auditory feedback, or tactile feedback, and input from the user can be received in any form, including acoustic, speech, or tactile input. Additionally, the computer can interact with the user by sending and receiving documents to and from a device used by the user, e.g., by sending a web page to a web browser on the user's client device in response to a request received from the web browser.

[0155] Embodiments of the subject matter described herein may be implemented in a computing system that includes a back-end component, e.g., as a data server, or includes a middleware component, e.g., an application server, or includes a front-end component, e.g., a client computer with a graphical user interface or web browser through which a user can interact with an implementation of the subject matter described herein, or any combination of one or more such back-end, middleware, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication, such as a communications network. Examples of communications networks include local area networks ("LANs") and wide area networks ("WANs"), e.g., the Internet.

[0156] A computing system may include clients and servers. Clients and servers are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.

[0157] Although the specification contains many specific implementation details, these should not be construed as limitations on the scope of the invention or what may be claimed, but rather as descriptions of features that may be specific to a particular embodiment of a particular invention. Certain features described in the specification in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination. Furthermore, although features may be described above as acting in a particular combination and are initially claimed as such, one or more features from the claimed combination may in some cases be carved out of the combination, and the claimed combination may be directed to a subcombination or a variation of the subcombination.

[0158] Similarly, although operations are shown in the figures in a particular order, this should not be understood as requiring that such operations be performed in the particular order or sequential order shown, or that all of the operations shown be performed, to achieve desirable results. In certain situations, multitasking and parallel processing may be advantageous. Furthermore, the separation of various system modules and components in the above embodiments should not be understood as requiring such separation in all embodiments, and it should be understood that the program components and systems described may generally be integrated together in a single software product or packaged in multiple software products.

[0159] Certain embodiments of the subject matter have been described. Other embodiments are within the scope of the following claims. For example, the actions recited in the claims can be performed in a different order and still achieve desirable results. As an example, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In certain implementations, multitasking and parallel processing may be advantageous. [Explanation of symbols]

[0160] 100 Neural Network System 101 Query Data Items 102 Support Set 103 Support key embedding 104 Support Value Embedding 105 Key Embedding Neural Network Subsystem 106 Query Key Embedding 107 Attention Map Subsystem 108 Attention Map 109 Value Embedding Neural Network Subsystem 110 Query Value Embedding 111 Similarity Subsystem 112 Similarity measure 113 Classifier Subsystem 114 Output Classification 201 Support Set 202 Support key embedding 206 Prototype

Claims

1. 1. A neural network system for determining a similarity measure between a query data item and a set of supporting data items, the neural network system comprising: one or more computers; and, when executed by the one or more computers, causing the one or more computers to: receiving said query data item; obtaining a support set of one or more supporting data items comprising a supporting key embedding and a supporting value embedding for each supporting data item in the support set; generating a query key embedding for the query data item using a key embedding neural network subsystem configured to process the data item to generate a key embedding; generating an attention map based on similarity between the query key embedding and the supporting key embedding for each supporting data item; generating a query value embedding for the query data item using a value embedding neural network subsystem configured to process the data item to generate a value embedding; determining a similarity measure of a similarity measure between the query data item and the support set based on the attention map, the support value embeddings for each support data item, and the query value embedding; and one or more storage devices storing instructions for performing operations comprising:

2. The operation, 2. The neural network system of claim 1, further comprising: generating the supporting key embedding using the key embedding neural network subsystem.

3. The operation, 3. The neural network system of claim 1 or 2, further comprising: generating the support value embedding using the value embedding neural network subsystem.

4. 4. The neural network system of claim 1, wherein the supporting data items are associated with one or more categories.

5. The operation, 5. The neural network system of claim 4, further comprising classifying the query data items based on a similarity measure determined for each category.

6. The operation, weighting the support value embedding based on the attention map; aggregating the weighted support embeddings of the support data items associated with the same category to generate a prototype for each category associated with the support set; and The neural network system according to claim 4 or 5, further comprising:

7. 7. The neural network system of claim 6, wherein determining a similarity measure comprises determining a similarity measure between the query value embedding and the prototype for each category.

8. 8. The neural network system of claim 6 or 7, wherein the similarity measure is based on a distance between the query value embedding and the prototype.

9. The neural network system of claim 8 , wherein the distance is based on Euclidean distance.

10. 10. The neural network system of claim 1, wherein the attention map is generated based on an unscaled similarity measure between the query key embedding and the supporting key embedding for each supporting data item.

11. 11. The neural network system of claim 1, wherein the similarity between the query key embedding and the supporting key embedding for each supporting data item is based on a dot product.

12. 12. The neural network system of claim 1, wherein the similarity between the query key embedding and the supporting key embedding for each supporting data item is based on similarity between features of the query key embedding and each feature of the supporting key embedding.

13. 13. The neural network system of claim 12, wherein the features are spatial features.

14. 14. The neural network system of claim 4, wherein the attention map is generated based on a softmax function that receives the similarity measure between the query key embedding and the supporting key embedding for each supporting data item of the same category.

15. 15. The neural network system of claim 1, wherein the key embedding neural network subsystem and / or the value embedding subsystem comprises a linear output layer.

16. 16. The neural network system of claim 1 , wherein the key embedding neural network subsystem and / or the value embedding neural network subsystem comprises a convolutional layer.

17. 17. The neural network system of claim 1, wherein the data items are images.

18. 18. A computer-implemented method for determining a similarity measure between a query data item and a set of supporting data items, comprising operations implemented by a neural network system according to any one of claims 1 to 17.

19. 1. A method of training a neural network system for determining a similarity measure between a query data item and a set of supporting data items, comprising: receiving an episodic training dataset comprising training data items grouped into a plurality of training episodes, each training episode comprising training data items partitioned into a support set and a query set of supporting training data items; selecting a training episode for modification; for each of a plurality of supporting training data items in the support set for the selected training episode, generating first and second transformed versions of the supporting training data item and labeling the first and second transformed versions with a label indicative of the original supporting training data item; generating a new query set for the training episodes based on the second transformed version of the supporting training data items; forming a modified episodic training data set by replacing the query set of the selected training episode with the new query set; generating a neural network using a training set that includes the modified episodic training data set; A method comprising:

20. 20. The method of claim 19, further comprising revising the support set for the selected training episodes based on the first transformed version.

21. For each of a plurality of supporting training data items in the support set for the selected training episode, generating first and second transformed versions of the supporting training data item includes: for each supporting training data item in the support set for the selected training episode, generating a first transformed version of the supporting training data item; for a subset of the supporting training data items in the support set of the selected training episode, generating a second transformed version of each of the supporting training data items; 21. The method of claim 19 or 20, comprising:

22. 22. The method of claim 19, wherein the neural network is generated based on the same loss function for both modified and unmodified training episodes.

23. 23. The method of any one of claims 19 to 22, wherein the neural network is generated based on a classification loss function.

24. 24. The method of claim 19, wherein the neural network is generated based on a cross-entropy loss function.

25. 25. The method of any one of claims 19 to 24, wherein the neural network is generated based on a regularized stochastic gradient descent technique.

26. 26. A method according to any one of claims 19 to 25, wherein generating a transformed version of the supporting training data items comprises applying a transformation based on a cropping operation, a colour distortion operation, or a Gaussian blur operation.

27. 27. A method according to any one of claims 19 to 26, wherein generating a transformed version of a supporting training data item comprises applying a randomly selected transformation function to the supporting training data item to generate a transformed version of the supporting data item.

28. 28. The method of any one of claims 19 to 27, wherein the generated neural network is a neural network system according to any one of claims 1 to 17.

29. A system comprising one or more computers and one or more storage devices storing instructions that, when executed by the one or more computers, cause the one or more computers to perform the operations of the respective methods described in any one of claims 19 to 28.

30. One or more computer storage media storing instructions that, when executed by one or more computers, cause the one or more computers to implement the system described in any one of claims 1 to 17 and 29 and / or perform the operations of the respective method described in any one of claims 18 to 28.

Citation Information

Patent Citations

  • Computer system

    JP2020071694A

  • Attention-based image generation neural networks

    US20190130213A1