Image frame processing chip and vehicle
Through the design of the image frame processing chip, the cooperation of the storage module and the acquisition module is used to achieve efficient calculation of the attention processing results, solve the problem of reduced computing efficiency caused by the attention mechanism, and improve the performance of the vehicle system.
Patent Information
- Application Number
- CN202410649672.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-05-23
AI Technical Summary
The attention mechanism leads to reduced computational efficiency in neural network models, especially affecting autonomous driving functions in vehicle image processing scenarios.
Design an image frame processing chip that stores multiple offset point information and attention weights corresponding to the reference points of the feature map of the image frame through the storage module, the acquisition module reads and forwards this information, and the determination module calculates and stores based on this information. The attention processing result realizes one data reading and writing step to complete the attention processing.
It reduces the reading and writing overhead of the data reading step in the process of determining the attention processing results, reduces the resource and time consumption in the calculation process of the neural network model, and improves the performance and efficiency of the vehicle system.
Smart Images

Figure CN118570616A
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image frame processing chip and a vehicle. Background Art
[0002] With the continuous development of AI (Artificial Intelligence) technology, attention mechanism has been widely used in natural language processing, computer vision and other fields. However, although the attention mechanism can enable the neural network model to focus on specific data information to improve the model prediction accuracy, it also introduces corresponding overhead, which affects the computational efficiency of the model to a certain extent. Summary of the invention
[0003] The present application provides an image frame processing chip and a vehicle.
[0004] The image frame processing chip provided in the embodiment of the present application includes:
[0005] A storage module configured to store information of a plurality of offset points and attention weights corresponding to reference points of a feature map of an image frame;
[0006] An acquisition module, configured to send a data read request to the storage module, and receive the plurality of offset point information and attention weights sent by the storage module;
[0007] A determination module is configured to determine the attention processing result of the feature map according to the multiple offset point information and the attention weight forwarded by the acquisition module, and store the attention processing result into the storage module to complete the processing of the image frame.
[0008] In the image frame processing chip provided in the embodiment of the present application, the storage module can store multiple offset point information and attention weights corresponding to the reference points of the feature map of the image frame, the acquisition module can send a data read request to the storage module, and receive the multiple offset point information and attention weights sent by the storage module, the determination module can determine the attention processing result of the feature map based on the multiple offset point information and attention weights forwarded by the acquisition module, and store the attention processing result in the storage module to complete the processing of the image frame.
[0009] Thus, in an embodiment of the present application, the determination module of the image frame processing chip can determine the attention processing result of the feature map of the image frame based on the offset point information and attention weight obtained by the acquisition module from the storage module, so that the determination of the attention processing result can be achieved through a single data reading and writing step, thereby reducing the reading and writing overhead brought by the data reading step in the process of determining the attention processing result, thereby weakening the negative impact brought by the attention mechanism in the calculation process of the neural network model.
[0010] In certain embodiments of the present application, the information of the multiple offset points corresponding to the reference point includes coordinate information of the multiple offset points and interpolated pixel values corresponding to the multiple offset points, and the determination module includes a first determination submodule and a second determination submodule;
[0011] The first determination submodule is configured to determine the target weight corresponding to the offset point according to the attention weight forwarded by the acquisition module and the coordinate information of the offset point;
[0012] The second determination submodule is configured to determine the attention processing result according to the target weight sent by the first determination submodule and the interpolation pixel value forwarded by the acquisition module.
[0013] Thus, in an embodiment of the present application, the target weight can be determined based on the attention weight, the coordinate information of the offset point of the feature map, and the interpolated pixel value corresponding to the offset point, and the attention processing result can be determined according to the target weight and the pixel value of the interpolated pixel point, thereby realizing the online calculation of the attention processing result.
[0014] In some embodiments of the present application, the coordinate information of the offset point includes a decimal part of the offset point coordinate, and the first determination submodule is configured as follows:
[0015] Determining an interpolation pixel coefficient corresponding to the offset point according to the decimal part of the offset point;
[0016] The target weight corresponding to the offset point is determined according to the attention weight and the interpolation pixel coefficient corresponding to the offset point.
[0017] Thus, in the implementation mode of the present application, the determination of the interpolation pixel coefficient can be completed based on the decimal part of the offset point coordinates, thereby reducing the overhead caused by the data interaction in the calculation process of the attention processing results to a certain extent, and enabling the interpolation pixel coefficient to be determined efficiently.
[0018] In some embodiments of the present application, the second determination submodule is configured as follows:
[0019] Determine the sub-attention processing result corresponding to each offset point according to the target weight and the interpolated pixel value corresponding to each offset point;
[0020] The attention processing result is determined according to the sub-attention processing result corresponding to each of the offset points.
[0021] Thus, in an embodiment of the present application, the attention processing result of the feature map may be determined based on the sub-attention processing result of each offset point in the feature map.
[0022] In certain embodiments of the present application, the information of the multiple offset points corresponding to the reference point includes coordinate information of the multiple offset points and interpolated pixel values corresponding to the multiple offset points, and the determination module includes a first determination submodule and a second determination submodule;
[0023] The first determination submodule is configured to determine the interpolation pixel coefficients corresponding to the offset points according to the coordinate information of the offset points forwarded by the acquisition module, construct a coefficient matrix according to the interpolation pixel coefficients corresponding to each of the offset points, and determine a weight matrix according to the coefficient matrix and the attention weights;
[0024] The second determination submodule is configured to determine the attention processing result based on the weight matrix sent by the first determination submodule and the interpolated pixel values corresponding to the multiple offset points forwarded by the acquisition module.
[0025] Thus, in an embodiment of the present application, the attention processing result of the feature map may be determined based on the sub-attention processing result of each offset point in the feature map.
[0026] In certain embodiments of the present application, the information of the multiple offset points corresponding to the reference point includes coordinate information of the multiple offset points and interpolated pixel values corresponding to the multiple offset points, and the determination module includes a first determination submodule and a second determination submodule;
[0027] The first determination submodule is configured to determine the interpolation pixel coefficient corresponding to the offset point according to the coordinate information of the offset point forwarded by the acquisition module, and determine the offset point pixel value of the offset point according to the interpolation pixel coefficient corresponding to the offset point and the interpolation pixel value corresponding to the offset point forwarded by the acquisition module;
[0028] The second determination submodule is configured to determine the attention processing result according to the attention weight forwarded by the acquisition module and the offset point pixel value sent by the first determination submodule.
[0029] Thus, in an embodiment of the present application, the interpolation pixel coefficients of the interpolation pixel points corresponding to the offset points can be determined by the coordinate information of the offset points, a coefficient matrix can be constructed according to the interpolation pixel coefficients of the interpolation pixel points corresponding to each offset point, and the attention processing results can be determined by combining the coefficient matrix, attention weights and interpolation pixel values with matrix operations, so that the attention processing results can be efficiently determined.
[0030] In certain embodiments of the present application, the information of the multiple offset points corresponding to the reference point includes coordinate information of the multiple offset points and interpolated pixel values corresponding to the multiple offset points, and the determination module includes a first determination submodule and a second determination submodule;
[0031] The first determination submodule is configured to determine a pixel weighted result corresponding to the offset point according to the interpolated pixel value corresponding to the offset point forwarded by the acquisition module and the attention weight;
[0032] The second determination submodule is configured to determine the attention processing result based on the pixel weighting result corresponding to the offset point sent by the first determination submodule and the interpolation pixel coefficient determined by the coordinate information forwarded by the acquisition module.
[0033] Thus, in an embodiment of the present application, the attention processing result of the feature map can be determined based on the attention weight of the feature map and the pixel value of the offset point in the feature map, so that the attention processing result of the feature map can be determined efficiently.
[0034] In some embodiments of the present application, the offset point information includes offset point pixel values of the multiple offset points, and the determination module is configured as follows:
[0035] Determine the sub-attention processing result corresponding to the offset point according to the offset point pixel value and the attention weight forwarded by the acquisition module;
[0036] The attention processing result is determined according to the sub-attention processing results corresponding to the multiple offset points.
[0037] Thus, in an embodiment of the present application, the attention weight, the coordinate information of the offset point of the feature map, and the pixel value of the interpolated pixel point corresponding to the offset point can be obtained to determine the offset point pixel value, and the attention processing result can be determined based on the offset point pixel value and the attention weight, thereby realizing the online calculation of the attention processing result.
[0038] In certain embodiments of the present application, the coordinate information of the multiple offset points corresponding to the reference point is obtained by randomly selecting pixels of the feature map based on a pre-trained neural network model.
[0039] Thus, in an embodiment of the present application, the coordinate information of multiple offset points can be determined randomly based on a neural network model and pixels.
[0040] An embodiment of the present application provides a vehicle, comprising the above-mentioned image frame processing chip.
[0041] In the vehicle provided in the embodiment of the present application, the determination module of the image frame processing chip can determine the attention processing result of the feature map of the image frame based on the offset point information and attention weight obtained by the acquisition module from the storage module, so that the determination of the attention processing result can be achieved through a single data reading and writing step, thereby reducing the reading and writing overhead brought by the data reading step in the process of determining the attention processing result, thereby weakening the negative impact brought by the attention mechanism in the calculation process of the neural network model.
[0042] Additional aspects and advantages of the embodiments of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0044] Figure 1 A schematic diagram of an image frame processing chip in certain embodiments of the present application;
[0045] Figure 2 A schematic diagram of an image frame processing chip in certain embodiments of the present application;
[0046] Figure 3 A schematic diagram of an image frame processing chip in certain embodiments of the present application;
[0047] Figure 4 A schematic diagram of application scenarios in certain embodiments of the present application;
[0048] Figure 5 A schematic diagram of an image frame processing chip in certain embodiments of the present application;
[0049] Figure 6 This is a schematic diagram of an image frame processing chip in certain implementation modes of the present application. DETAILED DESCRIPTION
[0050] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals represent the same or similar elements or elements having the same or similar functions from beginning to end. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the embodiments of the present application, and cannot be understood as limiting the embodiments of the present application.
[0051] With the continuous development of AI (Artificial Intelligence), the attention mechanism has attracted more and more attention in the industry and has been widely used in various fields such as natural language processing and computer vision.
[0052] At the same time, with the application of attention mechanism, the variants of attention mechanism are also increasing, such as channel attention, space attention, self-attention and deformable attention, etc. Among them, deformable attention has the advantages of low computational complexity and adaptability to non-fixed positions. Therefore, it has been widely used in the visual field where the amount of calculation is large and needs to be designed separately for visual targets.
[0053] However, in the actual application of deformable attention, the GPU (Graphics Processing Unit) and / or the CPU (Center Processing Unit) are usually used to linearly complete the various calculation steps of deformable attention. The calculation formula of deformable attention can be referred to as follows, namely:
[0054]
[0055] Where q represents the query vector index, z q represents the input query feature vector, p q represents the offset reference point of the query vector, x represents the input feature map, m represents the attention head index, M represents the total number of attention heads, k represents the sampling point index, K represents the total number of sampling points, and A mqk represents the attention weight of the kth offset point in the mth attention head of the query feature vector q, W m represents the output mapping matrix, W m ' represents the input mapping matrix of x, Δp mqk Represents the offset of the query feature vector q at the kth offset point on the mth attention head.
[0056] Furthermore, in the traditional implementation of the deformable attention mechanism, for each sampling point of the offset point, p is usually read from the external memory. q , Δp mqk and W m '(or read p q +Δp mqk ), after completing the corresponding multiplication and / or addition operation, the operation result is written into the external memory, and then the operation result and x are read from the external memory, and then the corresponding product operation is performed to obtain the pixel operation result of the sampling point. Then the pixel operation result is written into the external memory, and the pixel operation result and A are read from the external memory. mqk, and the pixel operation result and A mqk The corresponding product operation is performed to obtain the sampling result corresponding to the sampling point. Finally, the deformable attention calculation result is obtained according to the sampling results corresponding to the K sampling points of the M attention heads.
[0057] It is understandable that this linear calculation process involves multiple external memory reads and writes, and the reading and writing of external memory usually needs to consider queuing, priority, and preemption. The reading and writing of external memory requires a large overhead, which leads to more resources required for the calculation of deformable attention and a longer calculation time, which ultimately affects the computational efficiency of the neural network model.
[0058] It is also understandable that in vehicle-mounted system image processing scenarios with high real-time requirements, such as autonomous driving scenarios, the resources and time required for the calculation of deformable attention may affect the computational efficiency of the vehicle-mounted image processing model, thereby affecting the vehicle's autonomous driving function.
[0059] Based on the above problems you may encounter, please refer to Figure 1 The embodiment of the present application provides an image frame processing chip 100, comprising:
[0060] A storage module 110 is configured to store information of multiple offset points and attention weights corresponding to reference points of a feature map of an image frame;
[0061] The acquisition module 120 is configured to send a data read request to the storage module 110, and receive a plurality of offset point information and attention weights sent by the storage module 110;
[0062] The determination module 130 is configured to determine the attention processing result of the feature map according to the multiple offset point information and attention weights forwarded by the acquisition module 120, and store the attention processing result into the storage module 110 to complete the processing of the image frame.
[0063] Specifically, in an embodiment of the present application, a vehicle may be equipped with or installed with an image frame processing chip 100, and then in the process of the vehicle using a neural network model to process a feature map of an image frame, the storage module 110 of the image frame processing chip 100 may store a plurality of offset point information and attention weights corresponding to reference points of the feature map of the image frame, and the acquisition module 120 of the image frame processing chip 100 may send a data read request to the storage module 110, so that the storage module 110 sends a plurality of offset point information and attention weights corresponding to reference points of the feature map to the acquisition module 120.
[0064] Further, when the acquisition module 120 receives the multiple offset point information and attention weights corresponding to the reference points of the feature map, the acquisition module 120 may forward the multiple offset point information and attention weights corresponding to the reference points of the feature map to the determination module 130. The determination module 130 may determine the attention processing result of the feature map based on the multiple offset point information and attention weights corresponding to the reference points of the received feature map.
[0065] It can be understood that in the implementation manner of the present application, when the vehicle controls the camera component to perform a shooting action to obtain an image frame, a feature map can be obtained by performing feature extraction processing on the image frame.
[0066] Furthermore, the offset point in the embodiment of the present application can be understood as a point determined by the offset and the reference point coordinates in the feature map. Also, the attention weight can be understood as the weight corresponding to different offset points, which can be used to calculate the weighted value of the pixel value of the offset point.
[0067] It can also be understood that the reference point, offset, offset point and attention weight in the embodiments of the present application can be understood as data that can be determined by a pre-trained neural network model, or in other words, these data can be given by a pre-trained neural network model.
[0068] Optionally, in certain embodiments of the present application, the reference point, the offset, the offset point and the attention weight may be represented by the following formula, namely:
[0069]
[0070] Where DeformAttn() represents deformable attention, q represents the query vector index, and z q represents the input query feature vector, p q represents the offset reference point of the query vector, x represents the input feature map, m represents the attention head index, M represents the total number of attention heads, k represents the sampling point index, K represents the total number of sampling points, and A mqk represents the attention weight of the kth offset point in the mth attention head of the query feature vector q, W m represents the output mapping matrix, W m ' represents the input mapping matrix of x, Δp mqk Represents the offset of the query feature vector q at the kth offset point on the mth attention head.
[0071] As shown in the above formula, p q It can be understood as the reference point of the implementation mode of this application, Δp mqk It can be understood as the above offset, (p q +Δp mqk ) can be understood as the offset point of the embodiment of the present application, Amqk It can be understood as the attention weight of the implementation mode of this application.
[0072] It can be understood that when calculating the attention mechanism through the above formula, the various parameters in the formula such as A mqk , Δp mqk , W m ' and p q The specific values of parameters such as can be given by the pre-trained neural network model.
[0073] It can also be understood that the offset point information in the implementation mode of the present application can be understood as the above formula and p q Related data, such as W m 'x(p q +Δp mqk ). It is understandable that W m 'x(p q +Δp mqk ) can represent the pixel value of the offset point in the feature map.
[0074] It should also be noted that in the implementation of the present application, the offset point information and the attention weight are known quantities pre-stored in the memory. Figure 2 , Figure 2 Schematic diagram of the image frame processing chip 100 in some embodiments of the present application. That is, the acquisition module 120 in the embodiment of the present application can read the offset point information and the attention weight from the storage module 110, and forward the offset point information and the attention weight to the determination module 130. The determination module 130 can determine the attention processing result of the feature map according to the offset point information and the attention weight, thereby completing the calculation of the deformable attention.
[0075] It can be understood that the implementation mode of the present application can complete the calculation of the attention processing result in an online calculation manner after all the data required for the calculation of the attention processing result are read, that is, after reading the offset point information and attention weight required for the calculation of the attention processing result, the corresponding calculation unit (such as the determination module 130) is used to calculate the attention processing result through the offset point information and the attention weight, and the intermediate results in the calculation process (such as the above-mentioned pixel operation results) are no longer written into the corresponding storage unit (such as the storage module 110), but are directly used in the next calculation step until the final calculation result is obtained, that is, after the attention processing result is obtained, the calculation unit (such as the determination module 130) writes the attention processing result into the storage unit (such as the storage module 110) so that the corresponding device (such as an external processing module) reads the attention processing result, and captures the feature elements or feature information in the feature map according to the attention processing result.
[0076] It is also understandable that based on Figure 1 or Figure 2 The calculation method of the attention processing results implemented in the implementation method of the present application makes it possible for the intermediate calculation results to no longer be written to the storage unit (such as the storage module 110) during the complete calculation process of the attention processing results, so that the complete calculation process includes the reading and writing of the storage unit (such as the storage module 110) once.
[0077] Therefore, compared with the multiple storage unit reading and writing included in the traditional deformable attention mechanism implementation scheme, the implementation method of the present application can reduce the number of storage unit reading and writing times, and thus reduce the storage unit reading and writing overhead, thereby reducing the resources and time required for the calculation of the deformable attention. Therefore, for the neural network model that implements the deformable attention mechanism, the negative impact of the deformable attention mechanism on the model's computational efficiency can be alleviated.
[0078] In summary, in the implementation manner of the present application, the determination module 130 of the image frame processing chip 100 can determine the attention processing result of the feature map of the image frame based on the offset point information and attention weight required for calculating the attention processing result obtained by the acquisition module 120 from the storage module 110, so that the determination of the attention processing result can be achieved through a single data reading and writing step, thereby reducing the reading and writing overhead brought by the data reading step in the process of determining the attention processing result, thereby weakening the negative impact brought by the attention mechanism in the calculation process of the neural network model.
[0079] Moreover, it reduces the access and reading and writing of memory during the image processing process, thereby reducing the access conflicts existing when sharing memory with other processing units of the vehicle to a certain extent, and further reducing the negative impact of image processing on the performance of the vehicle system.
[0080] Furthermore, since in the vehicle-mounted system, the memory may be accessed based on the bus, the access and reading and writing of the memory during the image processing process are reduced, thereby reducing the power consumption of the bus and the memory.
[0081] In addition, since the implementation method of the present application reads "all the data required to determine the attention processing results" at one time, the data reading steps are reduced, thereby reducing the calculation time brought by the data reading steps. This can improve the efficiency of attention processing result calculation, neural network model reasoning and image processing, and the performance of the vehicle system can be improved.
[0082] See also Figure 3 , the multiple offset point information corresponding to the reference point includes coordinate information of the multiple offset points and interpolated pixel values corresponding to the multiple offset points, and the determination module 130 includes a first determination submodule 131 and a second determination submodule 132;
[0083] The first determination submodule 131 is configured to determine the target weight corresponding to the offset point according to the attention weight forwarded by the acquisition module 120 and the coordinate information of the offset point;
[0084] The second determination submodule 132 is configured to determine the attention processing result according to the target weight sent by the first determination submodule 131 and the interpolated pixel value forwarded by the acquisition module 120 .
[0085] Specifically, in the embodiment of the present application, the determination module 130 includes a first determination submodule 131 and a second determination submodule 132. Furthermore, the offset point information obtained by the acquisition module 120 from the storage module 110 includes the coordinate information of the offset point of the feature map, and the pixel value of the interpolated pixel point corresponding to the offset point (i.e., the interpolated pixel value), and the first determination submodule 131 and the second determination submodule 132 complete the online calculation of the attention processing result through these data.
[0086] It should be noted that in the calculation formula of the deformable attention mechanism, the pixel value of the offset point in the tensor (i.e., the feature map) needs to be determined according to the coordinates of the offset point, that is, W in the above formula m 'x(p q +Δp mqk ).
[0087] It should also be noted that in W m 'x(p q +Δp mqk ), based on (p q +Δp mqk ) in the offset point coordinates represented by , the horizontal and vertical coordinates may both be decimals (or floating point numbers), such as (3.4,5.2).
[0088] It is understandable that when both the horizontal and vertical coordinates are decimals, (p q +Δp mqk ) is difficult to point to any pixel in the feature map. Therefore, (p q +Δp mqk ) around the pixels pointed to by the coordinates whose horizontal and vertical coordinates are both integers, to equivalently replace (p q +Δp mqk ), that is, the pixel value of the offset point is determined by the pixel value of the interpolated pixel point corresponding to the offset point.
[0089] Therefore, in some embodiments of the present application, W in the calculation formula of the deformable attention mechanism m 'x(p q +Δp mqk ), can be expanded into the following formula:
[0090] W m ′x(p q +Δp mqk )=(P)=(Q 11 )(2-x)(2-)+(Q 12 )(2-)(y-1)
[0091] +(Q 21 )(-x1)(2-)+(Q 22 )(-x1)(-y1)
[0092] To more clearly illustrate the implementation of this application, please refer to Figure 4 , Figure 4 Schematic diagram of application scenarios in certain embodiments of the present application. Figure 4 As shown in the above formula, P(x,y) represents the coordinates of the offset point, f() represents the pixel value corresponding to the coordinates in the brackets, and Q 11 (x1,y1),Q 12 (x1,y2),Q 21 (y2,y1) and Q 22 (x2, y2) represents the interpolated pixel point corresponding to the offset point.
[0093] Among them, Q 11 , Q 12 , Q 21 and Q 22 It can be determined by P. For example, when P is (4.4, 4.8), Q 11 It can be (4,4), Q 12 It can be (4,5), Q 21 It can be (5,4), Q 22 It can be (5,5).
[0094] Furthermore, Q 11 , Q 12 , Q 21 and Q 22 It can be determined by rounding up and down the results of P. For example, when P is (4.4, 4.8), the rounding up result of the horizontal coordinate (i.e. 4.4) is 5, and the rounding down result is 4, while the rounding up and rounding down results of the vertical coordinate (i.e. 4.8) are 5 and 4 respectively. Then, the Q corresponding to P is determined by the horizontal and vertical coordinate values in the range of 4 and 5. 11 , Q 12 , Q 21 and Q 22 .
[0095] Based on the above background, the implementation method of the present application can complete the online calculation of the attention processing results through the coordinate information of the offset points of the determined feature map and the pixel values of the interpolated pixel points corresponding to the offset points.
[0096] For details, please refer again to Figure 3 and Figure 4 , and let the offset point be P(x,y), and let the interpolation pixel point be Q 11 (x1,y1),Q 12 (x1,y2),Q 21 (y2,y1) and Q 22 (x2,y2), and let the attention weight be A k , then:
[0097] The acquisition module 120 sends a read request to the storage module 110. The storage module 110 sends the attention weight A to the acquisition module 120 according to the received read request. k , the coordinate information of the offset point P and the interpolated pixel point Q 11 , Q 12 , Q 21 and Q 22 The pixel value (i.e., interpolated pixel value), f(Q 11 )、f(Q 12 )、f(Q 21 ) and f(Q 22 ).
[0098] After receiving the data sent by the storage module 110, the acquisition module 120 sends the attention weight A to the first determination submodule 131. k and the coordinate information of the offset point P, and sends the interpolated pixel value f(Q 11 )、f(Q 12 )、f(Q 21 ) and f(Q 22 ).
[0099] The first determination submodule 131 receives the coordinate information of the offset point P (x, y) and Q 11 (x1,y1),Q 12 (x1,y2),Q 21 (y2,y1) and Q 22 (x2,y2), determine Q 11 , Q 12 , Q 21 and Q 22 The interpolation pixel coefficient C. Among them, Q 11 The interpolation pixel coefficient C 11 is (x2-x)(y2-y), Q 12 The interpolation pixel coefficient C12 is (x2-x)(y-y1), Q 21 The interpolation pixel coefficient C 21 is (x-x1)(y2-y), Q 22 The interpolation pixel coefficient C 22 is (x-x1)(y-y1).
[0100] Then, for each interpolated pixel point Q, the first determination submodule 131 calculates the attention weight A k The product of the interpolation pixel coefficient C of the interpolation pixel point is obtained to obtain the target weight wgt corresponding to the interpolation pixel point Q. The calculation formula of the target weight wgt can be shown as follows, that is:
[0101] wgt1= k ·(x2-x)(2-)
[0102] wgt2= k ·(x2-)(y-1)
[0103] wgt3= k ·(x-x1)(2-)
[0104] wgt4= k ·(x-x1)(-y1)
[0105] Then, the first determination submodule 131 sends the target weight wgt corresponding to each interpolation pixel point Q to the second determination submodule 132. The second determination submodule 132 performs an inner product operation on wgt and f(Q) corresponding to each interpolation pixel point Q according to the received wgt and f(Q), and sums them to obtain the operation result res corresponding to P. The specific process can be referred to the following formula, that is:
[0106] res=f(Q 11 )·gt1+(Q 12 )·gt2+(Q 21 )·gt3+(Q 22 )·wgt4
[0107] Finally, the attention processing result of the feature map can be determined according to the calculation result res corresponding to P.
[0108] Thus, in an embodiment of the present application, the target weight can be determined based on the attention weight, the coordinate information of the offset point of the feature map, and the interpolated pixel value corresponding to the offset point, and the attention processing result can be determined according to the target weight and the pixel value of the interpolated pixel point, thereby realizing the online calculation of the attention processing result.
[0109] In some embodiments of the present application, the coordinate information of the offset point includes the decimal part of the offset point coordinate, and the first determination submodule 131 is configured as follows:
[0110] According to the decimal part of the offset point, determine the interpolation pixel coefficient corresponding to the offset point;
[0111] According to the attention weight and the interpolation pixel coefficient corresponding to the offset point, the target weight corresponding to the offset point is determined.
[0112] Specifically, in order to improve the efficiency of determining the interpolation pixel coefficients and reduce the time required to calculate the attention processing results, the coordinate information of the offset point in the implementation mode of the present application may include the decimal part of the horizontal and vertical coordinates of the offset point.
[0113] To more clearly illustrate the implementation method of this application, please refer to Figure 4 Specifically, let P(x,y) denote the offset point, and let Q 11 (x1,y1),Q 12 (x1,y2),Q 21 (y2,y1) and Q 22 (x2, y2) represent the interpolated pixel points corresponding to the offset points, respectively. Refer to the calculation formula of the deformable attention mechanism above: m 'x(p q +Δp mqk ), that is:
[0114] W m ′x(p q +Δp mqk )=(P)=(Q 11 )(2-x)(2-)+(Q 12 )(2-)(y-1)
[0115] +(Q 21 )(-x1)(2-)+(Q 22 )(-x1)(-y1)
[0116] It can be understood that the coordinates of the interpolated pixel point Q corresponding to the offset point P can be determined by the decimal part of the horizontal and vertical coordinates of the offset point P and the difference of the decimal part relative to 1. For example, let the decimal part x of the horizontal coordinate of the offset point P be d , and let the decimal part of the ordinate of the offset point P be y d , then: Q 11 The interpolation pixel coefficient C1 is ((1-x d )*(1-y d )), Q 12 The interpolation pixel coefficient C2 is ((1-x d )*y d ), Q21 The interpolation pixel coefficient C3 is (x d *(1-y d )), Q 22 The interpolation pixel coefficient C4 is (x d *y d ).
[0117] Based on this, the implementation method of the present application can obtain and use the decimal part of the coordinates of the offset point to complete the determination of the interpolation pixel coefficient. Figure 3 In some embodiments shown in the figure, after the acquisition module 120 sends a read request to the storage module 110, the storage module 110 sends the attention weight A to the acquisition module 120 according to the received read request. k 、f(Q 11 )、f(Q 12 )、f(Q 21 )、f(Q 22 ) and the decimal part of the offset point P(x,y), that is, x d and d .
[0118] After the acquisition module 120 sends a read request to the storage module 110, the storage module 110 determines the integer part and the decimal part of the offset point P(x, y) according to the received read request, and determines Q according to the integer part of the offset point P(x, y) (or, according to the integer part and the decimal part of the offset point P). 11 , Q 12 , Q 21 and Q 22 The pixel value, that is, f(Q 11 )、f(Q 12 )、f(Q 21 )、f(Q 22 ).
[0119] Further, the storage module 110 determines f(Q 11 )、f(Q 12 )、f(Q 21 )、f(Q 22 ) and determine the attention weight A k In the case of , the attention weight A can be sent to the acquisition module 120 k 、f(Q 11 )、f(Q 12 )、f(Q 21 )、f(Q 22 ) and the fractional part of the offset point P(x,y).
[0120] Thus, in the implementation mode of the present application, the determination of the interpolation pixel coefficient can be completed based on the decimal part of the offset point coordinates, thereby reducing the overhead caused by the data interaction in the calculation process of the attention processing results to a certain extent, and enabling the interpolation pixel coefficient to be determined efficiently.
[0121] In some embodiments of the present application, the second determining submodule 132 is configured as follows:
[0122] According to the target weight and interpolated pixel value corresponding to each offset point, the sub-attention processing result corresponding to each offset point is determined;
[0123] Determine the attention processing result according to the sub-attention processing result corresponding to each offset point.
[0124] It can be understood that in the implementation manner of the present application, a feature map may have multiple offset points. For example, in the above-mentioned deformable attention calculation formula, one attention head corresponds to K offset points.
[0125] Therefore, for multiple offset points of the feature map, the second determination submodule 132 (or determination module 130) of the embodiment of the present application can store the sub-attention processing result corresponding to an offset point in a data storage unit (such as a register) of its own each time when calculating the sub-attention processing result corresponding to the offset point, so as to perform the accumulation of the sub-attention processing results of multiple offset points through the data storage unit, thereby obtaining the attention processing result of the feature map.
[0126] For more information, please refer again to Figure 4 , and let the sub-attention processing result be the above-mentioned operation result res, then: a register is set inside the second determination submodule 132. Every time the second determination submodule 132 calculates the res corresponding to an offset point P, it stores the res corresponding to the offset point P in the register, so as to realize the accumulation of res of each offset point P corresponding to the feature map through the register, thereby obtaining the attention processing result DeformAttn of the feature map, and sending DeformAttn to the storage module 110 for storage.
[0127] Thus, in an embodiment of the present application, the attention processing result of the feature map may be determined based on the sub-attention processing result of each offset point in the feature map.
[0128] In some embodiments of the present application, the information of the multiple offset points corresponding to the reference point includes coordinate information of the multiple offset points and interpolated pixel values corresponding to the multiple offset points, and the determination module 130 includes a first determination submodule 131 and a second determination submodule 132;
[0129] The first determination submodule 131 is configured to determine the interpolation pixel coefficients corresponding to the offset points according to the coordinate information of the offset points forwarded by the acquisition module 120, construct a coefficient matrix according to the interpolation pixel coefficients corresponding to each offset point, and determine a weight matrix according to the coefficient matrix and the attention weights;
[0130] The second determination submodule 132 is configured to determine the attention processing result according to the weight matrix sent by the first determination submodule 131 and the interpolated pixel values corresponding to the multiple offset points forwarded by the acquisition module 120.
[0131] Specifically, the reasoning process of the neural network model usually involves the processing of multiple channels or multiple images. For example, in one example, an image with a size of 224×224 and a color mode of RGB (Red-Green-Blue) three channels is input into the neural network model to determine the category to which the object in the RGB image belongs among the known 1000 categories. The change process of the image may include: (224,224,3)-(224,224,64)-(112,112,128)-(56,56,256)-(28,28,512)-(14,14,512)-(7,7,512)-(1,1,4096)-(1,1,1000).
[0132] It can be understood that, in the above-mentioned image change process, the first two parameters in the brackets can represent the size of the image, and the last parameter in the brackets can represent the number of channels of the image.
[0133] Similar to the changing process of the above-mentioned images, when the neural network model includes an attention mechanism, the corresponding attention processing results can be calculated for the images of each channel, and the images of each channel can be processed through the attention processing results of the images of each channel.
[0134] It can also be understood that a complete image can be understood as being composed of multiple passing sub-images, and thus the feature graph of the embodiment of the present application can be composed of multiple feature sub-graphs. Also, there can be multiple offset points in an image.
[0135] Based on the above background, in an embodiment of the present application, in order to realize efficient processing of multi-channel and multi-offset points of a feature graph, or to realize efficient processing of single-channel and multi-offset points of a feature graph, the embodiment of the present application may integrate the calculation data corresponding to multiple offset points into a matrix, so as to realize parallel calculation of attention processing results corresponding to multiple offset points through matrix operations.
[0136] Specifically, in the embodiment of the present application, for the calculation of the attention processing result DeformAttn of any feature map, the data required for the calculation of DeformAttn may include the target weight wgt and the interpolation pixel value f(Q) of the interpolation pixel point Q corresponding to the offset point P. Thus, for any offset point P, the first determination submodule 131 can determine the interpolation pixel coefficient C of each interpolation pixel point Q corresponding to the offset point P by obtaining the horizontal and vertical coordinates x and y of the offset point P(x,y) forwarded by the module 120.
[0137] Then, the first determination submodule 131 constructs a coefficient matrix M corresponding to all offset points P using the interpolation pixel coefficient C of each interpolation pixel point Q corresponding to each offset point P. C .
[0138] Then, let the coefficient matrix M C Each element / interpolation pixel coefficient C in is related to the attention weight A k Multiply so that the coefficient matrix M composed of the interpolated pixel coefficients C C Converted to a weight matrix M consisting of weights wgt wgt Finally, the first determination submodule 131 converts the weight matrix M wgt Send it to the second determining submodule 132.
[0139] The second determination submodule 132 receives the weight matrix M sent by the first determination submodule 131 wgt , and after obtaining the interpolation pixel value f(Q) of each interpolation pixel point Q corresponding to each offset point P forwarded by module 120, the matrix MF(Q) constructed based on the pixel value f(Q) of each interpolation pixel point Q corresponding to each offset point P is constructed, and then the weight matrix M wgt The matrix M is constructed by multiplying the matrix of MF(Q) by the inner product wgt·f(Q) of the target weight wgt corresponding to the interpolated pixel point Q and the interpolated pixel value f(Q), and by the inner product wgt·f(Q) of each interpolated pixel point Q corresponding to each offset point P. T1 .
[0140] Finally, based on the matrix M T1 Determine the attention processing results of the feature map.
[0141] It can be understood that based on the matrix M T1 The process of determining the attention processing results DeformAttn of each feature sub-graph of the feature graph may include: in the matrix M T1In the case of the inner product (wgt·f(Q)) of each interpolated pixel point Q corresponding to each offset point P in the feature sub-image, the vehicle can accumulate each (wgt·f(Q)) corresponding to each offset point P in the feature sub-image to obtain the attention processing result DeformAttn of the sub-image.
[0142] Thus, in an embodiment of the present application, the interpolation pixel coefficients of the interpolation pixel points corresponding to the offset points can be determined by the coordinate information of the offset points, a coefficient matrix can be constructed according to the interpolation pixel coefficients of the interpolation pixel points corresponding to each offset point, and the attention processing results can be determined by combining the coefficient matrix, attention weights and interpolation pixel values with matrix operations, so that the attention processing results can be efficiently determined.
[0143] In addition, it can also be understood that in the implementation mode of the present application, the vehicle can also achieve efficient processing of multi-channel and multi-offset points of the feature map through other calculation orders.
[0144] For example, in some embodiments, the offset point information includes the coordinate information of multiple offset points P of the feature map, and the pixel value f(Q) of the interpolated pixel point Q corresponding to each offset point P. The vehicle can construct the coefficient matrix M corresponding to all offset points P by using the interpolated pixel coefficient C of each interpolated pixel point Q corresponding to each offset point P based on the coordinate information of each offset point P. C .
[0145] At the same time, by the pixel value f(Q) of each interpolated pixel point Q corresponding to each offset point P, a matrix M constructed by f(Q) is constructed f(Q) .
[0146] Then, let the pixel value matrix M f(Q) Each element f(Q) in is associated with the attention weight A k Do the multiplication so that the pixel value matrix M f(Q) Each element in is converted to f(Q) and A k The product S of M f(Q) Convert M S .
[0147] Finally, calculate M S With the coefficient matrix M C Matrix multiplication of the above M T .
[0148] For example, in some embodiments, the offset point information includes coordinate information of multiple offset points P of the feature map, and pixel values f(Q) of interpolated pixel points Q corresponding to each offset point P. The vehicle can construct a coefficient matrix M corresponding to all offset points P based on the coordinate information of each offset point P and the interpolated pixel coefficient C of each interpolated pixel point Q corresponding to each offset point P. C .
[0149] Then, let the coefficient matrix M C Each interpolation pixel coefficient C in is multiplied by the pixel value f(Q) of each interpolation pixel point Q corresponding to each offset point P to obtain the product result C*f(Q) of each interpolation pixel point Q corresponding to each offset point P.
[0150] At the same time, the product results C*f(Q) of each interpolation pixel point Q corresponding to each offset point P are summed to obtain the pixel value f(P) of each offset point P, thereby making the coefficient matrix M C Transformed into a pixel value matrix M consisting of the pixel value f(P) of each offset point P f(P) .
[0151] Finally, let the pixel value matrix M f(P) Each element in is associated with the attention weight A k Do the multiplication so that the pixel value matrix M f(P) Convert to M T2 , through M T2 Determine the attention processing results of the feature map.
[0152] Further, in some embodiments, the product result C*f(Q) of each interpolated pixel point Q corresponding to each offset point P may not be summed, that is, after obtaining the product result C*f(Q) of each interpolated pixel point Q corresponding to each offset point P, the coefficient matrix M C Each element in is converted to C*f(Q), so M C Convert to M tmp In the case of M tmp Each element in and the attention weight A k Do the multiplication so that the matrix M tmp Convert to matrix M T3 , so that the matrix M T3 Determine the attention processing results of the feature map.
[0153] In some embodiments of the present application, the offset point information includes offset point pixel values of multiple offset points, and the determination module 130 is configured as follows:
[0154] Determine the sub-attention processing result corresponding to the offset point according to the pixel value and attention weight of the offset point forwarded by the acquisition module 120;
[0155] The attention processing result is determined according to the sub-attention processing results corresponding to the multiple offset points.
[0156] Specifically, in the embodiment of the present application, the storage module 110 stores the pre-calculated pixel interpolation of each offset point, that is, the pixel value of each offset point. Then, the acquisition module 120 can read the pixel value and attention weight of each offset point, and send the pixel value and attention weight to the determination module 130, so that the determination module 130 outputs the attention processing result.
[0157] For details, please refer again to Figure 2 The offset point information stored in the storage module 110 may include the pixel value and attention weight of the offset point. The pixel value of the offset point can be understood as W in the above deformable attention calculation formula. m 'x(p q +Δp mqk ) item, the attention weight can be understood as A in the above deformable attention calculation formula mqk .
[0158] Optionally, in certain embodiments of the present application, the storage module 110 may store the coordinate information of the offset point, the pixel value of the interpolated pixel corresponding to the offset point, and the attention weight. Furthermore, the storage module 110 may send the coordinate information of the offset point and the pixel value of the interpolated pixel corresponding to the offset point to a pre-set calculation unit such as a CPU, so that the calculation unit determines the interpolated pixel coefficient according to the coordinate information, and determines the pixel value of the offset point according to the interpolated pixel coefficient and the pixel value of the marked pixel, and writes the pixel value of the offset point to the storage module 110.
[0159] Therefore, the storage module 110 can send the attention weight and the pixel value of the offset point to the acquisition module 120 according to the read request sent by the acquisition module 120. The acquisition module 120 can forward the attention weight and the pixel value of the offset point to the determination module 130 upon receiving the attention weight and the pixel value of the offset point, so that the determination module 130 determines the attention processing result of the feature map according to the attention weight and the pixel value of the offset point.
[0160] Thus, in an embodiment of the present application, the attention processing result of the feature map can be determined based on the attention weight of the feature map and the pixel value of the offset point in the feature map, so that the attention processing result of the feature map can be determined efficiently.
[0161] See also Figure 5In some embodiments of the present application, the information of the multiple offset points corresponding to the reference point includes coordinate information of the multiple offset points and interpolated pixel values corresponding to the multiple offset points, and the determination module 130 includes a first determination submodule 131 and a second determination submodule 132;
[0162] The first determination submodule 131 is configured to determine the interpolation pixel coefficient corresponding to the offset point according to the coordinate information of the offset point forwarded by the acquisition module 120, and determine the offset point pixel value of the offset point according to the interpolation pixel coefficient corresponding to the offset point and the interpolation pixel value corresponding to the offset point forwarded by the acquisition module 120;
[0163] The second determination submodule 132 is configured to determine the attention processing result according to the attention weight forwarded by the acquisition module 120 and the offset point pixel value sent by the first determination submodule 131 .
[0164] Specifically, in the embodiment of the present application, the offset point information stored in the storage module 110 includes the coordinate information of the offset point P of the feature map, and the pixel value f(Q) of the interpolated pixel point Q corresponding to each offset point P. The interpolated pixel point Q includes Q 11 (x1,y1),Q 12 (x1,y2),Q 21 (y2,y1) and Q 22 (x2, y2), so the pixel value f(Q) of the interpolated pixel point Q includes f(Q 11 )、f(Q 12 )、f(Q 21 ) and f(Q 22 ).
[0165] The acquisition module 120 sends a read request to the storage module 110. The storage module 110 sends the attention weight A to the acquisition module 120 according to the received read request. k , the coordinate information of the offset point P and f(Q 11 )、f(Q 12 )、f(Q 21 ) and f(Q 22 ).
[0166] After receiving the data sent by the storage module 110, the acquisition module 120 sends the coordinate information of the offset point P and the pixel value f(Q 11 )、f(Q 12 )、f(Q 21 ) and f(Q 22 ), and sends the attention weight A to the second determination submodule 132 k .
[0167] The first determination submodule 131 receives the coordinate information of the offset point P and Q 11 (x1,y1),Q 12 (x1,y2),Q 21 (y2,y1) and Q 22 (x2,y2), determine Q 11 , Q 12 , Q 21 and Q 22 The interpolation pixel coefficient C. Among them, Q 11 The interpolation pixel coefficient C 11 is (x2-x)(y2-y), Q 12 The interpolation pixel coefficient C 12 is (x2-x)(y-y1), Q 21 The interpolation pixel coefficient C 21 is (x-x1)(y2-y), Q 22 The interpolation pixel coefficient C 22 is (x-x1)(y-y1).
[0168] Furthermore, for each interpolation pixel point Q, the first determination submodule 131 calculates the product of the pixel value f(Q) of the interpolation pixel point and the interpolation pixel coefficient C, and calculates the sum of the "product of the pixel value f(Q) and the interpolation pixel coefficient C" of each interpolation pixel point corresponding to the offset point, thereby obtaining the pixel value f(P) of the offset point, that is, the offset point pixel.
[0169] Subsequently, the first determination submodule 131 sends the pixel value f(P) of the offset point to the second determination submodule 132. The second determination submodule 132 determines the pixel value f(P) of the offset point according to the received attention weight A. k , and the pixel value f(P) of the offset point P, calculate the attention weight A k The product of the pixel value f(P) of the offset point is obtained to obtain the calculation result res corresponding to the offset point P.
[0170] Finally, the second determination submodule 132 can determine the attention processing result of the feature map according to the operation result res corresponding to P.
[0171] Thus, in an embodiment of the present application, the attention weight, the coordinate information of the offset point of the feature map, and the pixel value of the interpolated pixel point corresponding to the offset point can be obtained to determine the offset point pixel value, and the attention processing result can be determined based on the offset point pixel value and the attention weight, thereby realizing the online calculation of the attention processing result.
[0172] In addition, it can be understood that by multiplying the pixel value f(Q) of each interpolation pixel point Q with its corresponding interpolation pixel coefficient C to obtain the corresponding product result, the product results corresponding to each interpolation pixel point Q are accumulated to obtain the pixel value f(P) of the offset point.
[0173] It can also be understood that the "interpolation pixel coefficients C corresponding to the interpolation pixel points Q" can reflect the "distance relationship between the interpolation pixel point Q and the offset point P". That is, the closer the interpolation pixel point Q is to the offset point P, the higher the interpolation pixel coefficient C of the interpolation pixel point Q, and vice versa.
[0174] Furthermore, it can be understood that the value of the offset point P is an integer.
[0175] In some embodiments of the present application, the information of the multiple offset points corresponding to the reference point includes coordinate information of the multiple offset points and interpolated pixel values corresponding to the multiple offset points, and the determination module 130 includes a first determination submodule 131 and a second determination submodule 132;
[0176] The first determination submodule 131 is configured to determine the pixel weighting result corresponding to the offset point according to the interpolated pixel value and the attention weight corresponding to the offset point forwarded by the acquisition module 120;
[0177] The second determination submodule 132 is configured to determine the attention processing result according to the pixel weighting result corresponding to the offset point sent by the first determination submodule 131 and the interpolation pixel coefficient determined by the coordinate information forwarded by the acquisition module 120.
[0178] Specifically, see Figure 6 , Figure 6 Schematic diagram of the image frame processing chip 100 in some embodiments of the present application. That is, the offset point information stored in the storage module 110 includes the coordinate information of the offset point P of the feature map, and the pixel value f(Q) of the interpolated pixel point Q corresponding to each offset point P. The interpolated pixel point Q includes Q 11 (x1,y1),Q 12 (x1,y2),Q 21 (y2,y1) and Q 22 (x2, y2), so the pixel value f(Q) of the interpolated pixel point Q includes f(Q 11 )、f(Q 12 )、f(Q 21 ) and f(Q 22 ).
[0179] The acquisition module 120 sends a read request to the storage module 110. The storage module 110 sends the attention weight A to the acquisition module 120 according to the received read request. k , the coordinate information of the offset point P and f(Q11 )、f(Q 12 )、f(Q 21 ) and f(Q 22 ).
[0180] After receiving the data sent by the storage module 110, the acquisition module 120 sends the attention weight A to the first determination submodule 131. k and interpolated pixel value f(Q 11 )、f(Q 12 )、f(Q 21 ) and f(Q 22 ), and sends the coordinate information of the offset point P to the second determining submodule 132.
[0181] The first determination submodule 131 determines the received attention weight A k 、Pixel value f(Q 11 )、f(Q 12 )、f(Q 21 ) and f(Q 22 ), calculate the attention weight A k Respectively with f(Q 11 )、f(Q 12 )、f(Q 21 ) and f(Q 22 ) to obtain the pixel weighted result of each interpolation pixel point Q, that is, A k *f(Q 11 ), A k *f(Q 12 ), A k *f(Q 21 ) and A k *f(Q 22 ), and sends A to the second determining submodule 132 k *f(Q 11 ), A k *f(Q 12 ), A k *f(Q 21 ) and A k *f(Q 22 ).
[0182] The second determination submodule 132 determines Q according to the received coordinate information of the offset point P. 11 , Q 12 , Q 21 and Q 22 The interpolation pixel coefficient C. Among them, Q 11 The interpolation pixel coefficient C 11 is (x2-x)(y2-y), Q 12 The interpolation pixel coefficient C 12is (x2-x)(y-y1), Q 21 The interpolation pixel coefficient C 21 is (x-x1)(y2-y), Q 22 The interpolation pixel coefficient C 22 is (x-x1)(y-y1).
[0183] Further, the second determining submodule 132 determines the received A k *f(Q 11 ), A k *f(Q 12 ), A k *f(Q 21 ) and A k *f(Q 22 ), and Q 11 , Q 12 , Q 21 and Q 22 The interpolation pixel coefficients C are multiplied and summed to obtain the operation result res corresponding to the offset point P.
[0184] Finally, the second determination submodule 132 can determine the attention processing result of the feature map according to the operation result res corresponding to P.
[0185] Thus, in the implementation mode of the present application, the attention weight, the coordinate information of the offset point of the feature map and the pixel value of the interpolated pixel point corresponding to the offset point can be obtained, the pixel weighting result can be determined and the attention processing result of the feature map can be determined based on the pixel weighting result and the target coefficient determined by the offset point coordinate information, thereby realizing the online calculation of the attention processing result.
[0186] In certain embodiments of the present application, the coordinate information of the multiple offset points corresponding to the reference point is obtained by randomly selecting pixels of the feature map based on a pre-trained neural network model.
[0187] Thus, in an embodiment of the present application, the coordinate information of multiple offset points can be determined randomly based on a neural network model and pixels.
[0188] In certain embodiments of the present application, the first determination submodule 131 includes a central processing unit (CPU), and the second determination submodule 132 includes an NPU (Neural Processing Units, embedded neural network processor).
[0189] In certain embodiments of the present application, the first determination submodule 131 and the second determination submodule 132 both include NPUs (Neural Processing Units, embedded neural network processors).
[0190] The embodiment of the present application further provides a vehicle equipped with the above-mentioned image frame processing chip 100.
[0191] In the description of this specification, the descriptions with reference to the terms "specifically", "further", "particularly", "understandably", etc. are intended to mean that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms are not intended to refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0192] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0193] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. An image frame processing chip, characterized in that: include: A storage module configured to store information of a plurality of offset points and attention weights corresponding to reference points of a feature map of an image frame; An acquisition module, configured to send a data read request to the storage module, and receive the plurality of offset point information and attention weights sent by the storage module; A determination module is configured to determine the attention processing result of the feature map according to the multiple offset point information and the attention weight forwarded by the acquisition module, and store the attention processing result into the storage module to complete the processing of the image frame.
2. The chip according to claim 1, characterized in that: The information of the multiple offset points corresponding to the reference point includes coordinate information of the multiple offset points and interpolated pixel values corresponding to the multiple offset points, and the determination module includes a first determination submodule and a second determination submodule; The first determination submodule is configured to determine the target weight corresponding to the offset point according to the attention weight forwarded by the acquisition module and the coordinate information of the offset point; The second determination submodule is configured to determine the attention processing result according to the target weight sent by the first determination submodule and the interpolation pixel value forwarded by the acquisition module.
3. The chip according to claim 2, characterized in that: The coordinate information of the offset point includes a decimal part of the offset point coordinate, and the first determining submodule is configured as follows: Determining an interpolation pixel coefficient corresponding to the offset point according to the decimal part of the offset point; The target weight corresponding to the offset point is determined according to the attention weight and the interpolation pixel coefficient corresponding to the offset point.
4. The chip according to claim 2, characterized in that: The second determination submodule is configured as follows: Determine the sub-attention processing result corresponding to each offset point according to the target weight and the interpolated pixel value corresponding to each offset point; The attention processing result is determined according to the sub-attention processing result corresponding to each of the offset points.
5. The chip according to claim 1, characterized in that: The information of the multiple offset points corresponding to the reference point includes coordinate information of the multiple offset points and interpolated pixel values corresponding to the multiple offset points, and the determination module includes a first determination submodule and a second determination submodule; The first determination submodule is configured to determine the interpolation pixel coefficients corresponding to the offset points according to the coordinate information of the offset points forwarded by the acquisition module, construct a coefficient matrix according to the interpolation pixel coefficients corresponding to each of the offset points, and determine a weight matrix according to the coefficient matrix and the attention weights; The second determination submodule is configured to determine the attention processing result based on the weight matrix sent by the first determination submodule and the interpolated pixel values corresponding to the multiple offset points forwarded by the acquisition module.
6. The chip according to claim 1, characterized in that: The information of the multiple offset points corresponding to the reference point includes coordinate information of the multiple offset points and interpolated pixel values corresponding to the multiple offset points, and the determination module includes a first determination submodule and a second determination submodule; The first determination submodule is configured to determine the interpolation pixel coefficient corresponding to the offset point according to the coordinate information of the offset point forwarded by the acquisition module, and determine the offset point pixel value of the offset point according to the interpolation pixel coefficient corresponding to the offset point and the interpolation pixel value corresponding to the offset point forwarded by the acquisition module; The second determination submodule is configured to determine the attention processing result according to the attention weight forwarded by the acquisition module and the offset point pixel value sent by the first determination submodule.
7. The chip according to claim 1, characterized in that: The information of the multiple offset points corresponding to the reference point includes coordinate information of the multiple offset points and interpolated pixel values corresponding to the multiple offset points, and the determination module includes a first determination submodule and a second determination submodule; The first determination submodule is configured to determine a pixel weighted result corresponding to the offset point according to the interpolated pixel value corresponding to the offset point forwarded by the acquisition module and the attention weight; The second determination submodule is configured to determine the attention processing result based on the pixel weighting result corresponding to the offset point sent by the first determination submodule and the interpolation pixel coefficient determined by the coordinate information forwarded by the acquisition module.
8. The chip according to claim 1, characterized in that: The offset point information includes offset point pixel values of the multiple offset points, and the determination module is configured as follows: Determine the sub-attention processing result corresponding to the offset point according to the offset point pixel value and the attention weight forwarded by the acquisition module; The attention processing result is determined according to the sub-attention processing results corresponding to the multiple offset points.
9. The chip according to any one of claims 2 to 8, characterized in that: The coordinate information of the multiple offset points corresponding to the reference point is obtained by randomly selecting pixels of the feature map based on a pre-trained neural network model.
10. A vehicle, characterized in that: A chip comprising any one of claims 1 to 9.
Citation Information
Patent Citations
Neural network computing device, data reading method, data storage method and related equipment
CN111984189A
Image processing method and device and computer readable storage medium
CN112580675A
Image key point detection method and system, electronic equipment and storage medium
CN113469111A
Image processing method and device and model training method and device
CN113888430A
Method and device for adjusting weight of neural network computing chip
CN114169489A
