Method and device for recognizing image

By using cumulative convolution operation and SIMD processing technology in image recognition, the problem of low convolution operation efficiency is solved, an efficient image recognition process is realized, and the processing speed and storage efficiency are improved.

CN112396085BActive Publication Date: 2024-09-24SAMSUNG ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010534666.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2019-10-14
Filing Date
2020-06-12
Publication Date
2024-09-24
Estimated Expiration
2040-06-12

AI Technical Summary

Technical Problem

When existing image recognition technology processes images, the convolution operation efficiency is low and there are redundant buffer operations, which affects the processing speed and storage efficiency.

Method used

The cumulative convolution operation method is adopted to avoid additional buffering operations by accumulating the intermediate results of the convolution operation in the output feature map, and utilizes single instruction multiple data (SIMD) processing technology to optimize the multiplication operation of weight elements and input elements, skipping Multiplication operations on zero-weighted elements, choosing the appropriate operation type to improve efficiency.

Benefits of technology

It significantly improves the efficiency of convolution operations, reduces the number of memory accesses and processing time, and improves the speed and efficiency of image recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112396085B_ABST
    Figure CN112396085B_ABST
Patent Text Reader

Abstract

Provided is a method and device for recognizing an image. The method includes: obtaining an input image; calculating an input feature map of a neural network based on the input image; obtaining, for each layer of at least one layer in the neural network, a first input plane corresponding to a first input channel among multiple input planes of the input feature map of the layer; receiving a first weight plane corresponding to the first input channel among multiple weight planes of a weight kernel of the layer; generating first accumulated data by accumulating multiplication results of multiplication operations between at least a portion of the first input elements in the first input plane and at least a portion of the first weight elements in the first weight plane; and generating a first output plane corresponding to the first output channel among multiple output planes of an output feature map of the layer based on the first accumulated data; and outputting an image recognition result based on the output feature map.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application claims the benefit of Korean Patent Application No. 10-2019-0098810 filed on August 13, 2019, in the Korean Intellectual Property Office, and Korean Patent Application No. 10-2019-0127258 filed on October 14, 2019, in the Korean Intellectual Property Office, the disclosures of which are incorporated herein in their entirety by reference for all purposes. Technical Field

[0002] The following description relates to a method and apparatus for recognizing an image. Background Art

[0003] Image recognition can be achieved through neural networks. Technical automation of processes such as recognition (e.g., speech recognition and voice recognition) has been achieved through neural network models implemented as processors of specialized computing architectures, which, after extensive training, can provide a computationally intuitive mapping between input patterns and output patterns. The training ability to produce such a mapping can be referred to as the learning ability of the neural network. In addition, due to the specialized training, such a specialized trained neural network can therefore have the generalization ability to generate relatively accurate outputs for input patterns for which the neural network may not have been trained, for example. Summary of the invention

[0004] This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter.

[0005] In one general aspect, a method for recognizing an image includes: obtaining an input image; calculating an input feature map of a neural network based on the input image, wherein the input feature map includes multiple input planes; for each layer of at least one layer within the neural network, obtaining a first input plane corresponding to a first input channel among multiple input channels among multiple input planes of the input feature map of the layer; receiving a first weight plane corresponding to the first input channel among multiple weight planes of a weight kernel of the layer; generating first accumulated data by accumulating multiplication results of multiplication operations between at least a portion of the first input elements in the first input plane and at least a portion of the first weight elements in the first weight plane; and generating a first output plane corresponding to a first output channel among multiple output channels among multiple output planes of an output feature map of the layer based on the first accumulated data; and outputting an image recognition result based on the output feature map, wherein the multiple input planes correspond one-to-one to the multiple input channels, the multiple weight planes correspond one-to-one to the multiple input channels, and the multiple output planes correspond one-to-one to the multiple output channels.

[0006] The step of calculating the input feature map of the neural network based on the input image includes: the i-th layer of the neural network outputs the output feature map of the i-th layer based on the output feature map of the i-1th layer as the input feature map of the i-th layer, wherein i is an integer greater than 1, wherein the first layer of the neural network receives the input image and outputs the output feature map of the first layer as the input feature map of the second layer based on the input image, wherein the last layer of the neural network generates and outputs an image recognition result based on the output feature map of the previous layer.

[0007] In one general aspect, a device for recognizing an image includes: one or more processors configured to: obtain an input image; calculate an input feature map of a neural network based on the input image, wherein the input feature map includes multiple input planes; for each layer of at least one layer within the neural network, obtain a first input plane corresponding to a first input channel among multiple input planes of the input feature map of the layer; receive a first weight plane corresponding to the first input channel among multiple weight planes of a weight kernel of the layer; generate first accumulated data by accumulating multiplication results of multiplication operations between at least a portion of the first input elements in the first input plane and at least a portion of the first weight elements in the first weight plane; and generate a first output plane corresponding to a first output channel among multiple output channels among multiple output planes of an output feature map of the layer based on the first accumulated data; output an image recognition result based on the output feature map, wherein the multiple input planes correspond one-to-one to the multiple input channels, the multiple weight planes correspond one-to-one to the multiple input channels, and the multiple output planes correspond one-to-one to the multiple output channels.

[0008] The one or more processors may also be configured to: output the output feature map of the i-th layer through the i-th layer of the neural network based on the output feature map of the i-1th layer as the input feature map of the i-th layer, where i is an integer greater than 1, wherein the first layer of the neural network receives an input image and outputs the output feature map of the first layer as the input feature map of the second layer based on the input image, wherein the last layer of the neural network generates and outputs an image recognition result based on the output feature map of the previous layer.

[0009] In a general aspect, a method for recognizing an image includes: obtaining an input image; calculating an input feature map of a neural network based on the input image; for each layer of at least one layer within the neural network, obtaining an input plane of the input feature map of the layer including multiple input elements; receiving a weight plane corresponding to the input plane of the layer, the weight plane including multiple weight elements; and generating an output plane of an output feature map of the layer by accumulating multiplication results obtained by performing multiplication operations between each weight element in the weight plane and a corresponding input element of the multiple input elements in the input plane; and outputting an image recognition result based on the output feature map.

[0010] In a general aspect, a method for recognizing an image includes: obtaining an input image; calculating an input feature map of a neural network based on the input image, wherein the input feature map includes multiple input planes; for each layer of at least one layer within the neural network, obtaining an input feature map of the layer including multiple input planes; receiving a weight kernel of the layer including multiple weight planes; performing a cumulative convolution operation between the input feature map and the weight kernel; and generating an output plane based on the cumulative convolution operation; and outputting an image recognition result based on the output feature map.

[0011] In one general aspect, a non-transitory computer-readable recording medium has recorded thereon a program for executing the method on a computer.

[0012] In a general aspect, a processor-implemented data processing method includes: receiving a first input plane corresponding to a first input channel from among multiple input planes of an input feature map; receiving a first weight plane corresponding to the first input channel from among multiple weight planes of a weight kernel; generating first accumulated data by accumulating multiplication results of multiplication operations between at least a portion of the first input elements in the first input plane and at least a portion of the first weight elements in the first weight plane; and generating a first output plane corresponding to the first output channel from among multiple output planes of an output feature map based on the first accumulated data, wherein each input plane in the multiple input planes and each weight plane in the multiple weight planes respectively correspond to an input channel, and wherein each output plane in the multiple output planes corresponds to an output channel.

[0013] The step of generating the first output plane may include generating the first output plane based on a sum of accumulated data of each input channel including the first accumulated data.

[0014] The method may include: receiving a second input plane corresponding to a second input channel among the input planes; receiving a second weight plane corresponding to the second input channel among the multiple weight planes; and generating second accumulated data by accumulating multiplication results between at least a portion of the second input elements in the second input plane and at least a portion of the second weight elements in the second weight plane.

[0015] The step of generating the first output plane may include generating the first output plane based on a sum of the first accumulated data and the second accumulated data.

[0016] The step of generating first accumulated data may include: extracting a first input element vector corresponding to the part of the first weight element from the first input plane; generating a first weighted input element vector corresponding to the multiplication result of the multiplication operation between the first input element vector and the part of the first weight element; and generating the first accumulated data by accumulating the first weighted input element vector.

[0017] The step of extracting the first input element vector may include: determining an offset corresponding to the first input element vector based on an index of the portion of the first weight element; and extracting the first input element vector from the first input plane based on the determined offset.

[0018] The size of the first input element vector and the size of the first weighted input element vector may correspond to a single instruction multiple data (SIMD) arithmetic unit.

[0019] When generating the first accumulated data, an operation of multiplying a zero weight element corresponding to a zero value among the portion of the first weight elements by the portion of the first input elements may be skipped.

[0020] The method may further include: determining the number of non-zero weight elements that do not correspond to zero among the first weight elements; and selecting an operation type corresponding to the determined number of non-zero weight elements from a plurality of operation types to perform an operation of a preset type.

[0021] The generating of the first accumulated data may include generating the first accumulated data by accumulating multiplication results of multiplication operations between the portion of the first input element and non-zero weight elements corresponding to the portion of the first weight element based on the selected operation type.

[0022] The step of generating the first accumulated data may include: extracting a first input element vector corresponding to the non-zero weight element from the first input plane based on the index of the non-zero weight element; generating a first weighted input element vector corresponding to the multiplication result of the multiplication operation between the first input element vector and the non-zero weight element corresponding to the part of the first weight element; and generating the first accumulated data by accumulating the first weighted input element vector.

[0023] The method may further comprise individually multiplying respective weight elements of each of the weight planes by a plurality of elements of the first input plane.

[0024] In a general aspect, a data processing device includes: one or more processors configured to: receive a first input plane corresponding to a first input channel among multiple input planes of an input feature map; receive a first weight plane corresponding to the first input channel among multiple weight planes of a weight kernel; generate first accumulated data by accumulating multiplication results of multiplication operations between at least a portion of the first input elements in the first input plane and at least a portion of the first weight elements in the first weight plane; and generate a first output plane corresponding to the first output channel among multiple output planes of an output feature map respectively corresponding to the output channels based on the first accumulated data, wherein each input plane of the multiple input planes and each weight plane of the multiple weight planes respectively correspond to an input channel, wherein each output plane of the multiple output planes corresponds to an output channel.

[0025] The processor may be further configured to generate a first output plane based on a sum of accumulated data for each input channel including the first accumulated data.

[0026] The processor may also be configured to: receive a second input plane corresponding to a second input channel among the input planes; receive a second weight plane corresponding to the second input channel among the multiple weight planes; and generate second accumulated data by accumulating a multiplication result of multiplication between at least a portion of the second input elements in the second input plane and at least a portion of the second weight elements in the second weight plane.

[0027] The processor may be further configured to generate a first output plane based on a sum of the first accumulated data and the second accumulated data.

[0028] The processor can also be configured to: extract a first input element vector corresponding to the part of the first weight element from the first input plane; generate a first weighted input element vector corresponding to the multiplication result of the multiplication operation between the first input element vector and the part of the first weight element; and generate first accumulated data by accumulating the first weighted input element vector.

[0029] The processor may be further configured to: determine an offset corresponding to the first input element vector based on an index of the portion of the first weight element; and extract the first input element vector from the first input plane based on the determined offset.

[0030] The size of the first input element vector and the size of the first weighted input element vector may correspond to a single instruction multiple data (SIMD) arithmetic unit.

[0031] When generating the first accumulated data, an operation of multiplying a zero weight element corresponding to a zero value among the portion of the first weight elements by the portion of the first input elements may be skipped.

[0032] The processor may also be configured to: determine the number of non-zero weight elements that do not correspond to zero among the first weight elements; and select an operation type corresponding to the determined number of non-zero weight elements from a plurality of operation types to perform a preset type of operation.

[0033] The processor may be further configured to generate first accumulated data by accumulating multiplication results of multiplication operations between the portion of the first input element and non-zero weight elements corresponding to the portion of the first weight element based on the selected operation type.

[0034] The processor can also be configured to: extract a first input element vector corresponding to a non-zero weight element from a first input plane based on an index of the non-zero weight element; generate a first weighted input element vector corresponding to a multiplication result of a multiplication operation between the first input element vector and the non-zero weight element corresponding to the portion of the first weight element; and generate first accumulated data by accumulating the first weighted input element vector.

[0035] The device may include a memory storing instructions that, when executed by the one or more processors, configure the one or more processors to perform the steps of receiving a first input plane, receiving a first weight plane, generating first accumulated data, and generating a first output plane.

[0036] In one general aspect, a processor-implemented method performed by a processor of an electronic device includes: receiving an input plane of a layer of a neural network including a plurality of input elements; receiving a weight plane corresponding to the input plane of the layer, the weight plane including a plurality of weight elements; and generating an output plane by accumulating multiplication results obtained by performing multiplication operations between each weight element in the weight plane and a corresponding one of the input elements in the input plane.

[0037] When there is a zero weight element corresponding to a zero value among the weight elements, multiplication between the zero weight element and the input element corresponding to the zero weight element may be skipped.

[0038] The convolution operations associated with the layer of the neural network may be performed based on single instruction multiple data (SIMD).

[0039] The input plane and the weight plane may correspond to a single input channel, and the output plane may correspond to a single output channel.

[0040] The input plane is one of multiple input planes corresponding to the input feature map of the layer, and the weight plane is one of multiple weight planes corresponding to the weight kernel of the layer, wherein the output feature map of the layer is determined based on the output plane, and one or more output planes generated based on one or more other input planes among the multiple input planes except the input plane and one or more other weight planes among the multiple weight planes except the weight plane.

[0041] In one general aspect, a processor-implemented method includes: receiving an input feature map comprising a plurality of input planes; receiving a weight kernel comprising a plurality of weight planes; performing a cumulative convolution operation between the input feature map and the weight kernel; and generating an output plane based on the cumulative convolution operation.

[0042] The method may further include generating an accumulation plane by performing a multiplication-accumulation (MAC) operation between the plurality of input planes and the plurality of weight planes.

[0043] An output plane may be generated by accumulating the outputs of the accumulation planes.

[0044] Other features and aspects will be apparent from the following detailed description, drawings, and claims. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 An example data processing device for image recognition with a neural network implementation is shown in accordance with one or more embodiments.

[0046] Figure 2 An example convolution operation for image recognition is shown in accordance with one or more embodiments.

[0047] Figure 3 An example sliding window convolution operation is shown.

[0048] Figure 4 and Figure 5 An example generation of an output plane by cumulative convolution operations according to one or more embodiments is respectively shown.

[0049] Figure 6 and Figure 7 Example multiply-accumulate (MAC) operations between an input plane and a weight plane for accumulating convolution operations are shown separately according to one or more embodiments.

[0050] Figures 8 to 10 Example accumulation convolution operations using single instruction multiple data (SIMD) processing according to one or more embodiments are respectively shown.

[0051] Fig.11 Example zero-skipping of cumulative convolution operations is shown in accordance with one or more embodiments.

[0052] Fig.12 An example of performing zero skipping using a preset operation type according to one or more embodiments is shown.

[0053] Fig.13 is a flow diagram illustrating an example cumulative convolution operation in accordance with one or more embodiments.

[0054] Fig.14 is a flow chart illustrating an example data processing method with a neural network implementation in accordance with one or more embodiments.

[0055] Fig.15 An example data processing device with a neural network implementation is shown in accordance with one or more embodiments.

[0056] Fig.16 An example electronic device is shown in accordance with one or more embodiments.

[0057] Throughout the drawings and detailed description, unless otherwise described or provided, the same figure reference numerals will be understood to refer to the same elements, features and structures. The drawings may not be to scale, and the relative sizes, proportions and depictions of the elements in the drawings may be exaggerated for clarity, illustration and convenience. DETAILED DESCRIPTION

[0058] The following specific embodiments are provided to help the reader obtain a comprehensive understanding of the method, device and / or system described herein. However, after understanding the disclosure of the present application, various changes, modifications and equivalents of the method, device and / or system described herein will be clear. For example, the order of operations described herein is only an example and is not limited to the order of operations set forth herein, but the order of operations can be changed as clearly after understanding the disclosure of the present application, except for the operations that must occur in a specific order. In addition, for greater clarity and simplicity, the description of features known after understanding the disclosure of the present application can be omitted.

[0059] The features described herein may be implemented in different forms and are not to be construed as being limited to the examples described herein. Rather, the examples described herein are provided to illustrate only some of the many possible ways of implementing the methods, devices and / or systems described herein, which will be clear after understanding the disclosure of the present application.

[0060] As used herein, the term "and / or" includes any one or any combination of any two or more of the associated listed items.

[0061] Throughout the specification, when an element such as a layer, region, or substrate is described as being "on," "connected to," or "bonded to" another element, the element may be directly "on," "connected to," or "bonded to" the other element, or there may be one or more other elements interposed therebetween. Conversely, when an element is described as being "directly on," "directly connected to," or "directly bonded to" another element, there may be no other elements interposed therebetween. As used herein, the term "and / or" includes any one of the associated listed items and any combination of any two or more.

[0062] Although terms such as "first", "second", and "third" may be used herein to describe various members, components, regions, layers, or portions, these members, components, regions, layers, or portions are not limited by these terms. Instead, these terms are only used to distinguish one member, component, region, layer, or portion from another member, component, region, layer, or portion. Therefore, without departing from the teachings of the examples described herein, the first member, first component, first region, first layer, or first portion referred to in the examples may also be referred to as the second member, second component, second region, second layer, or second portion.

[0063] The terms used herein are only used to describe various examples and are not intended to limit the present disclosure. Unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. The terms "comprise", "include" and "have" indicate the presence of the features, quantities, operations, components, elements and / or combinations thereof set forth, but do not exclude the presence or addition of one or more other features, quantities, operations, components, elements and / or combinations thereof.

[0064] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those commonly understood by those of ordinary skill in the art to which the present disclosure belongs and the same meaning as those commonly understood after understanding the disclosure of the present application. Unless explicitly defined as such herein, terms (such as those defined in general dictionaries) will be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the disclosure of the present application, and will not be interpreted in an idealized or overly formalized meaning.

[0065] Furthermore, in the description of examples, when it is considered that a detailed description of a structure or function known therefrom after understanding the disclosure of the present application will lead to an obscure interpretation of the examples, such description will be omitted.

[0066] Hereinafter, examples will be described in detail with reference to the accompanying drawings, and in the drawings, like reference numerals denote like elements throughout.

[0067] Figure 1 An example data processing device for image recognition with a neural network implementation according to one or more embodiments is shown. The data processing device for image recognition as described below may represent a device that processes image data for a neural network and will be referred to as a data processing device in the following. Figure 1 , the data processing device 100 may include a neural network 110. The data processing device may process one or more operations associated with the neural network 110. As a non-limiting example, the one or more operations associated with the neural network 110 may include an image recognition operation. Here, it should be noted that the use of the term "may" with respect to an example or embodiment (e.g., with respect to what an example or embodiment may include or what may be achieved) indicates that there is at least one example or embodiment that includes or achieves such a feature, and all examples and embodiments are not limited thereto.

[0068] One or more operations may be implemented by a neural network model implemented as a processor of a special purpose computing architecture, which neural network model, after extensive training, may provide a computationally intuitive mapping between input data or input patterns and output data or output patterns or pattern recognition of input patterns. The training capability to produce such mappings or perform such pattern recognition may be referred to as the learning capability of the neural network. Such training capability may also enable the special purpose computing architecture to classify such input patterns or portions of input patterns as belonging to members of one or more predetermined groups. In addition, due to the specialized training, such a specially trained neural network may therefore have a generalization capability to generate relatively accurate or reliable outputs for input patterns for which the neural network may not have been trained, for example.

[0069] In one example, as a non-limiting example, the neural network 110 may be a deep neural network (DNN). The DNN may include a plurality of layers. For example, the deep neural network may include an input layer to which input data is applied, an output layer for outputting a result obtained by prediction based on training and input data, and a plurality of hidden layers for performing neural network operations between the input layer and the output layer.

[0070] In one example, the input layer may correspond to or may be referred to as the lowest layer of the neural network, and the output layer may correspond to or may be referred to as the highest layer of the neural network. The layer order may be assigned and named or referred to sequentially from the output layer as the highest layer to the input layer as the lowest layer. For example, the second hidden layer may correspond to a layer higher than the first hidden layer and the input layer but lower than the output layer.

[0071] Depending on the machine learning used to process information, the DNN may include one or more convolutional layers, and may also include one or more of fully connected layers, recursive neural networks, etc., or may include different or overlapping neural network parts having such full connections, convolutional connections, or recursive connections, respectively.

[0072] As noted, the neural network 110 may perform one or more operations (e.g., an object recognition operation or a user authentication operation) by mapping input data and output data in a nonlinear relationship based on a deep learning method (such as in a convolutional neural network or a recursive neural network). As a non-limiting example, the deep learning method may represent a machine learning method for recognizing images from a large data set. The deep learning method may be interpreted as an optimized problem-solving process of locating a point where energy or loss is minimized while training the neural network 110 using prepared training data. The deep learning method may be classified as supervised learning or unsupervised learning, through which weights corresponding to the architecture or model of the neural network 110 may be obtained. Through the elements or weights of the kernel thus obtained, the input data and the output data may be mapped according to the training objective of the neural network 110.

[0073] The neural network 110 may be a deep neural network (DNN) including a plurality of layers including an input layer, at least one hidden layer, and an output layer. Figure 1As shown in , the first layer 111, one or more second layers 120 and the nth layer 130 may be at least a part of the plurality of layers. As an example, the neural network 110 may include at least one of a fully connected network, a convolutional neural network (CNN) and a recurrent neural network (RNN). For example, at least a part of the plurality of layers in the neural network 110 may correspond to a CNN, and another part of the plurality of layers in the neural network 110 may correspond to a fully connected network. Specifically, the neural network 110 may receive an input image to be recognized as input data via an input layer, then perform operations at each layer, and finally output a recognition result as output data via an output layer based on the result of the operation of the previous layer, such as, but not limited to, the category / label, position, region, etc. of the object recognized from the image.

[0074] In a CNN or CNN part, the data input to each layer may be referred to as an input feature map or input volume, and the data output from each layer may be referred to as an output feature map or output volume. The input feature map from the previous layer and the output feature map of the current layer may be referred to as activation data. In addition, the input feature map in the input layer may correspond to the input data.

[0075] In order to process operations associated with the neural network 110, the data processing device 100 may perform a convolution operation between an input feature map and a weight kernel for each convolution layer, and generate an output feature map based on the result of the convolution operation. The weight kernel may have a plurality of channels corresponding to the number of channels of the input feature map, and there may also be a plurality of weight kernels, resulting in the generation of output feature maps of a plurality of channels. When the width and depth of the neural network 110 are large enough, the neural network 110 may have a capacity sufficient to implement the function. As discussed above, when the neural network 110 has learned a sufficiently large amount of training data through a training process or is trained using a sufficiently large amount of training data, the neural network 110 may achieve optimal performance.

[0076] The weight kernel may be predetermined (e.g., the weight kernel includes a trained weight element indicating that it is determined before the neural network 110 is started (executed)). The startup of the neural network 110 may indicate that the neural network 110 is ready for inference. In one example, the startup of the neural network 110 may indicate that the neural network 110 is loaded into a memory, or that input data for inference is input to the neural network 110 after the neural network 110 is loaded into a memory. Inference is the process of applying a trained neural network to an input to generate an output.

[0077] As further described below, the convolution operation can be performed by accumulating the intermediate results of the convolution operation in the output feature map, and there is no need for a buffer operation to convert the weight kernel or the input feature map into a form suitable for convolution and store it in a buffer. That is, the convolution operation can use the data of the input feature map stored in a planar form. Therefore, the efficiency of the convolution operation can be greatly improved. In addition, in the convolution operation, the unit operation can correspond to multiplying a weight element corresponding to a scalar with an input plane corresponding to a matrix. Therefore, for weight elements with zero values, zero skipping can be effectively handled by software.

[0078] Figure 2 is a diagram illustrating an example convolution operation for image recognition. Figure 2 , an output feature map 230 may be generated by performing a convolution operation between the weight kernel 210 and the input feature map 220. Figure 2 In the example of , the data of the weight core 210, the input feature map 220, and the output feature map 230 can be stored in the memory in a plane form. In one example, each weight core of the weight core 1 to the weight core D of the weight core 210 may include C weight planes, the input feature map 220 may include C input planes, and the output feature map 230 may include D output planes, where C and D are natural numbers greater than 0. The C weight planes of the weight core 210 and the C input planes of the input feature map 220 may correspond to input channels, respectively, and the D output planes may correspond to output channels, respectively. In this example, C corresponds to the number of input channels, and D corresponds to the number of output channels.

[0079] Each weight plane and each output plane may include elements of a preset bit width. For example, each weight plane may have a size of K×K, and each input plane and each output plane may have a size of W×H, where W, K, and H indicate the respective number of elements. The elements of the weight plane may also be referred to as weight elements, and the elements of the input plane and the elements of the output plane may also be referred to as input elements and output elements, respectively. In one example, the convolution operation may be performed element by element.

[0080] Hereinafter, for ease of description, it may be assumed that the width and height of the weight plane are the same as K, and the size of the input plane and the size of the output plane are the same as W×H. However, according to one example, the width and height of the weight plane and the size of the input plane and the size of the output plane may be different from each other.

[0081] Figure 3 An example of a sliding window convolution operation is shown in accordance with one or more embodiments.

[0082] Reference Figure 3, when the weight kernel 310 slides into the input feature map 320, a convolution operation is performed by implementing a sliding window-based convolution operation to generate an output feature map 330.

[0083] Such a sliding window convolution operation can generally be implemented to perform a convolution operation and is different from the cumulative convolution operation described here. For example, in a sliding window convolution operation, a buffer operation can be performed on the input feature map 320 to generate a column vector. However, in one or more examples, the cumulative convolution operation here can accumulate the intermediate results of the convolution operation in the output feature map 330, so it may not be necessary to perform operations such as buffer operations in the sliding window convolution operation.

[0084] Through the sliding window convolution operation, the operation between the weight kernel 310 and the data stored in the non-continuous address of the input feature map 320 can be performed while the weight kernel 310 slides over the input feature map 320, so that the input feature map 320 can be converted into continuous data in a suitable form to increase the speed of the processing operation. Figure 3 In the example of , the sliding step size is 1, and zero padding can be applied to each of the horizontal and vertical directions of the input feature map 320 by two rows of zero element vectors. In this example, K corresponding to the weight kernel 310 2 ×C row vectors are defined, and the input feature map 320 is converted to K 2 ×C column vector.

[0085] The column vector may be buffered in the column buffer from the input feature map 320 in a planar structure or an interleaved structure. In the example of a planar structure, when the input feature map 320 is buffered as a column vector, a non-contiguous maximum memory access may occur as much as the result of multiplying the kernel's height K by the number of input channels C to determine one output element. In the example of an interleaved structure, when the input feature map 320 is buffered as a column vector, a non-contiguous maximum memory access may occur as much as the kernel's height K to determine one output element.

[0086] In contrast, in one or more examples, through the cumulative convolution operation discussed herein, the intermediate results of the convolution operation can be accumulated in the output feature map 330, so no such additional buffering operation is required to convert the input feature map 320 into such a planar structure or interleaved structure. Therefore, the cumulative convolution operation can minimize memory access and maximize the speed of processing the convolution operation.

[0087] Figure 4 and Figure 5 Examples of generating output planes through cumulative convolution operations according to one or more embodiments are respectively shown.

[0088] As previously discussed, in one example, the output feature map may include D output planes. Figure 4 and Figure 5 The process of generating one of the D output planes is shown separately. The process of generating one of the D output planes can be repeated for each of the D output planes. Figure 4 and Figure 5 The processing shown in , and an output feature map can be generated.

[0089] Reference Figure 4 , the output plane 430 may be generated by performing a convolution operation between the input feature map 410 and the weight kernel 420. In one example, the weight kernel 420 may be the d-th weight kernel among the D weight kernels, and the output plane 430 may be the d-th output plane among the D output planes. For example, the input feature map 410 may include: Figure 5 The one or more input planes 510 shown in FIG. 4 , the weight kernel 420 may include Figure 5 In addition, the output plane 430 may correspond to one or more weight planes 520 as shown in FIG. Figure 5 Output plane 540 shown in .

[0090] Reference Figure 5 As a non-limiting example, the input plane 510 may include input planes 511, 512, and 513. The number of input planes 510 corresponds to the number C of input channels. Figure 5 In the example of , the number C of input channels is three. However, for ease of description, the number three is provided as an example, and thus the number of input planes may be less than 3 or greater than 3 as corresponding to the number C of input channels. As a non-limiting example, the weight plane 520 may include weight planes 521, 522, and 523, and as a non-limiting example, the accumulation plane 530 may include accumulation planes 531, 532, and 533.

[0091] The accumulation plane 531 may be generated by a multiplication-accumulation (MAC) operation between the input plane 511 and the weight plane 521. The accumulation plane 532 may be generated by a MAC operation between the input plane 512 and the weight plane 522. The accumulation plane 533 may be generated by a MAC operation between the input plane 513 and the weight plane 523. The MAC operation will be described in more detail below. When the accumulation plane 530 is generated, the output plane 540 is generated based on the accumulation plane 530. For example, the output plane 540 may be generated by the sum of the accumulation planes 530.

[0092] Figure 6 and Figure 7 An example MAC operation between an input plane and a weight plane for an accumulation convolution operation according to one or more embodiments is shown, respectively.

[0093] Reference Figure 6 , the accumulation plane 630 may be generated based on a MAC operation between each input element in the input plane 610 and each weight element in the weight plane 620. As a non-limiting example, the weight plane 620 may include weight elements w 1 tow 9 Although the weight plane 620 is shown as having a size of 3×3 for ease of description, the size of the weight plane 620 is not limited to the example shown, and the weight plane 620 may have various other sizes. Figure 6 , but each of the input plane 610 and the accumulation plane 630 may include a plurality of elements, and an element-by-element convolution operation may be performed.

[0094] Reference Figure 7 , the input plane 711 may correspond to Figure 6 The input plane 610, Figure 7 The weight element w of the weight plane 1 tow 9 Corresponds to Figure 6 The weight element w of the weight plane 620 is 1 tow 9 , and the accumulation plane 740 may correspond to Figure 6 The input plane 712 may be generated by performing zero padding on the input plane 711 based on the sliding step size. For example, when the size of the input plane 711 is W×H and the sliding step size is 1, the input plane 712 may have a size of (W+2)×(H+2).

[0095] Consider including the weight element w 1 tow 9 The sliding window method between the weight plane and the input plane 712, in one or more examples, can define the input plane 712 in response to the weight element w 1 tow 9 For example, the input element in response area 721 responds to the weight element w 1 , the input element in the response region 722 responds to the weight element w 2 , and the input elements in the response region 729 respond to the weight elements w 9 .

[0096] The size of the response regions 721 to 729 is the same as the size of the input plane 711. In addition, the respective offsets of the response regions 721 to 729 are based on the weight element w 1 tow 9. For example, when the width of the input plane 711 is W+2, the offsets of the response areas 721 to 729 are defined as (W+2)×a+b, where "a" represents the quotient obtained by dividing (i-1) by K, and "b" represents the remainder obtained by dividing (i-1) by K, i represents the index of the weight element, and K represents the width of the weight kernel. In this example, the offset can be determined based on the input plane (e.g., the origin of the input plane with padding applied). Therefore, the offset of the response area 721 is 0, the offset of the response area 722 is 1, and the offset of the response area 729 is (W+2)×2+2.

[0097] The input elements in the response area 721 to 729 and the weight elements w 1 tow 9 The respective multiplications between generate multiplication results 731 to 739. The accumulation plane 740 is generated by accumulating each of the multiplication results 731 to 739. In one example, the output plane can be generated by the sum of C accumulation planes. In this example, Figure 7 The accumulation plane 740 corresponds to one of the C accumulation planes. The above reference is repeated for each of the C accumulation planes. Figure 7 The processing described above is performed, and an output plane is generated. Each of the elements in the multiplication results 731 to 739 may also be referred to as a multiplication result element. In addition, in an example where the output feature map includes D output planes, the output feature map can be determined by the D output planes generated in such a cumulative manner.

[0098] As described above, the output feature map can be generated by accumulating the multiplication results corresponding to the intermediate results of the convolution operation (e.g., multiplication results 731 to 739). Therefore, the operation of converting the input feature map into continuous data and storing the continuous data in the buffer may not be required. Therefore, the amount of time for such conversion and buffering can be reduced, and the operation speed of the convolution operation is accelerated, and the memory space for storing the converted data is saved.

[0099] Figures 8 to 10 Examples of cumulative convolution operations using single instruction multiple data (SIMD) processing according to one or more embodiments are shown respectively. SIMD may represent an operation processing method of a processor that processes multiple data using a single instruction. As will be described below, the cumulative convolution operation according to one or more embodiments may be performed by SIMD.

[0100] Reference Figure 8, the weight plane 810 slides into the sliding area 821 of the input plane 820, the MAC operation is performed between them, and the cumulative area 831 of the accumulation plane 830 is determined. Similarly, the weight plane 810 slides into the sliding area 822 of the input plane 820, the MAC operation is performed between them, and the cumulative area 832 of the accumulation plane 830 is determined. In addition, the weight plane 810 slides into the sliding area 823 of the input plane 820, the MAC operation is performed between them, and the cumulative area 833 of the accumulation plane 830 is determined. The height of the sliding areas 821 to 823 may correspond to the height of the weight plane 810, and the height of the cumulative areas 831 to 833 may correspond to a single element. Through such processing described above, the relationship between the sliding area and the cumulative area can be established.

[0101] Reference Fig. 9 , the sliding area 910 in the input plane 900 may include a weight element w 1 tow 9 The response regions 911 to 919 are offset based on the weight element w 1 tow 9 For example, Fig. 9 As shown in , the offset of the response areas 911 to 919 is defined as (W+2)×a+b. In this example, the offsets of the response areas 911 to 919 are 0, 1, 2, (W+2), (W+2)+1, (W+2)+2, (W+2)×2, (W+2)×2+1, and (W+2)×2+2, respectively. The offset may be determined based on the sliding area (e.g., the origin of each sliding area).

[0102] The input element vectors are extracted from the response regions 911 to 919 and stored in registers r1 to r9. For example, the first input element vector of the response region 911 is stored in register r1, and the second input element vector of the response region 912 is stored in register r2. Similarly, the input element vectors are stored in registers r1 to r9 in sequence.

[0103] Each element in the input element vector can be element-wise matched with the weight element w 1 tow 9 The corresponding weight elements in are multiplied to generate a weighted input element vector. In one example, the first input element vector of the response area 911 is stored in register r1 and multiplied with the weight element w 1 Similarly, the second input element vector of the response region 912 is stored in register r2 and multiplied with the weight element w 2The sizes of the response regions 911 to 919, the input element vectors, and the weighted input element vectors may correspond to SIMD operation units.

[0104] The weighted input element vectors generated by such processing described above may be accumulated, and an accumulation vector corresponding to the sliding area 910 may be generated. This processing may be repeated for each sliding area, and accumulation vectors corresponding to the sliding areas may be generated. The generated accumulation vectors may form an accumulation plane. Here, the accumulation plane and the accumulation vector may represent different forms of accumulation data, and may be collectively referred to as accumulation data.

[0105] Reference Fig.10 , the previously stored accumulation vector (hereinafter referred to as the first accumulation vector) is loaded from the output area 1011 in the output plane 1010 and then stored in the register r10. When a new accumulation vector (hereinafter referred to as the second accumulation vector) is generated through the registers r1 to r9, the first accumulation vector and the second accumulation vector are accumulated in the register r10 and stored in the output area 1011.

[0106] exist Fig.10 In the example, the process of storing the accumulated vector in the output area 1011 is performed at least once. In one example, a first accumulated vector is generated by a MAC operation between a first weight plane corresponding to a first input channel and a first input plane, and the first accumulated vector is stored in the output area 1011. Subsequently, a second accumulated vector may be generated by a MAC operation between a second weight plane corresponding to a second input channel and a second input plane. The generated first accumulated vector and second accumulated vector are accumulated and stored in the output area 1011. However, when an initial value is stored in the output area 1011, that is, when the accumulated vector is initially generated, the operation of loading the accumulated vector from the output area 1011 may be omitted, and the newly generated accumulated vector may be stored in the output area 1011 without performing an accumulation operation.

[0107] When the accumulated vectors are repeatedly stored in the output region 1011 based on the number of input channels (for example, the accumulated number is less than the number of input channels by 1), an output element vector corresponding to the output region 1011 is determined. In addition, such processing for the output region 1011 is performed on the remaining output regions in the output plane 1010, and then the output plane 1010 can be determined. Therefore, the accumulated convolution operation can be implemented by SIMD.

[0108] Fig.11 An example of zero skipping of a cumulative convolution operation is shown in accordance with one or more embodiments.

[0109] In one example, the convolution operation may be performed for each input plane as a unit or for each response area in the input plane as a unit, and thus zero skipping may be efficiently processed by software or a combination of software and hardware.

[0110] Reference Fig.11 , from the input elements in the response region 1121 to 1123 and the weight element w 1 tow 9 The respective multiplications between generate multiplication results 1141 to 1143.

[0111] Reference Fig.11 In the example shown in 3 tow 5 、w 8 and w 9 is zero (0). A weight element corresponding to zero is referred to as a zero weight element, and a weight element not corresponding to zero is referred to as a non-zero weight element. In this example, a multiplication result such as multiplication result 1143 generated from a zero weight element may not affect data of an accumulation plane or an output plane, and thus an operation for obtaining such a multiplication result may be skipped.

[0112] Fig.12 An example of performing zero skipping based on a preset operation type according to one or more embodiments is shown.

[0113] Reference Fig.12 In operation 1210, zero encoding is performed. Through zero encoding, the number of non-zero weight elements included in the weight elements is determined. Fig.12 In the example of , as a result of zero encoding, the number of non-zero weight elements can be determined to be four.

[0114] In operation 1220, an operation type corresponding to the determined number of non-zero weight elements may be selected from a plurality of operation types, and data corresponding to the non-zero weight elements may be loaded into a register. Fig.12 In the example, operation type 4 corresponding to four non-zero weight elements can be selected. The operation type may indicate various types of operations that are preset based on the number of non-zero weight elements. For example, for an example in which there are no non-zero weight elements in the weight elements, a corresponding operation type may be set, and for an example in which all weight elements are non-zero weight elements, a corresponding operation type may be set. When the sequence number of the operation type is defined as N and the number of weight elements is defined as K×K, N may be K×K+1 (N=K×K+1). Fig.12 In the example of , K=3 and N=10. The type of operation may indicate an operation related to whether the MAC operation is performed using zero weight elements or non-zero weight elements. In one example, the type of operation is determined based on the number of zero weight elements or the number of non-zero weight elements.

[0115] The data to be loaded into the register may correspond to at least a portion of the input plane. For example, an input element vector corresponding to a non-zero weight element may be loaded into the register. An offset corresponding to the input element vector may be determined based on an index of the non-zero weight element, and the input element vector may be extracted from the input plane based on the determined offset and stored in the register. Fig.12 In the example of 1 、w 2 、w 6 and w 7 To determine offsets 0, 1, (W+2)+2, and (W+2)×2, and load input element vectors corresponding to the determined offsets into registers reg1, reg2, reg3, and reg4.

[0116] The preset type of operation may include a type of operation that performs a MAC operation between a non-zero weight element and data loaded into a register and generates accumulated data. The data may be loaded into the register based on the number and offset of the non-zero weight elements. For example, a MAC operation may be performed between a non-zero weight element and an input element vector stored in a register. Fig.12 In the example, generate non-zero weight elements w 1 、w 2 、w 6 and w 7 The weighted input element vectors corresponding to the multiplication results of the multiplications between the input element vectors stored in the registers reg1, reg2, reg3, and reg4 are accumulated, and the generated weighted input element vectors are accumulated to generate accumulated data.

[0117] In operation 1230, source code corresponding to each operation type may be executed. In one example, for example only, source code corresponding to each of operation types 0 to 9 may be stored in a memory code area, and source code corresponding to a selected operation type may be loaded from the memory code area and executed. Fig.12 In the example of , the source code corresponding to operation type 4 is executed. Such source code may occupy less memory space, so the use of source code may not greatly reduce memory efficiency.

[0118] Fig.13 is a flow chart illustrating an example of a cumulative convolution operation in accordance with one or more embodiments. Fig.13 The operations in the description may be performed in the order and manner as shown, but the order of some operations may be changed or some operations may be omitted without departing from the spirit and scope of the described illustrative examples. Fig.13 Many of the operations shown in may be performed in parallel or simultaneously. Fig.13One or more blocks and combinations of blocks may be implemented by a computer based on dedicated hardware or a combination of dedicated hardware and computer instructions that perform the specified functions. Fig.13 In addition to the description, Figures 1 to 12 The description also applies to Fig.13 , and are incorporated herein by reference. Therefore, the above description may not be repeated here.

[0119] Reference Fig.13 In operation 1301, the weight kernel w is obtained. d In one example, "d" may represent the index of the output channel and may be a natural number (eg, 1 to D) having an initial value of 1. Each weight kernel may correspond to each output channel, respectively. For example, the weight kernel w 1 It can correspond to the first output channel, the weight kernel w 2 May correspond to the second output channel.

[0120] In operation 1302, an input plane i is obtained. c In operation 1303, a weight plane is obtained. In one example, "c" represents the index of the input channel and may be a natural number (eg, 1 to C) having an initial value of 1. The input plane and the weight plane may correspond to the input channels, respectively. 1 and weight plane Corresponding to the first input channel, input plane i 2 and weight plane Corresponds to the second input channel.

[0121] In operation 1306, a MAC operation is performed. In one example, by accumulating the input plane i c At least some of the input elements in The accumulated data is generated by multiplying at least a portion of the weight elements in the input plane i. c Extracting an input element vector corresponding to at least a portion of the weight element, generating a weighted input element vector corresponding to a multiplication result of the extracted input element vector and at least a portion of the weight element, and then generating accumulated data by accumulating the weighted input element vector. In this example, an offset corresponding to the input element vector may be determined based on an index of at least a portion of the weight element, and the input plane i may be shifted from the input plane i based on the determined offset. c Extract the input element vector.

[0122] In operations 1304 and 1305, zero skipping is performed. Specifically, in operation 1304, zero encoding is performed. In operation 1305, an operation type is selected. When the number of non-zero weight elements is determined by zero encoding, an operation type corresponding to the number of determined non-zero weight elements is selected, and input elements corresponding to the non-zero weight elements are loaded into a register. For example, an input element vector corresponding to the non-zero weight element is loaded into a register.

[0123] When an operation type is selected, an operation based on a preset operation type may be performed. For example, the operation may include multiplying a non-zero weight element with an input element vector or an input element in a register, and generating cumulative data (e.g., a cumulative vector) by accumulating the multiplication results. Therefore, when generating cumulative data, the operation of multiplying a zero weight element with an input element may be skipped.

[0124] In operation 1307, the output is accumulated. For example, accumulated data corresponding to the output of the MAC operation may be accumulated. For example, when the first repetition for c as 1 (c=1) is performed, the input plane i is obtained. 1 And get the weight plane And the input plane i obtained by accumulation 1 At least part of the first input element in is consistent with the obtained weight plane The first accumulated data is generated by multiplying at least a part of the first weight elements in the input plane i by performing the second repetition for c being 2 (c=2). 2 and weight plane And the input plane i obtained by accumulation 2 At least part of the second input element in is consistent with the obtained weight plane The second accumulated data is generated by multiplying at least a part of the second weight elements in . In this example, the first accumulated data and the second accumulated data generated are accumulated. When the C-th repetition for c as C (c=C) is performed, an output plane is generated based on the sum of the accumulated data of each input channel.

[0125] In operation 1308, c is compared with C. When c and C are different (e.g., when c is less than C), c is increased by 1 in operation 1309, and operation 1302 is performed. When c is equal to C, d and D are compared in operation 1309. When d and D are different (e.g., when d is less than D), d is increased by 1 in operation 1311, and operation 1301 is performed. Convolution may be performed on all input channels while setting or fixing output channels through operations 1308 and 1309, and convolution operations may be performed on all output channels by changing output channels through operations 1310 and 1311.

[0126] Fig.14 is a flow chart illustrating an example of a data processing method for a neural network according to one or more embodiments. Fig.14 The operations in the description may be performed in the order and manner as shown, but the order of some operations may be changed or some operations may be omitted without departing from the spirit and scope of the illustrative examples described. Fig.14 Many of the operations shown in may be performed in parallel or simultaneously. Fig.14 One or more blocks and combinations of blocks may be implemented by a computer based on dedicated hardware or a combination of dedicated hardware and computer instructions that perform the specified functions. Fig.14 In addition to the description, Figures 1 to 13 The description also applies to Fig.14 , and are incorporated herein by reference. Therefore, the above description may not be repeated here.

[0127] Reference Fig.14 , in operation 1410, the processing device obtains a first input plane corresponding to a first input channel among the input planes of the input feature map that respectively correspond to the input channels. In operation 1420, the processing device obtains a first weight plane corresponding to a first input channel among the weight planes of the weight kernel that respectively correspond to the input channels. In operation 1430, the processing device generates first cumulative data by accumulating a multiplication result between at least a portion of the first input elements in the obtained first input plane and at least a portion of the first weight elements in the obtained first weight plane. In operation 1440, the processing device generates a first output plane corresponding to the first output channel among the output planes of the output feature map that respectively correspond to the output channels based on the generated first cumulative data. For a more detailed description of the data processing method with a neural network implementation, reference may be made to the above-referenced description. Figures 1 to 13 The content of the description.

[0128] Fig.15 is a diagram illustrating an example of a data processing apparatus for image recognition according to one or more embodiments.

[0129] The data processing device 1500 may receive an input image as input data, and process the operation of the neural network associated with the received input image. As a non-limiting example, the operation of the neural network may include an image recognition operation as an example. The data processing device 1500 may perform one or more of the operations or methods described herein with respect to processing by the neural network, and provide a result (e.g., an image recognition result) processed by the neural network to a user. The data processing device 1500 may perform the cumulative convolution operation as described above while processing the operation of the neural network.

[0130] Reference Fig.15, the data processing device 1500 may include one or more processors 1510 and one or more memories 1520. In an example, "processor" may mean one or more processors, and "memory" may mean one or more memories. The memory 1520 may be connected to the processor 1510 and store instructions that can be executed by the processor 1510, and data to be processed by the processor 1510 or data that has been processed by the processor 1510. The memory 1520 may include a non-transitory computer-readable medium (e.g., a high-speed random access memory (RAM)) and / or a non-volatile computer-readable storage medium (e.g., at least one disk storage device, a flash memory device, and other non-volatile solid-state memory devices).

[0131] The processor 1510 may execute instructions to perform the above reference Figures 1 to 14 One or more of the operations or methods described herein. For example, when the instructions stored in the memory 1520 are executed by the processor 1510, the processor 1510 may obtain a first input plane corresponding to a first input channel among the input planes corresponding to the input channels of the input feature map, obtain a first weight plane corresponding to the first input channel among the weight planes corresponding to the input channels of the weight kernel, generate first cumulative data by accumulating a multiplication result of at least a portion of the first input elements in the obtained first input plane and at least a portion of the first weight elements in the obtained first weight plane, and generate a first output plane corresponding to the first output channel among the output planes corresponding to the output channels of the output feature map based on the generated cumulative data. In one example, the data processing device 1500 may also store instructions in, for example, the memory 1520, which, when executed by the processor 1510, configure the processor 1510 to implement such one or more or any combination of the operations described herein.

[0132] Fig.16 is a diagram illustrating an example of an electronic device according to one or more embodiments.

[0133] The electronic device 1600 may receive an input image as input data and process the operation of the neural network associated with the received input image. As a non-limiting example, the operation of the neural network may include an image recognition operation as an example. The electronic device 1600 may perform the cumulative convolution operation as described above while processing the operation of the neural network. The electronic device 1600 may include the above reference Figures 1 to 15 The processing device described above and performs Figures 1 to 15 Describe the operation of the processing device.

[0134] Reference Fig.16, the electronic device 1600 may include one or more processors 1610, one or more memories 1620, a camera 1630, a storage device 1640, an input device 1650, an output device 1660, and a network interface 1670. The processor 1610, the memory 1620, the camera 1630, the storage device 1640, the input device 1650, the output device 1660, and the network interface 1670 may communicate with each other via a communication bus 1680.

[0135] One or more processors 1610 may execute functions and instructions in the electronic device 1600. For example, the processor 1610 may process instructions stored in the memory 1620 or the storage device 1640. The processor 1610 may execute the above-mentioned Figures 1 to 15 One or more of the operations or methods described.

[0136] The memory 1620 may store information to be used for processing the operation of the neural network. The memory 1620 may include a computer-readable storage medium or a computer-readable storage device. The memory 1620 may store instructions to be executed by the processor 1610 and store relevant information when the software or application is being executed by the electronic device 1600.

[0137] The camera 1630 may capture still images, moving images, or video images, or both. The camera 1630 may capture an image of a facial region to be input by a user for facial verification or recognition. The camera 1630 may also provide a three-dimensional (3D) image including depth information of an object.

[0138] Storage device 1640 may include a computer-readable storage medium or a computer-readable storage device. Storage device 1640 may store a larger amount of information for a longer period of time than memory 1620. Storage device 1640 may include, for example, a magnetic hard disk, an optical disk, a flash memory, a floppy disk, and other types of non-volatile memory known in the relevant technical field.

[0139] The input device 1650 may receive input from the user through conventional input methods (including, as non-limiting examples, a keyboard and a mouse) and new input methods (e.g., touch input, voice input, and image input). The input device 1650 may include, for example, a keyboard, a mouse, a touch screen, a microphone, and other devices that may detect input from the user and send the detected input to the electronic device 1600.

[0140] The output device 1660 can provide the output of the electronic device 1600 to the user through visual, auditory or tactile channels. The output device 1660 may include, for example, a display, a touch screen, a speaker, a vibration generator, and other devices that can provide output to the user. The network interface 1670 can communicate with external devices through a wired network or a wireless network.

[0141] Here for Figures 1 to 16The neural network device, data processing device, electronic device, data processing device 100, processor 1510, memory 1520, processor 1610, memory 1620, camera 1630, storage device 1640, input device 1650, output device 1660, network interface 1670 and other devices and other components described are implemented as hardware components and implemented by hardware components. Examples of hardware components that can be used to perform the operations described in this application include, where appropriate: controllers, sensors, generators, drivers, memories, comparators, arithmetic logic units, adders, subtractors, multipliers, dividers, integrators, and any other electronic components configured to perform the operations described in this application. In other examples, one or more of the hardware components that perform the operations described in this application are implemented by computing hardware (e.g., by one or more processors or computers). A processor or computer can be implemented by one or more processing elements (such as logic gate arrays, controllers and arithmetic logic units, digital signal processors, microcomputers, programmable logic controllers, field programmable gate arrays, programmable logic arrays, microprocessors, or any other device or combination of devices configured to respond and execute instructions in a limited manner to achieve the desired result). In one example, a processor or computer includes or is connected to one or more memories storing instructions or software executed by a processor or computer. The hardware components implemented by a processor or computer can execute instructions or software (such as operating systems (OS) and one or more software applications running on OS) for performing the operations described in this application. The hardware components can also access, manipulate, process, create and store data in response to the execution of instructions or software. For simplicity, the singular term "processor" or "computer" can be used for the description of the examples described in this application, but in other examples, multiple processors or computers can be used, or a processor or computer can include multiple processing elements or multiple types of processing elements or both. For example, a single hardware component or two or more hardware components can be implemented by a single processor, or two or more processors, or a processor and a controller. One or more hardware components may be implemented by one or more processors, or a processor and a controller, and one or more other hardware components may be implemented by one or more other processors, or another processor and another controller. One or more processors, or a processor and a controller may implement a single hardware component or two or more hardware components. The hardware components may have any one or more of different processing configurations, examples of which include: a single processor, an independent processor, a parallel processor, a single instruction single data (SISD) multiprocessing, a single instruction multiple data (SIMD) multiprocessing, multiple instructions single data (MISD) multiprocessing, and multiple instructions multiple data (MIMD) multiprocessing.

[0142] Figures 1 to 16 The method for performing the operations described in the present application shown in the embodiment is performed by computing hardware (e.g., by one or more processors or computers), which is implemented as an execution instruction or software as described above to perform the operations performed by the method described in the present application. For example, a single operation or two or more operations may be performed by a single processor or two or more processors, or a processor and a controller. One or more operations may be performed by one or more processors, or a processor and a controller, and one or more other operations may be performed (e.g., as respective operations of the method implemented by the processor) by one or more other processors, or another processor and another controller. One or more processors, or a processor and a controller may perform a single operation or two or more operations.

[0143] Instructions or software for controlling computing hardware (e.g., one or more processors or computers) to implement hardware components and perform methods as described above may be written as computer programs, code segments, instructions, or any combination thereof to individually or collectively instruct or configure one or more processors or computers to operate as a machine or special-purpose computer to perform operations performed by the hardware components and methods as described above. In one example, the instructions or software include machine code (such as machine code generated by a compiler) that is directly executed by one or more processors or computers. In another example, the instructions or software include high-level code that is executed by one or more processors or computers using an interpreter. Instructions or software may be written in any programming language based on the block diagrams and flow charts shown in the accompanying drawings and the corresponding descriptions in the specification, which disclose algorithms for performing operations performed by the hardware components and methods as described above.

[0144] Instructions or software for controlling computing hardware (e.g., one or more processors or computers) to implement hardware components and perform the methods described above, and any associated data, data files, and data structures, may be recorded, stored, or fixed in or on one or more non-transitory computer-readable storage media. Examples of non-transitory computer-readable storage media include: read-only memory (ROM), random access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), flash memory, non-volatile memory, CD-ROM, CD-R, CD+R, CD-RW, CD+RW, DVD-ROM, DVD-R, DVD+R, DVD-RW, DVD+RW, DVD-RAM, BD-ROM, BD-R, BD-R LTH, BD-RE, Blu-ray or optical disk storage, hard disk drive (HDD), solid state drive (SSD), card storage (such as multimedia card or micro card (for example, secure digital (SD) or extreme digital (XD)), magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid state disk and any other device configured to store instructions or software and any associated data, data files and data structures in a non-transitory manner and provide the instructions or software and any associated data, data files and data structures to one or more processors or computers so that one or more processors or computers can execute the instructions. In one example, the instructions or software and any associated data, data files and data structures are distributed on a networked computer system so that the instructions or software and any associated data, data files and data structures are stored, accessed and executed by one or more processors or computers in a distributed manner.

[0145] Although the present disclosure includes specific examples, it will be clear to those skilled in the art that various changes in form and detail may be made in these examples without departing from the spirit and scope of the claims and their equivalents. The examples described herein are considered to be illustrative only and not for limiting purposes. The description of features or aspects in each example will be considered to be applicable to similar features or aspects in other examples. If the described techniques are performed in a different order, and / or if the components in the described systems, architectures, devices, or circuits are combined in different ways, and / or replaced or supplemented by other components or their equivalents, suitable results may be achieved. Therefore, the scope of the present disclosure is not limited by specific embodiments, but by the claims and their equivalents, and all changes within the scope of the claims and their equivalents should be interpreted as included in the present disclosure.

Claims

1. A method for recognizing an image, include: Get the input image; Calculate the input feature map of the neural network based on the input image; For each layer of at least one layer in the neural network, Obtaining a first input plane among a plurality of input planes of an input feature map of the layer corresponding to a first input channel among a plurality of input channels; receiving a first weight plane corresponding to a first input channel among a plurality of weight planes of a weight kernel of the layer; generating first accumulated data by accumulating multiplication results of multiplication operations between at least a portion of the first input elements in the first input plane and at least a portion of the first weight elements in the first weight plane; storing the first accumulated data in a first storage area; Obtaining a second input plane among the plurality of input planes corresponding to a second input channel among the plurality of input channels; receiving a second weight plane corresponding to a second input channel among the plurality of weight planes; generating second accumulated data by accumulating multiplication results of multiplication operations between at least a portion of the second input elements in the second input plane and at least a portion of the second weight elements in the second weight plane; as well as accumulating the second accumulated data in the first storage area to generate a first output plane corresponding to a first output channel among the plurality of output channels among the plurality of output planes of the output feature map of the layer based on a sum of the first accumulated data and the second accumulated data; as well as Based on the output feature map, output the image recognition result, The multiple input planes correspond to the multiple input channels one by one, the multiple weight planes correspond to the multiple input channels one by one, and The multiple output planes correspond one-to-one to the multiple output channels.

2. The method according to claim 1, in, The step of calculating the input feature map of the neural network based on the input image includes: the i-th layer of the neural network outputs the output feature map of the i-th layer based on the output feature map of the i-1th layer as the input feature map of the i-th layer, where i is an integer greater than 1, The first layer of the neural network receives an input image and outputs an output feature map of the first layer based on the input image as an input feature map of the second layer. Among them, the last layer of the neural network generates and outputs the image recognition result based on the output feature map of the previous layer.

3. The method according to claim 1, in, The steps of generating the first output plane include: A first output plane is generated based on a sum of the accumulated data for each input channel including the first accumulated data.

4. The method according to claim 1, in, The step of generating first accumulated data comprises: extracting, from the first input plane, a first input element vector corresponding to the portion of the first weight element; generating a first weighted input element vector corresponding to a multiplication result of a multiplication operation between the first input element vector and the portion of the first weight elements; and First accumulated data is generated by accumulating the first weighted input element vector.

5. The method according to claim 4, in, The steps of extracting the first input element vector include: determining an offset corresponding to the first input element vector based on an index of the portion of the first weight element; and A first input element vector is extracted from the first input plane based on the determined offset.

6. The method according to claim 4, in, The size of the first input element vector and the size of the first weighted input element vector correspond to a single instruction multiple data arithmetic unit.

7. The method according to claim 1, in, When generating the first accumulated data, an operation of multiplying a zero weight element corresponding to a zero value among the part of the first weight elements by the part of the first input elements is skipped.

8. The method according to claim 1, further comprising: include: determining the number of non-zero weight elements that do not correspond to zero among the first weight elements; as well as An operation type corresponding to the determined number of non-zero weight elements is selected from a plurality of operation types to perform an operation of a preset type.

9. The method according to claim 8, in, The step of generating first accumulated data comprises: The first accumulated data is generated by accumulating multiplication results of multiplication operations between the portion of the first input element and non-zero weight elements corresponding to the portion of the first weight element based on the selected operation type.

10. The method according to claim 8, in, The step of generating first accumulated data comprises: extracting a first input element vector corresponding to a non-zero weight element from the first input plane based on an index of the non-zero weight element; generating a first weighted input element vector corresponding to a multiplication result of a multiplication operation between the first input element vector and the non-zero weight elements corresponding to the portion of the first weight elements; and First accumulated data is generated by accumulating the first weighted input element vector.

11. The method according to claim 1, further comprising: include: Respective weight elements of each weight plane of the plurality of weight planes are individually multiplied by a plurality of elements of the first input plane.

12. A device for recognizing an image, include: One or more processors configured to: Get the input image; Calculate the input feature map of the neural network based on the input image; For each layer of at least one layer in the neural network, Obtaining a first input plane among a plurality of input planes of an input feature map of the layer corresponding to a first input channel among a plurality of input channels; receiving a first weight plane corresponding to a first input channel among a plurality of weight planes of a weight kernel of the layer; generating first accumulated data by accumulating multiplication results of multiplication operations between at least a portion of the first input elements in the first input plane and at least a portion of the first weight elements in the first weight plane; storing the first accumulated data in a first storage area; Obtaining a second input plane among the plurality of input planes corresponding to a second input channel among the plurality of input channels; receiving a second weight plane corresponding to a second input channel among the plurality of weight planes; as well as generating second accumulated data by accumulating multiplication results of multiplication operations between at least a portion of the second input elements in the second input plane and at least a portion of the second weight elements in the second weight plane; as well as accumulating the second accumulated data in the first storage area to generate a first output plane corresponding to a first output channel among the plurality of output channels among the plurality of output planes of the output feature map of the layer based on a sum of the first accumulated data and the second accumulated data; as well as Based on the output feature map, output the image recognition result, The multiple input planes correspond to the multiple input channels one by one, the multiple weight planes correspond to the multiple input channels one by one, and The multiple output planes correspond one-to-one to the multiple output channels.

13. The device according to claim 12, in, In order to calculate an input feature map of the neural network based on the input image, the one or more processors are further configured to: output the output feature map of the i-th layer through the i-th layer of the neural network based on the output feature map of the i-1th layer as the input feature map of the i-th layer, where i is an integer greater than 1, The first layer of the neural network receives an input image and outputs an output feature map of the first layer based on the input image as an input feature map of the second layer. Among them, the last layer of the neural network generates and outputs the image recognition result based on the output feature map of the previous layer.

14. The device according to claim 12, in, The one or more processors are further configured to: A first output plane is generated based on a sum of the accumulated data for each input channel including the first accumulated data.

15. The device according to claim 12, in, The one or more processors are further configured to: extracting, from the first input plane, a first input element vector corresponding to the portion of the first weight element; generating a first weighted input element vector corresponding to a multiplication result of a multiplication operation between the first input element vector and the portion of the first weight elements; as well as First accumulated data is generated by accumulating the first weighted input element vector.

16. The device according to claim 15, in, The one or more processors are further configured to: determining an offset corresponding to the first input element vector based on an index of the portion of the first weight element; and A first input element vector is extracted from the first input plane based on the determined offset.

17. The device according to claim 15, in, The size of the first input element vector and the size of the first weighted input element vector correspond to a single instruction multiple data arithmetic unit.

18. The device according to claim 12, in, When generating the first accumulated data, an operation of multiplying a zero weight element corresponding to a zero value among the part of the first weight elements by the part of the first input elements is skipped.

19. The device according to claim 12, in, The one or more processors are further configured to: determining the number of non-zero weight elements that do not correspond to zero among the first weight elements; and An operation type corresponding to the determined number of non-zero weight elements is selected from a plurality of operation types to perform an operation of a preset type.

20. The device according to claim 19, in, The one or more processors are further configured to: The first accumulated data is generated by accumulating multiplication results of multiplication operations between the portion of the first input element and non-zero weight elements corresponding to the portion of the first weight element based on the selected operation type.

21. The device according to claim 19, in, The one or more processors are further configured to: extracting a first input element vector corresponding to a non-zero weight element from the first input plane based on an index of the non-zero weight element; generating a first weighted input element vector corresponding to a multiplication result of a multiplication operation between the first input element vector and the non-zero weight elements corresponding to the portion of the first weight elements; as well as First accumulated data is generated by accumulating the first weighted input element vector.

22. The device according to claim 12 further includes a memory storing instructions, which, when executed by the one or more processors, configure the one or more processors to perform the steps of receiving a first input plane, receiving a first weight plane, generating first accumulated data, and generating a first output plane.

23. A method for recognizing an image, the method include: Get the input image; Calculate the input feature map of the neural network based on the input image; For each layer of at least one layer in the neural network, Obtain an input plane of an input feature map of the layer comprising a plurality of input elements; receiving a weight plane corresponding to an input plane of the layer, the weight plane comprising a plurality of weight elements; as well as generating an output plane of an output feature map of the layer by accumulating multiplication results, wherein the multiplication results are obtained by performing a multiplication operation between each weight element in the weight plane and a corresponding input element of the plurality of input elements in the input plane; and Based on the output feature map, output the image recognition result, The method comprises: for each layer of the at least one layer in the neural network, Obtaining a first input plane corresponding to a first input channel among the input planes of the layer; receiving a first weight plane corresponding to a first input channel among the weight planes of the layer; generating first accumulated data by accumulating multiplication results of multiplication operations between at least a portion of the first input elements in the first input plane and at least a portion of the first weight elements in the first weight plane; storing the first accumulated data in a first storage area; Obtaining a second input plane corresponding to a second input channel among the input planes of the layer; receiving a second weight plane corresponding to a second input channel among the weight planes of the layer; generating second accumulated data by accumulating multiplication results of multiplication operations between at least a portion of the second input elements in the second input plane and at least a portion of the second weight elements in the second weight plane; and The second accumulated data is accumulated in the first storage area to generate a first output plane corresponding to a first output channel among the plurality of output channels among output planes of an output feature map of the layer based on a sum of the first accumulated data and the second accumulated data.

24. The method according to claim 23, in, The step of calculating the input feature map of the neural network based on the input image includes: the i-th layer of the neural network outputs the output feature map of the i-th layer based on the output feature map of the i-1th layer as the input feature map of the i-th layer, where i is an integer greater than 1, The first layer of the neural network receives an input image and outputs an output feature map of the first layer based on the input image as an input feature map of the second layer. Among them, the last layer of the neural network generates and outputs the image recognition result based on the output feature map of the previous layer.

25. The method according to claim 23, in, When there is a zero weight element corresponding to a zero value among the plurality of weight elements, multiplication between the zero weight element and an input element corresponding to the zero weight element is skipped.

26. The method according to claim 23, in, A convolution operation associated with the layer of the neural network is performed based on a single instruction multiple data.

27. The method according to claim 23, in, The input plane corresponds to a plurality of input channels one by one, the weight plane corresponds to the plurality of input channels one by one, and The output plane corresponds one-to-one to the multiple output channels.

28. The method of claim 23, wherein: in, An output feature map of the layer is determined based on the first output plane, and one or more other output planes generated based on one or more other input planes among the input planes except the first input plane and one or more other weight planes among the weight planes except the weight plane.

29. A method for recognizing an image, include: Get the input image; Calculate the input feature map of the neural network based on the input image; For each layer of at least one layer in the neural network, Obtaining an input feature map of the layer comprising a plurality of input planes; receiving a weight kernel of the layer comprising a plurality of weight planes; Performing a cumulative convolution operation between the input feature map and the weight kernel; and generating an output plane of an output feature map of the layer based on an accumulated convolution operation; And based on the output feature map, output the image recognition result, The step of performing a cumulative convolution operation between the input feature map and the weight kernel includes: obtaining a first input plane corresponding to a first input channel among the plurality of input planes of the layer, receiving a first weight plane corresponding to a first input channel from among the plurality of weight planes of the layer, generating first accumulated data by accumulating multiplication results of multiplication operations between at least a portion of the first input elements in the first input plane and at least a portion of the first weight elements in the first weight plane, obtaining a second input plane corresponding to a second input channel among the plurality of input planes of the layer, receiving a second weight plane corresponding to a second input channel from among the plurality of weight planes of the layer, generating second accumulated data by accumulating multiplication results of multiplication operations between at least a portion of the second input elements in the second input plane and at least a portion of the second weight elements in the second weight plane, The step of generating an output plane of the output feature map of the layer based on the cumulative convolution operation comprises: storing the first accumulated data in a first storage area; The second accumulated data is accumulated in the first storage area to generate a first output plane corresponding to a first output channel among the plurality of output channels among output planes of an output feature map of the layer based on a sum of the first accumulated data and the second accumulated data.

30. The method according to claim 29, in, The step of calculating the input feature map of the neural network based on the input image includes: the i-th layer of the neural network outputs the output feature map of the i-th layer based on the output feature map of the i-1th layer as the input feature map of the i-th layer, where i is an integer greater than 1, The first layer of the neural network receives an input image and outputs an output feature map of the first layer based on the input image as an input feature map of the second layer. Among them, the last layer of the neural network generates and outputs the image recognition result based on the output feature map of the previous layer.

31. The method according to claim 29, further comprising: include: An accumulation plane is generated by performing a multiplication-accumulation operation between the plurality of input planes and the plurality of weight planes.

32. The method according to claim 31, in, A first output plane is generated by accumulating the outputs of the accumulation planes.

33. A non-transitory computer-readable storage medium storing instructions, which, when executed by a processor, causes the processor to perform the method of any one of claims 1 to 11, and claims 23 to 32.