Information processing device, image recognition method, and program

By generating attention maps using only key data within a patchwise self-attention network, the computational and memory demands for image recognition are reduced without compromising accuracy, addressing the high resource consumption of conventional methods.

JP7540344B2Active Publication Date: 2024-08-27DENSO CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
JP2021002348
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2021-01-08
Publication Date
2024-08-27
Estimated Expiration
2041-01-08

AI Technical Summary

Technical Problem

Conventional attention structures and SAN structures for image recognition require significant computational and memory resources due to the conversion of input data into three types of data: value, key, and query, leading to high calculation and memory demands.

Method used

The proposed solution involves generating an attention map using only key data, eliminating the need for query data calculation and utilizing a patchwise self-attention network (SAN) structure, which reduces the amount of calculation and memory required by leveraging the inherent relationship between key and query data.

Benefits of technology

This approach effectively suppresses the computational and memory requirements for image recognition, maintaining accuracy while reducing the amount of calculation and memory needed compared to conventional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007540344000002
    Figure 0007540344000002
  • Figure 0007540344000003
    Figure 0007540344000003
  • Figure 0007540344000006
    Figure 0007540344000006
Patent Text Reader

Abstract

To provide an information processing device, an image recognition method, and a program that allow a reduction in the calculation amount and memory capacity required for image recognition performed using the attention mechanism.SOLUTION: An information processing device that uses image data as input data and creates an attention map based on the input data to obtain output data includes: a key data calculation unit that calculates key data from the input data; a value data calculation unit that calculates value data from the input data; an attention data calculation unit that generates an attention map based on the key data; and an output data generation unit that generates output data by aggregation of the attention map and the value data.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present invention relates to an information processing device, an image recognition method, and a program. [Background technology]

[0002] Convolutional Neural Networks (CNNs) are widely used as a neural network technique, but in recent years, attention structures described in Patent Document 1 have also been used instead of CNNs.

[0003] As shown in Fig. 7, the attention structure converts input data into three types of data, namely, value, key, and query, by linear conversion, and generates an attention map using the key data and query data. The attention structure then obtains output data by aggregating the attention map and value data. [Prior art documents] [Patent documents]

[0004] [Patent Document 1] Special Publication No. 2020-506466 Summary of the Invention [Problem to be solved by the invention]

[0005] Here, attention structures have been used for natural language recognition, but a self-attention network (SAN) structure using a patchwise self-attention map has been developed as an attention structure for image recognition. The SAN structure does not use the same approach as the conventional attention structure, which is to select query data versus key data. SpatialInstead of generating an attention map from the relationship between each spatial location, we generate an attention map by dividing all the query data by the key data. Spatial The locations are used to generate an attention map.

[0006] However, even in the conventional attention structure and SAN structure, input data is converted into three types of data, namely, value data, key data, and query data, and therefore an information processing device requires a large amount of calculation and memory capacity.

[0007] In view of the above background, the present invention aims to provide an information processing device, an image recognition method, and a program that can reduce the amount of calculations and memory capacity required for image recognition using an attention structure. [Means for solving the problem]

[0008] The present invention employs the following technical means to solve the above problems. The reference characters in the claims and in this section are merely examples showing the corresponding relationship with the specific means described in the embodiments below as one aspect, and do not limit the technical scope of the present invention.

[0009] An information processing device (10) of one embodiment of the present invention is an information processing device that receives image data as input data, creates an attention map based on the input data, and obtains output data, and is equipped with a key data calculation unit (22) that calculates key data from the input data, a value data calculation unit (24) that calculates value data from the input data, an attention map generation unit (26) that generates the attention map based on the key data, and an output data generation unit (28) that generates the output data from the attention map and the value data.

[0010] One embodiment of the image recognition method of the present invention is an image recognition method that uses image data as input data, creates an attention map based on the input data, and obtains output data, calculates key data from the input data, calculates value data from the input data, generates the attention map based on the key data, and generates the output data from the attention map and the value data.

[0011] One aspect of the program of the present invention is a program for using image data as input data, creating an attention map based on the input data, and obtaining output data, and causes a computer to function as a key data calculation unit that calculates key data from the input data, a value data calculation unit that calculates value data from the input data, an attention map generation unit that generates the attention map based on the key data, and an output data generation unit that generates the output data from the attention map and the value data. Effect of the Invention

[0012] According to the present invention, it is possible to reduce the amount of calculations and memory capacity required for image recognition using an attention structure. [Brief description of the drawings]

[0013] [Figure 1] 1 is a functional block diagram showing a configuration of an information processing apparatus according to a first embodiment. [Diagram 2] 1 is a flowchart showing a processing flow of an attention structure in the first embodiment. [Diagram 3] 13 is a flowchart showing the flow of processing of the attention structure in the second embodiment. [Figure 4] 13 is a flowchart showing the flow of processing of the attention structure of the third embodiment. [Diagram 5] 13 is a flowchart showing the flow of processing of the attention structure of the fourth embodiment. [Figure 6]13 is a diagram showing a comparison of accuracy between the attention structure of the embodiment and a conventional attention structure. [Figure 7] 1 is a flowchart showing the flow of processing of a conventional attention structure. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0014] Hereinafter, an embodiment of the present invention will be described with reference to the drawings. Note that the embodiment described below shows an example of a case where the present invention is implemented, and the present invention is not limited to the specific configuration described below. In implementing the present invention, a specific configuration according to the embodiment may be appropriately adopted.

[0015] (First embodiment) 1 is a functional block diagram showing a configuration of an information processing device 10 according to the present embodiment. The information processing device 10 according to the present embodiment performs image recognition using a neural network having a plurality of attention structures, and uses image data as input data, creates an attention map based on the input data, and obtains output data (image recognition results). Note that the information processing device 10 according to the present embodiment is, for example, mounted on a vehicle, and uses image data acquired by an on-board camera as input data, but is not limited thereto, and may be a server to which image data to be the subject of image recognition is input via a network.

[0016] The information processing device 10 of this embodiment includes a calculation unit 12 such as a CPU (Central Processing Unit), a ROM (Read Only Memory) 14 in which various programs and various data are stored in advance, a RAM (Random Access Memory) 16 used as a work area when the calculation unit 12 executes various programs, and a storage device 18 that stores various programs (image recognition processing) and various data executed by the calculation unit 12. The storage device 18 is a semiconductor storage device, but is not particularly limited to this.

[0017] The calculation unit 12 includes an input unit 20, a key data calculation unit 22, a value data calculation unit 24, an attention map generation unit 26, and an output data generation unit 28 in order to execute image recognition processing using the attention structure.

[0018] The input unit 20 receives input of image data to be recognized. In the following description, the image data received by the input unit 20 is also referred to as input data.

[0019] The key data calculation unit 22 calculates key data from the input data. As an example, the key data calculation unit 22 calculates the key data by linearly converting the input data. Note that the conversion formula for converting the input data into the key data is a learned conversion formula.

[0020] The value data calculation unit 24 calculates from the input data Value Data The value data calculation unit 24 calculates the value data by, for example, linearly converting the input data. Note that the conversion formula for converting the input data into the value data is a learned conversion formula.

[0021] The attention map generating unit 26 generates an attention map. As an example, the attention map generating unit 26 of the present embodiment generates an attention map based on key data using a learned predetermined transformation formula, and does not use query data to generate the attention map, as will be described in detail later.

[0022] The output data generating unit 28 generates output data from the attention map and the value data. Note that generating output data from the attention map and the value data is also called aggregation.

[0023] The calculation unit 12 may be provided with a query data calculation unit that calculates query data by linearly converting input data. The attention map generation unit 26 may have a function of generating an attention map based on key data and query data.

[0024] In addition, the attention structure of this embodiment is a SAN (Self-Attention Network) structure in which input data is image data and a patchwise self-attention map is used.

[0025] In the SAN structure, the query data corresponds to one pixel, and the key data corresponds to N pixels x N pixels, so there is a relationship in which the key data contains the query data. Also, although the image range for the input data is the same for the key data and the value data, the number of channels for the value data is greater than the number of channels for the key data. Note that the value data, key data, and query data are increased or decreased by linear conversion for calculating them.

[0026] Next, the image recognition process using the attention structure of this embodiment will be described with reference to Fig. 2. Fig. 2 is a flowchart showing the flow of the attention structure process executed by the information processing device 10. The image recognition process is executed by a program stored in a recording medium such as the storage device 18 included in the information processing device 10. Note that the execution of this program results in the execution of a method corresponding to the program.

[0027] First, in step 100, the input unit 20 accepts image data as input data.

[0028] In the next step 102, the value data calculation unit 24 linearly converts the input data to calculate the value data. In addition, in step 104, the key data calculation unit 22 linearly converts the input data to calculate the key data. Note that steps 102 and 104 may be processed in parallel.

[0029] In the next step 106, the attention map generating unit 26 converts the key data to generate an attention map.

[0030] In the next step 108, the output data generation unit 28 generates and outputs output data by aggregating the attention map and the value data.

[0031] The neural network of this embodiment is composed of a multi-layer attention structure, with the attention structure shown in Fig. 2 corresponding to one layer. That is, the output data outputted through aggregation becomes the input data of the attention structure of the next layer. Then, the output data from the attention structure of the final layer becomes the image recognition result for the input image data.

[0032] As shown in FIG. 2, the attention structure of this embodiment does not calculate query data as in the conventional attention structure, but calculates an attention map by converting only key data.

[0033] The reason why an attention map can be generated by using only key data without using query data is as follows.

[0034] (1) In the SAN structure, to generate an attention map for a certain point (pixel), the image space region of the key data that includes that point (hereinafter referred to as Spatial The query data and key data are generated by linear transformation of the input data, and the key data is Spatial The location is the location of the query data. Spatial It includes the location, which allows us to generate an attention map using only the key data instead of the query data.

[0035] (2) In the SAN structure, the key data and the query data are concatenated and then the attention map is generated by full connection. Therefore, the same data is input twice as the key data and the query data, which is equivalent to doubling the weight value in the fully connected layer. Therefore, by substituting the query data with the key data, the key data is used only once instead of twice, which reduces the amount of calculation and memory capacity.

[0036] Second embodiment The second embodiment of the present invention will be described below. The configuration of the information processing device 10 according to this embodiment is similar to the configuration of the information processing device 10 according to the first embodiment shown in Fig. 1, but the key data calculation unit 22 of this embodiment calculates key data from value data calculated by the value data calculation unit 24.

[0037] FIG. 3 is a flowchart showing the flow of image recognition processing using the attention structure of this embodiment.

[0038] First, in step 200, the input unit 20 accepts image data as input data.

[0039] In the next step, step 202, the value data calculation unit 24 calculates value data by linearly converting the input data.

[0040] In the next step 204, the key data calculation section 22 calculates key data by linearly converting the value data.

[0041] In the next step 206, the attention map generating unit 26 converts the key data to generate an attention map.

[0042] In the next step 208, the output data generation unit 28 generates and outputs output data by aggregating the attention map and the value data.

[0043] 3, in this embodiment, the input data is converted into value data, and then the value data is converted into key data, thereby reducing the amount of calculations. The reason for this is as follows.

[0044] Conventionally, both value data and key data are calculated by linear conversion of input data. Here, the value data has a larger number of channels than the key data. Therefore, in this embodiment, the data used to calculate the key data is set as value data, and the key data is calculated by linearly converting the value data. As described above, the value data has a larger number of channels than the key data, so the value data contains sufficient data necessary for the key data. Furthermore, since the value data has a smaller number of channels than the input data, the amount of calculation required for conversion is smaller when converting from value data to key data.

[0045] Third embodiment Hereinafter, a third embodiment of the present invention will be described. Note that the configuration of the information processing device 10 according to this embodiment is similar to the configuration of the information processing device 10 according to the first embodiment shown in Fig. 1, but the attention structure of this embodiment has a skip connection.

[0046] 4 is a flowchart showing the flow of image recognition processing using the attention structure of this embodiment, where steps 200 to 208 are the same as those in the second embodiment. On the other hand, the attention structure of this embodiment adds value data to output data from an aggregation (output data generating unit 28) as a skip connection to generate output data.

[0047] Here, if key data is calculated from input data as in the conventional attention structure, and value data is also calculated from the input data, a branching path occurs in the attention structure until the output data is obtained, and the attention map is not calculated using the value data (see FIG. 7). However, by calculating key data from value data as in this embodiment, the branching path that existed in the conventional attention structure disappears, and the attention map is calculated using the value data, so that a skip connection using the value data can be introduced, and the gradient vanishing divergence problem can be avoided.

[0048] (Fourth embodiment) The fourth embodiment of the present invention will be described below. The configuration of the information processing device 10 according to this embodiment is similar to the configuration of the information processing device 10 according to the first embodiment shown in Fig. 1, but the attention map generating unit 26 of this embodiment generates an attention map based on key data and value data.

[0049] Fig. 5 is a flowchart showing the flow of image recognition processing using the attention structure of this embodiment. Note that the same steps in Fig. 5 as those in Fig. 3 or Fig. 4 are denoted by the same reference numerals as those in Fig. 3 or Fig. 4, and their explanations will be omitted in part or in whole.

[0050] In step 207, which follows step 204, the attention map generating unit 26 generates an attention map by converting the value data and the key data using a predetermined conversion formula. Then, in step 208, the attention map and the value data are aggregated to generate and output output data.

[0051] In addition, even in the attention structure of this embodiment shown in FIG. 5, a skip connection may be introduced as in FIG.

[0052] (Effects of the embodiment) 6 is a diagram showing a comparison of accuracy between a conventional attention structure and the attention structure of the second embodiment as an example. The SAN structures used for comparison are SAN19, SAN15, and SAN10. Note that SAN19 has 19 SAN structures, SAN15 has 15 SAN structures, and SAN10 has 10 SAN structures.

[0053] In Fig. 6, the accuracy of top1 and top5 in the ImageNet dataset is compared, and there is no significant difference in accuracy between the conventional method and this embodiment in any SAN structure. In other words, even if the attention map is generated without using query data, there is no deterioration in the accuracy of image recognition. Furthermore, the number of parameters (Params) and the number of Flops are both reduced in this embodiment compared to the conventional method, and this result shows that the calculation amount of this embodiment is smaller than that of the conventional method.

[0054] As described above, the information processing device 10 of the present embodiment can reduce the amount of calculation and memory capacity required for image recognition using the attention structure. That is, in the past, it was necessary to calculate three types of data, namely, value data, key data, and query data, store them in different memory areas, and read each data from each memory, which required a large amount of calculation and memory capacity. On the other hand, in the case where the input data is image data as in the present embodiment, the query data is not calculated and the query data is not used to generate the attention map by utilizing the fact that the query data is included in the key data. Therefore, in the present embodiment, the amount of calculation required to calculate the query data and the memory capacity for storing the query data can be reduced, and the reading from the memory is also reduced, so that the amount of calculation and the memory capacity can be reduced compared to the past.

[0055] Although the present invention has been described above using the above embodiment, the technical scope of the present invention is not limited to the scope described in the above embodiment. Various modifications or improvements can be made to the above embodiment without departing from the gist of the invention, and the forms with such modifications or improvements are also included in the technical scope of the present invention.

[0056] Furthermore, the processing flow described in the above embodiment is merely an example, and unnecessary steps may be deleted, new steps may be added, or the processing order may be rearranged, without departing from the spirit of the present invention. [Explanation of symbols]

[0057] 10: information processing device, 22: key data calculation unit, 24: value data calculation unit, 26: attention map calculation unit, 28: output data generation unit

Claims

1. An information processing device (10) that receives image data as input data, creates an attention map based on the input data, and obtains output data, a key data calculation unit (22) for calculating key data including a spatial location of query data from the input data; a value data calculation unit (24) that calculates value data from the input data; an attention map generating unit (26) for generating the attention map having a SAN structure using only the key data instead of query data; an output data generating unit (28) that generates the output data from the attention map and the value data; An information processing device comprising:

2. The information processing apparatus according to claim 1 , wherein the key data calculation section calculates the key data from the value data calculated by the value data calculation section.

3. The information processing apparatus according to claim 2 , wherein the value data is added to the output data from the output data generating section to generate the output data.

4. The information processing device according to claim 1 , wherein the attention map generating section generates the attention map based on the key data and the value data.

5. 1. An image recognition method for obtaining output data by creating an attention map based on image data as input data, the method comprising: Calculating key data including a spatial location of query data from the input data; Calculating value data from the input data; generating the attention map in a SAN structure using only the key data instead of query data; generating the output data from the attention map and the value data; Image recognition methods.

6. A program for receiving image data as input data, creating an attention map based on the input data, and obtaining output data, comprising: Computer, a key data calculation unit that calculates key data including a spatial location of query data from the input data; a value data calculation unit for calculating value data from the input data; an attention map generating unit for generating the attention map having a SAN structure by using only the key data instead of query data; an output data generation unit that generates the output data from the attention map and the value data; A program that makes it work.

Citation Information

Patent Citations

  • Attention-based sequence-to-sequence neural network

    JP2020506466A

  • Method and apparatus with key-value coupling

    US20200320408A1