WO2020134703A1 - Neural network system-based image processing method and neural network system - Google Patents

Neural network system-based image processing method and neural network system Download PDF

Info

Publication number
WO2020134703A1
WO2020134703A1 PCT/CN2019/119211 CN2019119211W WO2020134703A1 WO 2020134703 A1 WO2020134703 A1 WO 2020134703A1 CN 2019119211 W CN2019119211 W CN 2019119211W WO 2020134703 A1 WO2020134703 A1 WO 2020134703A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
image data
image frame
layer
neural network
Prior art date
Application number
PCT/CN2019/119211
Other languages
French (fr)
Chinese (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 WO2020134703A1 publication Critical patent/WO2020134703A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition

Definitions

  • the invention relates to the technical field of image processing, in particular to an image processing method and a neural network system based on a neural network system.
  • the present invention provides a neural network system-based image processing method and neural network system that overcome the above problems or at least partially solve the above problems.
  • an image processing method based on a neural network system for video analysis.
  • the method includes:
  • the neural network system recognizes the currently input image frame and judges whether the currently input image frame is the basic image frame
  • the N-1 convolutional layer of the neural network system sequentially performs calculation processing on the first image data, and outputs the processed second image data to the Nth layer convolutional layer, where N is greater than or equal to 2 An integer of
  • the Nth layer convolutional layer of the neural network system uses the second image data to replace the first intermediate complete data stored in the Nth layer convolutional layer corresponding to the location of the second image data Data to obtain third image data, and the Nth convolutional layer performs calculation processing on the third image data and outputs; wherein, the first intermediate complete data is the basic image frame in the Nth layer The calculation result of the convolution layer.
  • the N-1 convolutional layer of the neural network system sequentially performs calculation processing on the first image data, specifically including:
  • the i-th convolution layer of the neural network system compares the input image data with the second intermediate complete data stored in the i-th convolution layer, and extracts the input image data and the Two fourth image data having different intermediate complete data, and performing calculation processing on the fourth image data.
  • the N-1 convolutional layer of the neural network system sequentially performs calculation processing on the first image data, specifically including:
  • the k-th convolution layer of the neural network system directly performs calculation processing on the first image data.
  • the currently input image frame is not a basic image frame
  • extract first image data in the currently input image frame that is different from the basic image frame and convert the first image data
  • the output to the neural network system specifically includes:
  • the i-th convolution layer of the neural network system compares the input image data with the second intermediate complete data stored in the i-th convolution layer to extract the input image data
  • the fourth image data different from the second intermediate complete data specifically includes:
  • the i-th convolutional layer of the neural network system divides a frame of image into multiple data blocks based on preset image data block division rules
  • the first image Before the data is output to the neural network system it also includes:
  • the i-th convolutional layer of the neural network system compares the input image data with the second intermediate complete data, including:
  • the i-th convolution layer of the neural network system compares the input image data with the image data at the position corresponding to the identifier in the second intermediate complete data.
  • the identification includes: the starting address of the data block where the input image data is located in the entire image, and the size of each data block.
  • the Nth layer convolutional layer of the neural network system uses the second image data to replace the first intermediate complete data stored in the Nth layer convolutional layer with the second image data
  • the data corresponding to the location obtains the third image data, including:
  • the Nth layer convolutional layer of the neural network system replaces the image data of the position corresponding to the identifier in the first intermediate complete data of the Nth layer convolutional layer with the second image data.
  • the N-1 convolutional layer of the neural network system sequentially performs calculation processing on the first image data, including:
  • the nth layer convolutional layer of the neural network system replaces the image data at the position corresponding to the identifier in the intermediate complete data stored in the nth layer with the image data obtained by the calculation process to obtain the completeness of the nth layer Image data, the complete image data is used as the output data of the next convolution layer.
  • the neural network system recognizes the currently input image frame and determines whether the currently input image frame is a basic image frame, including:
  • the currently input image frame is the basic image frame, and in response to the currently input image frame The number of data frames spaced from the last input basic image frame is not equal to the preset number, then the currently input image frame is a non-base image frame; or
  • the currently input image frame In response to the image of the currently input image frame containing a predetermined file identifier, the currently input image frame is a basic image frame, and the image in response to the currently input image frame does not contain a predetermined file Flag, the currently input image frame is a non-base image frame.
  • the method further includes:
  • a neural network system including: an input layer and a multi-layer convolution layer;
  • the input layer is used to identify the currently input image frame and determine whether the currently input image frame is a basic image frame; in response to the currently input image frame not being a basic image frame, extract the currently input image First image data in a frame different from the basic image frame, output the first image data to the multi-layer convolutional layer;
  • the N-1 convolutional layer of the neural network system is used to sequentially perform calculation processing on the first image data, and output the processed second image data to the Nth layer convolutional layer, where N is Integer greater than or equal to 2;
  • the Nth layer convolution layer of the neural network system is used to replace the first intermediate complete data stored in the Nth layer convolution layer with the second image data corresponding to the location of the second image data
  • the Nth convolutional layer performs calculation processing on the third image data and outputs; wherein, the first intermediate complete data is the basic image frame in the Nth The calculation result of the layer convolution layer.
  • the i-th convolution layer of the neural network system is also used to compare the input image data with the second intermediate complete data stored in the i-th convolution layer to extract the input
  • the fourth image data having different image data from the second intermediate complete data is subjected to calculation processing on the fourth image data; wherein, i is an integer less than N.
  • the k-th layer convolution of the neural network system is also used to directly perform calculation processing on the first image data.
  • the input layer is also used to determine that the currently input image frame is not a basic image frame, and divide a frame of image into multiple data blocks based on a preset image data block division rule;
  • the i-th convolutional layer of the neural network system is further used to divide a frame of image into multiple data blocks based on preset image data block division rules;
  • the input layer is also used to identify the location of the data block where the first image data is located;
  • the i-th convolution layer in the multi-layer convolution layer is also used to compare the input image data with the image data at the position of the mark in the second intermediate complete data.
  • the identification information includes: the starting address of the data block where the input image data is located in the entire image, and the size of each data block.
  • the N-th convolution layer in the multi-layer convolution layer is also used to replace the first intermediate complete data of the N-th convolution layer with the second image data.
  • the image data identifying the corresponding position is described.
  • the n-th convolutional layer of the neural network system is also used to replace the intermediate complete data stored in the n-th layer with image data obtained by calculation before outputting data to the next convolutional layer.
  • the image data at the position corresponding to the input identification information obtains the complete image data of the nth layer, and uses the complete image data as the output data of the next convolution layer.
  • the input layer is further configured to respond to that the number of data frames between the currently input image frame and the last input basic image frame is equal to a preset number, then the current input image frame is based Image frames, in response to that the number of data frames between the currently input image frame and the last input basic image frame is not equal to the preset number, the current input image frame is a non-base image frame; or
  • the currently input image frame In response to the image of the currently input image frame containing a predetermined file identifier, the currently input image frame is a basic image frame, and the image in response to the currently input image frame does not contain a predetermined file Flag, the currently input image frame is a non-base image frame.
  • the input layer is also used to determine that the current input image frame is the basic image frame, and input the entire image data of the currently input image frame to the N-layer convolution of the neural network system.
  • the input image data is sequentially calculated by the N-layer convolutional layer, and the image data obtained after the calculation process is stored in each layer of the N-layer convolutional layer.
  • a storage device in which a computer program is stored, and when the computer program runs in an electronic device, the processor of the electronic device loads and executes any of the above Image processing method based on neural network system.
  • an electronic device including:
  • a processor for running computer programs and
  • the storage device is used to store a computer program, and when the computer program is running in the electronic device, the processor loads and executes the image processing method based on any one of the neural network systems described above.
  • the present invention provides an image processing method and neural network system based on a neural network system, which is applied to video analysis.
  • the system extracts difference data by comparing changes between the current frame and the basic image frame, and the difference data only retains the changes
  • the process of image processing only the change information retained in the difference data is input into the neural network system for data analysis and processing; in this way, in each layer of the neural network, the repeated information in the previous and subsequent frames can be hidden, and Only the changed information is calculated, thereby saving a lot of computing resources, reducing unnecessary information transmission, and speeding up the processing speed.
  • each convolutional layer of the neural network system will save a complete set of image data generated during the processing of the basic image frame. Using the stored image data, it can be restored to a complete integer after each layer of processing The image data is compared again as the input data of the next layer, so as to ensure the processing accuracy of the image by the neural network system.
  • FIG. 1 shows a schematic diagram of a conventional neural network-based image processing process
  • FIG. 2 shows a schematic flowchart of an image processing method based on a neural network system according to an embodiment of the present invention
  • FIG. 3 shows a schematic diagram of data block division according to an embodiment of the present invention
  • FIG. 4 shows a schematic diagram of an image processing process based on a neural network system according to another preferred embodiment of the present invention.
  • FIG. 5 shows a schematic flowchart of an image processing method based on a neural network system according to another preferred embodiment of the present invention
  • FIG. 6 shows a schematic structural diagram of an electronic device according to an embodiment of the present invention.
  • Fig. 1 shows a schematic diagram of a conventional neural network-based image processing process.
  • Fig. 1 shows a schematic diagram of a conventional neural network-based image processing process.
  • the basic image frame data is input to the neural network, for a neural network system with three convolutional layers of L1, L2, and L3, for For each frame of image data received, regardless of whether there is a change in the information between each frame of data, each layer of convolution will perform convolution calculation on its entire image data, resulting in the need to process many duplicate data, and it is not effective Discovering the differential information of the data stream itself has low processing efficiency, high energy consumption, and poor economy.
  • FIG. 2 shows a processing flowchart of an image processing method based on a neural network system according to an embodiment of the present invention, which is applied to the analysis of video.
  • the method includes at least step S201 to step S206.
  • Step S201 the neural network system recognizes the currently input image frame and determines whether the currently input image frame is a basic image frame; if the currently input image frame is a basic image frame, step S202 is executed; if the current input Is not the basic image frame, then step S203 is executed.
  • the basic image frame can be determined by, for example, two methods. First, the neural network system determines whether the number of data frames between the currently input image frame and the last input basic image frame is equal to the preset number If it is, the currently input image frame is a basic image frame, if not, the currently input image frame is a non-basic image frame.
  • the preset number is, for example, 3-5 frames, or other number of frames set based on different situations.
  • another judgment method can be adopted for the judgment of the basic image frame, that is, the neural network system judges whether the image of the currently input image frame contains a predetermined file identifier, and if so, the current input image frame is Basic image frame, if not, the currently input image frame is a non-basic image frame. For example, use the frame data when there is no person in the image data as the basic image frame, or use the frame data of a certain object as the basic image frame, etc.
  • the currently input image frame is a basic image frame according to other methods, which is not limited in the present invention.
  • Step S202 the entire image data of the currently input image frame is sequentially input to the N-layer convolutional layer of the neural network system, and the N-layer convolutional layer of the neural network system sequentially calculates the currently input image data Process and store the intermediate complete data after the calculation process in each of the N convolutional layers.
  • the basic image frame is input into the neural network system, and the basic image frame data is calculated in turn by each convolution layer Process and store the corresponding processing results.
  • the storage method may be, for example, storing the image data after the calculation of the specified convolutional layer in the N-layer convolutional layer in a preset storage device, or storing the intermediate complete data of all convolutional layers in the preset storage device.
  • the intermediate complete data in the embodiment of the present invention refers to the data after the basic image frame is calculated and processed in each convolutional layer, that is, the data after the basic image frame is calculated and processed by any convolutional layer of the neural network system can be used as The intermediate complete data of this layer is stored.
  • the preset storage device in the embodiment of the present invention is mainly used to store data, including the weight of each convolutional layer in the neural network system and the calculated intermediate data.
  • the preset storage device may be a self-use memory of each processor core in the many-core system, or may be a common memory provided on a chip carrying each processing core.
  • the many-core system may be a neural network system that allocates a processor core to each layer of convolutional layers, and each processing core has its own memory.
  • Each convolutional layer can calculate intermediate complete data based on the calculation of the basic image frame. Directly stored on the corresponding core storage.
  • Storage devices include, but are not limited to: static random access memory, dynamic random access memory, flash memory, magnetic change memory, resistance change memory, phase change storage, memristor and other non-volatile memories.
  • the calculation processing for each convolutional layer in the neural network system may include one or more of calculation operations such as convolution, pooling, and relu, which are not limited in the present invention.
  • Step S203 Compare the image data of the currently input image frame with the image data of the basic image frame, extract the first image data different from the basic image frame in the currently input image frame, and input the first image data to the neural network system in.
  • the neural network system When the neural network system recognizes that the currently input image frame is not the basic image frame, it compares it with the basic image frame, and uses the image data of the currently input image frame different from the basic image frame as the first image data.
  • the preset image data block division rule may be used to divide the current input image frame into multiple data blocks; compare the data of the corresponding position of the current input image frame with the basic image frame. If the blocks are the same, extract the data blocks in the currently input image frame that are different from the image data at the corresponding positions of the basic image frame, and output the different data blocks as the first image data to the neural network system.
  • the preset image data block in the embodiment of the present invention may be based on the characteristics of the type and pixel size of the frame data included in the video to be analyzed. To divide, set the size of each data block at the same time, and then use data blocks with different image data as the first image data.
  • Fig. 3 schematically shows the block diagram of the image frame data input to the neural network system.
  • the image frame data is equally divided into 56 data blocks.
  • the currently input image frame and basis The difference data K1 of the image frame spans three data blocks.
  • the three data blocks are input as the first image data to the first layer convolution layer of the neural network for convolution processing.
  • Step S204 the N-1 layer convolution layer of the neural network system sequentially performs calculation processing on the first image data, and outputs the processed second image data to the Nth layer convolution layer, where N is an integer greater than or equal to 2, N is the number of convolutional layers included in the neural network system.
  • the first image data may also be directly calculated and processed by the k-th convolution layer of the neural network system.
  • the k-th convolutional layer is any one of the N-1 convolutional layers in the neural network system, where i and k are all integers less than N.
  • step S205 at least one of the N-1 convolutional layers of the neural network system
  • the first layer compares the input image data of this layer with the saved intermediate complete data, extracts the difference data between the input image data of this layer and the saved intermediate complete data, performs the corresponding convolution operation on the difference data and outputs The next convolutional layer.
  • the i-th convolutional layer of the N-1 convolutional layer can compare the input image data with all The intermediate complete data stored in the i-th convolutional layer is compared, fourth image data that is different from the input image data and the stored intermediate complete data is extracted, and calculation processing is performed on the fourth image data.
  • the image frame data input to the neural network system can be partitioned to determine the first image data that is different from the basic image frame.
  • the i-th convolutional layer of the neural network system it can also be based on a preset image
  • the data block division rule divides a frame of image into multiple data blocks; compare whether the data block where the input image data is located is the same as the data block at the corresponding position of the intermediate complete data stored in the current layer, extract the input image data and store the middle
  • the complete data corresponds to data blocks with different image data at positions, and the different data blocks are used as fourth image data.
  • the N-1 convolutional layer of the neural network system can use the preset image data block division rule shown in step S203 to divide the image frame input to the layer into multiple data blocks, and then determine it by the comparison number A data block in which the currently input image data is different from the corresponding position image data in the intermediate complete data stored in the layer, and the data block is used as difference data for calculation processing.
  • the N-1 convolutional layers of the neural network system can all use the preset image data block division rule shown in step S203 to obtain difference data.
  • the neural network system can also identify the position of the data block where the first image data is located, and then the N-1 convolution layer of the neural network system, Based on the comparison between the input data block with the mark and the image data in the stored intermediate complete data corresponding to the mark. Specifically, the input image data and the image data at the position corresponding to the mark in the intermediate complete data stored in the i-th layer can be performed through the i-th convolution layer in the N-1 convolution layer of the neural network system Compare.
  • the identification of the data block is preferably the starting address of the data block and the size of each data block.
  • the calculation of the input image data by each convolutional layer of the neural network system includes but is not limited to convolution operations, Relu, sigmoid, pooling and other operations.
  • the start address can determine the starting position of the data block in the entire image, and the size of the data block determines the data range of the calculation process. The above information can be given when determining the data block. While performing the data calculation process, a And calculate the address information of the image data input to the next layer after processing, and then pack the address information with the output data of the current layer and transmit it to the next convolutional layer together.
  • the address information when calculating the address information, since the length and width of the data block are known parameters, when the coordinate information of the starting point of the data block is given, the addresses of all the data blocks can be calculated.
  • the difference data K1 spans three data blocks.
  • the starting address information of the three data blocks will also enter the convolutional layer of the neural network system with the difference data, and then calculate the corresponding output data address information.
  • the next convolutional layer can obtain the area of the area to be compared, and then quickly match the data block where the input image data identification is located and the intermediate complete data stored in this layer to the identification Compare the image data of the location.
  • the Nth layer convolution layer of the neural network system replaces the image data at the position corresponding to the identifier in the intermediate complete data with the input image data.
  • the image data input by this layer is compared with the saved intermediate complete data, and after obtaining the difference data, the difference data Perform calculations.
  • n-1 convolution layer of the N-1 convolution layer of the neural network system before outputting data to the next convolution layer, you can also use the calculation process to obtain Replaces the image data at the position corresponding to the input identifier in the stored intermediate complete data, and obtains the complete intermediate data of the convolutional layer as the output data of the next convolutional layer, where n is less than N Integer.
  • the data after the calculation and processing of the convolutional layer of this layer can also be replaced by the input intermediate identification in the corresponding stored intermediate complete data
  • the image data corresponding to the position is restored to the complete image data based on the difference data after the calculation process, and then output to the next layer, and then the complete image data is used as the output data of the layer, thereby meeting the requirements for image accuracy.
  • step S204 may only include step S204, or only include step S205, and may also perform step S204 in some layers of the N-1 convolutional layer, and perform step S205 in some layers.
  • S204 and/or S205 may be set and executed according to actual needs.
  • the method provided by the embodiment of the present invention may further include:
  • Step S206 the Nth layer convolutional layer of the neural network system replaces the data corresponding to the position of the second image data in the intermediate complete data stored in the Nth layer convolutional layer with the second image data, thereby obtaining the first Three image data, the third image data is a complete image data, and the third image data is calculated and output.
  • the last convolutional layer replace the data with the difference between the current input image frame and the basic image frame with the intermediate complete data stored in the last convolutional layer to restore a complete image data. Perform the final convolution operation to obtain the complete data of the neural network data processing of the currently input image frame.
  • the second image data can be used to replace the image of the position corresponding to the input identifier in the intermediate complete data stored in the Nth layer convolutional layer Data, get complete image data quickly, and then calculate and output it.
  • An embodiment of the present invention provides a more efficient image processing method based on a neural network system.
  • the image frame that responds to the current input is the basic image frame, and then the convolution process is performed through the neural network system first, and the image that is currently input
  • the frame is not a basic image frame, compare it with the basic image frame to extract the first image data that is different from the current input image frame and the basic image frame, and then input the first image data into the neural network to perform convolution layer operations in sequence.
  • the last layer of the convolutional layer of the neural network system replace the data at the corresponding position in the intermediate complete data stored in this layer with the image data input from this layer to obtain the image data of the new complete image, and calculate the image data And output.
  • the subsequent image data when processing the subsequent image data, information that has not changed in the preceding and subsequent frames is hidden, and only the changed information is processed, which can save a lot of computing resources, reduce unnecessary information transmission, and speed up the processing speed.
  • any intermediate layer of the neural network system can compare the input image data with the intermediate complete data stored in the current layer, extract the difference data, and perform calculation processing on the difference data, therefore, based on the embodiment of the present invention provides The image processing method can further improve the accuracy of image processing, and then meet different image processing needs.
  • the neural network can be based on specific needs. Any layer of the neural network replaces the data at the corresponding position in the stored intermediate complete data according to the difference data after the calculation process, and outputs the replaced entire image data as the output data of this layer to the next layer of convolution layer, thus Does not affect the accuracy of processing. This not only improves efficiency and reduces system power consumption, but also ensures the processing accuracy of the system.
  • the overall image processing flow based on the embodiment of the present invention may include:
  • Step 1 The input layer receives the currently input image frame, determines that the currently input image frame is the basic image frame data (that is, the frame data corresponding to the time t in FIG. 4), then stores the basic image frame and enters it into L1-
  • the L4 convolutional layer performs calculation processing layer by layer in the neural network, and stores the intermediate complete data after calculation processing in each layer;
  • Step 2 The input layer receives the currently input image frame, determines that the currently input image frame is not the basic image frame (that is, the frame data at time t+1 in FIG. 4), and compares the currently input image frame with the basic image frame , Extract the difference data in the current input image frame and the basic image frame, that is, the data in the box in the figure, determine the data block where the difference data is located, and output the difference data block to the L1 convolution layer for calculation processing;
  • Step 3 After the L1 convolution layer calculates and processes the difference data block, the calculated data is input into the L2 convolution layer;
  • Step 4 The L2 convolutional layer compares the image data input by the L1 convolutional layer with the intermediate complete data stored in L2 to obtain the difference data, and determines the data block where the difference data is located, performs calculation processing on the difference data block, and processes the calculation
  • the data is output as L2 output data to the L3 convolution layer;
  • Step 4 the L3 convolutional layer compares the image data input by L2 with the intermediate complete data stored in L3 to obtain the difference data, and determines the data block where the difference data is located, performs calculation processing on the difference data block, and takes the calculated data as
  • the output data of the third layer is output to L4; when the L2 and L3 convolutional layers are calculated, only relevant data that is different from the image data saved in the previous basic image frame data will be input to the system for processing.
  • the so-called relevant data here , Refers to the data associated with the changed data, that is, the data belonging to the same data block;
  • Step 5 fuse the difference data output by L3 with the intermediate complete data of L4, and replace the data at the same position in the intermediate complete data of L4 with the difference data output by L3 to obtain the image data of a new complete image.
  • the image data of the complete image is subjected to calculation processing, and the image data obtained by the calculation processing is output.
  • step 3 or 4 above after L2 or L3 completes the calculation of the difference data block, by replacing the changed data in the image data of the corresponding layer, the convolutional layer can be restored to the image data of the complete image And input to the next layer, and in the next layer can use the image data of the complete image as input data, so as to ensure the accuracy of the algorithm network.
  • an embodiment of the present invention also provides a neural network system, which may include: an input layer and multiple convolution layers;
  • the input layer is used to identify the currently input image frame, and in response to the currently input image frame not being a basic image frame, extract first image data in the currently input image frame that is different from the basic image frame, Output the first image data to the multi-layer convolution layer;
  • the N-1 convolutional layer of the neural network system is used to sequentially perform calculation processing on the first image data and output the processed second image data to the Nth layer convolutional layer, where N is greater than or equal to An integer of 2;
  • the Nth layer convolutional layer of the neural network system is used to replace the data corresponding to the location of the second image data in the first intermediate complete data stored in the Nth layer convolutional layer with the second image data To obtain third image data, and the Nth convolutional layer performs calculation processing on the third image data and outputs; wherein, the first intermediate complete data is that the basic image frame is in the Nth layer volume The calculation result of the layer.
  • the i-th convolution layer of the neural network system is also used to compare the input image data with the second intermediate complete data stored in the i-th convolution layer, Extracting fourth image data that is different from the input image data and the second intermediate complete data, and performing calculation processing on the fourth image data; wherein, i is an integer less than N.
  • the k-th layer convolution of the neural network system is also used to directly perform calculation processing on the first image data.
  • the input layer is also used to determine that the currently input image frame is not a basic image frame, and divide a frame of image into multiple data based on a preset image data block division rule Piece;
  • the i-th convolution layer of the neural network system is further used to divide a frame of image into multiple data blocks based on a preset image data block division rule;
  • the input layer is also used to identify the location of the data block where the first image data is located;
  • the i-th convolution layer in the multi-layer convolution layer is also used to compare the input image data with the image data at the position of the mark in the second intermediate complete data.
  • the identification information includes: the start address of the data block where the input image data is located in the entire image, and the size of each data block.
  • the N-th convolution layer in the multi-layer convolution layer is also used to replace the first intermediate complete data of the N-th convolution layer with the second image data Image data at the position corresponding to the logo in.
  • the n-th convolution layer of the neural network system is also used to replace the n-th convolution layer with image data obtained by calculation before outputting data to the next convolution layer.
  • the image data at the position corresponding to the input identification information in the intermediate complete data stored in the layer obtains the complete image data of the nth layer, and uses the complete image data as the output data of the next convolution layer.
  • the input layer is also used to respond to that the number of data frames between the currently input image frame and the last input basic image frame is equal to the preset number, then the currently input image frame is Basic image frames, in response to the number of data frames between the currently input image frame and the last input basic image frame being not equal to the preset number, the currently input image frame is a non-basic image frame; or
  • the currently input image frame In response to the image of the currently input image frame containing a predetermined file identification, the currently input image frame is the basic image frame, and in response to the image of the currently input image frame not containing a predetermined file identification, the current input The image frame is a non-base image frame.
  • the input layer is also used to determine that the current input image frame is the basic image frame, and all the entire image data of the currently input image frame is input to the neural network system.
  • the input image data is sequentially processed by the N-level convolutional layer, and the image data obtained after the calculation process is stored in each layer of the N-level convolutional layer.
  • an embodiment of the present invention further provides a storage device in which a computer program is stored, and when the computer program is run in an electronic device, the processor of the electronic device loads and executes any of the above embodiments
  • the image processing method based on neural network system.
  • an embodiment of the present invention also provides an electronic device, including:
  • a processor for running computer programs and
  • the storage device is used to store a computer program, and when the computer program is running in the electronic device, the processor loads and executes the image processing method based on the neural network system described in any of the above embodiments.
  • the electronic device of this embodiment includes processing cores 111, 112-11N and a network on chip 121.
  • the convolutional layers in the convolutional neural network are mapped to the processing cores 111-11N, respectively. It should be understood that one convolutional layer may be mapped to multiple processing cores, or multiple convolutional layers may be mapped to one processing core.
  • the processing cores 111-11N are all connected to the on-chip network 121.
  • the on-chip network 121 is used to exchange data between the N processing cores and external data.
  • At least one processing core of the N processing cores executes the image processing method based on the neural network system described in any of the above embodiments.
  • the processing core 111 may further include a memory 111a, an operator 111b, and a controller 111c.
  • the memory 111a can be used to store program codes
  • the operator 111b is used to perform various calculations on the program codes in the electronic device
  • the controller 111c is coupled to the memory 111a and the operator 111b, and controls the data storage of the memory 111a and the operator 111b to the memory 111a, respectively The data in is calculated according to different calculation logics.
  • the embodiments of the present invention can achieve the following beneficial effects:
  • Embodiments of the present invention provide an image processing method and neural network system based on a neural network system, which are applied to video analysis.
  • the system extracts difference data by comparing changes between the current frame and the basic image frame.
  • the difference data is only Retain the changed data information.
  • image processing only the changed information retained in the difference data is input to the neural network system for data analysis and processing; at the same time, in order to maintain the processing accuracy of the system, a complete basic image frame processing process will be saved
  • the intermediate complete data generated in the process is used to perform comparison at each layer after the intermediate complete data is processed, and the affected and changed intermediate data is extracted again as the input data of the next layer.
  • the repeated information in the previous and subsequent frames can be hidden, and only the changed information is calculated, thereby saving a lot of computing resources, reducing unnecessary information transmission, and speeding up the processing speed.
  • modules in the device in the embodiment can be adaptively changed and set in one or more devices different from the embodiment.
  • the modules or units or components in the embodiments may be combined into one module or unit or component, and in addition, they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and/or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstract and drawings) and any methods so disclosed or All processes or units of equipment are combined. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose.
  • the various component embodiments of the present invention may be implemented in hardware, or implemented in software modules running on one or more processors, or implemented in a combination thereof.
  • a microprocessor or a digital signal processor (DSP) may be used to implement some or all functions of some or all components in the neural network system according to an embodiment of the present invention.
  • DSP digital signal processor
  • the present invention may also be implemented as a device or device program (eg, computer program and computer program product) for performing part or all of the method described herein.
  • Such a program implementing the present invention may be stored on a computer-readable medium, or may have the form of one or more signals.
  • Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Image Analysis (AREA)

Abstract

The present invention provides a neural network system-based image processing method and a neural network system, according to the method provided by the present invention, the neural network system recognizes a currently input image frame, and determines whether the currently input image frame is a basic image frame; if yes, a multi-layer convolutional layer of the neural network performs computing processing on the currently input image frame; if not, firstly comparing the currently input image frame with image data of the basic image frame, extracting image data different from the basic image frame, then the multi-layer convolutional layer performs computing processing based on the image data, finally, the last layer of the convolutional layer of the neural network replaces the data calculated and output by the previous layer with the image data of the corresponding position of intermediate complete data stored in the layer to obtain the image data of a new complete image. According to the method provided by the present invention, when the neural network system processes the data, the information with no change in the previous and next frames can be hidden, and only the changed information is processed, which can save a lot of computing resources and speed up the processing speed.

Description

一种基于神经网络系统的图像处理方法及神经网络系统An image processing method and neural network system based on neural network system
本申请要求了2018年12月29日提交的、申请号为201811634090.4、发明名称为“一种基于神经网络系统的图像处理方法及神经网络系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on December 29, 2018 with the application number 201811634090.4 and the invention titled "An Image Processing Method and Neural Network System Based on Neural Network System", the entire contents of which are cited by reference Incorporated in this application.
技术领域Technical field
本发明涉及图像处理技术领域,特别是涉及一种基于神经网络系统的图像处理方法及神经网络系统。The invention relates to the technical field of image processing, in particular to an image processing method and a neural network system based on a neural network system.
背景技术Background technique
当今时代,随着人工智能技术的澎湃发展,其不仅从各个方面影响着人们的生产和生活,同时也推动着世界的发展和进步。为了有效地利用从各个终端采集的信息,对于信息的实时处理要求也不断提高。特别是在安防领域,视频信息的输入量大,计算量大,导致功耗高。然而,多数情况下,视频信息的前后帧之间信息相差并不多,对于传统方案来讲,对视频帧进行处理时,无论帧间信息是否有变化,均会将每帧数据全部输入神经网络系统等算法进行处理,导致需要处理许多重复的数据。In today's era, with the surging development of artificial intelligence technology, it not only affects people's production and life from all aspects, but also promotes the development and progress of the world. In order to effectively use the information collected from each terminal, the requirements for real-time processing of information are also constantly increasing. Especially in the field of security, the input of video information is large and the amount of calculation is large, resulting in high power consumption. However, in most cases, there is not much difference between the information before and after the frame of the video information. For the traditional scheme, when processing the video frame, regardless of whether the information between frames changes, all the data in each frame will be input into the neural network Processing by algorithms such as systems results in the need to process many duplicate data.
发明内容Summary of the invention
鉴于上述问题,本发明提供了一种克服上述问题或至少部分地解决了上述问题的基于神经网络系统的图像处理方法及神经网络系统。In view of the above problems, the present invention provides a neural network system-based image processing method and neural network system that overcome the above problems or at least partially solve the above problems.
根据本发明的一个方面,提供了一种基于神经网络系统的图像处理方法,应用于视频分析,所述方法包括:According to an aspect of the present invention, an image processing method based on a neural network system is provided for video analysis. The method includes:
神经网络系统对当前输入的图像帧进行识别,判断当前输入的图像帧是否为基础图像帧;The neural network system recognizes the currently input image frame and judges whether the currently input image frame is the basic image frame;
响应于所述当前输入的图像帧不是基础图像帧,则提取所述当前输入的图像帧中与所述基础图像帧不同的第一图像数据,将所述第一图像数据输出至所述神经网络系统;In response to that the currently input image frame is not a basic image frame, extract first image data different from the basic image frame in the currently input image frame, and output the first image data to the neural network system;
所述神经网络系统的N-1层卷积层依次对所述第一图像数据进行计算处理,并将处理后的第二图像数据输出至第N层卷积层,所述N为大于等于2的整数;The N-1 convolutional layer of the neural network system sequentially performs calculation processing on the first image data, and outputs the processed second image data to the Nth layer convolutional layer, where N is greater than or equal to 2 An integer of
所述神经网络系统的所述第N层卷积层使用所述第二图像数据替换所述第N层卷积层中存储的第一中间完备数据中与所述第二图像数据所在位置对应的数据,从而得到第三图像数据,所述第N卷积层对所述第三图像数据进行计算处理并输出;其中,所述第一中间完备数据为所述基础图像帧在所述第N层卷积层的计算结果。The Nth layer convolutional layer of the neural network system uses the second image data to replace the first intermediate complete data stored in the Nth layer convolutional layer corresponding to the location of the second image data Data to obtain third image data, and the Nth convolutional layer performs calculation processing on the third image data and outputs; wherein, the first intermediate complete data is the basic image frame in the Nth layer The calculation result of the convolution layer.
可选地,所述神经网络系统的N-1层卷积层依次对所述第一图像数据进行计算处理,具体包括:Optionally, the N-1 convolutional layer of the neural network system sequentially performs calculation processing on the first image data, specifically including:
所述神经网络系统的第i层卷积层将输入的图像数据与所述第i层卷积层中存储的第二中间完备数据进行比较,提取所述输入的所述图像数据与所述第二中间完备数据不同的第四图像数据,对所述第四图像数据进行计算处理。The i-th convolution layer of the neural network system compares the input image data with the second intermediate complete data stored in the i-th convolution layer, and extracts the input image data and the Two fourth image data having different intermediate complete data, and performing calculation processing on the fourth image data.
可选地,所述神经网络系统的N-1层卷积层依次对所述第一图像数据进行计算处理,具体包括:Optionally, the N-1 convolutional layer of the neural network system sequentially performs calculation processing on the first image data, specifically including:
所述神经网络系统的第k层卷积层对所述第一图像数据直接进行计算处理。The k-th convolution layer of the neural network system directly performs calculation processing on the first image data.
可选地,所述响应于所述当前输入的图像帧不是基础图像帧,则提取所述当前输入的图像帧中与所述基础图像帧不同的第一图像数据,将所述第一图像数据输出至所述神经网络系统,具体包括:Optionally, in response to that the currently input image frame is not a basic image frame, extract first image data in the currently input image frame that is different from the basic image frame, and convert the first image data The output to the neural network system specifically includes:
响应于所述当前输入的图像帧不是基础图像帧,则基于预设图像数据块划分规则将一帧图像划分为多个数据块;In response to that the currently input image frame is not a basic image frame, divide a frame of image into multiple data blocks based on a preset image data block division rule;
比较所述当前输入的图像帧的各个数据块与所述基础图像帧对应位置的数据块是否相同,提取所述当前输入的图像帧中与所述基础图像帧对应位置的图像数据不同的数据块,将所述不同的数据块作为所述第一图像数据输出至所述神经网络系统。Comparing whether each data block of the currently input image frame is the same as the data block corresponding to the basic image frame, and extracting data blocks in the current input image frame that are different from the image data of the corresponding position of the basic image frame , Output the different data blocks as the first image data to the neural network system.
可选地,所述神经网络系统的第i层卷积层将输入的图像数据与所述第i层卷积层中存储的第二中间完备数据进行比较,提取所述输入的所述图像数据与所述第二中间完备数据不同的第四图像数据,具体包括:Optionally, the i-th convolution layer of the neural network system compares the input image data with the second intermediate complete data stored in the i-th convolution layer to extract the input image data The fourth image data different from the second intermediate complete data specifically includes:
所述神经网络系统的第i层卷积层基于预设图像数据块划分规则将一帧图像划分为多个数据块;The i-th convolutional layer of the neural network system divides a frame of image into multiple data blocks based on preset image data block division rules;
比较所述输入的图像数据所在数据块与所述第二中间完备数据对应位置的数据块是否相同,提取所述输入的图像数据中与所述第二中间完备数据对应位置的图像数据不同的数据块,将所述不同的数据块作为所述第四图像数据。Comparing whether the data block where the input image data is located is the same as the data block corresponding to the second intermediate complete data, and extracting data in the input image data that is different from the image data corresponding to the second intermediate complete data Block, using the different data block as the fourth image data.
可选地,所述响应于所述当前输入的图像帧不是基础图像帧,则提取所述当前输入的图像帧中与所述基础图像帧不同的第一图像数据之后,将所述第一图像数据输出 至所述神经网络系统之前,还包括:Optionally, in response to the currently input image frame not being a basic image frame, after extracting first image data in the currently input image frame that is different from the basic image frame, the first image Before the data is output to the neural network system, it also includes:
标识所述第一图像数据所在的数据块的位置;Identify the location of the data block where the first image data is located;
所述神经网络系统的第i层卷积层将输入的图像数据与第二中间完备数据进行比较,包括:The i-th convolutional layer of the neural network system compares the input image data with the second intermediate complete data, including:
所述神经网络系统的第i层卷积层将输入的图像数据与所述第二中间完备数据中与所述标识对应的位置的图像数据进行比较。The i-th convolution layer of the neural network system compares the input image data with the image data at the position corresponding to the identifier in the second intermediate complete data.
可选地,所述标识包括:输入的图像数据所在的数据块在整幅图像中的起始地址,以及每个所述数据块的大小。Optionally, the identification includes: the starting address of the data block where the input image data is located in the entire image, and the size of each data block.
可选地,所述神经网络系统的所述第N层卷积层使用所述第二图像数据替换所述第N层卷积层中存储的第一中间完备数据中与所述第二图像数据所在位置对应的数据得到第三图像数据,包括:Optionally, the Nth layer convolutional layer of the neural network system uses the second image data to replace the first intermediate complete data stored in the Nth layer convolutional layer with the second image data The data corresponding to the location obtains the third image data, including:
所述神经网络系统的所述第N层卷积层使用所述第二图像数据替换所述第N层卷积层的所述第一中间完备数据中与所述标识对应的位置的图像数据。The Nth layer convolutional layer of the neural network system replaces the image data of the position corresponding to the identifier in the first intermediate complete data of the Nth layer convolutional layer with the second image data.
可选地,所述神经网络系统的N-1层卷积层依次对所述第一图像数据进行计算处理,包括:Optionally, the N-1 convolutional layer of the neural network system sequentially performs calculation processing on the first image data, including:
所述神经网络系统的第n层卷积层使用计算处理得到的图像数据替换所述第n层存储的中间完备数据中与所述标识对应的位置的图像数据,得到所述第n层的完整的图像数据,将所述完整的图像数据作为向下一次卷积层的输出数据。The nth layer convolutional layer of the neural network system replaces the image data at the position corresponding to the identifier in the intermediate complete data stored in the nth layer with the image data obtained by the calculation process to obtain the completeness of the nth layer Image data, the complete image data is used as the output data of the next convolution layer.
可选地,所述神经网络系统对当前输入的图像帧进行识别,判断当前输入的图像帧是否为基础图像帧,包括:Optionally, the neural network system recognizes the currently input image frame and determines whether the currently input image frame is a basic image frame, including:
响应于所述当前输入的图像帧与上一个输入的基础图像帧间隔的数据帧的数量等于预设数量,则所述当前输入的图像帧为基础图像帧,响应于所述当前输入的图像帧与上一个输入的基础图像帧间隔的数据帧的数量不等于预设数量,则所述当前输入的图像帧为非基础图像帧;或In response to that the number of data frames between the currently input image frame and the last input basic image frame is equal to a preset number, the currently input image frame is the basic image frame, and in response to the currently input image frame The number of data frames spaced from the last input basic image frame is not equal to the preset number, then the currently input image frame is a non-base image frame; or
响应于所述当前输入的图像帧的图像中包含有预定的文件标识,则所述当前输入的图像帧为基础图像帧,响应于所述当前输入的图像帧的图像中不包含有预定的文件标识,则所述当前输入的图像帧为非基础图像帧。In response to the image of the currently input image frame containing a predetermined file identifier, the currently input image frame is a basic image frame, and the image in response to the currently input image frame does not contain a predetermined file Flag, the currently input image frame is a non-base image frame.
可选地,所述方法还包括:Optionally, the method further includes:
响应于所述当前输入的图像帧为基础图像帧,则将所述当前输入的图像帧的整幅图像数据全部输入到神经网络系统的N层卷积层,由N层所述卷积层对输入的图像数 据依次进行计算处理,并在N层所述卷积层的每一层存储计算处理后得到的图像数据。In response to the currently input image frame being the basic image frame, all the entire image data of the currently input image frame is input to the N-layer convolutional layer of the neural network system, and the N-layer convolutional layer pairs The input image data is sequentially calculated, and the image data obtained after the calculation process is stored in each of the N layers of the convolutional layer.
根据本发明的另一个方面,还提供了一种神经网络系统,包括:输入层和多层卷积层;According to another aspect of the present invention, a neural network system is also provided, including: an input layer and a multi-layer convolution layer;
所述输入层,用于对当前输入的图像帧进行识别,判断当前输入的图像帧是否为基础图像帧;响应于所述当前输入的图像帧不是基础图像帧,则提取所述当前输入的图像帧中与所述基础图像帧不同的第一图像数据,将所述第一图像数据输出至所述多层卷积层;The input layer is used to identify the currently input image frame and determine whether the currently input image frame is a basic image frame; in response to the currently input image frame not being a basic image frame, extract the currently input image First image data in a frame different from the basic image frame, output the first image data to the multi-layer convolutional layer;
所述神经网络系统的N-1层卷积层,用于依次对所述第一图像数据进行计算处理,并将处理后的第二图像数据输出至第N层卷积层,所述N为大于等于2的整数;The N-1 convolutional layer of the neural network system is used to sequentially perform calculation processing on the first image data, and output the processed second image data to the Nth layer convolutional layer, where N is Integer greater than or equal to 2;
所述神经网络系统的第N层卷积层,用于使用所述第二图像数据替换所述第N层卷积层中存储的第一中间完备数据中与所述第二图像数据所在位置对应的数据,从而得到第三图像数据,所述第N卷积层对所述第三图像数据进行计算处理并输出;其中,所述第一中间完备数据为所述基础图像帧在所述第N层卷积层的计算结果。The Nth layer convolution layer of the neural network system is used to replace the first intermediate complete data stored in the Nth layer convolution layer with the second image data corresponding to the location of the second image data To obtain third image data, the Nth convolutional layer performs calculation processing on the third image data and outputs; wherein, the first intermediate complete data is the basic image frame in the Nth The calculation result of the layer convolution layer.
可选地,所述神经网络系统的第i层卷积层,还用于将输入的图像数据与所述第i层卷积层中存储的第二中间完备数据进行比较,提取所述输入的所述图像数据与所述第二中间完备数据不同的第四图像数据,对所述第四图像数据进行计算处理;其中,所述i为小于N的整数。Optionally, the i-th convolution layer of the neural network system is also used to compare the input image data with the second intermediate complete data stored in the i-th convolution layer to extract the input The fourth image data having different image data from the second intermediate complete data is subjected to calculation processing on the fourth image data; wherein, i is an integer less than N.
可选地,所述神经网络系统的第k层卷积,还用于对所述第一图像数据直接进行计算处理。Optionally, the k-th layer convolution of the neural network system is also used to directly perform calculation processing on the first image data.
可选地,所述输入层,还用于判断所述当前输入的图像帧不是基础图像帧时,基于预设图像数据块划分规则将一帧图像划分为多个数据块;Optionally, the input layer is also used to determine that the currently input image frame is not a basic image frame, and divide a frame of image into multiple data blocks based on a preset image data block division rule;
比较所述当前输入的图像帧的各个数据块与所述基础图像帧对应位置的数据块是否相同,提取所述当前输入的图像帧中与所述基础图像帧对应位置的图像数据不同的数据块,将所述不同的数据块作为所述第一图像数据输出至所述神经网络系统。Comparing whether each data block of the currently input image frame is the same as the data block corresponding to the basic image frame, and extracting data blocks in the current input image frame that are different from the image data of the corresponding position of the basic image frame , Output the different data blocks as the first image data to the neural network system.
可选地,所述神经网络系统的第i层卷积层,还用于基于预设图像数据块划分规则将一帧图像划分为多个数据块;Optionally, the i-th convolutional layer of the neural network system is further used to divide a frame of image into multiple data blocks based on preset image data block division rules;
比较所述输入的图像数据所在数据块与所述第二中间完备数据对应位置的数据块是否相同,提取所述输入的图像数据中与所述第二中间完备数据对应位置的图像数据不同的数据块,将所述不同的数据块作为所述第四图像数据。Comparing whether the data block where the input image data is located is the same as the data block corresponding to the second intermediate complete data, and extracting data in the input image data that is different from the image data corresponding to the second intermediate complete data Block, using the different data block as the fourth image data.
可选地,所述输入层,还用于标识所述第一图像数据所在的数据块的位置;Optionally, the input layer is also used to identify the location of the data block where the first image data is located;
所述多层卷积层中的第i层卷积层,还用于将输入的图像数据与所述第二中间完备数据中与所述标识的位置的图像数据进行比较。The i-th convolution layer in the multi-layer convolution layer is also used to compare the input image data with the image data at the position of the mark in the second intermediate complete data.
可选地,所述标识信息包括:输入的图像数据所在的数据块在整幅图像中的起始地址,以及所述每个数据块的大小。Optionally, the identification information includes: the starting address of the data block where the input image data is located in the entire image, and the size of each data block.
可选地,所述多层卷积层中的第N层卷积层,还用于使用所述第二图像数据替换所述第N层卷积层的所述第一中间完备数据中与所述标识对应的位置的图像数据。Optionally, the N-th convolution layer in the multi-layer convolution layer is also used to replace the first intermediate complete data of the N-th convolution layer with the second image data. The image data identifying the corresponding position is described.
可选地,所述神经网络系统的第n层卷积层,还用于向下一层卷积层输出数据之前,使用计算处理得到的图像数据替换所述第n层存储的中间完备数据中与输入的标识信息对应的位置的图像数据,得到所述第n层的完整的图像数据,将所述完整的图像数据作为向下一次卷积层的输出数据。Optionally, the n-th convolutional layer of the neural network system is also used to replace the intermediate complete data stored in the n-th layer with image data obtained by calculation before outputting data to the next convolutional layer. The image data at the position corresponding to the input identification information obtains the complete image data of the nth layer, and uses the complete image data as the output data of the next convolution layer.
可选地,所述输入层,还用于响应于所述当前输入的图像帧与上一个输入的基础图像帧间隔的数据帧的数量等于预设数量,则所述当前输入的图像帧为基础图像帧,响应于所述当前输入的图像帧与上一个输入的基础图像帧间隔的数据帧的数量不等于预设数量,则述当前输入的图像帧为非基础图像帧;或Optionally, the input layer is further configured to respond to that the number of data frames between the currently input image frame and the last input basic image frame is equal to a preset number, then the current input image frame is based Image frames, in response to that the number of data frames between the currently input image frame and the last input basic image frame is not equal to the preset number, the current input image frame is a non-base image frame; or
响应于所述当前输入的图像帧的图像中包含有预定的文件标识,则所述当前输入的图像帧为基础图像帧,响应于所述当前输入的图像帧的图像中不包含有预定的文件标识,则所述当前输入的图像帧为非基础图像帧。In response to the image of the currently input image frame containing a predetermined file identifier, the currently input image frame is a basic image frame, and the image in response to the currently input image frame does not contain a predetermined file Flag, the currently input image frame is a non-base image frame.
可选地,所述输入层,还用于判断所述当前输入的图像帧为基础图像帧时,将所述当前输入的图像帧的整幅图像数据全部输入到神经网络系统的N层卷积层,由N层卷积层对输入的图像数据依次进行计算处理,并在N层卷积层的每一层存储计算处理后得到的图像数据。Optionally, the input layer is also used to determine that the current input image frame is the basic image frame, and input the entire image data of the currently input image frame to the N-layer convolution of the neural network system. In the layer, the input image data is sequentially calculated by the N-layer convolutional layer, and the image data obtained after the calculation process is stored in each layer of the N-layer convolutional layer.
根据本发明的另一个方面,还提供了一种存储设备,其中存储有计算机程序,所述计算机程序在电子设备中运行时,由所述电子设备的处理器加载并执行上述任一项所述的基于神经网络系统的图像处理方法。According to another aspect of the present invention, there is also provided a storage device in which a computer program is stored, and when the computer program runs in an electronic device, the processor of the electronic device loads and executes any of the above Image processing method based on neural network system.
根据本发明的另一个方面,还提供了一种电子设备,包括:According to another aspect of the present invention, an electronic device is also provided, including:
处理器,用于运行计算机程序;以及A processor for running computer programs; and
存储设备,用于存储计算机程序,所述计算机程序在所述电子设备中运行时由处理器加载并执行上述任一项所述的基于神经网络系统的图像处理方法。The storage device is used to store a computer program, and when the computer program is running in the electronic device, the processor loads and executes the image processing method based on any one of the neural network systems described above.
本发明提供了一种基于神经网络系统的图像处理方法及神经网络系统,应用于视频分析,该系统通过比对当前帧和基础图像帧之间的变化,提取出差异数据,差异数 据只保留变化了的数据信息,在图像处理时,只将差异数据中保留的变化信息输入神经网络系统进行数据分析处理;这样,在神经网络的每一层中,可以隐去前后帧中重复的信息,而只计算改变的信息,由此节省大量的计算资源,降低不必要的信息传输,加快处理速度。另外,还可以在神经网络系统的每层卷积层将保存一份完备的基础图像帧处理过程中产生的图像数据,利用该存储的图像数据,可在每一层处理后恢复为完整的整幅图像数据再次进行比对作为下一层的输入数据,从而保证神经网络系统对图像的处理精度。The present invention provides an image processing method and neural network system based on a neural network system, which is applied to video analysis. The system extracts difference data by comparing changes between the current frame and the basic image frame, and the difference data only retains the changes In the process of image processing, only the change information retained in the difference data is input into the neural network system for data analysis and processing; in this way, in each layer of the neural network, the repeated information in the previous and subsequent frames can be hidden, and Only the changed information is calculated, thereby saving a lot of computing resources, reducing unnecessary information transmission, and speeding up the processing speed. In addition, each convolutional layer of the neural network system will save a complete set of image data generated during the processing of the basic image frame. Using the stored image data, it can be restored to a complete integer after each layer of processing The image data is compared again as the input data of the next layer, so as to ensure the processing accuracy of the image by the neural network system.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solutions of the present invention. In order to understand the technical means of the present invention more clearly, it can be implemented in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more obvious and understandable The specific embodiments of the present invention are listed below.
根据下文结合附图对本发明具体实施例的详细描述,本领域技术人员将会更加明了本发明的上述以及其他目的、优点和特征。According to the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will understand more about the above and other objects, advantages, and features of the present invention.
附图说明BRIEF DESCRIPTION
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:By reading the detailed description of the preferred embodiments below, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only for the purpose of showing the preferred embodiments, and are not considered to limit the present invention. Furthermore, throughout the drawings, the same reference symbols are used to denote the same components. In the drawings:
图1示出了传统基于神经网络的图像处理过程示意图;FIG. 1 shows a schematic diagram of a conventional neural network-based image processing process;
图2示出了根据本发明一个实施例的基于神经网络系统的图像处理方法流程示意;2 shows a schematic flowchart of an image processing method based on a neural network system according to an embodiment of the present invention;
图3示出了根据本发明实施例的数据块划分示意图;FIG. 3 shows a schematic diagram of data block division according to an embodiment of the present invention;
图4示出了根据本发明另一个优选实施例的基于神经网络系统的图像处理过程示意图;4 shows a schematic diagram of an image processing process based on a neural network system according to another preferred embodiment of the present invention;
图5示出了根据本发明另一个优选实施例的基于神经网络系统的图像处理方法流程示意图;5 shows a schematic flowchart of an image processing method based on a neural network system according to another preferred embodiment of the present invention;
图6示出了根据本发明实施例的电子设备的结构示意图。FIG. 6 shows a schematic structural diagram of an electronic device according to an embodiment of the present invention.
具体实施方式detailed description
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本 公开的范围完整的传达给本领域的技术人员。Hereinafter, exemplary embodiments of the present disclosure will be described in more detail with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
图1示出传统的基于神经网络的图像处理过程示意图,由图1可知,将基础图像帧数据输入神经网络后,对于具有L1、L2、L3三层卷积层的神经网络系统来讲,对于接收到的每一帧图像数据,不管各帧数据之间的信息是否有变化,每一层卷积均会对其整幅图像数据进行卷积计算,导致需要处理许多重复的数据,而且未有效发掘数据流本身的差分信息,处理效率低,能耗高,经济性差。Fig. 1 shows a schematic diagram of a conventional neural network-based image processing process. As can be seen from Fig. 1, after the basic image frame data is input to the neural network, for a neural network system with three convolutional layers of L1, L2, and L3, for For each frame of image data received, regardless of whether there is a change in the information between each frame of data, each layer of convolution will perform convolution calculation on its entire image data, resulting in the need to process many duplicate data, and it is not effective Discovering the differential information of the data stream itself has low processing efficiency, high energy consumption, and poor economy.
图2示出了根据本发明实施例的基于神经网络系统的图像处理方法的处理流程图,应用于视频的分析,参见图2,该方法至少包括步骤S201至步骤S206。FIG. 2 shows a processing flowchart of an image processing method based on a neural network system according to an embodiment of the present invention, which is applied to the analysis of video. Referring to FIG. 2, the method includes at least step S201 to step S206.
步骤S201,神经网络系统对当前输入的图像帧进行识别,判断当前输入的图像帧是否为基础图像帧;如果所述当前输入的图像帧为基础图像帧,则执行步骤S202;如果所述当前输入的图像帧不为基础图像帧,则执行步骤S203。Step S201, the neural network system recognizes the currently input image frame and determines whether the currently input image frame is a basic image frame; if the currently input image frame is a basic image frame, step S202 is executed; if the current input Is not the basic image frame, then step S203 is executed.
在本实施例中,基础图像帧例如可以通过两种方式进行判断,第一,由神经网络系统判断当前输入的图像帧与上一个输入的基础图像帧间隔的数据帧的数量是否等于预设数量,如果是,则当前输入的图像帧为基础图像帧,如果否,则当前输入的图像帧为非基础图像帧。所述预设数量例如为3-5帧,或是基于不同情况设定的其他数量帧。In this embodiment, the basic image frame can be determined by, for example, two methods. First, the neural network system determines whether the number of data frames between the currently input image frame and the last input basic image frame is equal to the preset number If it is, the currently input image frame is a basic image frame, if not, the currently input image frame is a non-basic image frame. The preset number is, for example, 3-5 frames, or other number of frames set based on different situations.
可选地,对于基础图像帧的判断还可以采用另外一种判断方式,即神经网络系统判断当前输入的图像帧的图像中是否包含有预定的文件标识,如果有,则当前输入的图像帧为基础图像帧,如果否,则当前输入的图像帧为非基础图像帧。例如:以图像数据中没有人时的帧数据作为基础图像帧、或者以某一个具有固有物体的帧数据作为基础图像帧等等。Optionally, another judgment method can be adopted for the judgment of the basic image frame, that is, the neural network system judges whether the image of the currently input image frame contains a predetermined file identifier, and if so, the current input image frame is Basic image frame, if not, the currently input image frame is a non-basic image frame. For example, use the frame data when there is no person in the image data as the basic image frame, or use the frame data of a certain object as the basic image frame, etc.
实际应用中,还可以根据其他方式对当前输入的图像帧是否为基础图像帧进行判断,本发明不做限定。In practical applications, it can also be determined whether the currently input image frame is a basic image frame according to other methods, which is not limited in the present invention.
步骤S202,将当前输入的图像帧的整幅图像数据依次输入到神经网络系统的N层卷积层,由神经网络系统的N层所述卷积层对所述当前输入的图像数据依次进行计算处理,并在N层卷积层的每一层存储计算处理后的中间完备数据。需要说明的是,对视频进行分析过程中,当判断当前输入的图像帧为基础图像帧时,则将基础图像帧输入神经网络系统中,由各个卷积层依次对该基础图像帧数据进行计算处理并存储相应的处理结果。存储的方式例如可以为:将N层卷积层中指定卷积层的计算处理后的图像数据存储在预设存储设备中,或将所有卷积层的中间完备数据存储在预设存储设 备。本发明实施例中的中间完备数据是指,基础图像帧在每个卷积层进行计算处理后的数据,即基础图像帧经由神经网络系统的任意一层卷积层计算处理后的数据可作为该层的中间完备数据进行存储。Step S202, the entire image data of the currently input image frame is sequentially input to the N-layer convolutional layer of the neural network system, and the N-layer convolutional layer of the neural network system sequentially calculates the currently input image data Process and store the intermediate complete data after the calculation process in each of the N convolutional layers. It should be noted that during the analysis of the video, when it is judged that the currently input image frame is the basic image frame, the basic image frame is input into the neural network system, and the basic image frame data is calculated in turn by each convolution layer Process and store the corresponding processing results. The storage method may be, for example, storing the image data after the calculation of the specified convolutional layer in the N-layer convolutional layer in a preset storage device, or storing the intermediate complete data of all convolutional layers in the preset storage device. The intermediate complete data in the embodiment of the present invention refers to the data after the basic image frame is calculated and processed in each convolutional layer, that is, the data after the basic image frame is calculated and processed by any convolutional layer of the neural network system can be used as The intermediate complete data of this layer is stored.
本发明实施例的预设存储设备主要用来存储数据,包括神经网络系统中各卷积层的权重和计算的中间数据。预设的存储设备可以为众核系统中的各个处理器核的自用存储器,也可以为设置于承载各处理核的芯片上的公用存储器。其中,众核系统可以是神经网络系统中为每层卷积层分配一个处理器核,每个处理核具有自己的存储器,每层卷积层基于基础图像帧的计算处理后的中间完备数据可以直接存储在相应的核内存储上。存储设备包括但不限于:静态随机存取存储器,动态随机存取存储器,闪存,磁变存储器、阻变存储器、相变存储、忆阻器等非易失性存储器等。而对于神经网络系统中每层卷积层的计算处理可以包括:卷积、pooling、relu等计算操作中的一种或多种,本发明对此不做限定。The preset storage device in the embodiment of the present invention is mainly used to store data, including the weight of each convolutional layer in the neural network system and the calculated intermediate data. The preset storage device may be a self-use memory of each processor core in the many-core system, or may be a common memory provided on a chip carrying each processing core. Among them, the many-core system may be a neural network system that allocates a processor core to each layer of convolutional layers, and each processing core has its own memory. Each convolutional layer can calculate intermediate complete data based on the calculation of the basic image frame. Directly stored on the corresponding core storage. Storage devices include, but are not limited to: static random access memory, dynamic random access memory, flash memory, magnetic change memory, resistance change memory, phase change storage, memristor and other non-volatile memories. The calculation processing for each convolutional layer in the neural network system may include one or more of calculation operations such as convolution, pooling, and relu, which are not limited in the present invention.
步骤S203,将当前输入的图像帧的图像数据与基础图像帧的图像数据进行比较,提取当前输入的图像帧中与基础图像帧不同的第一图像数据,将第一图像数据输入到神经网络系统中。Step S203: Compare the image data of the currently input image frame with the image data of the basic image frame, extract the first image data different from the basic image frame in the currently input image frame, and input the first image data to the neural network system in.
神经网络系统识别出当前输入的图像帧不是基础图像帧时,会将其与基础图像帧进行比较,将当前输入的图像帧不同于基础图像帧的图像数据作为第一图像数据。When the neural network system recognizes that the currently input image frame is not the basic image frame, it compares it with the basic image frame, and uses the image data of the currently input image frame different from the basic image frame as the first image data.
具体进行比较时,例如可以采用预设图像数据块划分规则将当前输入的图像帧这一帧图像划分为多个数据块;比较当前输入的图像帧的各个数据块与基础图像帧对应位置的数据块是否相同,提取所述当前输入的图像帧中与基础图像帧对应位置的图像数据不同的数据块,将上述不同的数据块作为第一图像数据输出至神经网络系统。For specific comparison, for example, the preset image data block division rule may be used to divide the current input image frame into multiple data blocks; compare the data of the corresponding position of the current input image frame with the basic image frame. If the blocks are the same, extract the data blocks in the currently input image frame that are different from the image data at the corresponding positions of the basic image frame, and output the different data blocks as the first image data to the neural network system.
对于同一待分析视频来讲,其每一帧数据的像素大小是相同的,因此,本发明实施例中的预设图像数据块可以基于待分析视频包含的帧数据的类型及像素大小等特征属性来划分,同时设定每一个数据块大小,进而将图像数据不同的数据块作为第一图像数据。For the same video to be analyzed, the pixel size of each frame of data is the same. Therefore, the preset image data block in the embodiment of the present invention may be based on the characteristics of the type and pixel size of the frame data included in the video to be analyzed. To divide, set the size of each data block at the same time, and then use data blocks with different image data as the first image data.
图3示意性地示出了输入神经网络系统的图像帧数据的分块示意图,参见图3可知,图像帧数据被等分为56个数据块,在图3中,当前输入的图像帧和基础图像帧的差异数据K1横跨三个数据块,此时将该三个数据块作为第一图像数据输入神经网络的第1层卷积层进行卷积处理。Fig. 3 schematically shows the block diagram of the image frame data input to the neural network system. Referring to Fig. 3, it can be seen that the image frame data is equally divided into 56 data blocks. In Fig. 3, the currently input image frame and basis The difference data K1 of the image frame spans three data blocks. At this time, the three data blocks are input as the first image data to the first layer convolution layer of the neural network for convolution processing.
步骤S204,神经网络系统的N-1层卷积层依次对第一图像数据进行计算处理,并 将处理后的第二图像数据输出至第N层卷积层,N为大于等于2的整数,N为神经网络系统包含的卷积层的层数。另外,还可以由神经网络系统的第k层卷积层对第一图像数据直接进行计算处理。其中,第k层卷积层为神经网络系统中N-1层卷积层中的任意一层,其中,i,k均为小于N的整数。Step S204, the N-1 layer convolution layer of the neural network system sequentially performs calculation processing on the first image data, and outputs the processed second image data to the Nth layer convolution layer, where N is an integer greater than or equal to 2, N is the number of convolutional layers included in the neural network system. In addition, the first image data may also be directly calculated and processed by the k-th convolution layer of the neural network system. The k-th convolutional layer is any one of the N-1 convolutional layers in the neural network system, where i and k are all integers less than N.
除此之外,为了进一步提升当前输入的图像帧与基础图像帧的图像的差异数据的处理精度,可选的,还可以包括步骤S205,神经网络系统的N-1层卷积层中的至少一层将该层输入的图像数据与已保存的中间完备数据相比较,提取该层输入的图像数据与已保存的中间完备数据不同的差异数据,对该差异数据执行对应的卷积运算并输出之下一个卷积层。In addition, in order to further improve the processing accuracy of the image difference data between the currently input image frame and the basic image frame, optionally, it may further include step S205, at least one of the N-1 convolutional layers of the neural network system The first layer compares the input image data of this layer with the saved intermediate complete data, extracts the difference data between the input image data of this layer and the saved intermediate complete data, performs the corresponding convolution operation on the difference data and outputs The next convolutional layer.
也就是说,在神经网络系统的N-1层卷积层依次对第一图像数据进行计算处理时,N-1层卷积层中的第i层卷积层可以将输入的图像数据与所述第i层卷积层中存储的中间完备数据进行比较,提取输入的图像数据与存储的中间完备数据不同的第四图像数据,对第四图像数据进行计算处理。That is to say, when the N-1 convolutional layer of the neural network system sequentially calculates the first image data, the i-th convolutional layer of the N-1 convolutional layer can compare the input image data with all The intermediate complete data stored in the i-th convolutional layer is compared, fourth image data that is different from the input image data and the stored intermediate complete data is extracted, and calculation processing is performed on the fourth image data.
上文介绍,可对输入神经网络系统的图像帧数据进行分块以确定与基础图像帧具备差异性的第一图像数据,对于神经网络系统的第i层卷积层,还可以基于预设图像数据块划分规则将一帧图像划分为多个数据块;比较输入的图像数据所在数据块与当前层对应存储的中间完备数据对应位置的数据块是否相同,提取输入的图像数据中与存储的中间完备数据对应位置的图像数据不同的数据块,将所述不同的数据块作为第四图像数据。进一步的,神经网络系统的N-1层卷积层均可以采用如步骤S203所示的预设图像数据块划分规则对该层输入的图像帧划分为多个数据块,进而通过对比数确定出当前输入的图像数据与该层存储的中间完备数据中对应位置图像数据不同的数据块,将所述数据块作为差异数据进行计算处理。As mentioned above, the image frame data input to the neural network system can be partitioned to determine the first image data that is different from the basic image frame. For the i-th convolutional layer of the neural network system, it can also be based on a preset image The data block division rule divides a frame of image into multiple data blocks; compare whether the data block where the input image data is located is the same as the data block at the corresponding position of the intermediate complete data stored in the current layer, extract the input image data and store the middle The complete data corresponds to data blocks with different image data at positions, and the different data blocks are used as fourth image data. Further, the N-1 convolutional layer of the neural network system can use the preset image data block division rule shown in step S203 to divide the image frame input to the layer into multiple data blocks, and then determine it by the comparison number A data block in which the currently input image data is different from the corresponding position image data in the intermediate complete data stored in the layer, and the data block is used as difference data for calculation processing.
进一步的,神经网络系统的N-1层卷积层均可以采用如步骤S203所示的预设图像数据块划分规则来获取差异数据。Further, the N-1 convolutional layers of the neural network system can all use the preset image data block division rule shown in step S203 to obtain difference data.
可选地,为了更加准确地对差异数据进行定位及计算,神经网络系统的还可以对第一图像数据所在的数据块的位置进行标识,进而由神经网络系统的N-1层卷积层,依据输入的具有标识的数据块与存储的中间完备数据中与该标识对应位置的图像数据进行比较。具体的,可通过神经网络系统的N-1层卷积层中的第i层卷积层将输入的图像数据与第i层存储的中间完备数据中与所述标识对应的位置的图像数据进行比较。Optionally, in order to more accurately locate and calculate the difference data, the neural network system can also identify the position of the data block where the first image data is located, and then the N-1 convolution layer of the neural network system, Based on the comparison between the input data block with the mark and the image data in the stored intermediate complete data corresponding to the mark. Specifically, the input image data and the image data at the position corresponding to the mark in the intermediate complete data stored in the i-th layer can be performed through the i-th convolution layer in the N-1 convolution layer of the neural network system Compare.
在本实施例中,数据块的标识优选为数据块的起始地址以及每个数据块的大小。对各数据块进行标识时,可先在整幅图像帧数据中选取起始点并设置起始坐标信息;结合起始坐标信息以及数据块的大小,确定差异数据所在数据块在整幅图像帧中的地址信息。也就是说,当确定了差异数据所在的数据块后,会将差异数据所在的数据块进行标识,进而确定数据块在待处理图像帧的地址,其中,选择的数据块包括所述差异数据,也即差异数据作为标识后的数据块的子集,从而可以提高计算准确性。In this embodiment, the identification of the data block is preferably the starting address of the data block and the size of each data block. When identifying each data block, you can first select the starting point in the entire image frame data and set the starting coordinate information; combine the starting coordinate information and the size of the data block to determine the data block where the difference data is located in the entire image frame Address information. That is, when the data block where the difference data is located is identified, the data block where the difference data is located is identified, and then the address of the data block in the image frame to be processed is determined, wherein the selected data block includes the difference data, That is, the difference data is used as a subset of the identified data blocks, so that the calculation accuracy can be improved.
神经网络系统各卷积层对输入的图像数据的计算包括但不限于卷积操作、Relu、sigmoid、pooling等运算。起始地址可以确定数据块在整幅图像的起始位置,而数据块大小决定了所进行计算处理的数据范围,上述信息可在确定数据块时给出,在进行数据计算处理的同时,一并计算出处理后的输入到下一层图像数据的地址信息,进而将地址信息与当前层的输出数据打包,共同传输至下一卷积层。The calculation of the input image data by each convolutional layer of the neural network system includes but is not limited to convolution operations, Relu, sigmoid, pooling and other operations. The start address can determine the starting position of the data block in the entire image, and the size of the data block determines the data range of the calculation process. The above information can be given when determining the data block. While performing the data calculation process, a And calculate the address information of the image data input to the next layer after processing, and then pack the address information with the output data of the current layer and transmit it to the next convolutional layer together.
在计算地址信息时,由于数据块的长和宽为已知参数,当给定数据块起始点的坐标信息时,所有数据块的地址都可以被推算出来。在图3中差异数据K1,横跨三个数据块。三个数据块的起始地址信息也会随差异数据进入神经网络系统的卷积层,然后计算出对应的输出数据地址信息。When calculating the address information, since the length and width of the data block are known parameters, when the coordinate information of the starting point of the data block is given, the addresses of all the data blocks can be calculated. In FIG. 3, the difference data K1 spans three data blocks. The starting address information of the three data blocks will also enter the convolutional layer of the neural network system with the difference data, and then calculate the corresponding output data address information.
下一层卷积层接收到所输入的图像数据之后,就能获取到需要对比区域范围,进而快速将输入的图像数据的标识所在的数据块与该层存储的中间完备数据中与该标识对应位置的图像数据进行比较。最后由神经网络系统的第N层卷积层使用输入的图像数据替换所述中间完备数据中与所述标识对应的位置的图像数据。After receiving the input image data, the next convolutional layer can obtain the area of the area to be compared, and then quickly match the data block where the input image data identification is located and the intermediate complete data stored in this layer to the identification Compare the image data of the location. Finally, the Nth layer convolution layer of the neural network system replaces the image data at the position corresponding to the identifier in the intermediate complete data with the input image data.
在上述实施例中,当判断当前输入的图像帧为基础图像帧之后,会将其输入到神经网络系统中的每层卷积层进行计算处理,并对应存储各卷积层对基础图像帧处理后的中间完备数据,因此,对于神经网络系统的N-1层卷积层中的至少一层将该层输入的图像数据与已保存的中间完备数据相比较,获取差异数据后,对差异数据进行运算。In the above embodiment, after determining that the currently input image frame is the basic image frame, it will be input to each convolutional layer in the neural network system for calculation processing, and correspondingly stored each convolutional layer to process the basic image frame After the intermediate complete data, therefore, for at least one of the N-1 convolutional layers of the neural network system, the image data input by this layer is compared with the saved intermediate complete data, and after obtaining the difference data, the difference data Perform calculations.
也就是说,除上文介绍的之外,对于神经网络系统的N-1层卷积层中的第n层卷积层在向下一层卷积层输出数据之前,还可以使用计算处理得到的图像数据替换存储的中间完备数据中与输入的标识对应的位置的图像数据,得到该卷积层的完整的中间数据并作为向下一次卷积层的输出数据,其中,n为小于N的整数。也就是说,对于神经网络系统除最后一层卷积层的任意一层卷积层,还可以将经过该层卷积层计算处理后的数据替换对应存储的中间完备数据中与输入的标识所在位置对应的图像数据,以基于计算处理后的差异数据恢复成完整的图像数据后输出至下一层,进而将完整的 图像数据作为该层的输出数据,从而满足对图像精度的要求。In other words, in addition to the above, for the n-1 convolution layer of the N-1 convolution layer of the neural network system, before outputting data to the next convolution layer, you can also use the calculation process to obtain Replaces the image data at the position corresponding to the input identifier in the stored intermediate complete data, and obtains the complete intermediate data of the convolutional layer as the output data of the next convolutional layer, where n is less than N Integer. In other words, for the neural network system, in addition to any convolutional layer of the last convolutional layer, the data after the calculation and processing of the convolutional layer of this layer can also be replaced by the input intermediate identification in the corresponding stored intermediate complete data The image data corresponding to the position is restored to the complete image data based on the difference data after the calculation process, and then output to the next layer, and then the complete image data is used as the output data of the layer, thereby meeting the requirements for image accuracy.
需要说明的是,本发明实施例可以仅包括步骤S204,或仅包括步骤S205,还可以在N-1层卷积层中的一些层执行步骤S204,一些层执行步骤S205,本发明对此不做限定,可以根据实际需要设定执行S204和/或S205。It should be noted that the embodiment of the present invention may only include step S204, or only include step S205, and may also perform step S204 in some layers of the N-1 convolutional layer, and perform step S205 in some layers. For limitation, S204 and/or S205 may be set and executed according to actual needs.
最后,参见图2可知,本发明实施例提供的方法还可以包括:Finally, referring to FIG. 2, the method provided by the embodiment of the present invention may further include:
步骤S206,神经网络系统的第N层卷积层使用所述第二图像数据替换所述第N层卷积层存储的中间完备数据中与所述第二图像数据位置对应的数据,从而得到第三图像数据,所述第三图像数据为一幅完整的图像数据,对所述第三图像数据进行计算处理并输出。Step S206, the Nth layer convolutional layer of the neural network system replaces the data corresponding to the position of the second image data in the intermediate complete data stored in the Nth layer convolutional layer with the second image data, thereby obtaining the first Three image data, the third image data is a complete image data, and the third image data is calculated and output.
在最后一层卷积层,将当前输入的图像帧与基础图像帧中具有差异的数据替换最后一层卷积层中存储的中间完备数据,以恢复为一个完整的图像数据,对该图像数据进行最后的卷积运算,从而获得当前输入的图像帧的神经网络的数据处理的完整数据。同样地,对于神经网络系统的第N层卷积层在恢复完整数据时,可使用第二图像数据替换所述第N层卷积层存储的中间完备数据中与输入的标识对应的位置的图像数据,以快的得到完整的图像数据,进而对其计算处理后输出。In the last convolutional layer, replace the data with the difference between the current input image frame and the basic image frame with the intermediate complete data stored in the last convolutional layer to restore a complete image data. Perform the final convolution operation to obtain the complete data of the neural network data processing of the currently input image frame. Similarly, for the Nth layer convolutional layer of the neural network system when recovering complete data, the second image data can be used to replace the image of the position corresponding to the input identifier in the intermediate complete data stored in the Nth layer convolutional layer Data, get complete image data quickly, and then calculate and output it.
本发明实施例提供了一种更加高效地基于神经网络系统的图像处理方法,首先响应于当前输入的图像帧为基础图像帧,则先通过神经网络系统进行卷积处理,响应于当前输入的图像帧不为基础图像帧,则将其与基础图像帧进行比较,提取当前输入的图像帧与基础图像帧不同的第一图像数据,进而将第一图像数据输入神经网络的依次进行卷积层运算,在神经网络系统的最后一层卷积层,使用该层输入的图像数据替换该层存储的中间完备数据中对应位置处的数据,得到新的完整图像的图像数据,对该图像数据进行计算并输出。在本发明实施例中,对后续图像数据进行处理时,隐去前后帧中没有变化的信息,只处理变化的信息,可以节省大量的计算资源,降低不必要的信息传输,加快处理速度。An embodiment of the present invention provides a more efficient image processing method based on a neural network system. First, the image frame that responds to the current input is the basic image frame, and then the convolution process is performed through the neural network system first, and the image that is currently input If the frame is not a basic image frame, compare it with the basic image frame to extract the first image data that is different from the current input image frame and the basic image frame, and then input the first image data into the neural network to perform convolution layer operations in sequence. , In the last layer of the convolutional layer of the neural network system, replace the data at the corresponding position in the intermediate complete data stored in this layer with the image data input from this layer to obtain the image data of the new complete image, and calculate the image data And output. In the embodiment of the present invention, when processing the subsequent image data, information that has not changed in the preceding and subsequent frames is hidden, and only the changed information is processed, which can save a lot of computing resources, reduce unnecessary information transmission, and speed up the processing speed.
进一步的,由于在神经网络系统的中间任意层都可以将输入的图像数据与当前层存储的中间完备数据进行比较,提取差异数据,并对差异数据进行计算处理,因此,基于本发明实施例提供的图像处理方法可以更进一步的提升图像处理的精准度,进而满足不同的图像处理需求。Further, since any intermediate layer of the neural network system can compare the input image data with the intermediate complete data stored in the current layer, extract the difference data, and perform calculation processing on the difference data, therefore, based on the embodiment of the present invention provides The image processing method can further improve the accuracy of image processing, and then meet different image processing needs.
除上述介绍的之外,由于基于基础图像帧计算处理后的中间完备数据也会对应神经网络系统中各层卷积层进行存储,因此,在本实施例中,神经网络可以根据具体需 求,在神经网络的任意层根据计算处理后的差异数据替换所存储的中间完备数据中对应位置的数据,并将替换后的整幅图像数据做为该层输出数据输出至下一层卷积层,从而不影响处理的精度。这样不仅可以提高效率、降低系统功耗,还能确保系统的处理精度。In addition to the above introduction, since the intermediate complete data calculated and processed based on the basic image frame will also be stored corresponding to the convolutional layers of the neural network system, therefore, in this embodiment, the neural network can be based on specific needs. Any layer of the neural network replaces the data at the corresponding position in the stored intermediate complete data according to the difference data after the calculation process, and outputs the replaced entire image data as the output data of this layer to the next layer of convolution layer, thus Does not affect the accuracy of processing. This not only improves efficiency and reduces system power consumption, but also ensures the processing accuracy of the system.
图4、图5分别示出了根据本发明的基于神经网络系统的图像处理过程及方法流程示意图。结合图4、图5可知,本实施例中的神经网络系统包括L1、L2、L3、L4共四层卷积层,其中L1卷积层可同时作为输入层。基于本发明实施例的图像处理流程整体可以包括:4 and 5 respectively show schematic diagrams of the image processing process and method based on the neural network system of the present invention. It can be known with reference to FIGS. 4 and 5 that the neural network system in this embodiment includes a total of four convolutional layers L1, L2, L3, and L4, where the L1 convolutional layer can be used as an input layer at the same time. The overall image processing flow based on the embodiment of the present invention may include:
步骤1,输入层接收当前输入的图像帧,判断当前输入的图像帧为基础图像帧数据(即图4中t时刻对应的帧数据),则存储该基础图像帧,并将其依次输入L1-L4卷积层,在神经网络中逐层进行计算处理,并在每层存储计算处理后的中间完备数据;Step 1: The input layer receives the currently input image frame, determines that the currently input image frame is the basic image frame data (that is, the frame data corresponding to the time t in FIG. 4), then stores the basic image frame and enters it into L1- The L4 convolutional layer performs calculation processing layer by layer in the neural network, and stores the intermediate complete data after calculation processing in each layer;
步骤2,输入层接收当前输入的图像帧,判断当前输入的图像帧不是基础图像帧(即图4中的t+1时刻的帧数据),则将当前输入的图像帧与基础图像帧进行比较,提取当前输入的图像帧中与基础图像帧不同的差异数据,即图中方框中的数据,确定该差异数据所在的数据块,将差异数据块输出至L1卷积层进行计算处理;Step 2: The input layer receives the currently input image frame, determines that the currently input image frame is not the basic image frame (that is, the frame data at time t+1 in FIG. 4), and compares the currently input image frame with the basic image frame , Extract the difference data in the current input image frame and the basic image frame, that is, the data in the box in the figure, determine the data block where the difference data is located, and output the difference data block to the L1 convolution layer for calculation processing;
步骤3,L1卷积层对差异数据块计算处理后,将计算处理后的数据输入L2卷积层;Step 3: After the L1 convolution layer calculates and processes the difference data block, the calculated data is input into the L2 convolution layer;
步骤4,L2卷积层将L1卷积层输入的图像数据与L2存储的中间完备数据进行比较获得差异数据,并确定差异数据所在数据块,对差异数据块进行计算处理,并将计算处理后的数据作为L2的输出数据后输出至L3卷积层;Step 4. The L2 convolutional layer compares the image data input by the L1 convolutional layer with the intermediate complete data stored in L2 to obtain the difference data, and determines the data block where the difference data is located, performs calculation processing on the difference data block, and processes the calculation The data is output as L2 output data to the L3 convolution layer;
步骤4,L3卷积层将L2输入的图像数据与L3存储的中间完备数据进行比较获得差异数据,并确定差异数据所在数据块,对差异数据块进行计算处理,并将计算处理后的数据作为第三层的输出数据后输出至L4;L2、L3卷积层进行计算处理时,只有与之前基础图像帧数据保存的图像数据不同的相关数据才会被输入系统进行处理,这里所谓的相关数据,是指与变化数据有关联的数据,即属于同一数据块的数据;Step 4, the L3 convolutional layer compares the image data input by L2 with the intermediate complete data stored in L3 to obtain the difference data, and determines the data block where the difference data is located, performs calculation processing on the difference data block, and takes the calculated data as The output data of the third layer is output to L4; when the L2 and L3 convolutional layers are calculated, only relevant data that is different from the image data saved in the previous basic image frame data will be input to the system for processing. The so-called relevant data here , Refers to the data associated with the changed data, that is, the data belonging to the same data block;
步骤5,将L3输出的差异数据与L4的中间完备数据融合,用L3输出的差异数据替换L4的中间完备数据中相同位置处的数据,得到一幅新的完整图像的图像数据,对新的完整图像的图像数据进行计算处理,输出计算处理得到的图像数据。Step 5, fuse the difference data output by L3 with the intermediate complete data of L4, and replace the data at the same position in the intermediate complete data of L4 with the difference data output by L3 to obtain the image data of a new complete image. The image data of the complete image is subjected to calculation processing, and the image data obtained by the calculation processing is output.
另外,在上述步骤3或4中,L2或L3完成对差异数据块计算处理后,通过在相应层的图像数据中替换有变化的数据,则可以在该卷积层恢复成完整图像的图像数据 并输入至下一层,进而在下一层可使用完整图像的图像数据作为输入数据,从而可以保证算法网络的精度。In addition, in step 3 or 4 above, after L2 or L3 completes the calculation of the difference data block, by replacing the changed data in the image data of the corresponding layer, the convolutional layer can be restored to the image data of the complete image And input to the next layer, and in the next layer can use the image data of the complete image as input data, so as to ensure the accuracy of the algorithm network.
基于同一发明构思,本发明实施例还提供了一种神经网络系统,可以包括:输入层和多层卷积层;Based on the same inventive concept, an embodiment of the present invention also provides a neural network system, which may include: an input layer and multiple convolution layers;
输入层,用于对当前输入的图像帧进行识别,响应于当前输入的图像帧不为基础图像帧,则提取所述当前输入的图像帧中与所述基础图像帧不同的第一图像数据,将所述第一图像数据输出至所述多层卷积层;The input layer is used to identify the currently input image frame, and in response to the currently input image frame not being a basic image frame, extract first image data in the currently input image frame that is different from the basic image frame, Output the first image data to the multi-layer convolution layer;
神经网络系统的N-1层卷积层,用于依次对所述第一图像数据进行计算处理,并将处理后的第二图像数据输出至第N层卷积层,所述N为大于等于2的整数;The N-1 convolutional layer of the neural network system is used to sequentially perform calculation processing on the first image data and output the processed second image data to the Nth layer convolutional layer, where N is greater than or equal to An integer of 2;
神经网络系统的第N层卷积层,用于使用所述第二图像数据替换所述第N层卷积层中存储的第一中间完备数据中与所述第二图像数据所在位置对应的数据,从而得到第三图像数据,所述第N卷积层对所述第三图像数据进行计算处理并输出;其中,所述第一中间完备数据为所述基础图像帧在所述第N层卷积层的计算结果。The Nth layer convolutional layer of the neural network system is used to replace the data corresponding to the location of the second image data in the first intermediate complete data stored in the Nth layer convolutional layer with the second image data To obtain third image data, and the Nth convolutional layer performs calculation processing on the third image data and outputs; wherein, the first intermediate complete data is that the basic image frame is in the Nth layer volume The calculation result of the layer.
在本发明的一个可选实施例中,神经网络系统的第i层卷积层,还用于将输入的图像数据与所述第i层卷积层中存储的第二中间完备数据进行比较,提取所述输入的所述图像数据与所述第二中间完备数据不同的第四图像数据,对所述第四图像数据进行计算处理;其中,所述i为小于N的整数。In an optional embodiment of the present invention, the i-th convolution layer of the neural network system is also used to compare the input image data with the second intermediate complete data stored in the i-th convolution layer, Extracting fourth image data that is different from the input image data and the second intermediate complete data, and performing calculation processing on the fourth image data; wherein, i is an integer less than N.
在本发明的一个可选实施例中,所述神经网络系统的第k层卷积,还用于对所述第一图像数据直接进行计算处理。In an optional embodiment of the present invention, the k-th layer convolution of the neural network system is also used to directly perform calculation processing on the first image data.
在本发明的一个可选实施例中,所述输入层,还用于判断所述当前输入的图像帧不是基础图像帧时,基于预设图像数据块划分规则将一帧图像划分为多个数据块;In an optional embodiment of the present invention, the input layer is also used to determine that the currently input image frame is not a basic image frame, and divide a frame of image into multiple data based on a preset image data block division rule Piece;
比较所述当前输入的图像帧的各个数据块与所述基础图像帧对应位置的数据块是否相同,提取所述当前输入的图像帧中与所述基础图像帧对应位置的图像数据不同的数据块,将所述不同的数据块作为所述第一图像数据输出至所述神经网络系统。Comparing whether each data block of the currently input image frame is the same as the data block corresponding to the basic image frame, and extracting data blocks in the current input image frame that are different from the image data of the corresponding position of the basic image frame , Output the different data blocks as the first image data to the neural network system.
在本发明的一个可选实施例中,所述神经网络系统的第i层卷积层,还用于基于预设图像数据块划分规则将一帧图像划分为多个数据块;In an optional embodiment of the present invention, the i-th convolution layer of the neural network system is further used to divide a frame of image into multiple data blocks based on a preset image data block division rule;
比较所述输入的图像数据所在数据块与所述第二中间完备数据对应位置的数据块是否相同,提取所述输入的图像数据中与所述第二中间完备数据对应位置的图像数据不同的数据块,将所述不同的数据块作为所述第四图像数据。Comparing whether the data block where the input image data is located is the same as the data block corresponding to the second intermediate complete data, and extracting data in the input image data that is different from the image data corresponding to the second intermediate complete data Block, using the different data block as the fourth image data.
在本发明的一个可选实施例中,所述输入层,还用于标识所述第一图像数据所在 的数据块的位置;In an optional embodiment of the present invention, the input layer is also used to identify the location of the data block where the first image data is located;
多层卷积层中的第i层卷积层,还用于将输入的图像数据与第二中间完备数据中与所述标识的位置的图像数据进行比较。The i-th convolution layer in the multi-layer convolution layer is also used to compare the input image data with the image data at the position of the mark in the second intermediate complete data.
在本发明的一个可选实施例中,所述标识信息包括:输入的图像数据所在的数据块在整幅图像中的起始地址,以及每个数据块的大小。In an optional embodiment of the present invention, the identification information includes: the start address of the data block where the input image data is located in the entire image, and the size of each data block.
在本发明的一个可选实施例中,多层卷积层中的第N层卷积层,还用于使用所述第二图像数据替换所述第N层卷积层的第一中间完备数据中与所述标识对应的位置的图像数据。In an optional embodiment of the present invention, the N-th convolution layer in the multi-layer convolution layer is also used to replace the first intermediate complete data of the N-th convolution layer with the second image data Image data at the position corresponding to the logo in.
在本发明的一个可选实施例中,所述神经网络系统的第n层卷积层,还用于向下一层卷积层输出数据之前,使用计算处理得到的图像数据替换所述第n层存储的中间完备数据中与输入的标识信息对应的位置的图像数据,得到所述第n层的完整的图像数据,将所述完整的图像数据作为向下一次卷积层的输出数据。In an optional embodiment of the present invention, the n-th convolution layer of the neural network system is also used to replace the n-th convolution layer with image data obtained by calculation before outputting data to the next convolution layer. The image data at the position corresponding to the input identification information in the intermediate complete data stored in the layer obtains the complete image data of the nth layer, and uses the complete image data as the output data of the next convolution layer.
在本发明的一个可选实施例中,输入层,还用于响应于当前输入的图像帧与上一个输入的基础图像帧间隔的数据帧的数量等于预设数量,则当前输入的图像帧为基础图像帧,响应于当前输入的图像帧与上一个输入的基础图像帧间隔的数据帧的数量不等于预设数量,则当前输入的图像帧为非基础图像帧;或In an optional embodiment of the present invention, the input layer is also used to respond to that the number of data frames between the currently input image frame and the last input basic image frame is equal to the preset number, then the currently input image frame is Basic image frames, in response to the number of data frames between the currently input image frame and the last input basic image frame being not equal to the preset number, the currently input image frame is a non-basic image frame; or
响应于当前输入的图像帧的图像中包含有预定的文件标识,则当前输入的图像帧为基础图像帧,响应于当前输入的图像帧的图像中不包含有预定的文件标识,则当前输入的图像帧为非基础图像帧。In response to the image of the currently input image frame containing a predetermined file identification, the currently input image frame is the basic image frame, and in response to the image of the currently input image frame not containing a predetermined file identification, the current input The image frame is a non-base image frame.
在本发明的一个可选实施例中,输入层,还用于判断所述当前输入的图像帧为基础图像帧时,将所述当前输入的图像帧的整幅图像数据全部输入到神经网络系统的N层卷积层,由N层卷积层对输入的图像数据依次进行计算处理,并在N层卷积层的每一层存储计算处理后得到的图像数据。In an optional embodiment of the present invention, the input layer is also used to determine that the current input image frame is the basic image frame, and all the entire image data of the currently input image frame is input to the neural network system. In the N-level convolutional layer, the input image data is sequentially processed by the N-level convolutional layer, and the image data obtained after the calculation process is stored in each layer of the N-level convolutional layer.
基于同一发明构思,本发明实施例还提供了一种存储设备,其中存储有计算机程序,所述计算机程序在电子设备中运行时,由所述电子设备的处理器加载并执行上述任一实施例所述的基于神经网络系统的图像处理方法。Based on the same inventive concept, an embodiment of the present invention further provides a storage device in which a computer program is stored, and when the computer program is run in an electronic device, the processor of the electronic device loads and executes any of the above embodiments The image processing method based on neural network system.
基于同一发明构思,本发明实施例还提供了一种电子设备,包括:Based on the same inventive concept, an embodiment of the present invention also provides an electronic device, including:
处理器,用于运行计算机程序;以及A processor for running computer programs; and
存储设备,用于存储计算机程序,所述计算机程序在所述电子设备中运行时由处理器加载并执行上述任一实施例所述的基于神经网络系统的图像处理方法。The storage device is used to store a computer program, and when the computer program is running in the electronic device, the processor loads and executes the image processing method based on the neural network system described in any of the above embodiments.
图6是本发明实施例的电子设备的示意图。如图所示,本实施例的电子设备包括处理核111、112-11N以及片上网络121。其中,卷积神经网络中的卷积层分别映射到处理核111-11N。应理解,可以将一个卷积层映射到多个处理核,也可以将多个卷积层映射到一个处理核。6 is a schematic diagram of an electronic device according to an embodiment of the invention. As shown in the figure, the electronic device of this embodiment includes processing cores 111, 112-11N and a network on chip 121. Among them, the convolutional layers in the convolutional neural network are mapped to the processing cores 111-11N, respectively. It should be understood that one convolutional layer may be mapped to multiple processing cores, or multiple convolutional layers may be mapped to one processing core.
处理核111-11N均与片上网络121连接。片上网络121用于交互所述N个处理核间的数据和外部数据。所述N个处理核中的至少一个处理核执行上述任一实施例所述的基于神经网络系统的图像处理方法。The processing cores 111-11N are all connected to the on-chip network 121. The on-chip network 121 is used to exchange data between the N processing cores and external data. At least one processing core of the N processing cores executes the image processing method based on the neural network system described in any of the above embodiments.
另外,继续参见图6可知,处理核111还可以包括存储器111a,运算器111b和控制器111c。存储器111a可用于存储程序代码,运算器111b用于电子设备中的程序代码进行多种计算,控制器111c与存储器111a和运算器111b耦合,分别控制存储器111a的数据存储和运算器111b对存储器111a中的数据根据不同的运算逻辑进行数据运算。In addition, referring to FIG. 6 continuously, the processing core 111 may further include a memory 111a, an operator 111b, and a controller 111c. The memory 111a can be used to store program codes, the operator 111b is used to perform various calculations on the program codes in the electronic device, the controller 111c is coupled to the memory 111a and the operator 111b, and controls the data storage of the memory 111a and the operator 111b to the memory 111a, respectively The data in is calculated according to different calculation logics.
根据上述任意一个可选实施例或多个可选实施例的组合,本发明实施例能够达到如下有益效果:According to any one of the foregoing optional embodiments or a combination of multiple optional embodiments, the embodiments of the present invention can achieve the following beneficial effects:
本发明实施例提供了一种基于神经网络系统的图像处理方法及神经网络系统,应用于视频分析,该系统通过比对当前帧和基础图像帧之间的变化,提取出差异数据,差异数据只保留变化了的数据信息,在图像处理时,只将差异数据中保留的变化信息输入神经网络系统进行数据分析处理;同时,为维持系统的处理精度,将保存一份完备的基础图像帧处理过程中产生的中间完备数据,利用该中间完备数据在每一层处理后,再次进行比对,并将受影响而变化了的中间数据再提取出来,作为下一层的输入数据。这样,不仅在神经网络的每一层中,可以隐去前后帧中重复的信息,只计算改变的信息,由此节省大量的计算资源,降低不必要的信息传输,加快处理速度。另一方面,还可以根据具体需求,在神经网络的任意一层恢复成完整的图像数据,将这些完整的图像数据输入后续层进行处理分析,从而保证神经网络系统对图像的处理精度。Embodiments of the present invention provide an image processing method and neural network system based on a neural network system, which are applied to video analysis. The system extracts difference data by comparing changes between the current frame and the basic image frame. The difference data is only Retain the changed data information. During image processing, only the changed information retained in the difference data is input to the neural network system for data analysis and processing; at the same time, in order to maintain the processing accuracy of the system, a complete basic image frame processing process will be saved The intermediate complete data generated in the process is used to perform comparison at each layer after the intermediate complete data is processed, and the affected and changed intermediate data is extracted again as the input data of the next layer. In this way, not only in each layer of the neural network, the repeated information in the previous and subsequent frames can be hidden, and only the changed information is calculated, thereby saving a lot of computing resources, reducing unnecessary information transmission, and speeding up the processing speed. On the other hand, according to specific requirements, it is possible to restore complete image data at any layer of the neural network, and input these complete image data into subsequent layers for processing and analysis, so as to ensure the processing accuracy of the image by the neural network system.
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。The specification provided here explains a lot of specific details. However, it can be understood that the embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this description.
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图: 即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it should be understood that in order to streamline the disclosure and help understand one or more of the various inventive aspects, in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together into a single embodiment, Figure, or its description. However, the disclosed method should not be interpreted as reflecting the following intention: that is, the claimed invention requires more features than those explicitly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, where each claim itself serves as a separate embodiment of the present invention.
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art can understand that the modules in the device in the embodiment can be adaptively changed and set in one or more devices different from the embodiment. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition, they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and/or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstract and drawings) and any methods so disclosed or All processes or units of equipment are combined. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose.
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。In addition, those skilled in the art can understand that although some of the embodiments described herein include certain features included in other embodiments instead of other features, the combination of features of different embodiments is meant to be within the scope of the present invention And form different embodiments. For example, in the claims, any one of the claimed embodiments can be used in any combination.
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的神经网络系统中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the present invention may be implemented in hardware, or implemented in software modules running on one or more processors, or implemented in a combination thereof. Those skilled in the art should understand that, in practice, a microprocessor or a digital signal processor (DSP) may be used to implement some or all functions of some or all components in the neural network system according to an embodiment of the present invention. The present invention may also be implemented as a device or device program (eg, computer program and computer program product) for performing part or all of the method described herein. Such a program implementing the present invention may be stored on a computer-readable medium, or may have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干 个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-mentioned embodiments illustrate the present invention rather than limit the present invention, and those skilled in the art can design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs between parentheses should not be constructed as limitations on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "one" before an element does not exclude the presence of multiple such elements. The invention can be realized by means of hardware including several different elements and by means of a suitably programmed computer. In the unit claims enumerating several devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third does not indicate any order. These words can be interpreted as names.
至此,本领域技术人员应认识到,虽然本文已详尽示出和描述了本发明的多个示例性实施例,但是,在不脱离本发明精神和范围的情况下,仍可根据本发明公开的内容直接确定或推导出符合本发明原理的许多其他变型或修改。因此,本发明的范围应被理解和认定为覆盖了所有这些其他变型或修改。By now, those skilled in the art should realize that although a number of exemplary embodiments of the present invention have been shown and described in detail herein, they can still be disclosed according to the present invention without departing from the spirit and scope of the present invention. The content directly determines or derives many other variations or modifications that conform to the principles of the present invention. Therefore, the scope of the present invention should be understood and deemed to cover all these other variations or modifications.

Claims (14)

  1. 一种基于神经网络系统的图像处理方法,应用于视频分析,所述方法包括:An image processing method based on a neural network system is applied to video analysis. The method includes:
    神经网络系统对当前输入的图像帧进行识别,判断当前输入的图像帧是否为基础图像帧;The neural network system recognizes the currently input image frame and judges whether the currently input image frame is the basic image frame;
    响应于所述当前输入的图像帧不是基础图像帧,则提取所述当前输入的图像帧中与所述基础图像帧不同的第一图像数据,将所述第一图像数据输出至所述神经网络系统;In response to that the currently input image frame is not a basic image frame, extract first image data different from the basic image frame in the currently input image frame, and output the first image data to the neural network system;
    所述神经网络系统的N-1层卷积层依次对所述第一图像数据进行计算处理,并将处理后的第二图像数据输出至第N层卷积层,所述N为大于等于2的整数;The N-1 convolutional layer of the neural network system sequentially performs calculation processing on the first image data, and outputs the processed second image data to the Nth layer convolutional layer, where N is greater than or equal to 2 An integer of
    所述神经网络系统的所述第N层卷积层使用所述第二图像数据替换所述第N层卷积层中存储的第一中间完备数据中与所述第二图像数据所在位置对应的数据,从而得到第三图像数据,所述第N卷积层对所述第三图像数据进行计算处理并输出;其中,所述第一中间完备数据为所述基础图像帧在所述第N层卷积层的计算结果。The Nth layer convolutional layer of the neural network system uses the second image data to replace the first intermediate complete data stored in the Nth layer convolutional layer corresponding to the location of the second image data Data to obtain third image data, and the Nth convolutional layer performs calculation processing on the third image data and outputs; wherein, the first intermediate complete data is the basic image frame in the Nth layer The calculation result of the convolution layer.
  2. 根据权利要求1所述的方法,其中,所述神经网络系统的N-1层卷积层依次对所述第一图像数据进行计算处理,具体包括:The method according to claim 1, wherein the N-1 convolutional layer of the neural network system sequentially performs calculation processing on the first image data, specifically including:
    所述神经网络系统的第i层卷积层将输入的图像数据与所述第i层卷积层中存储的第二中间完备数据进行比较,提取所述输入的所述图像数据与所述第二中间完备数据不同的第四图像数据,对所述第四图像数据进行计算处理。The i-th convolution layer of the neural network system compares the input image data with the second intermediate complete data stored in the i-th convolution layer, and extracts the input image data and the Two fourth image data having different intermediate complete data, and performing calculation processing on the fourth image data.
  3. 根据权利要求1或2所述的方法,其中,所述神经网络系统的N-1层卷积层依次对所述第一图像数据进行计算处理,具体包括:The method according to claim 1 or 2, wherein the N-1 convolutional layer of the neural network system sequentially performs calculation processing on the first image data, specifically including:
    所述神经网络系统的第k层卷积层对所述第一图像数据直接进行计算处理。The k-th convolution layer of the neural network system directly performs calculation processing on the first image data.
  4. 根据权利要求1-3任一项所述的方法,其中,所述响应于所述当前输入的图像帧不是基础图像帧,则提取所述当前输入的图像帧中与所述基础图像帧不同的第一图像数据,将所述第一图像数据输出至所述神经网络系统,具体包括:The method according to any one of claims 1 to 3, wherein, in response to the currently input image frame is not a basic image frame, extracting the current input image frame that is different from the basic image frame The first image data, outputting the first image data to the neural network system, specifically includes:
    响应于所述当前输入的图像帧不是基础图像帧,则基于预设图像数据块划分规则将一帧图像划分为多个数据块;In response to that the currently input image frame is not a basic image frame, divide a frame of image into multiple data blocks based on a preset image data block division rule;
    比较所述当前输入的图像帧的各个数据块与所述基础图像帧对应位置的数据块是否相同,提取所述当前输入的图像帧中与所述基础图像帧对应位置的图像数据不同的数据块,将所述不同的数据块作为所述第一图像数据输出至所述神经网络系统。Comparing whether each data block of the currently input image frame is the same as the data block corresponding to the basic image frame, and extracting data blocks in the current input image frame that are different from the image data of the corresponding position of the basic image frame , Output the different data blocks as the first image data to the neural network system.
  5. 根据权利要求2所述的方法,其中,所述神经网络系统的第i层卷积层将输 入的图像数据与所述第i层卷积层中存储的第二中间完备数据进行比较,提取所述输入的所述图像数据与所述第二中间完备数据不同的第四图像数据,具体包括:The method according to claim 2, wherein the i-th convolutional layer of the neural network system compares the input image data with the second intermediate complete data stored in the i-th convolutional layer to extract all The fourth image data in which the input image data is different from the second intermediate complete data specifically includes:
    所述神经网络系统的所述第i层卷积层基于预设图像数据块划分规则将一帧图像划分为多个数据块;The i-th convolutional layer of the neural network system divides a frame of image into multiple data blocks based on preset image data block division rules;
    比较所述输入的图像数据所在数据块与所述第二中间完备数据对应位置的数据块是否相同,提取所述输入的图像数据中与所述第二中间完备数据对应位置的图像数据不同的数据块,将所述不同的数据块作为所述第四图像数据。Comparing whether the data block where the input image data is located is the same as the data block corresponding to the second intermediate complete data, and extracting data in the input image data that is different from the image data corresponding to the second intermediate complete data Block, using the different data block as the fourth image data.
  6. 根据权利要求5所述的方法,其中,所述响应于所述当前输入的图像帧不是基础图像帧,则提取所述当前输入的图像帧中与所述基础图像帧不同的第一图像数据之后,将所述第一图像数据输出至所述神经网络系统之前,还包括:The method according to claim 5, wherein the image frame responsive to the current input is not a basic image frame, after extracting first image data different from the basic image frame in the currently input image frame Before outputting the first image data to the neural network system, further including:
    标识所述第一图像数据所在的数据块的位置;Identify the location of the data block where the first image data is located;
    所述神经网络系统的所述第i层卷积层将输入的图像数据与第二中间完备数据进行比较,包括:The i-th convolutional layer of the neural network system compares the input image data with the second intermediate complete data, including:
    所述神经网络系统的所述第i层卷积层将输入的图像数据与所述第二中间完备数据中与所述标识对应的位置的图像数据进行比较。The i-th convolutional layer of the neural network system compares the input image data with the image data of the position corresponding to the identifier in the second intermediate complete data.
  7. 根据权利要求6所述的方法,其中,所述标识包括:输入的图像数据所在的数据块在整幅图像中的起始地址,以及每个所述数据块的大小。The method according to claim 6, wherein the identification comprises: a start address of a data block where the input image data is located in the entire image, and a size of each data block.
  8. 根据权利要求6或7所述的方法,其中,所述神经网络系统的所述第N层卷积层使用所述第二图像数据替换所述第N层卷积层中存储的第一中间完备数据中与所述第二图像数据所在位置对应的数据得到第三图像数据,包括:The method according to claim 6 or 7, wherein the Nth layer convolutional layer of the neural network system replaces the first intermediate completeness stored in the Nth layer convolutional layer with the second image data The data corresponding to the location of the second image data in the data to obtain the third image data includes:
    所述神经网络系统的所述第N层卷积层使用所述第二图像数据替换所述第N层卷积层的所述第一中间完备数据中与所述标识对应的位置的图像数据。The Nth layer convolutional layer of the neural network system replaces the image data of the position corresponding to the identifier in the first intermediate complete data of the Nth layer convolutional layer with the second image data.
  9. 根据权利要求2,4-8任一项所述的方法,其中,所述神经网络系统的N-1层卷积层依次对所述第一图像数据进行计算处理,包括:The method according to any one of claims 2, 4-8, wherein the N-1 convolutional layer of the neural network system sequentially performs calculation processing on the first image data, including:
    所述神经网络系统的第n层卷积层使用计算处理得到的图像数据替换所述第n层存储的中间完备数据中与所述标识对应的位置的图像数据,得到所述第n层的完整的图像数据,将所述完整的图像数据作为向下一次卷积层的输出数据,所述n为小于N的整数。The nth layer convolutional layer of the neural network system replaces the image data at the position corresponding to the identifier in the intermediate complete data stored in the nth layer with the image data obtained by the calculation process to obtain the completeness of the nth layer , The complete image data is used as the output data of the next convolution layer, and n is an integer less than N.
  10. 根据权利要求1-9任一项所述的方法,其中,所述神经网络系统对当前输入的图像帧进行识别,判断当前输入的图像帧是否为基础图像帧,包括:The method according to any one of claims 1-9, wherein the neural network system recognizes the currently input image frame to determine whether the currently input image frame is a basic image frame, including:
    响应于所述当前输入的图像帧与上一个输入的基础图像帧间隔的数据帧的数量等于预设数量,则所述当前输入的图像帧为基础图像帧,响应于所述当前输入的图像帧与上一个输入的基础图像帧间隔的数据帧的数量不等于预设数量,则所述当前输入的图像帧为非基础图像帧;或In response to that the number of data frames between the currently input image frame and the last input basic image frame is equal to a preset number, the currently input image frame is the basic image frame, and in response to the currently input image frame The number of data frames spaced from the last input basic image frame is not equal to the preset number, then the currently input image frame is a non-base image frame; or
    响应于所述当前输入的图像帧的图像中包含有预定的文件标识,则所述当前输入的图像帧为基础图像帧,响应于所述当前输入的图像帧的图像中不包含有预定的文件标识,则所述当前输入的图像帧为非基础图像帧。In response to the image of the currently input image frame containing a predetermined file identifier, the currently input image frame is a basic image frame, and the image in response to the currently input image frame does not contain a predetermined file Flag, the currently input image frame is a non-base image frame.
  11. 根据权利要求1-10任一项所述的方法,其中,所述方法还包括:The method according to any one of claims 1-10, wherein the method further comprises:
    响应于所述当前输入的图像帧为基础图像帧,则将所述当前输入的图像帧的整幅图像数据全部输入到神经网络系统的N层卷积层,由N层所述卷积层对输入的图像数据依次进行计算处理,并在N层所述卷积层的每一层存储计算处理后得到的图像数据。In response to the currently input image frame being the basic image frame, all the entire image data of the currently input image frame is input to the N-layer convolutional layer of the neural network system, and the N-layer convolutional layer pairs The input image data is sequentially calculated, and the image data obtained after the calculation process is stored in each of the N layers of the convolutional layer.
  12. 一种神经网络系统,包括:输入层和多层卷积层;A neural network system, including: an input layer and multiple convolution layers;
    所述输入层,用于对当前输入的图像帧进行识别,判断当前输入的图像帧是否为基础图像帧;响应于所述当前输入的图像帧不是基础图像帧,则提取所述当前输入的图像帧中与所述基础图像帧不同的第一图像数据,将所述第一图像数据输出至所述多层卷积层;The input layer is used to identify the currently input image frame and determine whether the currently input image frame is a basic image frame; in response to the currently input image frame not being a basic image frame, extract the currently input image First image data in a frame different from the basic image frame, output the first image data to the multi-layer convolutional layer;
    所述神经网络系统的N-1层卷积层,用于依次对所述第一图像数据进行计算处理,并将处理后的第二图像数据输出至第N层卷积层,所述N为大于等于2的整数;The N-1 convolutional layer of the neural network system is used to sequentially perform calculation processing on the first image data, and output the processed second image data to the Nth layer convolutional layer, where N is Integer greater than or equal to 2;
    所述神经网络系统的第N层卷积层,用于使用所述第二图像数据替换所述第N层卷积层中存储的第一中间完备数据中与所述第二图像数据所在位置对应的数据,从而得到第三图像数据,所述第N卷积层对所述第三图像数据进行计算处理并输出;其中,所述第一中间完备数据为所述基础图像帧在所述第N层卷积层的计算结果。The Nth layer convolution layer of the neural network system is used to replace the first intermediate complete data stored in the Nth layer convolution layer with the second image data corresponding to the location of the second image data To obtain third image data, the Nth convolutional layer performs calculation processing on the third image data and outputs; wherein, the first intermediate complete data is the basic image frame in the Nth The calculation result of the layer convolution layer.
  13. 一种存储设备,其中存储有计算机程序,所述计算机程序在电子设备中运行时,由所述电子设备的处理器加载并执行权利要求1-11任一项所述的基于神经网络系统的图像处理方法。A storage device in which a computer program is stored, and when the computer program runs in an electronic device, the processor of the electronic device loads and executes the image based on the neural network system of any one of claims 1-11 Approach.
  14. 一种电子设备,包括:An electronic device, including:
    处理器,用于运行计算机程序;以及A processor for running computer programs; and
    存储设备,用于存储计算机程序,所述计算机程序在所述电子设备中运行时由处理器加载并执行权利要求1-11任一项所述的基于神经网络系统的图像处理方法。A storage device is used to store a computer program, and when the computer program is running in the electronic device, the processor loads and executes the image processing method based on the neural network system of any one of claims 1-11.
PCT/CN2019/119211 2018-12-29 2019-11-18 Neural network system-based image processing method and neural network system WO2020134703A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811634090.4A CN109740508B (en) 2018-12-29 2018-12-29 Image processing method based on neural network system and neural network system
CN201811634090.4 2018-12-29

Publications (1)

Publication Number Publication Date
WO2020134703A1 true WO2020134703A1 (en) 2020-07-02

Family

ID=66362235

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/119211 WO2020134703A1 (en) 2018-12-29 2019-11-18 Neural network system-based image processing method and neural network system

Country Status (2)

Country Link
CN (1) CN109740508B (en)
WO (1) WO2020134703A1 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109740508B (en) * 2018-12-29 2021-07-23 北京灵汐科技有限公司 Image processing method based on neural network system and neural network system
CN113673664B (en) * 2020-05-14 2023-09-12 杭州海康威视数字技术股份有限公司 Data overflow detection method, device, equipment and storage medium
CN111831356B (en) * 2020-07-09 2023-04-07 北京灵汐科技有限公司 Weight precision configuration method, device, equipment and storage medium
CN111831354B (en) * 2020-07-09 2023-05-16 北京灵汐科技有限公司 Data precision configuration method, device, chip array, equipment and medium
US11797850B2 (en) 2020-07-09 2023-10-24 Lynxi Technologies Co., Ltd. Weight precision configuration method and apparatus, computer device and storage medium
CN111737193B (en) * 2020-08-03 2020-12-08 深圳鲲云信息科技有限公司 Data storage method, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150170338A1 (en) * 2013-12-18 2015-06-18 Huawei Technologies Co., Ltd. Image processing method and apparatus
CN105787867A (en) * 2016-04-21 2016-07-20 华为技术有限公司 Method and apparatus for processing video images based on neural network algorithm
CN107993217A (en) * 2017-12-22 2018-05-04 北京奇虎科技有限公司 Video data real-time processing method and device, computing device
CN109740508A (en) * 2018-12-29 2019-05-10 北京灵汐科技有限公司 A kind of image processing method and nerve network system based on nerve network system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103440612B (en) * 2013-08-27 2016-12-28 华为技术有限公司 Image processing method and device in a kind of GPU vitualization
CN107492115B (en) * 2017-08-30 2021-01-01 北京小米移动软件有限公司 Target object detection method and device
CN108876812B (en) * 2017-11-01 2021-11-19 北京旷视科技有限公司 Image processing method, device and equipment for detecting object in video

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150170338A1 (en) * 2013-12-18 2015-06-18 Huawei Technologies Co., Ltd. Image processing method and apparatus
CN105787867A (en) * 2016-04-21 2016-07-20 华为技术有限公司 Method and apparatus for processing video images based on neural network algorithm
CN107993217A (en) * 2017-12-22 2018-05-04 北京奇虎科技有限公司 Video data real-time processing method and device, computing device
CN109740508A (en) * 2018-12-29 2019-05-10 北京灵汐科技有限公司 A kind of image processing method and nerve network system based on nerve network system

Also Published As

Publication number Publication date
CN109740508B (en) 2021-07-23
CN109740508A (en) 2019-05-10

Similar Documents

Publication Publication Date Title
WO2020134703A1 (en) Neural network system-based image processing method and neural network system
CN107977229B (en) Multiplexing method and device for instruction generation process and processing device
JP7242975B2 (en) Method, digital system, and non-transitory computer-readable storage medium for object classification in a decision tree-based adaptive boosting classifier
CN110781819A (en) Image target detection method, system, electronic equipment and storage medium
JP2018116469A (en) Arithmetic system and arithmetic method for neural network
JP7035827B2 (en) Learning identification device and learning identification method
CN109961107A (en) Training method, device, electronic equipment and the storage medium of target detection model
JP7087695B2 (en) Learning device and learning method
US20220156322A1 (en) Graph reordering and tiling techniques
US20160378791A1 (en) Method and apparatus for performing a search operation on heterogeneous computing systems
JP7069898B2 (en) Learning identification device and learning identification method
CN112799599A (en) Data storage method, computing core, chip and electronic equipment
CN111860771A (en) Convolutional neural network computing method applied to edge computing
KR102305575B1 (en) Method and system for highlighting similar areas using similarity between images
CN114445336A (en) Distribution equipment defect detection method and device, computer equipment and storage medium
CN110490302B (en) Neural network compiling and optimizing method and device and related products
CN115344805A (en) Material auditing method, computing equipment and storage medium
JP2019160252A (en) Learning discrimination device and method for learning discrimination
Tan et al. Saliency detection by deep network with boundary refinement and global context
CN113989601A (en) Feature fusion network, sample selection method, target detection method and device
US10997497B2 (en) Calculation device for and calculation method of performing convolution
JP7040168B2 (en) Learning identification device and learning identification method
CN115438658A (en) Entity recognition method, recognition model training method and related device
CN115984671A (en) Model online updating method and device, electronic equipment and readable storage medium
CN113840169B (en) Video processing method, device, computing equipment and storage medium

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: 19903362

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: 19903362

Country of ref document: EP

Kind code of ref document: A1