Systems and methods for machine learning models with convolution and attention
The method addresses computational inefficiencies in combining convolution and attention by using a machine-learned convolutional attention network with a relative attention mechanism, achieving high accuracy and reduced resource consumption in computer vision tasks.
Patent Information
- Application Number
- JP2024207410
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2021-05-27
- Filing Date
- 2024-11-28
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2042-05-27
AI Technical Summary
Existing methods for combining convolution and attention in machine learning models face increased computational cost and inefficiencies.
A computer-implemented method utilizing a machine-learned convolutional attention network with a relative attention mechanism, incorporating a sum of a static convolutional kernel and an adaptive attention matrix, to perform computer vision with reduced computational cost and improved accuracy.
The method achieves state-of-the-art performance with fewer parameters and computational resources, enhancing generalization and model capacity while maintaining high accuracy, particularly for unknown input data.
Smart Images

Figure 0007794934000009 
Figure 0007794934000010 
Figure 0007794934000011
Abstract
Description
[Technical Field]
[0001] Related Applications This application claims priority to and the benefit of U.S. Provisional Patent Application No. 63 / 194,077, filed May 27, 2021. U.S. Provisional Patent Application No. 63 / 194,077 is incorporated herein by reference in its entirety.
[0002] The present disclosure relates generally to machine learning. More particularly, the present disclosure relates to systems and methods for machine learning models with convolution and attention. [Background technology]
[0003] Machine learning refers to a class of learning algorithms that provide predictions for input data. Convolutional neural networks, or CNNs, are a class of machine learning models that utilize convolutional frames in neural networks. Transformers are a class of machine learning models that utilize attention mechanisms to weight distinct portions of input data. Existing methods for combining convolution and attention face drawbacks such as increased computational cost. Summary of the Invention [Means for solving the problem]
[0004] Aspects and advantages of embodiments of the present disclosure will be set forth in part in the description that follows, or may be learned from the description, or may be learned through practice of the embodiments.
[0005] One exemplary aspect of the present disclosure is directed to a computer-implemented method for performing computer vision with reduced computational cost and improved accuracy. The computer-implemented method includes, by a computing system including one or more computing devices, obtaining input data including an input tensor having one or more dimensions. The computer-implemented method includes, by the computing system, providing the input data to a machine-learned convolutional attention network, the machine-learned convolutional attention network including two or more network stages, each of the two or more network stages including one of an attention stage or a convolution stage. The computer-implemented method also includes, in response to providing the input data to the machine-learned convolutional attention network, receiving, by the computing system, a machine-learned prediction from the machine-learned convolutional attention network. The attention stage includes a relative attention mechanism, the relative attention mechanism including a sum of a static convolutional kernel and an adaptive attention matrix.
[0006] Another exemplary aspect of the present disclosure is directed to a computer-implemented method for performing computer vision with reduced computational cost and improved accuracy. The computer-implemented method includes, by a computing system including one or more computing devices, obtaining input data including an input tensor having one or more dimensions. The computer-implemented method includes, by the computing system, providing the input data to a machine-learned convolutional attention network. The machine-learned convolutional attention network includes a downsampling stage configured to reduce spatial resolution relative to the input tensor and one or more attention blocks including a relative attention mechanism, the relative attention mechanism including a sum of a static convolution kernel and an adaptive attention matrix. The computer-implemented method includes, in response to providing the input data to the machine-learned convolutional attention network, receiving, by the computing system, a machine-learned prediction from the machine-learned convolutional attention network.
[0007] Another exemplary aspect of the present disclosure is directed to a computer-implemented method for performing computer vision with reduced computational cost and improved accuracy. The computer-implemented method includes, by a computing system including one or more computing devices, obtaining input data including an input tensor having one or more dimensions. The computer-implemented method includes, by the computing system, providing the input data to a machine-learning convolutional attention network, the machine-learning convolutional attention network including multiple network stages. The multiple network stages include an S0 stage including a two-layer convolutional stem network, an S1 stage including a convolutional block with squeezed excitation, an S2 stage including a convolutional block, an S3 stage including a convolutional block, an S4 stage including an attention block, and an S5 stage including an attention block. Each of the S4 and S5 stages includes a relative attention mechanism including a sum of a static convolutional kernel and an adaptive attention matrix. Spatial resolution is reduced in each of the multiple network stages. The number of channels is increased in each of the multiple network stages. The computer-implemented method includes receiving, by a computing system, a machine-learned prediction from the machine-learned convolutional attention network in response to providing input data to the machine-learned convolutional attention network.
[0008] Other aspects of the present disclosure are directed to various systems, apparatus, non-transitory computer-readable media, user interfaces, and electronic devices.
[0009] These and other features, aspects, and advantages of various embodiments of the present disclosure will become better understood with reference to the following description and appended claims. The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate exemplary embodiments of the present disclosure and, together with the description, serve to explain associated principles.
[0010] The appendix describes in more detail exemplary implementations of the proposed techniques. The appendix is incorporated into and forms a part of this disclosure, although the present disclosure is not limited to the exemplary implementations given in the appendix.
[0011] Detailed descriptions of embodiments directed to persons skilled in the art are set forth herein, which refer to the accompanying figures. [Brief explanation of the drawings]
[0012] [Figure 1A] FIG. 1 is a block diagram of an exemplary computing system for implementing computer vision with reduced computational cost and increased accuracy, according to an exemplary embodiment of the present disclosure. [Figure 1B] FIG. 1 is a block diagram of an exemplary computing device that implements computer vision with reduced computational cost and increased accuracy, according to an exemplary embodiment of the present disclosure. [Figure 1C] FIG. 1 is a block diagram of an exemplary computing device that implements computer vision with reduced computational cost and increased accuracy, according to an exemplary embodiment of the present disclosure. [Figure 2] FIG. 1 is a block diagram of an exemplary Convolutional Attention Network (CoAtNet) model, according to an exemplary embodiment of the present disclosure. [Figure 3] FIG. 1 is a block diagram of an exemplary convolutional attention network model according to an exemplary embodiment of the present disclosure. [Figure 4] FIG. 1 is a block diagram of an exemplary convolutional attention network model according to an exemplary embodiment of the present disclosure. [Figure 5] FIG. 1 is a flowchart diagram of an exemplary method for performing computer vision with reduced computational cost and increased accuracy, according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION OF THE INVENTION
[0013] Reference numbers that are repeated among the figures identify the same features in various implementations.
[0014] In general, the present disclosure is directed to systems and methods for machine learning models with convolution and attention. In particular, systems and methods according to exemplary embodiments of the present disclosure may include a convolution block and / or an attention block. According to exemplary embodiments of the present disclosure, the attention block may include a relative attention mechanism. In particular, exemplary embodiments of the present disclosure recognize that the above-described relative attention can be considered a natural mixture of depthwise convolution and content-based attention. Furthermore, exemplary embodiments of the present disclosure recognize that both depthwise convolution and self-attention can be represented as a weighted sum of values in a receptive field. Thus, the relative attention mechanism may include a sum of a static convolution kernel and an adaptive attention matrix. This sum can be applied prior to and / or subsequent to softmax normalization by the relative attention mechanism. As an example, the relative attention mechanism (e.g., applied prior to softmax normalization) may be:
[0015]
number
[0016] As another example, a relative attention mechanism (e.g., applied following softmax normalization) can be expressed mathematically as:
[0017]
number
[0018] It can be mathematically expressed by:
[0019] In the above equation, the depthwise convolution kernel w i-j is an input-dependent parameter with a static value for a given index in the input tensor (i,j) (e.g., the relative shift between indices i to j; dependence on the relative shift rather than on a specific value is called transformation equivalence, which may improve generalization under datasets of limited size), and x iand x j are the input and output at location i, respectively, and G is the global acceptance field (e.g., the entire set of locations).
[0020] The use of global receptive fields (as opposed to the limited local receptive fields traditionally utilized in convolutional networks, for example) can improve the ability to capture complex relational interactions between different spatial locations, which may be desirable when processing higher-level concepts. The denominator term is the attention weight, i.e., A i,j The attention weights can be jointly determined by the transformation equivalence of the depthwise convolution kernel and the input-adaptive input-output pair, which can provide both properties to varying degrees, improving the generalization, capacity, and / or accuracy of the model.
[0021] These attention blocks with relative self-attention can be utilized in networks with convolution and attention (referred to herein as "CoAtNet" models) to improve the fusion of benefits from convolution and attention. For example, the models can have the high accuracy and efficiency associated with convolutional networks, as well as robustness against overfitting, relatively low computational cost, reduced memory usage, and / or relatively small parameter size, while further providing the ability to learn complex relational interactions between spatial locations in input data associated with transformers.
[0022] Systems and methods according to exemplary aspects of the present disclosure (e.g., utilizing attention blocks with relative attention) may provide several technical effects and benefits, including improvements to computer technology. As one example, systems and methods according to exemplary aspects of the present disclosure may unify convolution and attention to provide improved generalization, model capacity, and / or efficiency. For example, systems and methods according to exemplary aspects of the present disclosure may more effectively manage the trade-off between improved generalization (e.g., similar to convolutional networks) and improved model capacity (e.g., similar to transformers). For example, some exemplary implementations of the present disclosure may achieve state-of-the-art performance under different data sizes and computational budgets.
[0023] The improvements provided by the proposed model architecture (e.g., generalization and / or model capacity) can provide improved model accuracy, particularly for unknown input data, improved scope of input data types and / or dimensions, reduced consumption of computational resources (e.g., faster computation speed, fewer computation cycles, reduced processor or memory usage, etc.), and / or other improvements over existing models. In particular, the models proposed herein can achieve performance comparable to state-of-the-art convolutional neural networks while having a smaller number of parameters. As an example, an exemplary implementation of the CoAtNet model can achieve comparable top accuracy on the ImageNet dataset with only 40% of the number of parameters and 70% of the FLOPs.
[0024] As another exemplary technical effect, the hybrid convolution and attention architecture described herein may enable more efficient use of dedicated hardware, such as processors (e.g., graphics processing units), that was previously dedicated to implementing the convolution and attention mechanisms. For example, the convolution stage of the proposed hybrid model may be implemented by hardware dedicated to convolution operations, and the attention stage of the proposed hybrid model may be implemented by hardware dedicated to attention operations. For example, the convolution operations of the convolution stage of the proposed hybrid model may be performed in parallel by multiple processors.
[0025] Systems and methods according to example aspects of the present disclosure can be applied to a variety of machine learning tasks, particularly tasks that traditionally utilize convolutional neural networks. By way of example, the machine learning task may be a computer vision task such as object detection, object recognition, image classification, semantic segmentation, video recognition, video classification, video segmentation, etc. As another example, the machine learning task may be a multi-modality application, such as one involving additional signals (e.g., visual signals), such as, for example, image captioning, video captioning, etc.
[0026] Referring now to the drawings, exemplary embodiments of the present disclosure will be discussed in more detail.
[0027] 1A illustrates a block diagram of an exemplary computing system 100 for implementing computer vision with reduced computational cost and increased accuracy, according to an exemplary embodiment of the present disclosure. System 100 includes a user computing device 102, a server computing system 130, and a training computing system 150, communicatively coupled via a network 180.
[0028] The user computing device 102 may be any type of computing device, such as, for example, a personal computing device (e.g., a laptop or desktop), a mobile computing device (e.g., a smartphone or tablet), a gaming console or controller, a wearable computing device, an embedded computing device, or any other type of computing device.
[0029] The user computing device 102 includes one or more processors 112 and memory 114. The one or more processors 112 may be any suitable processing device (e.g., a processor core, a microprocessor, an ASIC, an FPGA, a controller, a microcontroller, etc.) and may be a single processor or multiple operatively connected processors. The memory 114 may include one or more non-transitory computer-readable storage media, such as RAM, ROM, EEPROM, EPROM, flash memory devices, magnetic disks, etc., and combinations thereof. The memory 114 may store data 116 and instructions 118 that are executed by the processor 112 to cause the user computing device 102 to perform operations.
[0030] In some implementations, the user computing device 102 can store or include one or more machine learning models 120. For example, the machine learning models 120 can be or otherwise include various machine learning models, such as neural networks (e.g., deep neural networks) or other types of machine learning models including nonlinear and / or linear models. The neural networks can include feedforward neural networks, recurrent neural networks (e.g., long short-term memory recurrent neural networks), convolutional neural networks, or other forms of neural networks. Some exemplary machine learning models can leverage attention mechanisms such as self-attention. For example, some exemplary machine learning models can include multi-headed self-attention models (e.g., transformer models). Exemplary machine learning models 120 (e.g., CoAtNet models) are discussed with reference to FIGS. 2-3.
[0031] In some implementations, one or more machine learning models 120 may be received from the server computing system 130 over the network 180, stored in the user computing device memory 114, and then used or otherwise implemented by one or more processors 112. In some implementations, the user computing device 102 may implement multiple parallel instances of a single machine learning model 120 (e.g., to perform parallel computer vision across multiple instances of the CoAtNet model).
[0032] Additionally or alternatively, one or more machine learning models 140 may be included in or otherwise stored and implemented by a server computing system 130 that communicates with the user computing device 102 according to a client-server relationship. For example, the machine learning models 140 may be implemented by the server computing system 130 as part of a web service (e.g., a computer vision service such as image classification). Thus, one or more models 120 may be stored and implemented at the user computing device 102 and / or one or more models 140 may be stored and implemented at the server computing system 130.
[0033] The user computing device 102 may also include one or more user input components 122 that receive user input. For example, the user input component 122 may be a touch-sensitive component (e.g., a touch-sensitive display screen or touchpad) that is sensitive to the touch of a user input object (e.g., a finger or stylus). The touch-sensitive component may be useful for implementing a virtual keyboard. Other exemplary user input components include a microphone, a traditional keyboard, or other means by which a user can provide user input.
[0034] The server computing system 130 includes one or more processors 132 and memory 134. The one or more processors 132 may be any suitable processing device (e.g., a processor core, a microprocessor, an ASIC, an FPGA, a controller, a microcontroller, etc.) and may be a single processor or multiple operatively connected processors. The memory 134 may include one or more non-transitory computer-readable storage media, such as RAM, ROM, EEPROM, EPROM, flash memory devices, magnetic disks, etc., and combinations thereof. The memory 134 may store data 136 and instructions 138 that are executed by the processor 132 to cause the server computing system 130 to perform operations.
[0035] In some implementations, server computing system 130 includes or is otherwise implemented by one or more server computing devices. In instances in which server computing system 130 includes multiple server computing devices, such server computing devices may operate according to a sequential computing architecture, a parallel computing architecture, or some combination thereof.
[0036] As described above, the server computing system 130 may store or otherwise include one or more machine learning models 140. For example, the models 140 may be or otherwise include various machine learning models. Exemplary machine learning models include neural networks or other multi-layer nonlinear models. Exemplary neural networks include feedforward neural networks, deep neural networks, recurrent neural networks, and convolutional neural networks. Some exemplary machine learning models may utilize attention mechanisms such as self-attention. For example, some exemplary machine learning models may include multi-headed self-attention models (e.g., transformer models). Exemplary models 140 are discussed with reference to FIGS. 2-3.
[0037] The user computing device 102 and / or the server computing system 130 can train the models 120 and / or 140 by interacting with a training computing system 150 that is communicatively coupled via a network 180. The training computing system 150 may be separate from the server computing system 130 or may be part of the server computing system 130.
[0038] The training computing system 150 includes one or more processors 152 and memory 154. The one or more processors 152 may be any suitable processing device (e.g., a processor core, a microprocessor, an ASIC, an FPGA, a controller, a microcontroller, etc.) and may be a single processor or multiple operably connected processors. The memory 154 may include one or more non-transitory computer-readable storage media, such as RAM, ROM, EEPROM, EPROM, flash memory devices, magnetic disks, etc., and combinations thereof. The memory 154 may store data 156 and instructions 158 that are executed by the processor 152 to cause the training computing system 150 to perform operations. In some implementations, the training computing system 150 includes or is otherwise implemented by one or more server computing devices.
[0039] The training computing system 150 may include a model trainer 160 that trains the machine learning models 120 and / or 140 stored at the user computing device 102 and / or the server computing system 130 using various training or learning techniques, such as, for example, backpropagation. For example, a loss function may be backpropagated through the model to update one or more parameters of the model (e.g., based on the gradient of the loss function). Various loss functions may be used, such as mean squared error, likelihood loss, cross-entropy loss, hinge loss, and / or various other loss functions. Gradient descent techniques may be used to iteratively update the parameters for several training iterations.
[0040] In some implementations, performing error backpropagation may include performing truncated backpropagation over time. The model trainer 160 can implement several generalization techniques (e.g., weight decay, dropout, etc.) to improve the generalization ability of the trained model.
[0041] In particular, model trainer 160 can train machine learning models 120 and / or 140 based on a set of training data 162. Training data 162 may include, for example, a corpus of task-specific training data or other dataset, such as an image classification database (e.g., ImageNet, JFT300M, etc.).
[0042] In some implementations, if the user provides consent, the training examples may be provided by the user computing device 102. Thus, in such implementations, the model 120 provided to the user computing device 102 may be trained by the training computing system 150 against user-specific data received from the user computing device 102. In some instances, this process may be referred to as model personalization.
[0043] Model trainer 160 includes computer logic used to provide the desired functionality. Model trainer 160 can be implemented in hardware, firmware, and / or software controlling a general-purpose processor. For example, in some implementations, model trainer 160 includes program files stored on a storage device, loaded into memory, and executed by one or more processors. In other implementations, model trainer 160 includes one or more sets of computer-executable instructions stored on a tangible computer-readable storage medium, such as RAM, a hard disk, or an optical or magnetic medium.
[0044] Network 180 may be any type of communications network, such as a local area network (e.g., an intranet), a wide area network (e.g., the Internet), or some combination thereof, and may include any number of wired or wireless links. Generally, communications over network 180 may be carried over any type of wired and / or wireless connection, using a wide variety of communications protocols (e.g., TCP / IP, HTTP, SMTP, FTP), encodings or formats (e.g., HTML, XML), and / or protection schemes (e.g., VPN, Secure HTTP, SSL).
[0045] The machine learning models described herein may be used in a variety of tasks, applications, and / or use cases.
[0046] In some implementations, an input to a machine learning model of the present disclosure may be image data. The machine learning model may process the image data to generate an output. As an example, the machine learning model may process the image data to generate an image recognition output (e.g., a recognition of the image data, a latent embedding of the image data, an encoded representation of the image data, a hash of the image data, etc.). As another example, the machine learning model may process the image data to generate an image segmentation output. As another example, the machine learning model may process the image data to generate an image classification output. As another example, the machine learning model may process the image data to generate an image data modification output (e.g., an alteration of the image data, etc.). As another example, the machine learning model may process the image data to generate an encoded image data output (e.g., an encoded and / or compressed representation of the image data, etc.). As another example, the machine learning model may process the image data to generate an upscaled image data output. As another example, the machine learning model may process the image data to generate a prediction output.
[0047] In some implementations, the input to the machine learning model of the present disclosure may be text or natural language data. The machine learning model may process the text or natural language data to generate an output. As an example, the machine learning model may process the natural language data to generate a language-encoded output. As another example, the machine learning model may process the text or natural language data to generate a latent text embedding output. As another example, the machine learning model may process the text or natural language data to generate a transformation output. As another example, the machine learning model may process the text or natural language data to generate a classification output. As another example, the machine learning model may process the text or natural language data to generate a text segmentation output. As another example, the machine learning model may process the text or natural language data to generate a semantic intent output. As another example, the machine learning model can process the text or natural language data to generate an upscaled text or natural language output (e.g., text or natural language data that is of higher quality than the input text or natural language, etc.). As another example, the machine learning model may process the text or natural language data to generate a predicted output.
[0048] In some implementations, the input to a machine learning model of the present disclosure may be audio data. The machine learning model may process the audio data to generate an output. As an example, the machine learning model may process the audio data to generate a speech recognition output. As another example, the machine learning model may process the audio data to generate a speech conversion output. As another example, the machine learning model may process the audio data to generate a latent embedding output. As another example, the machine learning model may process the audio data to generate an encoded audio output (e.g., an encoded and / or compressed representation of the audio data, etc.). As another example, the machine learning model may process the audio data to generate an upscaled audio output (e.g., audio data of higher quality than the input audio data, etc.). As another example, the machine learning model may process the audio data to generate a text representation output (e.g., a text representation of the input audio data, etc.). As another example, the machine learning model may process the audio data to generate a predicted output.
[0049] In some implementations, the input to the machine learning based model of the present disclosure may be latent coding data (e.g., a latent space representation of the input, etc.). The machine learning based model may process the latent coding data to generate an output. As an example, the machine learning based model may process the latent coding data to generate a recognition output. As another example, the machine learning based model may process the latent coding data to generate a reconstruction output. As another example, the machine learning based model may process the latent coding data to generate a search output. As another example, the machine learning based model may process the latent coding data to generate a reclustered output. As another example, the machine learning based model may process the latent coding data to generate a predicted output.
[0050] In some implementations, input to a machine learning model of the present disclosure may be statistical data. The statistical data may be, represent, or otherwise include data calculated and / or computed from some other data source. The machine learning model may process the statistical data to generate an output. As an example, the machine learning model may process the statistical data to generate a recognition output. As another example, the machine learning model may process the statistical data to generate a prediction output. As another example, the machine learning model may process the statistical data to generate a classification output. As another example, the machine learning model may process the statistical data to generate a segmentation output. As another example, the machine learning model may process the statistical data to generate a visualization output. As another example, the machine learning model may process the statistical data to generate a diagnostic output.
[0051] In some implementations, the input to the machine learning model of the present disclosure may be sensor data. The machine learning model may process the sensor data to generate an output. As an example, the machine learning model may process the sensor data to generate a recognition output. As another example, the machine learning model may process the sensor data to generate a prediction output. As another example, the machine learning model may process the sensor data to generate a classification output. As another example, the machine learning model may process the sensor data to generate a segmentation output. As another example, the machine learning model may process the sensor data to generate a visualization output. As another example, the machine learning model may process the sensor data to generate a diagnostic output. As another example, the machine learning model may process the sensor data to generate a detection output.
[0052] In some cases, the machine learning model can be configured to perform a task that includes encoding input data for reliable and / or efficient transmission or storage (and / or corresponding decoding). For example, the task may be an audio compression task. The input may include audio data, and the output may include compressed audio data. In another example, the input includes visual data (e.g., one or more images or videos), and the output includes compressed visual data, and the task is a visual data compression task. In another example, the task may include generating an embedding for the input data (e.g., input audio or visual data).
[0053] In some cases, the input includes visual data and the task is a computer vision task. In some cases, the input includes pixel data for one or more images and the task is an image processing task. For example, the image processing task may be image classification, where the output is a set of scores, each score corresponding to a different object class and representing the likelihood that one or more images show an object belonging to the object class. The image processing task may be object detection, where the image processing output identifies one or more regions in one or more images and, for each region, the likelihood that the region shows an object of interest. As another example, the image processing task may be image segmentation, where the image processing output defines, for each pixel in one or more images, a respective likelihood for each category in a predetermined set of categories. For example, the set of categories may be foreground and background. As another example, the set of categories may be object classes. As another example, the image processing task may be depth estimation, where the image processing output defines, for each pixel in one or more images, a respective depth value. As another example, the image processing task may be motion estimation, where the network input includes multiple images and the image processing output defines, for each pixel in one of the input images, the scene motion indicated at that pixel between the images in the network input.
[0054] In some cases, the input includes audio data representing speech and the task is a speech recognition task. The output may include text output that is mapped to the speech. In some cases, the task includes encrypting or decrypting input data. In some cases, the task includes a microprocessor-implemented task such as branch prediction or memory address translation.
[0055] 1A illustrates one exemplary computing system that can be used to implement the present disclosure. Other computing systems may be used. For example, in some implementations, a user computing device 102 may include a model trainer 160 and a training dataset 162. In such implementations, the model 120 can be both trained and used locally on the user computing device 102. In some such implementations, the user computing device 102 can implement the model trainer 160 to personalize the model 120 based on user-specific data.
[0056] 1B illustrates a block diagram of an exemplary computing device 10 implemented in accordance with an exemplary embodiment of the present disclosure. Computing device 10 may be a user computing device or a server computing device.
[0057] Computing device 10 includes several applications (e.g., applications 1-N). Each application includes its own machine learning library and machine learning model. For example, each application may include a machine learning model. Exemplary applications include a text messaging application, an email application, a dictation application, a virtual keyboard application, a browser application, etc.
[0058] 1B , each application can communicate with several other components of the computing device, such as one or more sensors, a context manager, a device state component, and / or additional components. In some implementations, each application can communicate with each device component using an API (e.g., a public API). In some implementations, the API used by each application is specific to that application.
[0059] 1C illustrates a block diagram of an exemplary computing device 50 for implementing in accordance with an exemplary embodiment of the present disclosure. Computing device 50 may be a user computing device or a server computing device.
[0060] Computing device 50 includes several applications (e.g., applications 1-N). Each application communicates with a central intelligence layer. Exemplary applications include a text messaging application, an email application, a dictation application, a virtual keyboard application, a browser application, etc. In some implementations, each application can communicate with the central intelligence layer (and the models stored therein) using an API (e.g., a common API across all applications).
[0061] The central intelligence layer includes several machine learning models. For example, as shown in FIG. 1C, a respective machine learning model may be provided for each application and managed by the central intelligence layer. In other implementations, two or more applications may share a single machine learning model. For example, in some implementations, the central intelligence layer may provide a single model for all applications. In some implementations, the central intelligence layer is included in or otherwise implemented by the operating system of the computing device 50.
[0062] The central intelligence layer can communicate with a central device data layer, which can be a centralized repository of data for computing device 50. As shown in FIG. 1C , the central device data layer can communicate with several other components of the computing device, such as one or more sensors, a context manager, a device state component, and / or additional components. In some implementations, the central device data layer can communicate with each device component using an API (e.g., a private API).
[0063] 2 illustrates a block diagram of an exemplary Convolutional Attention Network (CoAtNet) model 200 according to an exemplary embodiment of the present disclosure. In some implementations, the model 200 receives a set of input data 202 describing, for example, image data or other task-specific input data, and is trained to provide, as a result of receiving the input data 202, output data 204 responsive to a particular machine learning task, such as a computer vision task (e.g., image classification).
[0064] According to exemplary aspects of the present disclosure, the model 200 may include a downsampling stage 210. The downsampling stage 210 can reduce the spatial resolution of the input data 202. For example, if the input data 202 includes tensors, the downsampling stage 210 may reduce the spatial resolution such that the output of the downsampling stage 210 has at least one dimension or resolution lower than that of the tensors of the input data 202. Additionally and / or alternatively, the downsampling stage 210 may increase the number of channels relative to the input data. In some implementations, the downsampling stage 210 may be or include a convolutional stem. The convolutional stem may have an aggressive stride, such as a stride greater than 10.
[0065] Additionally and / or alternatively, the model 200 may include one or more attention blocks 212. The attention blocks 212 may receive downsampled input data from the downsampling stage 210 and produce output data 204. The attention blocks 212 may implement a relative attention mechanism. In some implementations, the attention blocks 212 may be transformer blocks that operate similarly to a transformer network.
[0066] According to an exemplary embodiment of the present disclosure, the attention block 212 may include a relative attention mechanism. The relative attention mechanism may include a sum of a static convolution kernel and an adaptive attention matrix. This sum may be applied prior to and / or subsequent to softmax normalization by the relative attention mechanism. As an example, the relative attention mechanism (e.g., applied prior to softmax normalization) may be:
[0067]
number
[0068] As another example, a relative attention mechanism (e.g., applied following softmax normalization) can be expressed mathematically as:
[0069]
number
[0070] It can be mathematically expressed by:
[0071] In the above equation, the depthwise convolution kernel w i-j is an input-dependent parameter with a static value for a given index in the input tensor (i,j) (e.g., the relative shift between indices i to j; dependence on the relative shift rather than on a specific value is called transformation equivalence, which may improve generalization under datasets of limited size), and x i and x j are the input and output at location i, respectively, and G is the global acceptance field (e.g., the entire set of locations).
[0072] The use of global receptive fields (as opposed to the limited local receptive fields traditionally utilized in convolutional networks, for example) can improve the ability to capture complex relational interactions between different spatial locations, which may be desirable when processing higher-level concepts. The denominator term is the attention weight, i.e., A i,j The attention weights can be jointly determined by the transformation equivalence of the depthwise convolution kernel and the input-adaptive input-output pair, which can provide both properties to varying degrees, improving the generalization, capacity, and / or accuracy of the model.
[0073] 3 illustrates a block diagram of an exemplary Convolutional Attention Network (CoAtNet) model 300 according to an exemplary embodiment of the present disclosure. In some implementations, the model 300 receives a set of input data 202 describing, for example, image data or other task-specific input data, and is trained to provide, as a result of receiving the input data 202, output data 204 responsive to a particular machine learning task, such as a computer vision task (e.g., image classification).
[0074] The machine-learning convolutional attention network 300 may include two or more network stages (e.g., 302, 304, 306, 308, and 310). Each of the two or more network stages may be or include one of an attention stage or a convolution stage, with the convolution stage preceding the attention stage in order. As an example, in some implementations, the two or more network stages may include an S0 stage 302, an S1 stage 304, an S2 stage 306, an S3 stage 308, and an S4 stage 310. Each of these stages may be a convolution stage including one or more convolution blocks (e.g., MBConv blocks) or an attention stage including one or more attention blocks with a relative attention mechanism. As another example, in some implementations, the convolution blocks may perform depthwise separable convolution (e.g., across multiple channels). Additionally and / or alternatively, in some implementations, the convolution blocks may perform inverse bottleneck convolution. In some implementations, the spatial resolution decreases gradually over two or more network stages. In some implementations, the number of channels can be increased (e.g., doubled) in any of the stages, such as at least one of the S1 stage 304, S2 stage 306, S3 stage 308, or S4 stage 310.
[0075] In some implementations, the S0 stage 302 includes a two-layer convolutional stem network. Additionally and / or alternatively, the S1 stage 304 may include one or more convolution blocks with squeezed excitation. One or more convolution blocks of the S1 stage and / or other convolution stages may include an MBConv block. The MBConv block may be configured to expand the channel size from the original channel size of the input to the one or more convolution blocks, and then back-project the expanded channel size to the original channel size. As another example, in some implementations, the convolution block may perform depthwise separable convolution (e.g., across multiple channels). Additionally and / or alternatively, in some implementations, the convolution block may perform inverse bottleneck convolution. In some implementations, the width of the S0 stage 302 is less than or equal to the width of the S1 stage 304. In some implementations, each of the S0 stage 302, the S1 stage 304, and the S4 stage 310 includes (e.g., exactly) two blocks, and each of the S2 stage 306 and the S3 stage 308 includes more than two blocks. For example, in one particular implementation, the two or more network stages include the S0 stage 302 including a two-layer convolutional stem network, the S1 stage 304 including a convolutional block with squeezed excitation, the S2 stage 306 including a convolutional block, the S3 stage 308 including an attention block, and the S4 stage 310 including an attention block, and each of the S3 stage 308 and the S4 stage 310 includes a relative attention mechanism configured to determine the sum of a static convolution kernel and an adaptive attention matrix.
[0076] The attention block and / or stage (e.g., S3 and / or S4 stages 308, 310) may include a relative attention mechanism according to an exemplary embodiment of the present disclosure. The relative attention mechanism may include a sum of a static convolution kernel and an adaptive attention matrix. This sum may be applied prior to and / or subsequent to softmax normalization by the relative attention mechanism. As an example, the relative attention mechanism (e.g., applied prior to softmax normalization) may be:
[0077]
number
[0078] It can be mathematically expressed by:
[0079] As another example, a relative attention mechanism (e.g., applied following softmax normalization)
[0080]
number
[0081] It can be mathematically expressed by:
[0082] In the above equation, the depthwise convolution kernel w i-j is an input-dependent parameter with a static value for a given index in the input tensor (i,j) (e.g., the relative shift between indices i to j; dependence on the relative shift rather than on a specific value is called transformation equivalence, which may improve generalization under datasets of limited size), and x i and x j are the input and output at location i, respectively, and G is the global acceptance field (e.g., the entire set of locations).
[0083] FIG. 4 illustrates a block diagram of an exemplary convolutional attention network (CoAtNet) model 400 according to an exemplary embodiment of the present disclosure. As shown in FIG. 4, the model 400 may include S0, S1, S2, S3, and S4 stages. For example, the S0 stage, or stem stage, may include two (e.g., 3×3) convolutional layers (e.g., with a stride of 2). Furthermore, the convolutional S1 and S2 stages may each include a 1×1 convolutional layer, a 3×3 deconvolutional layer, and a 1×1 convolutional layer. Furthermore, the attention (e.g., S3 and S4) stages may each include a relative attention mechanism and a feedforward network. The model may further include a global pooling layer and a fully connected layer to produce a model output. Each of the stages may be repeated a designed number of times.
[0084] 5 shows a flowchart diagram of an exemplary method performed in accordance with an exemplary embodiment of the present disclosure. While FIG. 5 shows steps performed in a particular order for purposes of explanation and discussion, the methods of the present disclosure are not limited to the order or sequence specifically shown. Various steps of method 500 may be omitted, rearranged, combined, and / or adapted in various ways without departing from the scope of the present disclosure.
[0085] Method 500 may include, at 502, obtaining (e.g., by a computing system including one or more computing devices) input data including an input tensor having one or more dimensions. For example, the input tensor may be a two-dimensional tensor having a length and / or a width. Additionally and / or alternatively, the input tensor may have one or more channels. In some implementations, for example, the input tensor may be or include image data, such as an image having a length, a width, and / or multiple color channels.
[0086] Method 500 may include, at 504, providing (e.g., by a computing system) input data to a machine-learning convolutional attention network. The machine-learning convolutional attention network may be any suitable network according to example aspects of the present disclosure, such as networks 200 and / or 300 of FIGS. 2 and / or 3 .
[0087] For example, in some implementations, a machine-learned convolutional attention network may include two or more network stages, each of which includes one of an attention stage or a convolution stage, with the convolution stage preceding the attention stage in order. As an example, in some implementations, the two or more network stages may include an S0 stage, an S1 stage, an S2 stage, an S3 stage, and an S4 stage. Each of these stages may be a convolution stage including one or more convolution blocks (e.g., MBConv blocks) or an attention stage including one or more attention blocks with a relative attention mechanism. In some implementations, spatial resolution gradually decreases across the two or more network stages. In some implementations, the number of channels may be increased (e.g., doubled) in any of the stages, such as at least one of the S1 stage, S2 stage, S3 stage, or S4 stage.
[0088] In some implementations, the S0 stage includes a two-layer convolutional stem network. Additionally and / or alternatively, the S1 stage may include one or more convolution blocks with squeezed excitation. One or more convolution blocks of the S1 stage and / or other convolution stages may include an MBConv block. The MBConv block may be configured to expand the channel size from the original channel size of the input to the one or more convolution blocks and then back-project the expanded channel size to the original channel size. As another example, in some implementations, the convolution block may perform depthwise separable convolution (e.g., across multiple channels). Additionally and / or alternatively, in some implementations, the convolution block may perform inverse bottleneck convolution. In some implementations, the width of the S0 stage is less than or equal to the width of the S1 stage. In some implementations, the S0 stage, S1 stage, and S5 stage each include (e.g., exactly) two blocks, and the S2 stage and S3 stage each include more than two blocks. For example, in one particular implementation, the two or more network stages include an S0 stage including a two-layer convolutional stem network, an S1 stage including a convolution block with squeezed excitation, an S2 stage including a convolution block, an S3 stage including an attention block, and an S4 stage including an attention block, wherein each of the S3 stage and the S4 stage includes a relative attention mechanism configured to determine a sum of a static convolution kernel and an adaptive attention matrix.
[0089] As another example, in some implementations, a machine-learned convolutional attention network may include a downsampling stage configured to reduce spatial resolution relative to input tensors and one or more attention blocks including a relative attention mechanism. The downsampling stage may reduce spatial resolution to improve the feasibility of performing computations. For example, if the input data includes tensors, the downsampling stage may reduce spatial resolution such that the output of the downsampling stage has at least one dimension or resolution lower than that of the tensors of the input data. Additionally and / or alternatively, the downsampling stage may increase the number of channels relative to the input data. In some implementations, the downsampling stage may be or include a convolutional stem. The convolutional stem may have an aggressive stride, such as a stride greater than 10.
[0090] The attention block and / or stage (e.g., S3 and / or S4 stages) may include a relative attention mechanism according to an exemplary embodiment of the present disclosure. The relative attention mechanism may include a sum of a static convolution kernel and an adaptive attention matrix. This sum may be applied prior to and / or subsequent to softmax normalization by the relative attention mechanism. As an example, the relative attention mechanism (e.g., applied prior to softmax normalization) may be:
[0091]
number
[0092] As another example, a relative attention mechanism (e.g., applied following softmax normalization) can be expressed mathematically as:
[0093]
number
[0094] It can be mathematically expressed by:
[0095] In the above equation, the depthwise convolution kernel w i-j is an input-dependent parameter with a static value for a given index in the input tensor (i,j) (e.g., the relative shift between indices i to j; dependence on the relative shift rather than on a specific value is called transformation equivalence, which may improve generalization under datasets of limited size), and x i and x j are the input and output at location i, respectively, and G is the global acceptance field (e.g., the entire set of locations).
[0096] The method 500 may include, at 506, receiving, by the computing system, a machine learning prediction from the machine learning convolutional attention network in response to providing input data to the machine learning convolutional attention network. The machine learning prediction may be a task-specific machine learning prediction. By way of example, the output may be a computer vision output such as a classification output (e.g., a classification vector), an object recognition output, or the like. Alternatively, the machine learning prediction may be an intermediate prediction or representation, such as an embedding in a latent or learned space.
[0097] The technology described herein refers to servers, databases, software applications, and other computer-based systems, as well as actions taken and information sent to and from such systems. The inherent flexibility of computer-based systems allows for a wide variety of possible configurations, combinations, and divisions of tasks and functions among components. For example, the processes described herein may be implemented using a single device or component, or multiple devices or components working in combination. Databases and applications may be implemented on a single system or distributed across multiple systems. Distributed components may operate sequentially or in parallel.
[0098] While the present subject matter has been described in detail with reference to various specific exemplary embodiments thereof, each example is provided by way of explanation, not limitation, of the present disclosure. Those skilled in the art, upon understanding the foregoing, will be able to readily create modifications, variations, and equivalents of such embodiments. Accordingly, the present disclosure does not exclude the inclusion of such changes, variations, and / or additions to the present subject matter as would be readily apparent to one skilled in the art. For example, features illustrated or described as part of one embodiment may be used with another embodiment to yield yet a further embodiment. Accordingly, it is intended that the present disclosure cover such modifications, variations, and equivalents. [Explanation of symbols]
[0099] 100 Computing Systems 120 Machine Learning Models 130 Server Computing System 140 Machine Learning Models 160 Model Trainer 200 models, network 210 downsampling stages 212 Attention Block 300 Convolutional Attention Network (CoAtNet) model, a machine learning convolutional attention network 302 Network stage, S0 stage 304 Network stage, S1 stage 306 Network stage, S2 stage 308 Network stage, S3 stage 310 Network stage, S4 stage 400 Convolutional Attention Network (CoAtNet) Model
Claims
1. A computer-implemented method comprising: obtaining, by a computing system, input data; providing the input data to a neural network implemented by the computing system, the neural network including a static convolution kernel and an adaptive attention matrix, wherein the neural network processes the input data by applying a sum of the static convolution kernel and the adaptive attention matrix to the input data before or after performing softmax normalization; receiving, by the computing system, a prediction based on the neural network processing the input data; A computer-implemented method comprising:
2. The input data includes an input tensor having one or more dimensions.
10. The computer-implemented method of claim 1.
3. The neural network is a machine learning convolutional network including at least a convolution stage and an attention stage, wherein the attention stage includes a relative attention mechanism configured to apply the sum of the static convolution kernel and the adaptive attention matrix to the input data before or after performing the softmax normalization.
10. The computer-implemented method of claim 1.
4. The neural network includes at least an S0 stage, an S1 stage, an S2 stage, an S3 stage, and an S4 stage.
10. The computer-implemented method of claim 1.
5. The S0 stage includes a two-layer convolutional stem network.
5. The computer-implemented method of claim 4.
6. The S1 stage includes one or more convolution blocks with squeezed excitation.
5. The computer-implemented method of claim 4.
7. The one or more convolution blocks of the S1 stage include a mobile inverted bottleneck convolution (MBConv) block configured to upscale a channel size from an original channel size of an input to the one or more convolution blocks, and then backproject the upscaled channel size back to the original channel size.
7. The computer-implemented method of claim 6.
8. Each of the S2, S3, or S4 stages that includes a convolution stage includes a mobile inverted bottleneck convolution (MBConv) block.
5. The computer-implemented method of claim 4.
9. The number of channels is doubled for at least one of the S1 stage, the S2 stage, the S3 stage, or the S4 stage.
5. The computer-implemented method of claim 4.
10. The width of the S0 stage is equal to or less than the width of the S1 stage.
5. The computer-implemented method of claim 4.
11. Each of the S0, S1, and S4 steps includes two blocks, and each of the S2 and S3 steps includes more than two blocks.
5. The computer-implemented method of claim 4.
12. Spatial resolution decreases gradually over two or more network stages 10. The computer-implemented method of claim 1.
13. The sum of the static convolution kernel and the adaptive attention matrix is applied prior to performing softmax normalization.
10. The computer-implemented method of claim 1.
14. The sum of the static convolution kernel and the adaptive attention matrix is applied to the input data after the softmax normalization is performed by the relative attention mechanism.
4. The computer-implemented method of claim 3.
15. The prediction includes a computer vision output.
10. The computer-implemented method of claim 1.
16. The prediction includes a classification output.
10. The computer-implemented method of claim 1.
17. The one or more convolution stages of the neural network sequentially precede the one or more attention stages of the neural network.
10. The computer-implemented method of claim 1.
18. A method for implementing a multi-threaded network comprising: one or more processors; and one or more non-transitory computer-readable storage media storing instructions that, when executed by the one or more processors, Obtaining input data; providing the input data to a neural network including a static convolution kernel and an adaptive attention matrix, the neural network processing the input data by applying a sum of the static convolution kernel and the adaptive attention matrix to the input data before or after performing softmax normalization; receiving, from the neural network, a prediction based on the neural network processing the input data; causing the computing system to perform operations including Computing system.
19. The neural network is a machine learning convolutional network including at least a convolution stage and an attention stage, wherein the attention stage comprises a relative attention mechanism configured to apply the sum of the static convolution kernel and the adaptive attention matrix to the input data before or after performing the softmax normalization.
20. The computing system of claim 18.
20. The neural network includes at least an S0 stage, an S1 stage, an S2 stage, an S3 stage, and an S4 stage.
20. The computing system of claim 18.
Citation Information
Patent Citations
Visual question answering model, electronic device, and storage medium
JP2020149685A
Systems and methods for applying machine learning to analyze microcopy images in high-throughput systems
WO2020028313A1