WO2019218900A1 - 一种神经网络模型、数据处理方法及处理装置 - Google Patents

一种神经网络模型、数据处理方法及处理装置 Download PDF

Info

Publication number
WO2019218900A1
WO2019218900A1 PCT/CN2019/085885 CN2019085885W WO2019218900A1 WO 2019218900 A1 WO2019218900 A1 WO 2019218900A1 CN 2019085885 W CN2019085885 W CN 2019085885W WO 2019218900 A1 WO2019218900 A1 WO 2019218900A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
weight value
processing
input data
task
Prior art date
Application number
PCT/CN2019/085885
Other languages
English (en)
French (fr)
Other versions
WO2019218900A9 (zh
Inventor
杨帆
郑成林
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2019218900A1 publication Critical patent/WO2019218900A1/zh
Publication of WO2019218900A9 publication Critical patent/WO2019218900A9/zh
Priority to US17/068,358 priority Critical patent/US20210027162A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/544Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices for evaluating functions by calculation
    • G06F7/5443Sum of products
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/047Probabilistic or stochastic networks

Definitions

  • the embodiments of the present invention relate to the field of computer technologies, and in particular, to a neural network model, a data processing method, and a processing device.
  • a neural network model is an operational model consisting of a large number of nodes (or neurons) connected to each other.
  • Commonly used neural network models include an input layer, an output layer, and multiple hidden layers (also known as hidden layers). For any hidden layer, the output of the hidden layer acts as the input to the next layer (another hidden layer or output layer) of the hidden layer.
  • Each layer of the neural network model except the output layer can calculate its input data according to the corresponding parameter set (such as weight value) to generate output data.
  • the Convolutional Neural Network (CNN) model is one of the neural network models.
  • the CNN model has achieved remarkable results in applications such as image recognition, speech processing, and intelligent robots.
  • the convolutional neural network model that processes multiple tasks has a strong generalization ability, and can appropriately reduce the resources and storage costs occupied by each task.
  • the embodiment of the present application provides a neural network model, a data processing method, and a processing device, which can solve the problem that the neural network model has low performance when processing different tasks.
  • a neural network model for performing N (N is an integer greater than or equal to 2) tasks, the N tasks including a first task, and the neural network model includes M (M a positive integer) network layer, the ith (1 ⁇ i ⁇ M, i is an integer) network layers in the M network layers have a shared weight value and a N group of unique weight values, where the shared weight value is used to execute the Each of the N tasks, each of the N sets of unique weights is used to perform one of the N tasks, and each set of unique weights and one of the N tasks The tasks correspond one by one.
  • Each of the N sets of special weights of the i-th network layer is used to perform one of the N tasks, and each set of unique weights corresponds to one of the N tasks, and therefore, For any task, the i-th network layer only needs to obtain the shared weight value and the specific weight value corresponding to the current task when performing data processing, without acquiring specific weight values corresponding to other tasks, effectively improving The performance of the i-th network layer, which in turn improves the performance of the neural network model.
  • the i-th network layer since the shared weight value is used to perform each of the N tasks, in the scenario of switching the task, the i-th network layer does not need to re-acquire the sharing weight value, and only needs to obtain the special weight value corresponding to the current task. That is, the number of data readings is reduced, and the processing performance is improved.
  • the ith network layer is any one of a convolution layer, a fully connected layer, a deconvolution layer, and a loop layer.
  • the i-th network layer may be a convolution layer, a full-connection layer, a deconvolution layer, or a loop layer, which is not specifically limited in this application.
  • the foregoing output data includes shared output data and unique output data, and the foregoing “according to the tth group special weight value, the shared weight value, and the acquired input data
  • the method of obtaining output data is: when the i-th network layer is a convolution layer, convolution calculation is performed on the input data by using the above shared weight value to obtain shared output data; and the t-th group special weight-value pair is input. The data is convoluted to obtain unique output data.
  • the input data is multiplied and added to obtain shared output data by using the shared weight value; and the input data is multiplied and added by using the t-th special weight value to obtain The unique output data.
  • the input data is subjected to inverse convolution calculation using the above-mentioned shared weight value to obtain shared output data; and the input data is inversely compressed by using the t-th special weight value.
  • the i-th network layer uses different calculation methods to calculate the input data as its properties change.
  • the data processing method is: acquiring the first object to be processed, and responding to the first processing operation after receiving the first processing operation input by the user for indicating that the first task is to be executed on the first object to be processed. Obtaining the t-th group unique weight value, the shared weight value, and the first input data in the i-th network layer, and acquiring the first according to the t-th group unique weight value, the shared weight value, and the first input data.
  • the i-th network layer in the neural network provided by the application has a sharing weight value and an N-group weight value, and the sharing weight value is used to perform each of the N tasks, the N group.
  • Each set of special weights in the special weight value is used to perform one of the N tasks, and each set of special weights corresponds to one of the N tasks one by one.
  • the processing device since the shared weight value is used to perform each of the N tasks, the processing device does not need to re-acquire the sharing weight value in the i-th network layer.
  • the processing device needs to re-acquire the special weight value corresponding to the current task in the i-th network layer.
  • the processing device does not need to repeatedly obtain the shared weight value, which effectively reduces the number of data readings and improves the processing performance.
  • a data processing method uses the neural network model described in the first aspect or any one of the foregoing first aspects to perform data processing, and the image denoising task is an image. Denoising task.
  • the data processing method is: acquiring a first to-be-processed image, and responding to the first processing after receiving a first processing operation input by the user for instructing to perform an image denoising task on the first to-be-processed image And acquiring, in the i-th network layer, the t-th group unique weight value, the shared weight value, and the first input data, and acquiring the first according to the t-th group special weight value, the shared weight value, and the first input data.
  • the first input data is data output by the i-1th network layer in the M network layers after processing the first to-be-processed image;
  • the processing device does not need to reacquire the sharing weight value in the i-th network layer.
  • the processing device needs to re-acquire the special weight value corresponding to the current task in the i-th network layer. The processing device does not need to repeatedly obtain the shared weight value, which effectively reduces the number of data readings and improves the processing performance.
  • a neural network model training method is provided, and the neural network model is the neural network model described in the above first aspect or any one of the foregoing possible implementation manners.
  • the training method is: acquiring training information including marking information of each of the K (K is a positive integer) training object and each of the K training objects; performing a training processing operation according to the acquired training information, The training processing operation is “putting K training objects into the neural network model, and obtaining K processing results, each of the K processing results uniquely corresponding to one training object; determining K difference values, K difference values Determining the difference between each processing result and the marking information of the training object corresponding to each processing result separately; calculating a difference value of the K difference values according to a preset statistical algorithm to obtain a first statistical error, a The training object corresponding to each difference value is used to perform the first task, 0 ⁇ a ⁇ K, a is an integer; b difference values of the K difference values are calculated according to a preset statistical algorithm, The second statistical error, the training object
  • the training processing operation is to adjust the correlation weight value of the i-th network layer.
  • the training method is to perform the training processing operation according to the acquired training information, and then re-acquire the training information, and utilize the re-acquired training.
  • the information and the neural network model after adjusting the weight value perform the training processing operation.
  • the training process is an iterative process. In practical applications, the training of the neural network model needs to be completed using a larger number of training objects to achieve the stability of the neural network model.
  • a processing apparatus having a neural network model as described in the first aspect above and any one of its possible implementations.
  • the processing device includes an acquiring unit, a receiving unit, a processing unit, and a transmitting unit.
  • the acquiring unit is configured to acquire the first object to be processed.
  • the receiving unit is configured to receive a first processing operation input by the user, where the first processing operation is used to instruct to perform a first task on the first to-be-processed object acquired by the acquiring unit.
  • the processing unit is configured to: in response to the first processing operation received by the receiving unit, acquire a t-th group unique weight value, a shared weight value, and a first input data in the i-th network layer, and according to the t-th group special weight
  • the first output data is obtained by using the value, the shared weight value, and the first input data; wherein, when 1 ⁇ i ⁇ M, the first input data is processed by the i-1th network layer in the M network layers to be processed first
  • the transmission unit is configured to transmit the first output data obtained by the processing unit.
  • the acquiring unit is further configured to acquire a second object to be processed.
  • the receiving unit is further configured to receive a second processing operation input by the user, where the second processing operation is used to instruct to perform a second task on the second to-be-processed object acquired by the acquiring unit, where the second task is one of the N tasks. And the second task is different from the first task.
  • the processing unit is further configured to: in response to the second processing operation received by the receiving unit, acquire the q-th set of the special weight value and the second input data in the i-th network layer, and according to the q-th group special weight value, The second input data is obtained by the two input data and the shared weight value that has been acquired; wherein the qth group special weight value is a unique weight value uniquely corresponding to the second task in the i-th network layer, N ⁇ q ⁇ 1, Q ⁇ t,q is an integer.
  • the foregoing transmission unit is further configured to transmit the second output data obtained by the processing unit.
  • a processing apparatus having a neural network model as in the first aspect described above and any one of the possible implementations.
  • the processing device includes an acquiring unit, a receiving unit, a processing unit, and a transmitting unit.
  • the acquiring unit is configured to acquire a first image to be processed.
  • the receiving unit is configured to receive a first processing operation input by the user, where the first processing operation is used to perform an image denoising task on the first to-be-processed image acquired by the acquiring unit.
  • the processing unit is configured to: in response to the first processing operation received by the receiving unit, acquire a t-th group unique weight value, a shared weight value, and a first input data in the i-th network layer, and according to the t-th group special weight
  • the first output data is obtained by using the value, the shared weight value, and the first input data; wherein, when 1 ⁇ i ⁇ M, the first input data is processed by the i-1th network layer in the M network layers to be processed first
  • the transmission unit is configured to transmit the first output data obtained by the processing unit.
  • the acquiring unit is further configured to acquire a second image to be processed.
  • the receiving unit is further configured to receive a second processing operation input by the user, where the second processing operation is used to perform an image recognition task on the second to-be-processed image acquired by the acquiring unit, where the image recognition task is N tasks. one of.
  • a processing apparatus comprising an acquisition unit and a processing unit.
  • the obtaining unit is configured to acquire training information including mark information of each of the K (K is a positive integer) training object and the K training objects.
  • the processing unit is configured to perform a training processing operation according to the training information acquired by the acquiring unit, where the training processing operation is “putting K training objects into the neural network model, and obtaining K processing results, and K processing results.
  • Each processing result uniquely corresponds to one training object; K difference values are determined, and K difference values respectively represent the difference between each processing result and the marking information of the training object corresponding to each processing result; K difference values are The a difference value in the calculation is calculated according to a preset statistical algorithm, and the first statistical error is obtained.
  • the training object corresponding to each difference value of the a difference values is used to perform the first task, 0 ⁇ a ⁇ K, and a is an integer.
  • the special weight value, and according to the preset back propagation algorithm and the second statistical error adjust the qth group special weight value in the i-th network layer, according to the preset back propagation algorithm, the first statistical error and the second Statistical error, adjust the shared weight value, the q-th special weight value is the unique weight value corresponding to the second task in the i-th network layer, N ⁇ q ⁇ 1, q ⁇ t, q
  • the obtaining unit is further configured to re-acquire the training information.
  • the processing unit is further configured to perform a training processing operation according to the training information reacquired by the acquiring unit and the neural network model after the processing unit adjusts the t-th special weight value, the q-th group special weight value, and the shared weight value;
  • the difference value between the preset parameter of the neural network model after the xth execution of the training processing operation and the preset parameter of the neural network model after the xyth execution of the training processing operation is less than the first preset threshold or until the training processing operation is performed.
  • the number of times reaches the second predetermined threshold, x is an integer greater than or equal to 2, and y is a positive integer.
  • a processing apparatus comprising: one or more processors, a memory, a communication interface.
  • the memory, communication interface is coupled to one or more processors; the processing device is in communication with other devices via a communication interface, the memory is for storing computer program code, the computer program code comprising instructions, when one or more processors execute the instructions.
  • the processing device performs the data processing method according to the above second aspect or the above third aspect, or the training method of the neural network model as described in the above fourth aspect.
  • a ninth aspect further provides a computer readable storage medium having stored therein instructions; when operating on the processing device of the above eighth aspect, causing the processing device to perform the above The data processing method according to the second aspect or the third aspect, or the training method of the neural network model according to the fourth aspect described above.
  • a tenth aspect further provides a computer program product comprising instructions, when operating on the processing device of the above eighth aspect, causing the processing device to perform the second aspect or the third aspect described above A data processing method, or a training method of the neural network model as described in the above fourth aspect.
  • the eighth aspect, the ninth aspect, the tenth aspect, and various implementations thereof reference may be made to the detailed description of any of the foregoing second, third, and fourth aspects; and, the eighth For the beneficial effects of the aspects, the ninth aspect, the tenth aspect, and various implementations thereof, reference may be made to the beneficial effects analysis of any of the foregoing second, third, and fourth aspects, and details are not described herein again.
  • the names of the above processing devices are not limited to the devices or the functional modules themselves. In actual implementation, these devices or functional modules may appear under other names. As long as the functions of the respective devices or functional modules are similar to the present application, they are within the scope of the claims and their equivalents.
  • FIG. 1 is a schematic diagram of a mobile phone in an embodiment of the present application.
  • FIG. 2 is a schematic structural diagram of hardware of a mobile phone according to an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram 1 of a neural network model in an embodiment of the present application.
  • FIG. 4 is a schematic diagram 1 of a data processing flow of an i-th network layer in the embodiment of the present application.
  • FIG. 5 is a second schematic diagram of data processing of an i-th network layer according to an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram 2 of a neural network model in an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram 3 of a neural network model in an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram 4 of a neural network model in an embodiment of the present application.
  • FIG. 9 is a schematic flowchart of processing an image by a neural network model in an embodiment of the present application.
  • FIG. 10 is a schematic diagram of an image processed by different models in an embodiment of the present application.
  • Figure 11 is a schematic structural view 1 of a processing device in an embodiment of the present application.
  • FIG. 12 is a second schematic structural diagram of a processing apparatus according to an embodiment of the present application.
  • the words “exemplary” or “such as” are used to mean an example, illustration, or illustration. Any embodiment or design described as “exemplary” or “for example” in the embodiments of the present application should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of the words “exemplary” or “such as” is intended to present the concepts in a particular manner.
  • first and second are used for descriptive purposes only, and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, features defining “first” and “second” may include one or more of the features either explicitly or implicitly. In the description of the embodiments of the present application, “multiple” means two or more unless otherwise stated.
  • the deep neural network simulates the neural connection structure of the human brain by establishing a model.
  • the data features are described by stratification through multiple transformation stages.
  • a neural network consists of multiple network layers, each of which processes its input data and transmits the processed data to the next network layer.
  • the processing device the device storing the neural network
  • the processing manner of the processing device is determined by attributes of the network layer (such as a convolution layer, a fully connected layer, etc.), and the weight value used by the processing device is determined by the processing device during the process of training the neural network.
  • the processing device adjusts the weight values corresponding to the network layer to obtain different data processing results.
  • the convolutional neural network model is one of the deep neural network models.
  • CNN has achieved remarkable results in applications such as image recognition, speech processing, and intelligent robots.
  • the convolutional neural network model that processes multiple tasks has a strong generalization ability, and can appropriately reduce the resources and storage costs occupied by each task.
  • the chip-based neural network accelerator in the terminal can only perform one image enhancement task and output a single image in a certain period of time. Therefore, a string can be proposed.
  • a convolutional neural network model that performs multiple tasks.
  • the plurality of tasks share the weight value in at least one convolution layer of the convolutional neural network model, and for the convolution layer (referred to as the shared layer) sharing the weight value, the ownership weight of the shared layer is Be shared.
  • the sharing of weight values in the convolutional neural network model not only reduces the number of weight values, but also reduces the bandwidth requirements of the terminal when switching tasks.
  • the weights of ownership of the shared layer are shared, the effective utilization of the image features in the shared layer is reduced when the terminal performs different tasks, and the performance of the convolutional neural network model in processing different tasks is reduced.
  • an embodiment of the present application provides a neural network model for performing N (N is an integer greater than or equal to 2) tasks, where the neural network model includes M (M is a positive integer) network layers, M The i-th (1 ⁇ i ⁇ M, i is an integer) network layer of the network layer has a shared weight value and a N-group weighted value, where the shared weight value is used to perform each of the N tasks, and the N-group unique Each set of weighted values in the weight value is used to perform one of the N tasks, and each set of weighted values corresponds one-to-one with one of the N tasks.
  • the i-th network layer since the shared weight value is used to perform each of the N tasks, in the scenario of switching the task, the i-th network layer does not need to re-acquire the sharing weight value, and only needs to obtain the special weight value corresponding to the current task. That is, the number of data readings is reduced, and the processing performance is improved.
  • the structure of the “i+1th network layer in the M network layers” may be the same as the structure of the “i-th network layer” described above (that is, both have a shared weight value and N groups of special rights). Value) can also be different.
  • the structure of the "i+1th network layer in the M network layers” may be different from the structure of the "i-th network layer” described above, "the i+1th network layer in the M network layers” It may have only a shared weight value (ie, does not have a special weight value), or may not have a shared weight value (ie, only has a special weight value), which is not specifically limited in this application.
  • the network neural model in the present application may include at least one network layer having the same structure as the "i-th network layer" described above.
  • the neural network model provided by the present application may be any artificial neural network model, such as a convolutional neural network model, which is not specifically limited in this embodiment of the present application.
  • the neural network model provided by the embodiment of the present application may be stored in a processing device.
  • the processing device can be an electronic device.
  • the electronic device may be a mobile phone (such as the mobile phone 100 shown in FIG. 1), a tablet computer, a personal computer (PC), and a personal digital assistant (Personal Digital Assistant), which allows the user to input a processing operation instructing the electronic device to perform related operational events.
  • the PDA the smart watch, the netbook, the wearable electronic device, and the like, the specific form of the electronic device is not particularly limited in the embodiment of the present application.
  • the mobile phone 100 is exemplified as the above electronic device.
  • the mobile phone 100 may specifically include: a processor 101, a radio frequency (RF) circuit 102, a memory 103, a touch screen 104, a Bluetooth device 105, one or more sensors 106, a Wi-Fi device 107, a positioning device 108, and an audio circuit 109.
  • Components such as peripheral interface 110 and power supply unit 111. These components can communicate over one or more communication buses or signal lines (not shown in Figure 2). It will be understood by those skilled in the art that the hardware structure shown in FIG. 2 does not constitute a limitation to the mobile phone, and the mobile phone 100 may include more or less components than those illustrated, or some components may be combined, or different component arrangements.
  • the processor 101 is a control center of the mobile phone 100, and connects various parts of the mobile phone 100 by using various interfaces and lines, and executes the mobile phone 100 by running or executing an application stored in the memory 103 and calling data stored in the memory 103.
  • processor 101 can include one or more processing units.
  • the processor 101 may further include a fingerprint verification chip for verifying the collected fingerprint.
  • the processor 101 can invoke the training information to implement training of the neural network model. Specifically, the processor 101 acquires training information including the K (K is a positive integer) training object and the marking information of each of the K training objects, and performs a training processing operation according to the acquired training information,
  • the training processing operation is as follows: “K training objects are input into the neural network model, and K processing results are obtained. Each processing result of the K processing results uniquely corresponds to one training object; K difference values are determined, and K difference values are respectively determined.
  • the processor 101 can also process the object to be processed according to the neural network model. Specifically, the processor 101 processes the first object to be processed by using a neural network model after acquiring the first object to be processed and the first processing operation input by the user for indicating that the first task is to be executed. . Specifically, the processor 101 acquires the t-th group unique weight value, the shared weight value, and the first input data in the i-th network layer, and obtains the first according to the t-th group unique weight value, the shared weight value, and the first input data. As soon as the data is output, the processor 101 then transmits the first output data.
  • the processor 101 processes the second to-be-processed by using the neural network model. Process the object.
  • the processor 101 acquires a qth (N ⁇ q ⁇ 1, q ⁇ t, q is an integer) group special weight value, a shared weight value, and a second input data in the i-th network layer, and according to the q-th group The special weight value, the shared weight value, and the second input data acquire the second output data, and then the processor 101 transmits the second output data.
  • the processor 101 can also periodically update the above neural network model in order to better adapt to actual needs.
  • the radio frequency circuit 102 can be used to receive and transmit wireless signals during transmission or reception of information or calls.
  • the radio frequency circuit 102 can process the downlink data of the base station and then process it to the processor 101; in addition, transmit the data related to the uplink to the base station.
  • radio frequency circuits include, but are not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like.
  • the radio frequency circuit 102 can also communicate with other devices through wireless communication.
  • the wireless communication can use any communication standard or protocol, including but not limited to global mobile communication systems, general packet radio services, code division multiple access, wideband code division multiple access, long term evolution, email, short message service, and the like.
  • the memory 103 is used to store applications and data, and the processor 101 executes various functions and data processing of the mobile phone 100 by running applications and data stored in the memory 103.
  • the memory 103 mainly includes a storage program area and a storage data area, wherein the storage program area can store an operating system and an application required for at least one function (such as a sound playing function, an image processing function, etc.); the storage data area can be stored according to the use of the mobile phone. Data created at 100 o'clock (such as audio data, phone book, etc.).
  • the memory 103 may include high speed random access memory (RAM), and may also include nonvolatile memory such as a magnetic disk storage device, a flash memory device, or other volatile solid state storage device.
  • the memory 103 can store various operating systems, for example, operating system, Operating system, etc.
  • the above memory 103 may be independent and connected to the processor 101 via the above communication bus; the memory 103 may also be integrated with the processor 101.
  • the neural network model in the embodiment of the present application can be regarded as an application program that can implement functions such as image processing, word processing, and voice processing in the program area.
  • the weight values of each network layer in the neural network model are stored in the above-mentioned storage data area.
  • the weight values used by the neural network model during operation are stored in the memory 103 in a multi-level storage manner.
  • Each network layer of the neural network model has weight values stored in off-chip memory, that is, the above-described nonvolatile memory.
  • the processor 101 when performing the current task, the processor 101 reads the weight value corresponding to the current task in the i-th network layer from the non-volatile memory into the memory, and then the processor 101 The currently required weight value is read from memory into the cache.
  • the network neural model in the present application may include at least one network layer having the same structure as the above-mentioned "i-th network layer".
  • the embodiment of the present application refers to a network layer having the structure as a target network layer.
  • the special weight value of each task of a target network layer in the embodiment of the present application may be stored in different areas of the memory 103, and the shared weight values of different target network layers may also be stored in different areas of the memory 103, so that When the processor 101 performs different tasks, the weight value required by the processor 101 is quickly read, and the reading speed of the weight value is increased.
  • the first set of weights, the second set of weights, and the shared weights of the i-th network layer in FIG. 2 are stored in different storage locations in the memory 103, respectively.
  • the mobile phone 100 further includes a memory other than the memory 103, and the other memory is of the same type as the memory 103, the weight values of the different target network layers may be stored in different memories of the type, which is not specifically described in this embodiment of the present application. limited.
  • the touch screen 104 may specifically include a touch panel 104-1 and a display 104-2.
  • the touch panel 104-1 can collect touch events on or near the user of the mobile phone 100 (for example, the user uses any suitable object such as a finger, a stylus, or the like on the touch panel 104-1 or on the touchpad 104.
  • the operation near -1), and the collected touch information is sent to other devices (for example, processor 101).
  • the touch event of the user in the vicinity of the touch panel 104-1 may be referred to as a hovering touch; the hovering touch may mean that the user does not need to directly touch the touchpad in order to select, move or drag a target (eg, an icon, etc.) , and only the user is located near the device to perform the desired function.
  • the touch panel 104-1 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • a display (also referred to as display) 104-2 can be used to display information entered by the user or information provided to the user as well as various menus of the mobile phone 100.
  • the display 104-2 can be configured in the form of a liquid crystal display, an organic light emitting diode, or the like.
  • the touchpad 104-1 can be overlaid on the display 104-2, and when the touchpad 104-1 detects a touch event on or near it, it is transmitted to the processor 101 to determine the type of touch event, and then the processor 101 may provide a corresponding visual output on display 104-2 depending on the type of touch event.
  • the touchpad 104-1 and the display 104-2 are implemented as two separate components to implement the input and output functions of the handset 100, in some embodiments, the touchpad 104- 1 is integrated with the display screen 104-2 to implement the input and output functions of the mobile phone 100. It is to be understood that the touch screen 104 is formed by stacking a plurality of layers of materials. In the embodiment of the present application, only the touch panel (layer) and the display screen (layer) are shown, and other layers are in the embodiment of the present application. Not recorded in the middle.
  • the touch panel 104-1 may be disposed on the front surface of the mobile phone 100 in the form of a full-board
  • the display screen 104-2 may also be disposed on the front surface of the mobile phone 100 in the form of a full-board, so that the front of the mobile phone can be borderless. Structure.
  • the mobile phone 100 can also have a fingerprint recognition function.
  • the fingerprint capture device 112 can be configured on the back of the handset 100 (e.g., below the rear camera) or on the front side of the handset 100 (e.g., below the touch screen 104).
  • the fingerprint collection device 112 can be configured in the touch screen 104 to implement the fingerprint recognition function, that is, the fingerprint collection device 112 can be integrated with the touch screen 104 to implement the fingerprint recognition function of the mobile phone 100.
  • the fingerprint capture device 112 is disposed in the touch screen 104 and may be part of the touch screen 104 or may be otherwise disposed in the touch screen 104.
  • the main component of the fingerprint collection device 112 in the embodiment of the present application is a fingerprint sensor, which can adopt any type of sensing technology, including but not limited to optical, capacitive, piezoelectric or ultrasonic sensing technologies. .
  • the mobile phone 100 may also include a Bluetooth device 105 for enabling data exchange between the handset 100 and other short-range devices (eg, mobile phones, smart watches, etc.).
  • the Bluetooth device in the embodiment of the present application may be an integrated circuit or a Bluetooth chip or the like.
  • the handset 100 can also include at least one type of sensor 106, such as a light sensor, motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display of the touch screen 104 according to the brightness of the ambient light, and the proximity sensor may turn off the power of the display when the mobile phone 100 moves to the ear.
  • the accelerometer sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity. It can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching, related Game, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.
  • the mobile phone 100 can also be configured with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors, here Let me repeat.
  • a Wireless Fidelity (Wi-Fi) device 107 for providing the mobile phone 100 with network access complying with the Wi-Fi related standard protocol, and the mobile phone 100 can access the Wi-Fi access point through the Wi-Fi device 107.
  • Wi-Fi device 107 can also function as a Wi-Fi wireless access point, and can provide Wi-Fi network access to other devices.
  • the positioning device 108 is configured to provide a geographic location for the mobile phone 100. It can be understood that the positioning device 108 can be specifically a receiver of a positioning system such as a Global Positioning System (GPS) or a Beidou satellite navigation system, or a Russian GLONASS. After receiving the geographical location transmitted by the positioning system, the positioning device 108 sends the information to the processor 101 for processing, or sends it to the memory 103 for storage. In some other embodiments, the positioning device 108 can also be a receiver of an Assisted Global Positioning System (AGPS), which assists the positioning device 108 in performing ranging and positioning services by acting as an auxiliary server.
  • AGPS Assisted Global Positioning System
  • the secondary location server provides location assistance over a wireless communication network in communication with a location device 108 (i.e., a GPS receiver) of the device, such as handset 100.
  • the positioning device 108 can also be a Wi-Fi access point based positioning technology. Since each Wi-Fi access point has a globally unique Media Access Control (MAC) address, the device can scan and collect the surrounding Wi-Fi access points when Wi-Fi is turned on. The broadcast signal, so the MAC address broadcasted by the Wi-Fi access point can be obtained; the device sends the data (such as the MAC address) capable of indicating the Wi-Fi access point to the location server through the wireless communication network, and is retrieved by the location server. The geographic location of each Wi-Fi access point, combined with the strength of the Wi-Fi broadcast signal, calculates the geographic location of the device and sends it to the location device 108 of the device.
  • MAC Media Access Control
  • the audio circuit 109, the speaker 113, and the microphone 114 can provide an audio interface between the user and the handset 100.
  • the audio circuit 109 can transmit the converted electrical data of the received audio data to the speaker 113 for conversion to the sound signal output by the speaker 113; on the other hand, the microphone 114 converts the collected sound signal into an electrical signal by the audio circuit 109. After receiving, it is converted into audio data, and then the audio data is output to the RF circuit 102 for transmission to, for example, another mobile phone, or the audio data is output to the memory 103 for further processing.
  • the peripheral interface 110 is used to provide various interfaces for external input/output devices (such as a keyboard, a mouse, an external display, an external memory, a subscriber identity module card, etc.). For example, it is connected to the mouse through a Universal Serial Bus (USB) interface, and is connected to a Subscriber Identification Module (SIM) card provided by the service provider through a metal contact on the card slot of the subscriber identity module. . Peripheral interface 110 can be used to couple the external input/output peripherals described above to processor 101 and memory 103.
  • USB Universal Serial Bus
  • SIM Subscriber Identification Module
  • the mobile phone 100 can communicate with other devices in the device group through the peripheral interface 110.
  • the peripheral interface 110 can receive display data sent by other devices for display, etc. No restrictions are imposed.
  • the mobile phone 100 may further include a power supply device 111 (such as a battery and a power management chip) that supplies power to the various components.
  • the battery may be logically connected to the processor 101 through the power management chip to manage charging, discharging, and power management through the power supply device 111. And other functions.
  • the mobile phone 100 may further include a camera (front camera and/or rear camera), a flash, a micro projection device, a near field communication (NFC) device, and the like, and details are not described herein.
  • a camera front camera and/or rear camera
  • a flash a flash
  • micro projection device a micro projection device
  • NFC near field communication
  • neural network model and its training method and data processing method provided by the present application are described in detail below.
  • the embodiment of the present application provides a neural network model 200, which belongs to an artificial neural network model and can perform N (N ⁇ 2, N is an integer) tasks.
  • FIG. 3 is a schematic structural diagram of a neural network model 200.
  • the neural network model 200 includes M (M is a positive integer) network layers, and i (1 ⁇ i ⁇ M, i is an integer) network layers in the M network layers have sharing weight values And the N group has the special weight.
  • the shared weight value is used to perform each of the N tasks, that is, the processing device uses the shared weight value when performing any of the N tasks in the i-th network layer.
  • Each set of special weights in the N sets of special weights is used to perform one of the N tasks, and each set of unique weights corresponds to one of the N tasks one by one.
  • the N sets of special weights in FIG. 3 include the first set of special weights, ..., the t (1 ⁇ t ⁇ N, t is an integer) group special weight, ... q (1 ⁇ q ⁇ N, q ⁇ t, q is an integer)
  • the group has the special weight value, ... the Nth group has the special weight value.
  • Each set of unique weights uniquely corresponds to a task.
  • the t-th group weight value in FIG. 3 uniquely corresponds to the first task in the N tasks
  • the q-th group unique weight value uniquely corresponds to the second task in the N tasks.
  • the ith network layer is configured to: acquire input data when performing the first task of the N tasks; and acquire output data according to the t-th group unique weight value, the shared weight value, and the input data.
  • the i-th network layer only needs to use the shared weight value and the t-th group special weight to calculate the input data when performing the first task, regardless of other special weights.
  • the output data acquired in the i-th network layer is the output data of the neural network model 200, and therefore, will be directly in the i-th network layer.
  • the obtained output data can be directly output.
  • the output data acquired in the i-th network layer needs to be transmitted to the i+1th network layer, so that the i+1th network layer pair is used. It is processed.
  • the ith network layer in the embodiment of the present application may be a convolution layer, a full-connection layer, a deconvolution layer, or a re-circulation layer, which is not specifically limited in this embodiment of the present application.
  • the above method of “acquiring output data according to the t-th group unique weight value, the shared weight value, and the input data” is: performing volume on the input data by using a shared weight value.
  • the product is calculated to obtain shared output data; the input data is convoluted using the t-th set of weights to obtain unique output data.
  • the output data includes shared output data and unique output data.
  • the input data and the output data are all three-dimensional tensors
  • the shared weight value and the N sets of weights are all four-dimensional tensors.
  • the dimensions corresponding to the three-dimensional tensor are: the length and width of the feature maps and the number of feature maps.
  • the dimensions corresponding to the four-dimensional tensor are: the length and width of the convolution kernel, the number of input feature maps, and the output characteristics. Number of drawings.
  • the above method of “acquiring output data according to the t-th group unique weight value, the shared weight value, and the input data” is: multiplying the input data by using a shared weight value. Computation is performed to obtain shared output data; the t-th set of unique weights is subjected to multiplication and addition calculation of the input data to obtain unique output data.
  • the output data also includes shared output data and unique output data.
  • the output data is a one-dimensional vector that depends on the structure of the previous network layer of the fully connected layer.
  • the input data of the fully connected layer is a one-dimensional vector.
  • the unique weight value and the shared weight value of the fully connected layer may be a two-dimensional matrix, and the corresponding dimension of the two-dimensional matrix is the number of input neurons and the number of output neurons.
  • the output data of the previous network layer is a feature map
  • the input data of the fully connected layer is also a feature map, that is, the fully connected layer
  • the input data is a three-dimensional tensor.
  • the unique weight value and the shared weight value of the fully connected layer may be a four-dimensional tensor, and the four dimensions of the four-dimensional tensor correspond to: the input feature map length, the width, the number of input feature maps, and the number of output neurons.
  • the above method of “acquiring output data according to the t-th group unique weight value, the shared weight value, and the input data” is: performing the input data by using a shared weight value.
  • the inverse convolution calculation is performed to obtain shared output data; the input data is subjected to inverse convolution calculation using the t-th set of unique weight values to obtain unique output data.
  • the output data also includes shared output data and unique output data.
  • the input data and the output data are all three-dimensional tensors
  • the shared weight value and the N sets of weights are all four-dimensional tensors.
  • the dimensions corresponding to the three-dimensional tensor are: the length and width of the feature maps and the number of feature maps.
  • the dimensions corresponding to the four-dimensional tensor are: the length and width of the convolution kernel, the number of input feature maps, and the output characteristics. Number of drawings.
  • each weight value matrix or partial weight value matrix includes a shared weight value and N sets of special weight values.
  • the input data is subjected to multiplication and addition calculation using the weight value matrix or the activation function to obtain target output data. Subsequently, the next weight value matrix of the weight value matrix is used to perform multiplication and addition calculation on the target output data. It is easy to understand that if the weight value matrix is the first weight value matrix, the target input data is the input data. If the weight value matrix is not the first weight value matrix, the target input data is the output data processed through the previous weight value matrix.
  • the input data and the output data are all one-dimensional vectors
  • the shared weight value and the N sets of weights are all two-dimensional matrices.
  • the N-th model can be used to complete the first task and the second task as an example.
  • the i-th network layer has a sharing weight value for performing the first task and the second task, a first group of weights uniquely corresponding to the first task, and a second group of weights corresponding to the second task.
  • the processing device acquires input data of the i-th network layer (first input data, second input data, ... After the mth input data, the convolution operation is performed on the input data by using the shared weight value to obtain the first output data, and the input data is convoluted by the first set of special weight values to obtain the second output data; After obtaining the first output data and the second output data, the processing device transmits the first output data and the second output data to the (i+1)th network layer.
  • the processing device acquires input data of the i-th network layer (first input data, first After the two input data, ..., the mth input data), the input data is convoluted by the shared weight value to obtain the first output data, and the second set of special weights is used to convolute the input data to obtain the first Three output data; after obtaining the first output data and the third output data, the processing device transmits the first output data and the third output data to the (i+1)th network layer.
  • the i-th network layer in the neural network model only needs to use the weight value and the shared weight value corresponding to the task.
  • Input data can be calculated without having to obtain specific weight values corresponding to other tasks, which effectively improves the performance of each target network layer, thereby improving the performance of the neural network model.
  • h (h ⁇ 0) network layers having the same structure as the i-th network layer.
  • the i-th network layer and the i-th network layer in the neural network model 200 also have respective The shared weight value and the N set of unique weight values, the i-1th network layer only has a shared weight value, and the i+1th network layer has only N sets of special weight values.
  • the shared weight value of the i-2th network layer is used.
  • the processing device uses the unique weight value uniquely corresponding to the first task in the i-2th network layer.
  • the processing device when the processing device performs any of the N tasks in the i+2 network layer, the shared weight value of the i+2 network layer is used.
  • the processing device uses the unique weight value uniquely corresponding to the first task in the i+2th network layer.
  • the i-1th network layer and the i+1th network layer in the neural network model 200 also have respective sharing weight values and Group N has the special weight value, and other network layers do not have such a structure.
  • the shared weight value of the i-1th network layer is used.
  • the processing device uses the unique weight value uniquely corresponding to the first task in the i-1th network layer.
  • the processing device uses the unique weight value uniquely corresponding to the first task in the i+1th network layer.
  • the processing device uses the unique weight value uniquely corresponding to the first task in the i+1th network layer.
  • the structure of the neural network model 200 illustrated in FIGS. 6 and 7 is merely an example of the neural network model 200, and is not a limitation of the neural network model 200.
  • the neural network model provided by the present application is applied to technical fields such as image processing and audio processing.
  • the neural network model can complete tasks such as image denoising task, classification of image to be processed, and image recognition.
  • the neural network model can perform tasks such as speech recognition.
  • the processing device needs to use the training object to perform model training to generate the above neural network model.
  • the training method of the neural network model in the present application is: the processing device acquires training information including mark information of each of the K (K is a positive integer) training object and the K training objects, and obtains the Training information, performing a training processing operation, the training processing operation is "putting K training objects into the neural network model, obtaining K processing results, and each processing result of the K processing results uniquely corresponds to one training object; determining K difference values, K difference values respectively represent the difference between each processing result and the marker information of the training object corresponding to each processing result; a (0 ⁇ a ⁇ K, a of the K difference values)
  • the integer value is calculated according to a preset statistical algorithm (for example, a weighted average) to obtain a first statistical error, and the training object corresponding to each of the a difference values is used to execute the first task;
  • the difference value of b (0 ⁇ b ⁇ K, 1 ⁇ a + b ⁇ K, b is an integer
  • a second statistical algorithm for example, a weighted
  • the preset parameter of the neural network model after the processing operation is different from the preset parameter of the neural network model after the xy (y is a positive integer) execution training operation operation is less than the first preset threshold or until the training processing operation is performed. The number of times reaches the second preset threshold.
  • the process of training the neural network model by the processing device is an iterative process.
  • the processing device needs to complete training with a large number of training objects to achieve stability of the neural network model.
  • the processing device acquires the sharing weight value, the t-th group special weight value, and the input data in the i-th network layer, and adopts The shared weight value is calculated on the input data to obtain the shared output data, and the input data is calculated by using the t-th special weight value to obtain the unique output data, and then the processing device transmits the shared output data to the i+1th network layer and the unique data.
  • Output Data if the K training objects acquired by the processing device are used to complete the first task, the processing device acquires the sharing weight value, the t-th group special weight value, and the input data in the i-th network layer, and adopts The shared weight value is calculated on the input data to obtain the shared output data, and the input data is calculated by using the t-th special weight value to obtain the unique output data, and then the processing device transmits the shared output data to the i+1th network layer and the unique data.
  • the processing is performed.
  • the device acquires a sharing weight value, a t-th group weight value, a q-th group weight value, and first input data in the i-th network layer, where the first input data is data of a training object used to perform the first task;
  • the processing device calculates the first input data by using the shared weight value to obtain the shared output data, and calculates the first input data by using the t-th special weight value to obtain the unique output data 1, and adopts the q-th group special weight value. Calculating the first input data to obtain the unique output data 2; thereafter, since the current task is the first task, the processing device selects the shared output from the shared output data, the unique output data 1 and the unique output data 2 through the filter. Data and unique output data 1.
  • the neural network model is used to execute the first task and the second task, and the i-th network layer has a share for performing the first task and the second task.
  • the weight value, the first group of unique weights corresponding to the first task, and the second group of weights corresponding to the second task, the current task is the first task, and the i-th network layer is a convolution layer.
  • the processing device After acquiring the input data (the first input data, the second input data, the ..., the mth input data) of the i-th network layer, the processing device convolves the obtained input data by using the shared weight value to obtain a convolution operation.
  • the output data is shared, and the obtained input data is convoluted by the first set of special weights, the unique output data 1 is obtained, and the input data obtained by using the second set of special weights is convoluted and calculated.
  • Output data 2 since the current task is the first task, the processing device acquires only the shared output data and the unique output data 1 through the filter, and transmits the shared output data and the unique output data 1 to the i+1th network layer.
  • Figure 8 shows the filter with a broken line.
  • the network layer may have only a shared weight value, or may have only a unique weight value, and may also have a shared weight value and a N group. Special rights are worth. Therefore, in the process of adjusting the corresponding task, the processing device also needs to adjust the weight value corresponding to the task in the network layer.
  • a 7-layer convolutional neural network model is used to perform image denoising tasks.
  • the 7-layer convolutional neural network model adopts the structure of the neural network model provided by the present application respectively (the i-th convolutional layer in the convolutional neural network model has a shared weight value and multiple sets of special weight values, and each group has a special weight value.
  • existing scheme 1 each convolutional neural network model has only a special weight value, there is no shared weight value
  • existing scheme 2 the convolutional neural network model
  • Each convolutional layer of a partial convolutional layer has only a shared weight value, and there is no special weight value.
  • each volume level has only a special weight value, and there is no shared weight value.
  • the image is denoised and processed. Verify the reliability of the network model provided by this application.
  • the first convolutional layer in the 7-layer convolutional neural network model is represented by conv1 (1, 5, 24), where conv1 (1, 5, 24) indicates that the input of the first convolutional layer is 1 characteristic map, and the output
  • the size of the convolution kernel is 5x5
  • the second convolution layer is represented by conv2(24,1,6), where conv2(24,1,6) indicates that the input of the first convolutional layer is 24
  • the feature map, the output is 6 feature maps, the size of the convolution kernel is 1x1
  • the third convolution layer is represented by conv3(6,3,6), where conv3(6,3,6) represents the third convolution
  • the input of the layer is 6 feature maps
  • the output is 6 feature maps
  • the size of the convolution kernel is 3x3
  • the fourth convolution layer is represented by conv4(6,1,6), where conv4(6,1,6)
  • the input representing the fourth convolution layer is 6 feature maps, and the output is 6 feature maps.
  • the size of the convolution kernel is 1x1; the fifth convolution layer is represented by conv5(6,3,6), where conv5(6 , 3, 6) indicates that the input of the fifth convolution layer is 6 feature maps, the output is 6 feature maps, the size of the convolution kernel is 3x3, and the sixth convolution layer is represented by conv6 (6, 1, 16). Where conv6(6,1,16) represents the sixth convolution The input is 6 feature maps, and the output is 16 feature maps.
  • the size of the convolution kernel is 1x1; the seventh convolution layer is represented by conv7(16,3,1), where conv7(16,3,1) indicates the first The input of the seven-volume layer is 16 feature maps, and the output is one feature map.
  • the size of the convolution kernel is 3x3.
  • Fig. 9 shows a process of processing the image A by the above-described 7-layer convolutional neural network model, and after processing through the above-described 7-layer convolutional neural network model, the image B is output. It can be seen that the sharpness of the image B is higher than the sharpness of the image A, and the denoising of the image A is effectively realized.
  • the square in Fig. 9 represents the data flow, i.e., the feature map, during the processing of the convolutional neural network model.
  • the width of the square indicates the number of feature maps. The wider the square, the larger the number of feature maps.
  • tanh may be employed as an activation function in a convolutional neural network model, which is not shown in FIG.
  • noise-free image of the original training database Different degrees of noise are added to the noise-free image of the original training database to generate a noise image that is used to simulate an image captured in a real scene. Because in the real photo scene, under different illumination conditions, using different photosensitivity, the noise intensity in the image is different, adding different amounts of noise can simulate the images taken in different real scenes, and can also train multiple targets.
  • a model for denoising different levels of noise That is to say, the noise image is used as the training object, and the original noiseless image is used as the marker information of the training object.
  • noise with a variance (var) of 10, 30, 50 is added to the original noise-free image to generate a noisy image, which may be an image in a BSD database.
  • the 7-layer convolutional neural network model performs denoising tasks on these three noise images, that is, the 7-layer convolutional neural network model is used to perform three tasks.
  • the number of weight values in a convolutional layer is calculated according to the following formula:
  • the number of weight values of the convolutional layer (the number of input feature maps ⁇ the width of the convolution kernel ⁇ the height +1 of the convolution kernel) ⁇ the number of output feature maps.
  • the number of weight values in the first convolutional layer in the 7-layer convolutional neural network model shown in FIG. 9 is 624, and the number of weight values in the second convolutional layer is 150, and the weight in the third convolutional layer
  • the number of values is 330
  • the number of weight values in the fourth convolution layer is 42
  • the number of weight values in the fifth convolution layer is 330
  • the number of weight values in the sixth convolution layer is 112
  • the seventh convolution layer The number of weights in the middle is 145.
  • each convolution in the first 4 layers (the first convolutional layer to the fourth convolutional layer) of the convolutional neural network model is implemented.
  • the layer only has the shared weight value, and there is no special weight value.
  • Each convolution layer in the last 3 layers (the fifth convolution layer to the seventh convolution layer) has only the special weight value, and there is no sharing weight value.
  • each of the first convolutional layer, the third convolutional layer, and the fifth convolutional layer of the convolutional neural network model has 2/3 shared weight value and 1/3 special weight value
  • the second convolutional layer, the fourth convolutional layer, and the sixth convolutional layer all have only the shared weight value
  • the seventh convolutional layer has only the special weight value.
  • Table 1 shows the peak signal-to-noise ratio (Peak Signal to Noise Ratio) after denoising the image using the existing scheme 1, the existing scheme 2, and the 7-layer convolutional neural network model for completing three tasks implemented by the present application. , PSNR), the total number of weight values, and the proportion of shared weight values.
  • the noise reduction effect of the present application is basically the same as the noise reduction effect of the prior scheme 1.
  • the PSNR of the present application is 25.93
  • the PSNR of the existing scheme is 25.93.
  • the difference between the noise reduction effect of the present application and the noise reduction effect of the prior scheme 1 is also small.
  • the PSNR of the present application is 33.48
  • the PSNR of the existing scheme is 33.63, which differs by only 0.15.
  • the image processing quality of the present application is high.
  • FIG. 10 shows an image obtained by adding a noise image having a variance of 50 after being processed by the existing scheme 1, the prior scheme 2, and the neural network model of the present application.
  • (a) in Fig. 10 is a noise image with a variance of 50
  • (b) in Fig. 10 is a noise image with a variance of 50 after the conventional scheme 1
  • (c) in Fig. 10 is an existing one.
  • the noise image after the processing of the scheme 2 has a variance of 50
  • the noise of the image processed by the neural network model of the present application is lower than that of the image processed by the prior scheme 2; from the perspective of the naked eye, the neural network model of the present application is processed.
  • the noise of the image is similar to the noise of the image processed by the prior scheme 1.
  • the total weight value in the neural network model provided by the present application is reduced, the number of data readings is effectively reduced, and the processing performance is improved, and the reliability of the neural network model is high.
  • the processing device trains the neural network model by using the above training method, the trained neural network model can be directly used to perform the corresponding task to realize data processing.
  • the processing device may also periodically update the neural network model to better adapt to actual needs.
  • the data processing method performed by the processing apparatus by using the neural network model provided by the present application is: acquiring the first object to be processed and receiving a first input by the user for indicating that the first task is performed on the first object to be processed
  • the processing device is at the ith
  • the network layer obtains the qth (N ⁇ q ⁇ 1, q ⁇ t) group special weight value and the second input data (when 1 ⁇ i ⁇ M, the second input data is the i-1th network layer processing the second waiting
  • the data output after processing the object; when i 1, the second input data is the data of the second object to be processed), and is obtained according to the q-th group unique weight value, the second input data, and the shared weight value that has been acquired.
  • the second output data after which the processing device transmits the acquired second output data.
  • the transmitting the first output data is to send the first output data to the i+1th network layer, so that the processing device is in the i-th
  • the first output data is processed by +1 network layers.
  • the transmitting the second output data is to send the second output data to the i+1th network layer, so that the processing device is at the (i+1)th.
  • the network layer processes the second output data.
  • the first task is an image denoising task
  • the second task is an image recognition task
  • the first input data is the data of the first image to be processed, and the first output data is obtained according to the t-th set of the weight value, the shared weight value, and the first input data, and then the processing device transmits the first Output Data.
  • the processing device when different tasks are switched, the processing device only needs to obtain the unique weight value uniquely corresponding to the switched task, and does not need to re-acquire the weight value, which reduces the number of readings and improves the processing efficiency.
  • the embodiment of the present application provides a processing device, which may be an electronic device. Specifically, the processing device is configured to execute the steps performed by the processing device in the data processing method described above or the steps performed by the processing device in the training method of the neural network model described above.
  • the processing device provided by the embodiment of the present application may include a module corresponding to the corresponding step.
  • the embodiment of the present application may divide the function module into the processing device according to the foregoing method example.
  • each function module may be divided according to each function, or two or more functions may be integrated into one processing module.
  • the above integrated modules can be implemented in the form of hardware or in the form of software functional modules.
  • the division of modules in the embodiments of the present application is schematic, and is only a logical function division, and may be further divided in actual implementation.
  • FIG. 11 shows a possible structural diagram of the processing device involved in the above embodiment.
  • the processing device 11 includes an acquisition unit 1100, a reception unit 1101, a processing unit 1102, and a transmission unit 1103.
  • the obtaining unit 1100 is for supporting the processing device to perform "acquiring the first image to be processed", “acquiring the second image to be processed”, etc., and/or other processes for the techniques described herein.
  • the receiving unit 1101 is for supporting the processing device to perform "first processing operation of receiving user input", “receiving a second processing operation of user input”, and the like, and/or other processes for the techniques described herein.
  • the processing unit 1102 is configured to support the processing apparatus to perform “acquiring first output data according to the tth group of unique weights, shared weight values and first input data”, “according to the qth set of special weights, second input data, and already The obtained shared weight value, the second output data, etc., and/or other processes for the techniques described herein.
  • Transmission unit 1103 is for supporting the processing device to perform "transport first output data", “transmit second output data”, etc., and/or other processes for the techniques described herein.
  • the processing device provided by the embodiment of the present application includes, but is not limited to, the foregoing module.
  • the processing device may further include a storage unit 1104.
  • the storage unit 1104 can be used to store program code and data for the processing device.
  • the processing device 12 includes a processing module 120 and a communication module 121.
  • the processing module 120 is for controlling management of the actions of the processing device, for example, performing the steps performed by the acquisition unit 1100 and the processing unit 1102 described above, and/or other processes for performing the techniques described herein.
  • the communication module 121 is for supporting interaction between the processing device and other devices, for example, performing the steps performed by the receiving unit 1101 and the transmitting unit 1103 described above.
  • the processing device may further include a storage module 122 for storing program codes and data of the processing device, such as a storage neural network model.
  • the processing module 120 can be a processor or a controller, for example, a central processing unit (CPU), a general-purpose processor, a digital signal processor (DSP), an ASIC, an FPGA, or other programmable Logic device, transistor logic device, hardware component, or any combination thereof. It is possible to implement or carry out the various illustrative logical blocks, modules and circuits described in connection with the present disclosure.
  • the processor may also be a combination of computing functions, for example, including one or more microprocessor combinations, a combination of a DSP and a microprocessor, and the like.
  • the communication module 121 can be a transceiver, an RF circuit, a communication interface, or the like.
  • the storage module 122 can be the memory 103.
  • the processing module 120 may be the processor 101 in FIG. 2, the communication module 121 may be the antenna in FIG. 2, and the storage module 122 may be the memory in FIG.
  • Another embodiment of the present application also provides a computer readable storage medium comprising one or more program codes, the one or more programs comprising instructions, when a processor in a processing device is executing the program At the time of the code, the processing device executes the above data processing method.
  • a computer program product comprising computer executed instructions stored in a computer readable storage medium; at least one processor of the processing device can be from a computer
  • the readable storage medium reads the computer execution instructions, and the at least one processor executes the computer to execute the instructions such that the processing device implements the steps of performing the data processing method described above.
  • the above embodiments it may be implemented in whole or in part by software, hardware, firmware or any combination thereof.
  • a software program it may occur in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions.
  • the computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • the computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be from a website site, computer, server or data center Transfer to another website site, computer, server, or data center by wire (eg, coaxial cable, fiber optic, digital subscriber line (DSL), or wireless (eg, infrared, wireless, microwave, etc.).
  • the computer readable storage medium can be any available media that can be accessed by a computer or a data storage device such as a server, data center, or the like that includes one or more available media.
  • the usable medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (such as a solid state disk (SSD)).
  • the disclosed apparatus and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the modules or units is only a logical function division.
  • there may be another division manner for example, multiple units or components may be used.
  • the combination may be integrated into another device, or some features may be ignored or not performed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may be one physical unit or multiple physical units, that is, may be located in one place, or may be distributed to multiple different places. . Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a readable storage medium.
  • the technical solution of the embodiments of the present application may be embodied in the form of a software product in the form of a software product in essence or in the form of a contribution to the prior art, and the software product is stored in a storage medium.
  • a number of instructions are included to cause a device (which may be a microcontroller, chip, etc.) or a processor to perform all or part of the steps of the methods described in various embodiments of the present application.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like, which can store program codes. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Biophysics (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Biomedical Technology (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Image Analysis (AREA)

Abstract

本申请实施例公开一种神经网络模型、数据处理方法及处理装置,涉及计算机技术领域,解决神经网络模型处理不同任务性能低的问题。神经网络模型用于执行N个任务,包括M个网络层,M为正整数,第i个网络层具有用于执行N个任务中的每个任务的共享权重值和N组特有权重值,每组特有权重值用于执行N个任务中的一个任务,每组特有权重值与N个任务中的一个任务一一对应,1≤i≤M;第i个网络层在执行第一任务时被配置为:获取输入数据;根据第t组特有权重值、共享权重值以及输入数据,获取输出数据;当1≤i<M时,向第i+1个网络层传输输出数据,第t组特有权重值与第一任务对应,1≤t≤N;当i=M时,输出输出数据。

Description

一种神经网络模型、数据处理方法及处理装置
本申请要求于2018年05月15日提交国家知识产权局、申请号为201810464380.2、发明名称为“一种神经网络模型、数据处理方法及处理装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及计算机技术领域,尤其涉及一种神经网络模型、数据处理方法及处理装置。
背景技术
神经网络模型是一种由大量的节点(或称为神经元)相互联接组成的运算模型。常用的神经网络模型包括输入层、输出层以及多个隐藏层(也称为隐层)。对于任一隐藏层而言,该隐藏层的输出作为该隐藏层的下一层(另一隐藏层或输出层)的输入。神经网络模型中除输出层以外的每一层均可根据相应参数集(如权重值)对其输入数据进行计算,以生成输出数据。
卷积神经网络(Convolutional Neural Network,CNN)模型为其中一种神经网络模型。CNN模型在图像识别、语音处理、智能机器人等应用领域取得了令人瞩目的成果。对多个任务进行处理的卷积神经网络模型的泛化能力较强,能够适当降低每个任务占用的资源以及存储成本。
发明内容
本申请实施例提供一种神经网络模型、数据处理方法及处理装置,能够解决神经网络模型在处理不同任务时性能低的问题。
为达到上述目的,本申请采用如下技术方案:
第一方面,提供一种神经网络模型,该神经网络模型用于执行N(N为大于或等于2的整数)个任务,该N个任务包括第一任务,所述神经网络模型包括M(M为正整数)个网络层,M个网络层中的第i(1≤i≤M,i为整数)个网络层具有共享权重值和N组特有权重值,这里的共享权重值用于执行所述N个任务中的每个任务,N组特有权重值中的每组特有权重值用于执行所述N个任务中的一个任务,且每组特有权重值与所述N个任务中的一个任务一一对应。第i个网络层在执行第一任务时被配置为:获取输入数据;根据第t(1≤t≤N,t为整数)组特有权重值、上述共享权重值以及获取到的输入数据,获取输出数据;当1≤i<M时,向M个网络层中的第i+1个网络层传输上述输出数据,其中,第t组特有权重值与第一任务对应;当i=M时,输出上述输出数据。
第i个网络层的N组特有权重值中的每组特有权重值用于执行N个任务中的一个任务,且每组特有权重值与N个任务中的一个任务一一对应,因此,对于任意一个任务而言,第i个网络层在进行数据处理时,只需要获取共享权重值以及与当前任务对应的特定权重值即可,而无需获取与其他任务对应的特定权重值,有效的提高了第i个网络层的性能,进而提高了神经网络模型的性能。
此外,由于共享权重值用于执行N个任务中的每个任务,因此,在切换任务的场景中,第i个网络层无需重新获取共享权重值,只需获取与当前任务对应的特有权重值即可,减少了数据的读取次数,提高了处理性能。
可选的,在本申请的一种可能的实现方式中,上述第i个网络层为卷积层、全连接层、反卷积层和循环层中的任意一种。
在实际应用中,第i个网络层可以为卷积层,也可以为全连接层,还可以为反卷积层,还可以为循环层,本申请对此不作具体限定。
可选的,在本申请的另一种可能的实现方式中,上述输出数据包括共享输出数据和特有输出数据,上述“根据第t组特有权重值、上述共享权重值以及获取到的输入数据,获取输出数据”的方法为:在第i个网络层为卷积层的情况下,采用上述共享权重值对输入数据进行卷积计算,以获得共享输出数据;采用第t组特有权重值对输入数据进行卷积计算,以获得特有输出数据。在第i个网络层为全连接层的情况下,采用上述共享权重值对输入数据进行乘加计算,以获得共享输出数据;采用第t组特有权重值对输入数据进行乘加计算,以获得所述特有输出数据。在第i个网络层为反卷积层的情况下,采用上述共享权重值对输入数据进行反置卷积计算,以获得共享输出数据;采用第t组特有权重值对输入数据进行反置卷积计算,以获得特有输出数据。
可以看出,第i个网络层随着其属性的变化,采用不同的计算方法对输入数据进行计算。
第二方面,提供一种数据处理方法,该数据处理方法使用上述第一方面或上述第一方面中任意一种可能的实现方式所述的神经网络模型进行数据处理。具体的,该数据处理方法为:获取第一待处理对象,并在接收到用户输入的用于指示对第一待处理对象执行第一任务的第一处理操作后,响应于该第一处理操作,在第i个网络层中获取上述第t组特有权重值、上述共享权重值以及第一输入数据,并根据上述第t组特有权重值、上述共享权重值以及第一输入数据,获取第一输出数据,传输该第一输出数据;其中,当1<i≤M时,第一输入数据为M个网络层中的第i-1个网络层处理第一待处理对象后输出的数据;当i=1时,第一输入数据为第一待处理对象的数据;后续,获取第二待处理对象,并在接收到用户输入的用于指示对第二待处理对象执行第二任务的第二处理操作后,响应于该第二处理操作,在第i个网络层中获取第q组特有权重值以及第二输入数据,并根据第q组特有权重值、第二输入数据以及已经获取到的共享权重值,获取第二输出数据,传输第二输出数据;其中,第q组特有权重值为第i个网络层中与第二任务唯一对应的特有权重值,N≥q≥1,q≠t,q为整数,当1<i≤M时,第二输入数据为第i-1个网络层处理第二待处理对象后输出的数据;当i=1时,第二输入数据为第二待处理对象的数据,第二任务为N个任务中的一个,且第二任务与第一任务不同。
结合上述第一方面的描述可知,本申请提供的神经网络中的第i个网络层具有共享权重值和N组特有权重值,共享权重值用于执行N个任务中的每个任务,N组特有权重值中的每组特有权重值用于执行N个任务中的一个任务,且每组特有权重值与N个任务中的一个任务一一对应。在从第一任务切换为第二任务的场景中,由于共享权重值用于执行N个任务中的每个任务,因此,处理装置在第i个网络层中无需重新获 取共享权重值。相应的,由于每组特有权重值与N个任务中的一个任务一一对应,因此,处理装置在第i个网络层中需重新获取与当前任务对应的特有权重值。处理装置无需重复获取共享权重值,有效的减少了数据的读取次数,提高了处理性能。
第三方面,提供一种数据处理方法,该数据处理方法使用上述第一方面或上述第一方面中任意一种可能的实现方式所述的神经网络模型进行数据处理,上述图像去噪任务为图像去噪任务。具体的,该数据处理方法为:获取第一待处理图像,并在接收到用户输入的用于指示对第一待处理图像执行图像去噪任务的第一处理操作后,响应于该第一处理操作,在第i个网络层中获取上述第t组特有权重值、上述共享权重值以及第一输入数据,并根据上述第t组特有权重值、上述共享权重值以及第一输入数据,获取第一输出数据,传输该第一输出数据;其中,当1<i≤M时,第一输入数据为M个网络层中的第i-1个网络层处理第一待处理图像后输出的数据;当i=1时,第一输入数据为第一待处理图像的数据;后续,获取第二待处理图像,并在接收到用户输入的用于指示对第二待处理图像执行图像识别任务的第二处理操作后,响应于该第二处理操作,在第i个网络层中获取第q组特有权重值以及第二输入数据,并根据第q组特有权重值、第二输入数据以及已经获取到的共享权重值,获取第二输出数据,传输第二输出数据;其中,第q组特有权重值为第i个网络层中与图像识别任务唯一对应的特有权重值,N≥q≥1,q≠t,q为整数,当1<i≤M时,第二输入数据为第i-1个网络层处理第二待处理图像后输出的数据;当i=1时,第二输入数据为第二待处理图像的数据,图像识别任务为N个任务中的一个。
在从图像去噪任务切换为图像识别任务的场景中,由于共享权重值用于执行N个任务中的每个任务,因此,处理装置在第i个网络层中无需重新获取共享权重值。相应的,由于每组特有权重值与N个任务中的一个任务一一对应,因此,处理装置在第i个网络层中需重新获取与当前任务对应的特有权重值。处理装置无需重复获取共享权重值,有效的减少了数据的读取次数,提高了处理性能。
第四方面,提供一种神经网络模型的训练方法,该神经网络模型为上述第一方面或上述第一方面中任意一种可能的实现方式所述的神经网络模型。具体的,该训练方法为:获取包括K(K为正整数)个训练对象和K个训练对象中的每个训练对象的标记信息的训练信息;根据获取到的训练信息,执行训练处理操作,该训练处理操作为“将K个训练对象输入到神经网络模型中,得到K个处理结果,K个处理结果中的每个处理结果唯一对应一个训练对象;确定K个差异值,K个差异值分别表征每个处理结果以及与每个处理结果对应的训练对象的标记信息之间的差异;将K个差异值中的a个差异值根据预设统计算法进行计算,得到第一统计误差,a个差异值中的每个差异值对应的训练对象用于执行第一任务,0≤a≤K,a为整数;将K个差异值中的b个差异值根据预设统计算法进行计算,得到第二统计误差,b个差异值中的每个差异值对应的训练对象用于执行第二任务;第二任务为N个任务中的其中一个,且与第一任务不同,0≤b≤K,1≤a+b≤K,b为整数;根据预设的反向传播算法和第一统计误差,调整第t组特有权重值,并根据预设的反向传播算法和第二统计误差,调整第i网络层中的第q组特有权重值,并根据预设的反向传播算法、第一统计误差和第二统计误差,调整共享权重值,第q组特有权重值为第i个网络层中与第二任务唯一对应的特有权 重值,N≥q≥1,q≠t,q为整数”;重新获取训练信息,并根据重新获取到的训练信息和调整第t组特有权重值、第q组特有权重值以及共享权重值后的神经网络模型执行训练处理操作,直到第x次执行训练处理操作后的神经网络模型的预设参数与第x-y次执行训练处理操作后的神经网络模型的预设参数的差异值小于第一预设阈值为止或者直到执行训练处理操作的次数达到第二预设阈值为止,x为大于或等于2的整数,y为正整数。
容易理解的是,上述训练处理操作为调整第i个网络层的相关权重值,上述训练方法为根据获取到的训练信息执行训练处理操作,后续再重新获取训练信息,并利用重新获取到的训练信息和调整权重值后的神经网络模型执行训练处理操作。该训练过程为迭代过程。实际应用中,神经网络模型的训练需要使用较大数量的训练对象完成,以实现该神经网络模型的稳定性。
第五方面,提供一种处理装置,该处理装置具有如上述第一方面及其任意一种可能的实现方式所述的神经网络模型。具体的,该处理装置包括获取单元、接收单元、处理单元以及传输单元。
本申请提供的各个单元模块所实现的功能具体如下:
上述获取单元,用于获取第一待处理对象。上述接收单元,用于接收用户输入的第一处理操作,该第一处理操作用于指示对上述获取单元获取到的第一待处理对象执行第一任务。上述处理单元,用于响应于上述接收单元接收到的第一处理操作,在第i个网络层中获取第t组特有权重值、共享权重值以及第一输入数据,并根据第t组特有权重值、共享权重值以及第一输入数据,获取第一输出数据;其中,当1<i≤M时,第一输入数据为M个网络层中的第i-1个网络层处理第一待处理对象后输出的数据;当i=1时,第一输入数据为第一待处理对象的数据。上述传输单元,用于传输上述处理单元得到的第一输出数据。上述获取单元,还用于获取第二待处理对象。上述接收单元,还用于接收用户输入的第二处理操作,该第二处理操作用于指示对获取单元获取到的第二待处理对象执行第二任务,第二任务为N个任务中的一个,且第二任务与第一任务不同。上述处理单元,还用于响应于上述接收单元接收到的第二处理操作,在第i个网络层中获取第q组特有权重值以及第二输入数据,并根据第q组特有权重值、第二输入数据以及已经获取到的共享权重值,获取第二输出数据;其中,第q组特有权重值为第i个网络层中与第二任务唯一对应的特有权重值,N≥q≥1,q≠t,q为整数,当1<i≤M时,第二输入数据为第i-1个网络层处理第二待处理对象后输出的数据;当i=1时,第二输入数据为第二待处理对象的数据。上述传输单元,还用于传输上述处理单元得到的第二输出数据。
第六方面,提供一种处理装置,该处理装置具有如上述第一方面及其任意一种可能的实现方式的神经网络模型。具体的,该处理装置包括获取单元、接收单元、处理单元以及传输单元。
本申请提供的各个单元模块所实现的功能具体如下:
上述获取单元,用于获取第一待处理图像。上述接收单元,用于接收用户输入的第一处理操作,该第一处理操作用于指示对获取单元获取到的第一待处理图像执行图像去噪任务。上述处理单元,用于响应于上述接收单元接收到的第一处理操作,在第 i个网络层中获取第t组特有权重值、共享权重值以及第一输入数据,并根据第t组特有权重值、共享权重值以及第一输入数据,获取第一输出数据;其中,当1<i≤M时,第一输入数据为M个网络层中的第i-1个网络层处理第一待处理图像后输出的数据;当i=1时,第一输入数据为第一待处理图像的数据。上述传输单元,用于传输上述处理单元得到的第一输出数据。上述获取单元,还用于获取第二待处理图像。上述接收单元,还用于接收用户输入的第二处理操作,该第二处理操作用于指示对是上述获取单元获取到的第二待处理图像执行图像识别任务,图像识别任务为N个任务中的一个。上述处理单元,还用于响应于第二处理操作,在第i个网络层中获取第q组特有权重值以及第二输入数据,并根据第q组特有权重值、第二输入数据以及已经获取到的共享权重值,获取第二输出数据;其中,第q组特有权重值为第i个网络层中与图像识别任务唯一对应的特有权重值,N≥q≥1,q≠t,q为整数,当1<i≤M时,第二输入数据为第i-1个网络层处理第二待处理图像后输出的数据;当i=1时,第二输入数据为第二待处理图像的数据。上述传输单元,还用于传输上述处理单元得到的第二输出数据。
第七方面,提供一种处理装置,该处理装置包括获取单元和处理单元。
本申请提供的各个单元模块所实现的功能具体如下:
上述获取单元,用于获取包括K(K为正整数)个训练对象和K个训练对象中的每个训练对象的标记信息的训练信息。上述处理单元,用于根据上述获取单元获取到的训练信息,执行训练处理操作,该训练处理操作为“将K个训练对象输入到神经网络模型中,得到K个处理结果,K个处理结果中的每个处理结果唯一对应一个训练对象;确定K个差异值,K个差异值分别表征每个处理结果以及与每个处理结果对应的训练对象的标记信息之间的差异;将K个差异值中的a个差异值根据预设统计算法进行计算,得到第一统计误差,a个差异值中的每个差异值对应的训练对象用于执行第一任务,0≤a≤K,a为整数;将K个差异值中的b个差异值根据预设统计算法进行计算,得到第二统计误差,b个差异值中的每个差异值对应的训练对象用于执行第二任务;第二任务为N个任务中的其中一个,且与第一任务不同,0≤b≤K,1≤a+b≤K,b为整数;根据预设的反向传播算法和第一统计误差,调整第t组特有权重值,并根据预设的反向传播算法和第二统计误差,调整第i网络层中的第q组特有权重值,并根据预设的反向传播算法、第一统计误差和第二统计误差,调整共享权重值,第q组特有权重值为第i个网络层中与第二任务唯一对应的特有权重值,N≥q≥1,q≠t,q为整数”。上述获取单元,还用于重新获取训练信息。上述处理单元,还用于根据上述获取单元重新获取到的训练信息和该处理单元调整第t组特有权重值、第q组特有权重值以及共享权重值后的神经网络模型执行训练处理操作,直到第x次执行训练处理操作后的神经网络模型的预设参数与第x-y次执行训练处理操作后的神经网络模型的预设参数的差异值小于第一预设阈值为止或者直到执行训练处理操作的次数达到第二预设阈值为止,x为大于或等于2的整数,y为正整数。
第八方面,提供一种处理装置,该处理装置包括:一个或多个处理器、存储器、通信接口。其中,存储器、通信接口与一个或多个处理器耦合;该处理装置通过通信接口与其他设备通信,存储器用于存储计算机程序代码,计算机程序代码包括指令, 当一个或多个处理器执行指令时,处理装置执行如上述第二方面或上述第三方面所述的数据处理方法,或者执行如上述第四方面所述的神经网络模型的训练方法。
第九方面,还提供一种计算机可读存储介质,该计算机可读存储介质中存储有指令;当其在上述第八方面所述的处理装置上运行时,使得所述处理装置执行如上述第二方面或上述第三方面所述的数据处理方法,或者执行如上述第四方面所述的神经网络模型的训练方法。
第十方面,还提供一种包含指令的计算机程序产品,当其在上述第八方面所述的处理装置上运行时,使得所述处理装置执行如上述第二方面或上述第三方面所述的数据处理方法,或者执行如上述第四方面所述的神经网络模型的训练方法。
本申请中第八方面、第九方面、第十方面及其各种实现方式的具体描述,可以参考上述第二方面、第三方面和第四方面中任意一方面的详细描述;并且,第八方面、第九方面、第十方面及其各种实现方式的有益效果,可以参考上述第二方面、第三方面和第四方面中任意一方面的有益效果分析,此处不再赘述。
在本申请中,上述处理装置的名字对设备或功能模块本身不构成限定,在实际实现中,这些设备或功能模块可以以其他名称出现。只要各个设备或功能模块的功能和本申请类似,属于本申请权利要求及其等同技术的范围之内。
本申请的这些方面或其他方面在以下的描述中会更加简明易懂。
附图说明
图1为本申请实施例中手机的示意图;
图2为本申请实施例中手机的硬件结构示意图;
图3为本申请实施例中神经网络模型的结构示意图一;
图4为本申请实施例中第i个网络层的数据处理流程示意图一;
图5为本申请实施例中第i个网络层的数据处理流程示意图二;
图6为本申请实施例中神经网络模型的结构示意图二;
图7为本申请实施例中神经网络模型的结构示意图三;
图8为本申请实施例中神经网络模型的结构示意图四;
图9为本申请实施例中神经网络模型处理图像的流程示意图;
图10为本申请实施例中不同模型处理后的图像示意图;
图11为本申请实施例中处理装置的结构示意图一;
图12为本申请实施例中处理装置的结构示意图二。
具体实施方式
在本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。
深度神经网络通过建立模型来模拟人类大脑的神经连接结构,在处理图像、声音和文本等信号时,通过多个变换阶段分层对数据特征进行描述。
一般的,神经网络由多个网络层构成,每个网络层对其输入数据进行处理,并将处理后的数据传输至下一网络层。具体的,在每个网络层中,处理装置(存储有该神经网络的设备)使用与该网络层对应的权重值对输入数据进行卷积、乘加等处理。其中,处理装置的处理方式是由网络层(如卷积层、全连接层等)的属性确定的,处理装置使用的权重值是该处理装置在训练神经网络的过程中确定出的。处理装置调整与网络层对应的权重值能够得到不同的数据处理结果。
卷积神经网络模型为深度神经网络模型的一种。CNN在图像识别、语音处理、智能机器人等应用领域取得了令人瞩目的成果。对多个任务进行处理的卷积神经网络模型的泛化能力较强,能够适当降低每个任务占用的资源以及存储成本。在很多图像处理领域中,以图像增强任务为例,终端中芯片化的神经网络加速器在某一时间段内只能执行一个图像增强任务,并输出单幅图像,因此,提出了一种能够串行执行多个任务的卷积神经网络模型。
现有技术中,存在一种可行的能够串行执行多个任务的卷积神经网络模型。具体的,多个任务在该卷积神经网络模型的至少一个卷积层中共享权重值,且对于共享权重值的卷积层(简称为共享层)而言,该共享层的所有权重值均被共享。该卷积神经网络模型中权重值的共享不仅能降低权重值的数量,还能降低终端在切换任务时对带宽的需求。但是,由于共享层的所有权重值均被共享,导致终端在执行不同任务时,对共享层内图像特征的有效利用率降低,降低了该卷积神经网络模型在处理不同任务时的性能。
针对上述问题,本申请实施例提供一种用于完成N(N为大于或等于2的整数)个任务的神经网络模型,该神经网络模型包括M(M为正整数)个网络层,M个网络层的第i(1≤i≤M,i为整数)个网络层具有共享权重值和N组特有权重值,这里,共享权重值用于执行N个任务中的每个任务,N组特有权重值中的每组特有权重值用于执行N个任务中的一个任务,且每组特有权重值与N个任务中的一个任务一一对应。该第i个网络层在执行N个任务中的第一任务时被配置为:获取输入数据;根据第t(1≤t≤N,t为整数)组特有权重值、所述共享权重值以及获取到的输入数据,获取输出数据;当1≤i<M时,向M个网络层中的第i+1个网络层传输该输出数据,其中,第t组特有权重值与第一任务对应;当i=M时,输出该输出数据。可以看出,对于任意一个任务而言,第i个网络层在进行数据处理时,只需要获取共享权重值以及与当前任务对应的特定权重值即可,而无需获取与其他任务对应的特定权重值,有效的提高了第i个网络层的性能,进而提高了神经网络模型的性能。
此外,由于共享权重值用于执行N个任务中的每个任务,因此,在切换任务的场景中,第i个网络层无需重新获取共享权重值,只需获取与当前任务对应的特有权重值即可,减少了数据的读取次数,提高了处理性能。
需要说明的是,本申请中“M个网络层中的第i+1个网络层”的结构可以与上述“第i个网络层”的结构相同(即均具有共享权重值以及N组特有权重值),也可以不同。在“M个网络层中的第i+1个网络层”的结构可以与上述“第i个网络层”的 结构不同的场景中,“M个网络层中的第i+1个网络层”可以只具有共享权重值(即不具有特有权重值),也可以不具有共享权重值(即只具有特有权重值),本申请对此不作具体限定。
容易理解的是,本申请中的网络神经模型可以包括至少一个与上述“第i个网络层”的结构相同的网络层。
本申请提供的神经网络模型可以为任意一种人工神经网络模型,例如卷积神经网络模型,本申请实施例对此不做具体限定。
本申请实施例提供的神经网络模型可以存储于处理装置。该处理装置可以为电子设备。
上述电子设备可以是允许用户输入处理操作指示电子设备执行相关操作事件的手机(如图1所示的手机100)、平板电脑、个人计算机(Personal Computer,PC)、个人数字助理(Personal Digital Assistant,PDA)、智能手表、上网本、可穿戴电子设备等,本申请实施例对该电子设备的具体形式不做特殊限制。
如图2所示,以手机100作为上述电子设备举例。手机100具体可以包括:处理器101、射频(Radio Frequency,RF)电路102、存储器103、触摸屏104、蓝牙装置105、一个或多个传感器106、Wi-Fi装置107、定位装置108、音频电路109、外设接口110以及电源装置111等部件。这些部件可通过一根或多根通信总线或信号线(图2中未示出)进行通信。本领域技术人员可以理解,图2中示出的硬件结构并不构成对手机的限定,手机100可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
下面结合图2对手机100的各个部件进行具体的介绍:
处理器101是手机100的控制中心,利用各种接口和线路连接手机100的各个部分,通过运行或执行存储在存储器103内的应用程序,以及调用存储在存储器103内的数据,执行手机100的各种功能和处理数据。在一些实施例中,处理器101可包括一个或多个处理单元。在本申请实施例一些实施例中,上述处理器101还可以包括指纹验证芯片,用于对采集到的指纹进行验证。
本申请实施例中,处理器101可调用训练信息实现神经网络模型的训练。具体的,处理器101获取包括K(K为正整数)个训练对象和K个训练对象中的每个训练对象的标记信息的训练信息,并根据获取到的训练信息,执行训练处理操作,该训练处理操作为“将K个训练对象输入到神经网络模型中,得到K个处理结果,K个处理结果中的每个处理结果唯一对应一个训练对象;确定K个差异值,K个差异值分别表征每个处理结果以及与每个处理结果对应的训练对象的标记信息之间的差异;将K个差异值中的a个差异值根据预设统计算法进行计算,得到第一统计误差,a个差异值中的每个差异值对应的训练对象用于执行第一任务,0≤a≤K,a为整数;将K个差异值中的b个差异值根据预设统计算法进行计算,得到第二统计误差,b个差异值中的每个差异值对应的训练对象用于执行第二任务;第二任务为N个任务中的其中一个,且与第一任务不同,0≤b≤K,1≤a+b≤K,b为整数;根据预设的反向传播算法和第一统计误差,调整第t组特有权重值,并根据预设的反向传播算法和第二统计误差,调整第i网络层中的第q组特有权重值,并根据预设的反向传播算法、第一统计误差和 第二统计误差,调整共享权重值,第q组特有权重值为第i个网络层中与第二任务唯一对应的特有权重值,N≥q≥1,q≠t,q为整数”;然后,该处理器101重新获取训练信息,并根据重新获取到的训练信息和调整第t组特有权重值、第q组特有权重值以及共享权重值后的神经网络模型执行训练处理操作,直到第x次执行训练处理操作后的神经网络模型的预设参数与第x-y次执行训练处理操作后的神经网络模型的预设参数的差异值小于第一预设阈值为止或者直到执行训练处理操作的次数达到第二预设阈值为止,x为大于或等于2的整数,y为正整数。
此外,处理器101还可以根据神经网络模型对待处理对象进行处理。具体的,处理器101在获取到第一待处理对象以及用户输入的用于指示对第一待处理对象执行第一任务的第一处理操作后,利用神经网络模型处理所述第一待处理对象。具体的,处理器101在第i个网络层中获取第t组特有权重值、共享权重值以及第一输入数据,并根据第t组特有权重值、共享权重值以及第一输入数据,获取第一输出数据,然后,处理器101传输该第一输出数据。当1<i≤M时,第一输入数据为M个网络层中的第i-1个网络层处理第一待处理对象后输出的数据;当i=1时,第一输入数据为第一待处理对象的数据。后续,处理器101在获取到第二待处理对象以及用户输入的用于指示对所述第二待处理对象执行第二任务的第二处理操作后,处理器101利用神经网络模型处理第二待处理对象。具体的,处理器101在第i个网络层中获取第q(N≥q≥1,q≠t,q为整数)组特有权重值、共享权重值以及第二输入数据,并根据第q组特有权重值、共享权重值以及第二输入数据,获取第二输出数据,然后,处理器101传输该第二输出数据。当1<i≤M时,第二输入数据为M个网络层中的第i-1个网络层处理第二待处理对象后输出的数据;当i=1时,第二输入数据为第二待处理对象的数据。
处理器101还可以周期性更新上述神经网络模型,以便于较好的适应实际需求。
射频电路102可用于在收发信息或通话过程中,无线信号的接收和发送。特别地,射频电路102可以将基站的下行数据接收后,给处理器101处理;另外,将涉及上行的数据发送给基站。通常,射频电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器、双工器等。此外,射频电路102还可以通过无线通信和其他设备通信。所述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统、通用分组无线服务、码分多址、宽带码分多址、长期演进、电子邮件、短消息服务等。
存储器103用于存储应用程序以及数据,处理器101通过运行存储在存储器103的应用程序以及数据,执行手机100的各种功能以及数据处理。存储器103主要包括存储程序区以及存储数据区,其中,存储程序区可存储操作系统以及至少一个功能所需的应用程序(比如声音播放功能、图像处理功能等);存储数据区可以存储根据使用手机100时所创建的数据(比如音频数据、电话本等)。此外,存储器103可以包括高速随机存取存储器(RAM),还可以包括非易失存储器,例如磁盘存储器件、闪存器件或其他易失性固态存储器件等。存储器103可以存储各种操作系统,例如,
Figure PCTCN2019085885-appb-000001
操作系统,
Figure PCTCN2019085885-appb-000002
操作系统等。上述存储器103可以是独立的,通过上述通信总线与处理器101相连接;存储器103也可以和处理器101集成在一起。
本申请实施例中神经网络模型可视为存储程序区中能够实现图像处理、文字处理、 语音处理等功能的应用程序。神经网络模型中每个网络层的权重值均存储于上述存储数据区中。
神经网络模型在运行过程中使用到的权重值按照多级存储的方式存储于存储器103中。该神经网络模型的每一网络层具有的权重值均存储于片外存储器,即上述非易失存储器。以第i个网络层为例,处理器101在执行当前任务时,将第i个网络层中与当前任务对应的权重值从非易失存储器中读取到内存中,然后,该处理器101将当前需要的权重值从内存中读取到缓存中。
从上面描述可知:本申请中的网络神经模型可以包括至少一个与上述“第i个网络层”的结构相同的网络层。为了便于描述,本申请实施例将具有该结构的网络层称为目标网络层。可选的,本申请实施例中某一目标网络层的每个任务的特有权重值可以存储于存储器103的不同区域,不同目标网络层的共享权重值也可以存储于存储器103的不同区域,以便于处理器101在执行不同任务时,快捷读取该处理器101所需要的权重值,提高权重值的读取速度。示例性的,图2中第i个网络层中的第一组特有权重值、第二组特有权重值以及共享权重值分别存储于存储器103中的不同存储位置。
若手机100还包括除存储器103之外的其他存储器,且其他存储器与存储器103的类型相同,则不同目标网络层的权重值可以存储于该类型的不同存储器中,本申请实施例对此不作具体限定。
触摸屏104具体可以包括触控板104-1和显示器104-2。
其中,触控板104-1可采集手机100的用户在其上或附近的触摸事件(比如用户使用手指、触控笔等任何适合的物体在触控板104-1上或在触控板104-1附近的操作),并将采集到的触摸信息发送给其他器件(例如处理器101)。其中,用户在触控板104-1附近的触摸事件可以称之为悬浮触控;悬浮触控可以是指,用户无需为了选择、移动或拖动目标(例如图标等)而直接接触触控板,而只需用户位于设备附近以便执行所想要的功能。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型来实现触控板104-1。
显示器(也称为显示屏)104-2可用于显示由用户输入的信息或提供给用户的信息以及手机100的各种菜单。可以采用液晶显示器、有机发光二极管等形式来配置显示器104-2。触控板104-1可以覆盖在显示器104-2之上,当触控板104-1检测到在其上或附近的触摸事件后,传送给处理器101以确定触摸事件的类型,随后处理器101可以根据触摸事件的类型在显示器104-2上提供相应的视觉输出。虽然在图2中,触控板104-1与显示屏104-2是作为两个独立的部件来实现手机100的输入和输出功能,但是在某些实施例中,可以将触控板104-1与显示屏104-2集成而实现手机100的输入和输出功能。可以理解的是,触摸屏104是由多层的材料堆叠而成,本申请实施例实施例中只展示出了触控板(层)和显示屏(层),其他层在本申请实施例实施例中不予记载。另外,触控板104-1可以以全面板的形式配置在手机100的正面,显示屏104-2也可以以全面板的形式配置在手机100的正面,这样在手机的正面就能够实现无边框的结构。
另外,手机100还可以具有指纹识别功能。例如,可以在手机100的背面(例如 后置摄像头的下方)配置指纹采集器件112,或者在手机100的正面(例如触摸屏104的下方)配置指纹采集器件112。又例如,可以在触摸屏104中配置指纹采集器件112来实现指纹识别功能,即指纹采集器件112可以与触摸屏104集成在一起来实现手机100的指纹识别功能。在这种情况下,该指纹采集器件112配置在触摸屏104中,可以是触摸屏104的一部分,也可以以其他方式配置在触摸屏104中。本申请实施例实施例中的指纹采集器件112的主要部件是指纹传感器,该指纹传感器可以采用任何类型的感测技术,包括但不限于光学式、电容式、压电式或超声波传感技术等。
手机100还可以包括蓝牙装置105,用于实现手机100与其他短距离的设备(例如手机、智能手表等)之间的数据交换。本申请实施例实施例中的蓝牙装置可以是集成电路或者蓝牙芯片等。
手机100还可以包括至少一种传感器106,比如光传感器、运动传感器以及其他传感器。具体的,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节触摸屏104的显示器的亮度,接近传感器可在手机100移动到耳边时,关闭显示器的电源。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于手机100还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。
无线保真(Wireless Fidelity,Wi-Fi)装置107,用于为手机100提供遵循Wi-Fi相关标准协议的网络接入,手机100可以通过Wi-Fi装置107接入到Wi-Fi接入点,进而帮助用户收发电子邮件、浏览网页和访问流媒体等,它为用户提供了无线的宽带互联网访问。在其他一些实施例中,该Wi-Fi装置107也可以作为Wi-Fi无线接入点,可以为其他设备提供Wi-Fi网络接入。
定位装置108,用于为手机100提供地理位置。可以理解的是,该定位装置108具体可以是全球定位系统(Global Positioning System,GPS)或北斗卫星导航系统、俄罗斯GLONASS等定位系统的接收器。定位装置108在接收到上述定位系统发送的地理位置后,将该信息发送给处理器101进行处理,或者发送给存储器103进行保存。在另外的一些实施例中,该定位装置108还可以是辅助全球卫星定位系统(Assisted Global Positioning System,AGPS)的接收器,AGPS系统通过作为辅助服务器来协助定位装置108完成测距和定位服务,在这种情况下,辅助定位服务器通过无线通信网络与设备例如手机100的定位装置108(即GPS接收器)通信而提供定位协助。在另外的一些实施例中,该定位装置108也可以是基于Wi-Fi接入点的定位技术。由于每一个Wi-Fi接入点都有一个全球唯一的媒体访问控制(Media Access Control,MAC)地址,设备在开启Wi-Fi的情况下即可扫描并收集周围的Wi-Fi接入点的广播信号,因此可以获取到Wi-Fi接入点广播出来的MAC地址;设备将这些能够标示Wi-Fi接入点的数据(例如MAC地址)通过无线通信网络发送给位置服务器,由位置服务器检索出每一个Wi-Fi接入点的地理位置,并结合Wi-Fi广播信号的强弱程度,计算出该设备的地理位置并发送到该设备的定位装置108中。
音频电路109、扬声器113、麦克风114可提供用户与手机100之间的音频接口。 音频电路109可将接收到的音频数据转换后的电信号,传输到扬声器113,由扬声器113转换为声音信号输出;另一方面,麦克风114将收集的声音信号转换为电信号,由音频电路109接收后转换为音频数据,再将音频数据输出至RF电路102以发送给比如另一手机,或者将音频数据输出至存储器103以便进一步处理。
外设接口110,用于为外部的输入/输出设备(例如键盘、鼠标、外接显示器、外部存储器、用户识别模块卡等)提供各种接口。例如通过通用串行总线(Universal Serial Bus,USB)接口与鼠标连接,通过用户识别模块卡卡槽上的金属触点与电信运营商提供的用户识别模块卡(Subscriber Identification Module,SIM)卡进行连接。外设接口110可以被用来将上述外部的输入/输出外围设备耦接到处理器101和存储器103。
在本申请实施例中,手机100可通过外设接口110与设备组内的其他设备进行通信,例如,通过外设接口110可接收其他设备发送的显示数据进行显示等,本申请实施例对此不作任何限制。
手机100还可以包括给各个部件供电的电源装置111(比如电池和电源管理芯片),电池可以通过电源管理芯片与处理器101逻辑相连,从而通过电源装置111实现管理充电、放电、以及功耗管理等功能。
尽管图2未示出,手机100还可以包括摄像头(前置摄像头和/或后置摄像头)、闪光灯、微型投影装置、近场通信(Near Field Communication,NFC)装置等,在此不再赘述。
下面对本申请提供的神经网络模型及其训练方法、数据处理方法进行详细描述。
本申请实施例提供一种神经网络模型200,该神经网络模型200属于人工神经网络模型,能够完成N(N≥2,N为整数)个任务。
图3为神经网络模型200的结构示意图。如图3所示,该神经网络模型200包括M(M为正整数)个网络层,该M个网络层中的第i(1≤i≤M,i为整数)个网络层具有共享权重值和N组特有权重值。共享权重值用于执行N个任务中的每个任务,即处理装置在第i个网络层中执行N个任务的任一任务时均使用该共享权重值。N组特有权重值中的每组特有权重值用于执行N个任务中的一个任务,且每组特有权重值与N个任务中的一个任务一一对应。
图3中的N组特有权重值包括第一组特有权重值、……、第t(1≤t≤N,t为整数)组特有权重值、……第q(1≤q≤N,q≠t,q为整数)组特有权重值、……第N组特有权重值。每一组特有权重值唯一对应一个任务。示例性的,图3中的第t组特有权重值与N个任务中的第一任务唯一对应,第q组特有权重值与N个任务中的第二任务唯一对应。
上述第i个网络层在执行N个任务中的第一任务时被配置为:获取输入数据;根据第t组特有权重值、共享权重值以及所述输入数据,获取输出数据。这样,当1≤i<M时,向M个网络层中的第i+1个网络层传输所述输出数据;当i=M时,输出所述输出数据。
容易理解的是,第i个网络层在执行第一任务时,只需利用共享权重值以及第t组特有权重值对输入数据进行计算即可,与其他特有权重值无关。当第i个网络层为神经网络模型200的最后一层时,在第i个网络层中获取到的输出数据为该神经网络 模型200的输出数据,因此,直接将在第i个网络层中获取到的输出数据直接输出即可。当第i个网络层不是神经网络模型200的最后一层时,需要将第i个网络层中获取到的输出数据传输至第i+1个网络层,以便于第i+1个网络层对其进行处理。
本申请实施例中的第i个网络层可以为卷积层,也可以为全连接层,还可以为反卷积层,还可以为循环层,本申请实施例对此不作具体限定。
当第i个网络层为卷积层时,上述“根据第t组特有权重值、共享权重值以及所述输入数据,获取输出数据”的方法为:采用共享权重值对所述输入数据进行卷积计算,以获得共享输出数据;采用第t组特有权重值对所述输入数据进行卷积计算,以获得特有输出数据。这种场景中,所述输出数据包括共享输出数据和特有输出数据。
这种场景中,所述输入数据以及所述输出数据均为三维张量,共享权重值以及N组特有权重值均为四维张量。这里,三维张量对应的维度分别为:特征图(feature maps)的长、宽和特征图的数量,四维张量对应的维度为:卷积核的长、宽、输入特征图数量、输出特征图数量。
当第i个网络层为全连接层时,上述“根据第t组特有权重值、共享权重值以及所述输入数据,获取输出数据”的方法为:采用共享权重值对所述输入数据进行乘加计算,以获得共享输出数据;所述第t组特有权重值对所述输入数据进行乘加计算,以获得特有输出数据。同理,这种场景中,所述输出数据也包括共享输出数据和特有输出数据。
在这种场景中,所述输出数据为一维向量,所述输入数据取决于该全连接层的上一网络层的结构。
若该全连接层的上一网络层为全连接层,则上一网络层的输出数据为一维向量,则该全连接层的输入数据为一维向量。全连接层的特有权重值以及共享权重值可以为二维矩阵,该二维矩阵对应维度为输入神经元数量和输出神经元数量。
若该全连接层的上一网络层为卷积层或反卷积层,则上一网络层的输出数据为特征图,该全连接层的输入数据也为特征图,即该全连接层的输入数据为三维张量。这种情况下,全连接层的特有权重值以及共享权重值可以为四维张量,该四维张量的四个维度分别对应:输入特征图长、宽、输入特征图数量、输出神经元数量。
当第i个网络层为反卷积层时,上述“根据第t组特有权重值、共享权重值以及所述输入数据,获取输出数据”的方法为:采用共享权重值对所述输入数据进行反置卷积计算,以获得共享输出数据;采用第t组特有权重值对所述输入数据进行反置卷积计算,以获得特有输出数据。同理,这种场景中,所述输出数据也包括共享输出数据和特有输出数据。
在这种场景中,所述输入数据以及所述输出数据均为三维张量,共享权重值以及N组特有权重值均为四维张量。这里,三维张量对应的维度分别为:特征图(feature maps)的长、宽和特征图的数量,四维张量对应的维度为:卷积核的长、宽、输入特征图数量、输出特征图数量。
一般的,循环层的结构形式存在多种,例如:循环神经网络(Recurrent Neural Networks,RNN)、长短时间记忆(Long Short-Term Memory,LSTM)等。循环层具有多个权重值矩阵。当第i个网络层为循环层时,每个权重值矩阵或部分权重值矩阵 包括共享权重值以及N组特有权重值。对于某一权重值矩阵而言,在获取到目标输入数据后,采用该权重值矩阵或激活函数对所述输入数据进行乘加计算,以获得目标输出数据。后续,再采用该权重值矩阵的下一权重值矩阵对目标输出数据进行乘加计算。容易理解的是,若该权重值矩阵为第一个权重值矩阵,则目标输入数据为所述输入数据。若该权重值矩阵不是第一个权重值矩阵,则目标输入数据为经由上一权重值矩阵处理后的输出数据。
在这种场景中,所述输入数据以及所述输出数据均为一维向量,共享权重值以及N组特有权重值均为二维矩阵。
需要说明的是,神经网络模型中每一网络层的输入数据以及输出数据的维度以及数量需要根据实际需求确定,本申请实施例对此不作具体限定。
为了便于理解,现以N=2,神经网络模型能够完成第一任务和第二任务为例进行说明。第i个网络层具有用于执行第一任务和第二任务的共享权重值、与第一任务唯一对应的第一组特有权重以及与第二任务对应的第二组特有权重值。
如图4所示,若第i个网络层为卷积层,当前任务为第一任务,则处理装置在获取到第i个网络层的输入数据(第一输入数据、第二输入数据、……、第m输入数据)后,采用共享权重值对输入数据进行卷积运算,得到第一输出数据,并采用第一组特有权重值对输入数据进行卷积计算,得到第二输出数据;在得到第一输出数据和第二输出数据后,处理装置向第i+1个网络层传输该第一输出数据和第二输出数据。
结合上述图4,如图5所示,若第i个网络层为卷积层,当前任务为第二任务,则处理装置在获取到第i个网络层的输入数据(第一输入数据、第二输入数据、……、第m输入数据)后,采用共享权重值对输入数据进行卷积运算,得到第一输出数据,并采用第二组特有权重值对输入数据进行卷积计算,得到第三输出数据;在得到第一输出数据和第三输出数据后,处理装置向第i+1个网络层传输该第一输出数据和第三输出数据。
结合图3~图5示出的神经网络模型可知,该神经网络模型中第i个网络层在执行任一任务的过程中,只需根据与该任务对应的特有权重值和共享权重值对其输入数据进行计算即可,而无需获取与其他任务对应的特定权重值,有效的提高了各个目标网络层的性能,进而提高了神经网络模型的性能。
需要说明的是,图3示出的神经网络模型200中,除了第i个网络层之外,还可以存在h(h≥0)个与第i个网络层结构相同的网络层。
示例性的,结合上述图3,如图6所示,除第i个网络层之外,神经网络模型200中的第i-2个网络层和第i+2个网络层也分别具有各自的共享权重值和N组特有权重值,第i-1个网络层仅仅具有共享权重值,第i+1个网络层仅仅具有N组特有权重值。这样,处理装置在第i-2个网络层中执行N个任务的任一任务时,均使用第i-2个网络层所具有的共享权重值。当处理装置在第i-2个网络层中执行第一任务时,该处理装置使用第i-2个网络层中与第一任务唯一对应的特有权重值。同理,处理装置在第i+2个网络层中执行N个任务的任一任务时,均使用第i+2个网络层所具有的共享权重值。当处理装置在第i+2个网络层中执行第一任务时,该处理装置使用第i+2个网络层中与第一任务唯一对应的特有权重值。
结合上述图3,如图7所示,除第i个网络层之外,神经网络模型200中的第i-1个网络层和第i+1个网络层也分别具有各自的共享权重值和N组特有权重值,其他网络层均不具备这样的结构。这样,处理装置在第i-1个网络层中执行N个任务的任一任务时,均使用第i-1个网络层所具有的共享权重值。当处理装置在第i-1个网络层中执行第一任务时,该处理装置使用第i-1个网络层中与第一任务唯一对应的特有权重值。同理,处理装置在第i+1个网络层中执行N个任务的任一任务时,均使用第i+1个网络层所具有的共享权重值。当处理装置在第i+1个网络层中执行第一任务时,该处理装置使用第i+1个网络层中与第一任务唯一对应的特有权重值。
图6和图7示出的神经网络模型200的结构仅仅是对神经网络模型200的示例,并不是对神经网络模型200的限定。
本申请提供的神经网络模型应用于图像处理、音频处理等技术领域。例如:在图像处理技术领域,神经网络模型可以完成图像去噪任务、对待处理图像进行分类、图像识别等任务。在音频处理技术领域,神经网络模型可以完成语音识别等任务。
实际应用中,处理装置需要利用训练对象进行模型训练,以生成上述神经网络模型。
具体的,本申请中神经网络模型的训练方法为:处理装置获取包括K(K为正整数)个训练对象和K个训练对象中的每个训练对象的标记信息的训练信息,并根据获取到的训练信息,执行训练处理操作,该训练处理操作为“将K个训练对象输入到神经网络模型中,得到K个处理结果,K个处理结果中的每个处理结果唯一对应一个训练对象;确定K个差异值,K个差异值分别表征每个处理结果以及与每个处理结果对应的训练对象的标记信息之间的差异;将K个差异值中的a(0≤a≤K,a为整数)个差异值根据预设统计算法(例如加权平均)进行计算,得到第一统计误差,a个差异值中的每个差异值对应的训练对象用于执行第一任务;将K个差异值中的b(0≤b≤K,1≤a+b≤K,b为整数)个差异值根据预设统计算法进行计算,得到第二统计误差,b个差异值中的每个差异值对应的训练对象用于执行第二任务;根据预设的反向传播算法和第一统计误差,调整第t组特有权重值,并根据预设的反向传播算法和第二统计误差,调整第i网络层中的第q组特有权重值,并根据预设的反向传播算法、第一统计误差和第二统计误差,调整共享权重值”;在调整权重值后,处理装置重新获取训练信息,并根据重新获取到的训练信息和调整第t组特有权重值、第q组特有权重值以及共享权重值后的神经网络模型执行训练处理操作,直到第x(x为大于或等于2的整数)次执行训练处理操作后的神经网络模型的预设参数与第x-y(y为正整数)次执行训练处理操作后的神经网络模型的预设参数的差异值小于第一预设阈值为止或者直到执行训练处理操作的次数达到第二预设阈值为止。
可以看出,处理装置训练神经网络模型的过程为一个迭代过程。实际应用中,处理装置需要利用大量的训练对象完成训练,以实现神经网络模型的稳定。
在训练过程中,若处理装置获取到的K个训练对象均用于完成第一任务,则处理装置在第i个网络层中获取共享权重值、第t组特有权重值以及输入数据,并采用共享权重值对输入数据进行计算,得到共享输出数据,采用第t组特有权重值对输入数据进行计算,得到特有输出数据,进而处理装置向第i+1个网络层传输该共享输出数 据和特有输出数据。
可选的,在训练过程中,若处理装置获取到的K个训练对象中一部分训练对象用于完成第一任务,另一部分训练对象用于完成第二任务,当前任务为第一任务,则处理装置在第i个网络层中获取共享权重值、第t组特有权重值、第q组特有权重值以及第一输入数据,第一输入数据为用于执行第一任务的训练对象的数据;然后,处理装置采用共享权重值对第一输入数据进行计算,得到共享输出数据,并采用第t组特有权重值对第一输入数据进行计算,得到特有输出数据1,以及采用第q组特有权重值对第一输入数据进行计算,得到特有输出数据2;之后,由于当前任务为第一任务,因此,处理装置通过过滤器从共享输出数据、特有输出数据1以及特有输出数据2中选取出共享输出数据以及特有输出数据1。
示例性的,结合上述图4或图5,如图8所示,神经网络模型用于执行第一任务和第二任务,第i个网络层具有用于执行第一任务和第二任务的共享权重值、与第一任务唯一对应的第一组特有权重以及与第二任务对应的第二组特有权重值,当前任务为第一任务,第i个网络层为卷积层。处理装置在获取到第i个网络层的输入数据(第一输入数据、第二输入数据、……、第m输入数据)后,采用共享权重值对获取到的输入数据进行卷积运算,得到共享输出数据,并采用第一组特有权重值对获取到的输入数据进行卷积计算,得到特有输出数据1,以及采用第二组特有权重值对获取到的输入数据进行卷积计算,得到特有输出数据2。然后,由于当前任务为第一任务,该处理装置通过过滤器仅获取到共享输出数据和特有输出数据1,并向第i+1个网络层传输该共享输出数据和特有输出数据1。
综上所述可知,训练过程中的过滤器是可选的,因此,图8用虚线表示过滤器。
从上面描述可知,对于神经网络模型中除第i个网络层以外的任一网络层,该网络层可以仅具有共享权重值,也可以仅具有特有权重值,还可以具有共享权重值和N组特有权重值。因此,在调整与某一任务对应的过程中,处理装置也需要调整该网络层中与该任务对应的权重值。
进一步地,为了验证本申请提供的神经网络模型的可靠性,现对其进行验证。
这里采用7层卷积神经网络模型执行图像去噪任务。该7层卷积神经网络模型分别采用本申请提供的神经网络模型的结构(该卷积神经网络模型中第i个卷积层具有共享权重值以及多组特有权重值,每一组特有权重值与一个任务一一对应)、现有方案1(该卷积神经网络模型的每一卷积层只有特有权重值,不存在共享权重值)和现有方案2(该卷积神经网络模型中的部分卷积层的每一卷积层只有共享权重值,不存在特有权重值,另一部分卷积层的每一卷阶层只有特有权重值,不存在共享权重值)对图像进行去噪处理,以验证本申请提供的网络模型的可靠性。
7层卷积神经网络模型中的第一卷积层采用conv1(1,5,24)表示,其中,conv1(1,5,24)表示第一卷积层的输入为1个特征图,输出为24个特征图,卷积核的大小为5x5;第二卷积层采用conv2(24,1,6)表示,其中,conv2(24,1,6)表示第一卷积层的输入为24个特征图,输出为6个特征图,卷积核的大小为1x1;第三卷积层采用conv3(6,3,6)表示,其中,conv3(6,3,6)表示第三卷积层的输入为6个特征图,输出为6个特征图,卷积核的大小为3x3;第四卷积层采用conv4(6,1, 6)表示,其中,conv4(6,1,6)表示第四卷积层的输入为6个特征图,输出为6个特征图,卷积核的大小为1x1;第五卷积层采用conv5(6,3,6)表示,其中,conv5(6,3,6)表示第五卷积层的输入为6个特征图,输出为6个特征图,卷积核的大小为3x3;第六卷积层采用conv6(6,1,16)表示,其中,conv6(6,1,16)表示第六卷积层的输入为6个特征图,输出为16个特征图,卷积核的大小为1x1;第七卷积层采用conv7(16,3,1)表示,其中,conv7(16,3,1)表示第七卷积层的输入为16个特征图,输出为1个特征图,卷积核的大小为3x3。
图9示出了上述7层卷积神经网络模型处理图像A的过程,在经由上述7层卷积神经网络模型处理后,输出图像B。可以看出,图像B的清晰度要高于图像A的清晰度,有效的实现了图像A的去噪。图9中的方块代表该卷积神经网络模型处理过程中的数据流,即特征图。方块的宽度表示特征图的数量。方块越宽,特征图的数量越大。在实际实施例中,可采用tanh作为卷积神经网络模型中的激活函数,图9中并未示出。
在原始训练数据库的无噪声图像中加入不同程度的噪声,以生成噪声图像,该噪声图像用于模拟真实场景中拍照获取到的图像。由于在真实拍照场景中,在不同的光照情况下,采用不同的感光系数,图像中的噪声强度不同,加入不同量的噪声可以模拟不同真实场景下拍出的图像,也可以训练出多个针对不同量级噪声进行去噪的模型。也就是说,将噪声图像作为训练对象,将原始无噪声的图像作为训练对象的标记信息。
示例性的,在原始无噪声的图像中加入方差(var)为10、30、50的噪声,以生成噪声图像,该原始无噪声的图像可以为BSD数据库中的图像。7层卷积神经网络模型针对这三种噪声图像执行去噪任务,也就是说,7层卷积神经网络模型用于完成三个任务。
一般的,某一卷积层中权重值的数量根据下述公式进行计算:
卷积层的权重值的数量=(输入特征图的数量×卷积核的宽×卷积核的高+1)×输出特征图的数量。
相应的,图9示出的7层卷积神经网络模型中的第一卷积层中权重值的数量为624,第二卷积层中权重值的数量为150,第三卷积层中权重值的数量为330,第四卷积层中权重值的数量为42,第五卷积层中权重值的数量为330,第六卷积层中权重值的数量为112,第七卷积层中权重值的数量为145。
若上述图9示出的7层卷积神经网络模型采用现有方案1实现,即卷积神经网络模型中的每一卷积层只有特有权重值,且不存在共享权重值,这样的话,对于每一任务而言,该卷积神经网络模型中权重值的总数量为1733。相应的,对于三个任务,该卷积神经网络模型中权重值的总数量为1733×3=5199。
若上述图9示出的7层卷积神经网络模型采用现有方案2实现,该卷积神经网络模型的前4层(第一卷积层~第四卷积层)中的每一卷积层只有共享权重值,且不存在特有权重值,后3层(第五卷积层~第七卷积层)中的每一卷积层只有特有权重值,且不存在共享权重值,这样的话,前4层的权重值数量为1146,后3层的权重值数量为1761(587×3=1761),该卷积神经网络模型中权重值的总数量为2907,(1146+1761=2907),该卷积神经网络中共享权重值的占比为1146/(1146+587)=66.1%。
若上述图9示出的7层卷积神经网络模型采用本申请实现,卷积神经网络模型的 第一卷积层、第三卷积层和第五卷积层中的每一卷积层具有2/3的共享权重值和1/3的特有权重值,第二卷积层、第四卷积层和第六卷积层均只具有共享权重值,第七卷积层只具有特有权重值。这样的话,该卷积神经网络模型中权重值的总数量为2879,其中,(624+330+330)×(2/3)+(624+330+330)×(1/3)×3+(150+42+112)+145×3=2879,该卷积神经网络模型中共享权重值的占比为66.9%。
表1示出了采用现有方案1、现有方案2和本申请实现的完成三个任务的7层卷积神经网络模型对图像进行去噪处理后的峰值信噪比(Peak Signal to Noise Ratio,PSNR)、权重值的总数量以及共享权重值的占比。
表1
Figure PCTCN2019085885-appb-000003
从表1可以看出,与现有方案1相比,采用本申请实现的用于完成三个任务的7层卷积神经网络模型的权重值的总数量降低了44.6%,其中,(5199-2879)/5199=44.6%。采用本申请实现的用于完成三个任务的7层卷积神经网络模型中共享权重值的占比为66.9%,这样,在不同任务切换时,处理装置减少了66.9%的权重值的读取。
在处理较大的噪声时,本申请的降噪效果与现有方案1的降噪效果基本一致。例如:Var=50时,本申请的PSNR为25.93,现有方案的PSNR为25.93。在处理较小的噪声时,本申请的降噪效果与现有方案1的降噪效果之间的差距也较小。例如:Var=10时,本申请的PSNR为33.48,现有方案的PSNR为33.63,二者仅仅相差0.15。此外,在与现有方案2的共享权重值的占比类似的场景中,本申请的图像处理质量较高。
上述表1从数字的角度描述了采用现有方案1、现有方案2以及本申请实现的神经网络模型处理图像的区别。为了更加直观的说明三者之间的区别,图10示出了加入方差为50的噪声图像经过现有方案1、现有方案2以及本申请的神经网络模型处理后,输出的图像。图10中的(a)为加入方差为50的噪声图像,图10中的(b)为采用现有方案1处理后的方差为50的噪声图像,图10中的(c)为采用现有方案2处理后的方差为50的噪声图像,图10中的(d)为采用本申请的神经网络模型处理后的方差为50的噪声图像。从图10可以看出,与现有方案2处理后的图像相比,本申请的神经网络模型处理后的图像的噪声较低;从肉眼观察的角度看,本申请的神经网络模型处理后的图像的噪声与现有方案1处理后的图像的噪声类似。
综上,相比于现有方案,本申请提供的神经网络模型中权重值总量降低,有效的减少了数据的读取次数,提高了处理性能,该神经网络模型的可靠性较高。
处理装置采用上述训练方法训练出神经网络模型后,可直接利用训练出的神经网络模型执行相应任务,实现数据处理。可选的,处理装置还可以周期性更新该神经网络模型,以便于较好的适应实际需求。
具体的,处理装置采用本申请提供的神经网络模型执行的数据处理方法为:在获取到第一待处理对象并接收到用户输入的用于指示对第一待处理对象执行第一任务的 第一处理操作后,处理装置在第i个网络层获取第t组特有权重值(与第一任务唯一对应的权重值)、共享权重值以及第一输入数据(当1<i≤M时,第一输入数据为M个网络层中的第i-1个网络层处理第一待处理对象后输出的数据;当i=1时,第一输入数据为第一待处理对象的数据),并根据第t组特有权重值、所述共享权重值以及第一输入数据,获取第一输出数据,之后,处理装置传输该第一输出数据。后续,在获取到第二待处理对象并接收到用户输入的用于指示对第二待处理对象执行第二任务(与第一任务不同)的第二处理操作后,该处理装置在第i个网络层获取第q(N≥q≥1,q≠t)组特有权重值以及第二输入数据(当1<i≤M时,第二输入数据为第i-1个网络层处理第二待处理对象后输出的数据;当i=1时,第二输入数据为第二待处理对象的数据),并根据第q组特有权重值、第二输入数据以及已经获取到的共享权重值,获取第二输出数据,之后,该处理装置传输获取到的第二输出数据。
容易理解的是,若第i个网络层不是神经网络模型的最后一个网络层,则上述传输第一输出数据是指向第i+1个网络层发送第一输出数据,以便于处理装置在第i+1个网络层对该第一输出数据进行处理。同理,若第i个网络层不是神经网络模型的最后一个网络层,则上述传输第二输出数据是指向第i+1个网络层发送第二输出数据,以便于处理装置在第i+1个网络层对该第二输出数据进行处理。
示例性的,若第一待处理图像和第二待处理图像均为图像,第一任务为图像去噪任务,第二任务为图像识别任务,则在获取到第一待处理图像并接收到用户输入的用于指示对第一待处理图像执行图像去噪任务的第一处理操作后,处理装置在第i个网络层获取第t组特有权重值(与第一任务唯一对应的权重值)、共享权重值以及第一输入数据(当1<i≤M时,第一输入数据为M个网络层中的第i-1个网络层处理第一待处理图像后输出的数据;当i=1时,第一输入数据为第一待处理图像的数据),并根据第t组特有权重值、所述共享权重值以及第一输入数据,获取第一输出数据,之后,处理装置传输该第一输出数据。后续,在获取到第二待处理图像并接收到用户输入的用于指示对第二待处理图像执行图像识别任务的第二处理操作后,该处理装置在第i个网络层获取第q(N≥q≥1,q≠t)组特有权重值以及第二输入数据(当1<i≤M时,第二输入数据为第i-1个网络层处理第二待处理图像后输出的数据;当i=1时,第二输入数据为第二待处理图像的数据),并根据第q组特有权重值、第二输入数据以及已经获取到的共享权重值,获取第二输出数据,之后,该处理装置传输获取到的第二输出数据。
可以看出,在不同任务切换时,处理装置只需获取到与切换后的任务唯一对应的特有权重值即可,而无需全部重新获取权重值,减少了读取次数,提高了处理效率。
本申请实施例提供一种处理装置,该处理装置可以为电子设备。具体的,处理装置用于执行上述数据处理方法中的处理装置所执行的步骤或执行上述神经网络模型的训练方法中的处理装置所执行的步骤。本申请实施例提供的处理装置可以包括相应步骤所对应的模块。
本申请实施例可以根据上述方法示例对处理装置进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形 式实现。本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
在采用对应各个功能划分各个功能模块的情况下,图11示出上述实施例中所涉及的处理装置的一种可能的结构示意图。如图11所示,处理装置11包括获取单元1100、接收单元1101、处理单元1102以及传输单元1103。
获取单元1100用于支持该处理装置执行“获取第一待处理图像”、“获取第二待处理图像”等,和/或用于本文所描述的技术的其它过程。
接收单元1101用于支持该处理装置执行“接收用户输入的第一处理操作”、“接收用户输入的第二处理操作”等,和/或用于本文所描述的技术的其它过程。
处理单元1102用于支持该处理装置执行“根据第t组特有权重值、共享权重值以及第一输入数据,获取第一输出数据”、“根据第q组特有权重值、第二输入数据以及已经获取到的共享权重值,获取第二输出数据”等,和/或用于本文所描述的技术的其它过程。
传输单元1103用于支持该处理装置执行“传输第一输出数据”、“传输第二输出数据”等,和/或用于本文所描述的技术的其它过程。
其中,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。
当然,本申请实施例提供的处理装置包括但不限于上述模块,例如:处理装置还可以包括存储单元1104。
存储单元1104可以用于存储该处理装置的程序代码和数据。
在采用集成的单元的情况下,本申请实施例提供的处理装置的结构示意图如图12所示。在图12中,处理装置12包括:处理模块120和通信模块121。处理模块120用于对处理装置的动作进行控制管理,例如,执行上述获取单元1100和处理单元1102执行的步骤,和/或用于执行本文所描述的技术的其它过程。通信模块121用于支持处理装置与其他设备之间的交互,例如,执行上述接收单元1101和传输单元1103执行的步骤。如图12所示,处理装置还可以包括存储模块122,存储模块122用于存储处理装置的程序代码和数据,例如存储神经网络模型。
其中,处理模块120可以是处理器或控制器,例如可以是中央处理器(Central Processing Unit,CPU),通用处理器,数字信号处理器(Digital Signal Processor,DSP),ASIC,FPGA或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。所述处理器也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,DSP和微处理器的组合等等。通信模块121可以是收发器、RF电路或通信接口等。存储模块122可以是存储器103。
若处理装置12为手机,则上述处理模块120可以是图2中的处理器101,上述通信模块121可以是图2中的天线,上述存储模块122可以是图2中的存储器。
本申请另一实施例还提供一种计算机可读存储介质,该计算机可读存储介质包括一个或多个程序代码,该一个或多个程序包括指令,当处理装置中的处理器在执行该程序代码时,该处理装置执行上述数据处理方法。
在本申请的另一实施例中,还提供一种计算机程序产品,该计算机程序产品包括计算机执行指令,该计算机执行指令存储在计算机可读存储介质中;处理装置的至少一个处理器可以从计算机可读存储介质读取该计算机执行指令,至少一个处理器执行该计算机执行指令使得处理装置实施执行上述数据处理方法的步骤。
在上述实施例中,可以全部或部分的通过软件,硬件,固件或者其任意组合来实现。当使用软件程序实现时,可以全部或部分地以计算机程序产品的形式出现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。
所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。该可用介质可以是磁性介质,(例如,软盘,硬盘、磁带)、光介质(例如,DVD)或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方 法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (10)

  1. 一种神经网络模型,所述神经网络模型用于执行N个任务,N为大于或等于2的整数,所述N个任务包括第一任务,所述神经网络模型包括M个网络层,M为正整数,其特征在于,所述M个网络层中的第i个网络层具有共享权重值和N组特有权重值,所述共享权重值用于执行所述N个任务中的每个任务,所述N组特有权重值中的每组特有权重值用于执行所述N个任务中的一个任务,所述每组特有权重值与所述N个任务中的一个任务一一对应,1≤i≤M,i为整数;所述第i个网络层在执行所述第一任务时被配置为:
    获取输入数据;
    根据第t组特有权重值、所述共享权重值以及所述输入数据,获取输出数据,1≤t≤N,t为整数;
    当1≤i<M时,向所述M个网络层中的第i+1个网络层传输所述输出数据,其中,所述第t组特有权重值与所述第一任务对应;
    当i=M时,输出所述输出数据。
  2. 根据权利要求1所述的神经网络模型,其特征在于,所述第i个网络层为卷积层、全连接层、反卷积层和循环层中的任意一种。
  3. 根据权利要求1或2所述的神经网络模型,其特征在于,所述输出数据包括共享输出数据和特有输出数据,所述根据第t组特有权重值、所述共享权重值以及所述输入数据,获取输出数据,具体包括:
    在所述第i个网络层为卷积层的情况下,采用所述共享权重值对所述输入数据进行卷积计算,以获得所述共享输出数据;采用所述第t组特有权重值对所述输入数据进行卷积计算,以获得所述特有输出数据;
    在所述第i个网络层为全连接层的情况下,采用所述共享权重值对所述输入数据进行乘加计算,以获得所述共享输出数据;采用所述第t组特有权重值对所述输入数据进行乘加计算,以获得所述特有输出数据;
    在所述第i个网络层为反卷积层的情况下,采用所述共享权重值对所述输入数据进行反置卷积计算,以获得所述共享输出数据;采用所述第t组特有权重值对所述输入数据进行反置卷积计算,以获得所述特有输出数据。
  4. 一种数据处理方法,其特征在于,所述数据处理方法使用如上述权利要求1-3中任意一项所述的神经网络模型进行数据处理,所述数据处理方法包括:
    获取第一待处理对象;
    接收用户输入的第一处理操作,所述第一处理操作用于指示对所述第一待处理对象执行所述第一任务;
    响应于所述第一处理操作,在所述第i个网络层中获取所述第t组特有权重值、所述共享权重值以及第一输入数据,并根据所述第t组特有权重值、所述共享权重值以及所述第一输入数据,获取第一输出数据,传输所述第一输出数据;其中,当1<i≤M时,所述第一输入数据为所述M个网络层中的第i-1个网络层处理所述第一待处理对象后输出的数据;当i=1时,所述第一输入数据为所述第一待处理对象的数据;
    获取第二待处理对象;
    接收用户输入的第二处理操作,所述第二处理操作用于指示对所述第二待处理对象执行第二任务,所述第二任务为所述N个任务中的一个,且所述第二任务与所述第一任务不同;
    响应于所述第二处理操作,在所述第i个网络层中获取第q组特有权重值以及第二输入数据,并根据所述第q组特有权重值、所述第二输入数据以及已经获取到的所述共享权重值,获取第二输出数据,传输所述第二输出数据;其中,所述第q组特有权重值为所述第i个网络层中与所述第二任务唯一对应的特有权重值,N≥q≥1,q≠t,q为整数,当1<i≤M时,所述第二输入数据为所述第i-1个网络层处理所述第二待处理对象后输出的数据;当i=1时,所述第二输入数据为所述第二待处理对象的数据。
  5. 一种数据处理方法,其特征在于,所述数据处理方法使用如上述权利要求1-3中任意一项所述的神经网络模型进行数据处理,所述第一任务为图像去噪任务,所述数据处理方法包括:
    获取第一待处理图像;
    接收用户输入的第一处理操作,所述第一处理操作用于指示对所述第一待处理图像执行所述图像去噪任务;
    响应于所述第一处理操作,在所述第i个网络层中获取所述第t组特有权重值、所述共享权重值以及第一输入数据,并根据所述第t组特有权重值、所述共享权重值以及所述第一输入数据,获取第一输出数据,传输所述第一输出数据;其中,当1<i≤M时,所述第一输入数据为所述M个网络层中的第i-1个网络层处理所述第一待处理图像后输出的数据;当i=1时,所述第一输入数据为所述第一待处理图像的数据;
    获取第二待处理图像;
    接收用户输入的第二处理操作,所述第二处理操作用于指示对所述第二待处理图像执行图像识别任务,所述图像识别任务为所述N个任务中的一个;
    响应于所述第二处理操作,在所述第i个网络层中获取第q组特有权重值以及第二输入数据,并根据所述第q组特有权重值、所述第二输入数据以及已经获取到的所述共享权重值,获取第二输出数据,传输所述第二输出数据;其中,所述第q组特有权重值为所述第i个网络层中与所述图像识别任务唯一对应的特有权重值,N≥q≥1,q≠t,q为整数,当1<i≤M时,所述第二输入数据为所述第i-1个网络层处理所述第二待处理图像后输出的数据;当i=1时,所述第二输入数据为所述第二待处理图像的数据。
  6. 一种处理装置,其特征在于,所述处理装置具有如上述权利要求1-3中任意一项所述的神经网络模型,所述处理装置包括:
    获取单元,用于获取第一待处理对象;
    接收单元,用于接收用户输入的第一处理操作,所述第一处理操作用于指示对所述获取单元获取到的所述第一待处理对象执行所述第一任务;
    处理单元,用于响应于所述接收单元接收到的所述第一处理操作,在所述第i个网络层中获取所述第t组特有权重值、所述共享权重值以及第一输入数据,并根据所述第t组特有权重值、所述共享权重值以及所述第一输入数据,获取第一输出数据;其中,当1<i≤M时,所述第一输入数据为所述M个网络层中的第i-1个网络层处理 所述第一待处理对象后输出的数据;当i=1时,所述第一输入数据为所述第一待处理对象的数据;
    传输单元,用于传输所述处理单元得到的所述第一输出数据;
    所述获取单元,还用于获取第二待处理对象;
    所述接收单元,还用于接收用户输入的第二处理操作,所述第二处理操作用于指示对所述获取单元获取到的所述第二待处理对象执行第二任务,所述第二任务为所述N个任务中的一个,且所述第二任务与所述第一任务不同;
    所述处理单元,还用于响应于所述接收单元接收到的所述第二处理操作,在所述第i个网络层中获取第q组特有权重值以及第二输入数据,并根据所述第q组特有权重值、所述第二输入数据以及已经获取到的所述共享权重值,获取第二输出数据;其中,所述第q组特有权重值为所述第i个网络层中与所述第二任务唯一对应的特有权重值,N≥q≥1,q≠t,q为整数,当1<i≤M时,所述第二输入数据为所述第i-1个网络层处理所述第二待处理对象后输出的数据;当i=1时,所述第二输入数据为所述第二待处理对象的数据;
    所述传输单元,还用于传输所述处理单元得到的所述第二输出数据。
  7. 一种处理装置,其特征在于,其特征在于,所述处理装置具有如上述权利要求1-3中任意一项所述的神经网络模型,所述处理装置包括:
    获取单元,用于获取第一待处理图像;
    接收单元,用于接收用户输入的第一处理操作,所述第一处理操作用于指示对所述获取单元获取到的所述第一待处理图像执行所述图像去噪任务;
    处理单元,用于响应于所述接收单元接收到的所述第一处理操作,在所述第i个网络层中获取所述第t组特有权重值、所述共享权重值以及第一输入数据,并根据所述第t组特有权重值、所述共享权重值以及所述第一输入数据,获取第一输出数据;其中,当1<i≤M时,所述第一输入数据为所述M个网络层中的第i-1个网络层处理所述第一待处理图像后输出的数据;当i=1时,所述第一输入数据为所述第一待处理图像的数据;
    传输单元,用于传输所述处理单元得到的所述第一输出数据;
    所述获取单元,还用于获取第二待处理图像;
    所述接收单元,还用于接收用户输入的第二处理操作,所述第二处理操作用于指示对是获取单元获取到的所述第二待处理图像执行图像识别任务,所述图像识别任务为所述N个任务中的一个;
    所述处理单元,还用于响应于所述第二处理操作,在所述第i个网络层中获取第q组特有权重值以及第二输入数据,并根据所述第q组特有权重值、所述第二输入数据以及已经获取到的所述共享权重值,获取第二输出数据;其中,所述第q组特有权重值为所述第i个网络层中与所述图像识别任务唯一对应的特有权重值,N≥q≥1,q≠t,q为整数,当1<i≤M时,所述第二输入数据为所述第i-1个网络层处理所述第二待处理图像后输出的数据;当i=1时,所述第二输入数据为所述第二待处理图像的数据;
    所述传输单元,还用于传输所述处理单元得到的所述第二输出数据。
  8. 一种处理装置,其特征在于,所述处理装置包括:一个或多个处理器、存储器 和通信接口;
    所述存储器、所述通信接口与所述一个或多个处理器连接;所述处理装置通过所述通信接口与其他设备通信,所述存储器用于存储计算机程序代码,所述计算机程序代码包括指令,当所述一个或多个处理器执行所述指令时,所述处理装置执行如权利要求4所述的数据处理方法或者如权利要求5所述的数据处理方法。
  9. 一种包含指令的计算机程序产品,其特征在于,当所述计算机程序产品在处理装置上运行时,使得所述处理装置执行如权利要求4所述的数据处理方法或者如权利要求5所述的数据处理方法。
  10. 一种计算机可读存储介质,包括指令,其特征在于,当所述指令在处理装置上运行时,使得所述处理装置执行如权利要求4所述的数据处理方法或者如权利要求5所述的数据处理方法。
PCT/CN2019/085885 2018-05-15 2019-05-07 一种神经网络模型、数据处理方法及处理装置 WO2019218900A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US17/068,358 US20210027162A1 (en) 2018-05-15 2020-10-12 Neural Network Model, Data Processing Method, and Processing Apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810464380.2A CN110490295B (zh) 2018-05-15 2018-05-15 一种数据处理方法及处理装置
CN201810464380.2 2018-05-15

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/068,358 Continuation US20210027162A1 (en) 2018-05-15 2020-10-12 Neural Network Model, Data Processing Method, and Processing Apparatus

Publications (2)

Publication Number Publication Date
WO2019218900A1 true WO2019218900A1 (zh) 2019-11-21
WO2019218900A9 WO2019218900A9 (zh) 2019-12-12

Family

ID=68539518

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/085885 WO2019218900A1 (zh) 2018-05-15 2019-05-07 一种神经网络模型、数据处理方法及处理装置

Country Status (3)

Country Link
US (1) US20210027162A1 (zh)
CN (1) CN110490295B (zh)
WO (1) WO2019218900A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11983853B1 (en) * 2019-10-31 2024-05-14 Meta Plattforms, Inc. Techniques for generating training data for machine learning enabled image enhancement
CN112862085B (zh) * 2019-11-27 2023-08-22 杭州海康威视数字技术股份有限公司 存储空间优化方法及装置
CN111401546B (zh) * 2020-02-11 2023-12-08 华为技术有限公司 神经网络模型的训练方法及其介质和电子设备
CN111639759A (zh) * 2020-06-01 2020-09-08 深圳前海微众银行股份有限公司 神经网络模型保护方法、装置、设备及可读存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160196479A1 (en) * 2015-01-05 2016-07-07 Superfish Ltd. Image similarity as a function of weighted descriptor similarities derived from neural networks
CN107076567A (zh) * 2015-05-21 2017-08-18 百度(美国)有限责任公司 多语言图像问答
CN107871163A (zh) * 2016-09-28 2018-04-03 爱思开海力士有限公司 用于卷积神经网络的操作装置及方法
CN107918794A (zh) * 2017-11-15 2018-04-17 中国科学院计算技术研究所 基于计算阵列的神经网络处理器

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9715642B2 (en) * 2014-08-29 2017-07-25 Google Inc. Processing images using deep neural networks
CN105894025A (zh) * 2016-03-30 2016-08-24 中国科学院自动化研究所 基于多任务深度学习的自然图像美感质量评估方法
US9959498B1 (en) * 2016-10-27 2018-05-01 Google Llc Neural network instruction set architecture
US10949736B2 (en) * 2016-11-03 2021-03-16 Intel Corporation Flexible neural network accelerator and methods therefor
CN106815566B (zh) * 2016-12-29 2021-04-16 天津中科智能识别产业技术研究院有限公司 一种基于多任务卷积神经网络的人脸检索方法
WO2018203169A1 (ja) * 2017-05-02 2018-11-08 株式会社半導体エネルギー研究所 撮像装置、及び電子機器
CN107832835A (zh) * 2017-11-14 2018-03-23 贵阳海信网络科技有限公司 一种卷积神经网络的轻量化方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160196479A1 (en) * 2015-01-05 2016-07-07 Superfish Ltd. Image similarity as a function of weighted descriptor similarities derived from neural networks
CN107076567A (zh) * 2015-05-21 2017-08-18 百度(美国)有限责任公司 多语言图像问答
CN107871163A (zh) * 2016-09-28 2018-04-03 爱思开海力士有限公司 用于卷积神经网络的操作装置及方法
CN107918794A (zh) * 2017-11-15 2018-04-17 中国科学院计算技术研究所 基于计算阵列的神经网络处理器

Also Published As

Publication number Publication date
US20210027162A1 (en) 2021-01-28
CN110490295A (zh) 2019-11-22
CN110490295B (zh) 2022-04-05
WO2019218900A9 (zh) 2019-12-12

Similar Documents

Publication Publication Date Title
WO2019218900A1 (zh) 一种神经网络模型、数据处理方法及处理装置
CN110059744B (zh) 训练神经网络的方法、图像处理的方法、设备及存储介质
CN108629747B (zh) 图像增强方法、装置、电子设备及存储介质
JP7154678B2 (ja) 目標の位置取得方法、装置、コンピュータ機器及びコンピュータプログラム
CN109299315B (zh) 多媒体资源分类方法、装置、计算机设备及存储介质
CN110495819B (zh) 机器人的控制方法、机器人、终端、服务器及控制系统
CN111145339B (zh) 图像处理方法及装置、设备、存储介质
CN109784351B (zh) 行为数据分类方法、分类模型训练方法及装置
CN111104980B (zh) 确定分类结果的方法、装置、设备及存储介质
WO2022121711A1 (zh) 一种测温方法、装置、设备及系统
CN105959587A (zh) 快门速度获取方法和装置
CN103473253A (zh) 经地理编码的数据的检测及用于其的用户界面
CN114154068A (zh) 媒体内容推荐方法、装置、电子设备及存储介质
CN107330867B (zh) 图像合成方法、装置、计算机可读存储介质和计算机设备
CN110211017B (zh) 图像处理方法、装置及电子设备
US20170249308A1 (en) Image tagging
CN111159551B (zh) 用户生成内容的显示方法、装置及计算机设备
CN111611414B (zh) 车辆检索方法、装置及存储介质
CN111563201A (zh) 内容推送方法、装置、服务器及存储介质
WO2022095906A1 (zh) 一种按键映射方法、电子设备及系统
CN113343709B (zh) 意图识别模型的训练方法、意图识别方法、装置及设备
CN114817709A (zh) 排序方法、装置、设备及计算机可读存储介质
CN115082202A (zh) 用于房屋抵押的信息处理方法、装置、设备及存储介质
CN114897158A (zh) 数据处理模型的训练方法、数据处理方法、装置及设备
JP2023544022A (ja) グループタイプの識別方法、装置、コンピュータ機器及びコンピュータプログラム

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19803792

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19803792

Country of ref document: EP

Kind code of ref document: A1