WO2020132825A1 - Image processing apparatus and image processing method - Google Patents

Image processing apparatus and image processing method Download PDF

Info

Publication number
WO2020132825A1
WO2020132825A1 PCT/CN2018/123160 CN2018123160W WO2020132825A1 WO 2020132825 A1 WO2020132825 A1 WO 2020132825A1 CN 2018123160 W CN2018123160 W CN 2018123160W WO 2020132825 A1 WO2020132825 A1 WO 2020132825A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
filtering
parameter set
filter
scheduler
Prior art date
Application number
PCT/CN2018/123160
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 华为技术有限公司
Priority to CN201880098076.9A priority Critical patent/CN112771566A/en
Priority to PCT/CN2018/123160 priority patent/WO2020132825A1/en
Publication of WO2020132825A1 publication Critical patent/WO2020132825A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis

Definitions

  • the present application relates to the field of electronic technology, and in particular, to an image processing device and an image processing method.
  • Artificial Intelligence is a theory, method, technology, and application system that uses digital computers or digital computer-controlled machines to simulate, extend, and expand human intelligence, sense the environment, acquire knowledge, and use knowledge to obtain the best results.
  • artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence.
  • Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that the machine has the functions of perception, reasoning and decision-making.
  • Research in the field of artificial intelligence includes robotics, natural language processing, computer vision, decision-making and reasoning, human-computer interaction, recommendation and search, basic AI theory, etc.
  • AI networks such as Neural Networks (NN), Recurrent Neural Networks, Convolutional Neural Networks, and Deep Neural Networks
  • NN Neural Networks
  • Recurrent Neural Networks Convolutional Neural Networks
  • Convolutional Neural Networks Convolutional Neural Networks
  • Deep Neural Networks Deep Neural Networks
  • image preprocessing is to eliminate irrelevant information in the image, restore useful real information, enhance the detectability of relevant information, and simplify the data to the greatest extent, thereby improving AI network feature extraction, image segmentation, image matching and Reliability and accuracy of image processing operations such as image recognition.
  • Image filtering is an indispensable operation in image preprocessing. It is to suppress image noise while preserving the details of the image as much as possible. Its processing effect will directly affect the effectiveness and reliability of subsequent image processing and analysis. .
  • Image filtering in image preprocessing mainly includes adjusting the image size, and performing denoising and smoothing on the noise in the scaled image.
  • image denoising can be performed using median hardware filters, Gaussian hardware filters, and so on.
  • Resizing is mainly based on the size requirements of the AI network for the input image, and the image to be processed of the AI network is cropped and scaled to adapt to the standard size required by the specific AI network.
  • hardware filters are usually used to implement image filtering during image preprocessing, such as common RC filtering and LC filtering.
  • each hardware filter can meet the image filtering requirements of a limited number of image filtering scenarios at most, and no good image filtering effect can be obtained in any image filtering scenario. Therefore, it is necessary to solve the problem that the filtering parameters in the hardware filter cannot be adjusted, so as to obtain a better image filtering effect in any image filtering scene.
  • the embodiments of the present application provide an image processing device and an image processing method.
  • the hardware filter uses a user-configured filter parameter to filter an image, which can solve the problem that the hardware filter can only use a fixed set of filter parameters for filtering.
  • an image processing apparatus including:
  • the scheduler is used to obtain a parameter set selection instruction input by the input device, the parameter set selection instruction is an instruction input by a user through the input device and is used to instruct to select N filters from the F filter parameter set files stored in the memory Parameter set file, where F is a positive integer greater than 1 and N is an integer greater than 0;
  • a hardware filter coupled to the scheduler is used to filter the reference image using a set of filter parameters included in one filter parameter set file among the N filter parameter set files.
  • the user configures the filter parameter file in the hardware filter by himself, so that the hardware filter uses the user-configured filter parameter file to filter the image, which can meet the needs of different scenarios and is simple to implement.
  • an image processor respectively coupled to the scheduler and the hardware filter is used to parse the one filter parameter set file to obtain a reference filter parameter set; according to the reference image in A first scaling factor in the horizontal direction and a second scaling factor in the vertical direction, determining that the set of filtering parameters in the reference filtering parameter set is the hardware filter using the reference filtering parameter set for the reference image Filter the parameters to be used.
  • the reference filtering parameter set file includes at least two sets of filtering parameters.
  • the image processor determines the parameters to be used by the hardware filter to filter the reference image using the reference filtering parameter set according to the first scaling factor in the horizontal direction and the second scaling factor in the vertical direction of the reference image ; So that the size of the filtered image of the reference image meets the requirements.
  • the scheduler is further configured to send N file names corresponding to the N filter parameter set files to the image processor according to the parameter set selection instruction, the N file names correspond to the N filter parameter set files in one-to-one correspondence;
  • the image processor is further configured to obtain the reference filter parameter set file from the memory according to a reference file name, the reference file name is the file name of the reference filter parameter set file and is included in the N files name.
  • the scheduler is further configured to read the reference image from the memory and send it to the image processor.
  • the scheduler sends the reference file name to the image processor, so that the image processor uses the reference file name to read the reference filtering parameter set from the memory; the implementation is simple and consumes little signaling resources.
  • the image processor is specifically configured to select a set of horizontal filtering parameters from the reference filtering parameter set according to the first scaling factor, and select The reference filtering parameter set collectively selects a group of vertical filtering parameters; the group of horizontal filtering parameters and the group of vertical filtering parameters are used as the group of filtering parameters; the group of filtering parameters A register configured to the hardware filter;
  • the hardware filter is specifically used to read the set of filter parameters in the register and filter the reference image using the set of filter parameters.
  • the reference filtering parameter set file includes at least two sets of filtering parameters in the horizontal direction and at least two sets of filtering parameters in the vertical direction.
  • the image processor may use the mapping relationship between the horizontal scaling factor and the horizontal filtering parameter to determine a set of horizontal filtering parameters corresponding to any horizontal scaling factor; the vertical scaling factor and The mapping relationship of the filter parameters in the vertical direction determines a set of filter parameters in the vertical direction corresponding to any vertical scaling factor.
  • the horizontal scaling factor of the image corresponds to H parameter intervals
  • the reference filtering parameter set file includes H sets of horizontal filtering parameters, and the H sets of horizontal filtering parameters are in one-to-one relationship with the H parameter intervals
  • H is an integer greater than 1.
  • the image processor may select a set of horizontal filtering parameters corresponding to the parameter interval where the first scaling factor is located from the H sets of horizontal filtering parameters.
  • the vertical scaling factor of the image corresponds to G parameter intervals
  • the reference filtering parameter set file includes G sets of vertical filtering parameters
  • the G sets of vertical filtering parameters are in one-to-one relationship with the G parameter intervals
  • G is an integer greater than 1.
  • the image processor may select a group of vertical filtering parameters corresponding to the parameter interval where the second scaling factor is located from the G group of vertical filtering parameters.
  • the image processor may configure the filtering parameters for the hardware filter according to the horizontal and vertical scaling factors of the reference image, so that the size of the filtered image of the reference image meets the requirements.
  • the hardware filter is further used to send the filtered image of the reference image to the image processor;
  • the image processor is further configured to send the filtered image of the reference image to the scheduler; the image processing device further includes:
  • a neural network processor NPU coupled with the scheduler
  • the scheduler is further configured to input the filtered image of the reference image to the NPU;
  • the NPU is used to perform image analysis on the filtered image of the reference image using a target AI network, and send the obtained image analysis result to the scheduler.
  • the AI network is used to perform image analysis on the filtered image of the reference image, and the image processing efficiency is high.
  • the image processing apparatus further includes:
  • a result comparator coupled with the scheduler
  • the scheduler is also used to send the annotation information of the reference image and the image analysis result to the result comparator;
  • the result comparator is used to compare the image analysis result with the reference information of the reference image to obtain the comparison result of the parameter image.
  • the result comparison device is used to compare the image analysis result with the image annotation information, so as to determine the filtering effect of the hardware filter.
  • the result comparator is further configured to send the comparison result of the reference image and the comparison result of each image in the image set except the reference image to The scheduler; wherein, the result aligner obtains the comparison result of each image in the image set except the reference image in the same way as the reference result.
  • the image set includes at least two images;
  • the scheduler is further configured to determine the filtering effect of the reference filtering parameter set according to the comparison result of each image in the image set; separately determine the filtering other than the reference filtering parameter set in the N filtering parameter sets The filtering effect of the parameter set, where the N filtering parameter sets are N parameter sets obtained by the image processor parsing the N filtering parameter set files; the N filtering parameter set is the target filter with the best filtering effect
  • the parameter set is configured as a filtering parameter set of the hardware filter; wherein, the manner in which the scheduler determines the filtering effect of the filtering parameter set other than the reference filtering parameter set in the N filtering parameter sets and determines the The filtering effect of the reference filtering parameter set is the same.
  • the scheduler configures the target filtering parameter set with the best filtering effect in multiple filtering parameter sets as the filtering parameter set of the hardware filter, which can improve the performance of image processing.
  • the NPU is further used to obtain an AI network selection instruction input by the input device, and the AI network selection instruction is used to select the target in at least two AI networks to be selected AI network; configure the network adopted by the NPU as the target AI network according to the AI network selection instruction;
  • the NPU is also used to obtain the AI network programming code input by the input device; execute the AI network programming code to implement the target AI network.
  • the user configures the AI network in the image processing apparatus to facilitate processing different types of images or performing different image processing operations, which can meet different needs.
  • an embodiment of the present application provides an image processing method, which is applied to an image processing apparatus.
  • the image processing apparatus includes a scheduler and a hardware filter.
  • the method includes:
  • the scheduler obtains a parameter set selection instruction input by the input device, where the parameter set selection instruction is an instruction input by the user through the input device and is used to instruct the selection of N filter parameters from the F filter parameter set files stored in the memory Set file, where F is a positive integer greater than 1 and N is an integer greater than 0;
  • the hardware filter uses a set of filtering parameters included in one filtering parameter set file among the N filtering parameter set files to filter the reference image.
  • the user can configure the filter parameter file of the hardware filter according to oneself, so that the hardware filter uses the user-configured filter parameter file to filter the image, which can meet the needs of different scenarios and is simple to implement.
  • the image processor further includes an image processor respectively coupled to the scheduler and the hardware filter; the hardware filter uses one of the N filtering parameter set files Before filtering the reference image with a set of filtering parameters included in the filtering parameter set file, the method further includes:
  • the image processor parses the one filtering parameter set file to obtain a reference filtering parameter set; and determines the reference filtering parameter set according to the first scaling factor of the reference image in the horizontal direction and the second scaling factor in the vertical direction
  • the set of filtering parameters is a parameter to be used by the hardware filter to filter the reference image by using the reference filtering parameter set.
  • the method before the image processor configures a set of filter parameters in the reference filter parameter set file as the filter parameters to be used by the hardware filter to filter the reference image, the method further includes :
  • the scheduler sends N file names corresponding to the N filter parameter set files to the image processor according to the parameter set selection instruction, the N file names and the N filter parameter set files One-to-one correspondence
  • the image processor obtains the reference filter parameter set file from the first memory according to a reference file name, where the reference file name is the file name of the reference filter parameter set file and is included in the N file names.
  • the determining of the set of filtering parameters in the reference filtering parameter set is based on the first scaling factor in the horizontal direction and the second scaling factor in the vertical direction of the reference image
  • the hardware filter uses the reference filtering parameter set to filter the reference image, and the parameters to be adopted include:
  • the image processor selects a set of horizontal filtering parameters from the reference filtering parameter set according to the first scaling factor, and selects a set of vertical filtering from the reference filtering parameter set according to the second scaling factor Parameters; the set of horizontal filtering parameters and the set of vertical filtering parameters as the set of filtering parameters; configuring the set of filtering parameters to the register of the hardware filter;
  • the hardware filter filtering the reference image using a set of filtering parameters included in one filtering parameter set file among the N filtering parameter set files includes:
  • the hardware filter reads the set of filter parameters in the register and uses the set of filter parameters to filter the reference image.
  • the image processing device further includes a neural network processor NPU coupled to the scheduler; the hardware filter utilizes a filtering parameter set file among the N filtering parameter set files After filtering the reference image with the included set of filtering parameters, the method further includes:
  • the hardware filter sends the filtered image of the reference image to the image processor
  • the image processor sends the filtered image of the reference image to the scheduler
  • the scheduler inputs the filtered image of the reference image to the NPU;
  • the NPU uses the target AI network to perform image analysis on the filtered image of the reference image, and sends the obtained image analysis result to the scheduler.
  • the image processing device further includes a result comparator coupled with the scheduler; the NPU performs image analysis on the filtered image of the reference image by using a target AI network, and will obtain After the image analysis result of is sent to the scheduler, the method further includes:
  • the scheduler sends the annotation information of the reference image and the image analysis result to the result comparator;
  • the result comparison device compares the image analysis result with the reference information of the reference image to obtain a comparison result of the parameter image.
  • the result comparator compares the image analysis result with the reference information of the reference image, and after obtaining the comparison result of the parameter image, the method further includes:
  • the result comparator sends the comparison result of the reference image and the comparison result of each image in the image set except the reference image to the scheduler; wherein, the result comparator obtains the result
  • the way of comparing the results of each image in the image set except the reference image is the same as the way of obtaining the results of the comparison of the reference image, and the image set includes at least two images;
  • the scheduler determines the filtering effect of the reference filtering parameter set according to the comparison result of each image in the image set; separately determines the filtering of the filtering parameter sets other than the reference filtering parameter set in the N filtering parameter sets Effect, the N filter parameter sets are N parameter sets obtained by the image processor parsing the N filter parameter set files; the target filter parameter set with the best filtering effect in the N filter parameter sets is configured as A filtering parameter set of the hardware filter; wherein, the manner in which the scheduler determines a filtering effect of a filtering parameter set other than the reference filtering parameter set in the N filtering parameter sets and determines the reference filtering parameter set The filtering effect is the same.
  • the method before the NPU uses the target AI network to perform image analysis on the filtered image of the reference image, and before sending the obtained image analysis result to the scheduler, the method further includes:
  • the NPU obtains an AI network selection instruction input by the input device, and the AI network selection instruction is used to select the target AI network in at least two AI networks to be selected; according to the AI network selection instruction, the The network configuration adopted by the NPU is the target AI network;
  • the NPU obtains the AI network programming code input by the input device; executes the AI network programming code to implement the target AI network.
  • FIG. 1 is a schematic structural diagram of an image processing apparatus provided by an embodiment of the present application.
  • FIG. 2 is a schematic diagram of a filtering parameter set selection interface provided by an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of another image processing device provided by the present application.
  • FIG. 4 is a schematic diagram of calculating the overlapping degree of two bounding boxes provided by an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of another image processing device provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of an AI network selection interface provided by an embodiment of this application.
  • FIG. 7 is a schematic structural diagram of a neural network processor provided by an embodiment of the present application.
  • FIG. 8 is a schematic flowchart of an image processing method according to an embodiment of the present application.
  • FIG. 9 is a flowchart of a method for comparing filtering effects of multiple filtering parameter set files according to an embodiment of the present application.
  • FIG. 1 is a schematic structural diagram of another image processing apparatus provided by an embodiment of the present application. As shown in FIG. 1, the image processing apparatus 10 includes:
  • the scheduler 101 is used to obtain a parameter set selection instruction input by the input device 102, where the parameter set selection instruction is an instruction input by a user through the input device 102 and is used to instruct to select N from F filter parameter set files stored in the memory 103 Filter parameter set files, where F is a positive integer greater than 1 and N is an integer greater than 0;
  • a hardware filter 104 coupled to the scheduler 101 is used to filter the reference image by using a set of filter parameters included in one filter parameter set file among the N filter parameter set files.
  • the input device 102 may be a keyboard, a mouse, a touch screen, or the like.
  • the F filter parameter set files stored in the memory 103 may be pre-configured when the image processing apparatus is shipped from the factory, or may be configured by the user.
  • the number of filter parameter set files generated by different parameter strategies is different.
  • each filtering parameter set file has more than 1000 sets of filtering parameters in the horizontal direction and more than 1000 sets of filtering parameters in the vertical direction.
  • the image processing apparatus exposes the file name of each filter parameter set file to the user, and the user selects the file name of the filter parameter set through the input device 102 to configure the corresponding filter parameter set. Since the hardware filter is used for image filtering, a set of filter parameters in any filter parameter set file is a set of filter parameters in the spatial domain of the hardware filter.
  • the user can configure the filter parameter file of the hardware filter according to oneself, so that the hardware filter uses the user-configured filter parameter file to filter the image, which can meet the needs of different scenarios and be simple to implement.
  • the image processing apparatus further includes an image processor 105 coupled to the scheduler 101 and the hardware filter 104, respectively:
  • the image processor 105 is configured to parse the one filter parameter set file to obtain a reference filter parameter set; determine the reference filter according to the first scaling factor of the reference image in the horizontal direction and the second scaling factor in the vertical direction
  • the set of filtering parameters in the parameter set is a parameter to be used by the hardware filter to filter the reference image by using the reference filtering parameter set.
  • the image processor 105 is specifically configured to select a set of horizontal filtering parameters from the reference filtering parameter set according to the first scaling factor, and from the reference filtering parameter set according to the second scaling factor Select a set of vertical filtering parameters; use the set of horizontal filtering parameters and the set of vertical filtering parameters as the set of filtering parameters; configure the set of filtering parameters to the hardware filter 101 Register of
  • the hardware filter 104 is specifically used to read the set of filter parameters in the register and filter the reference image using the set of filter parameters.
  • the first scaling factor of the reference image in the horizontal direction refers to a scaling factor corresponding to the standard size of the input image required by the image processing device adjusted in the horizontal direction corresponding to the reference image.
  • the second vertical scaling factor of the reference image refers to a scaling factor corresponding to the vertical size of the reference image adjusted to the standard size of the input image required by the image processing device.
  • the above reference filtering parameter set file includes at least two sets of filtering parameters in the horizontal direction and at least two sets of filtering parameters in the vertical direction.
  • the above image processor can use the mapping relationship between the horizontal scaling factor and the horizontal filtering parameter to determine a set of horizontal filtering parameters corresponding to any horizontal scaling factor; the vertical scaling factor and the vertical can be used
  • the mapping relationship of the filter parameters in the direction determines a set of filter parameters in the vertical direction corresponding to any vertical scaling factor.
  • the horizontal scaling factor of the image corresponds to H parameter intervals.
  • the reference filter parameter set file includes H sets of horizontal filtering parameters.
  • the H sets of horizontal filtering parameters correspond to the H parameter intervals in one-to-one correspondence. It is an integer greater than 1.
  • the image processor may select a group of horizontal filtering parameters corresponding to the parameter interval where the first scaling factor is located from the H group of horizontal filtering parameters.
  • the scaling factor in the vertical direction of the image corresponds to G parameter intervals.
  • the above reference filter parameter set file includes G sets of vertical filtering parameters, and the G sets of vertical filtering parameters correspond one-to-one to the G parameter intervals. G It is an integer greater than 1.
  • the image processor may select a group of vertical filter parameters corresponding to the parameter interval in which the second scaling factor is located from the G group of vertical filter parameters.
  • the reference image is an image currently to be processed by the data processing device and is an image in the image set.
  • the memory 103 stores the image set.
  • Each image in the image set is annotated, that is, each image has an annotation information (label or true value). It can be understood that each image in the above image set is a test image, which is used to test the image processing effect of the image processing device.
  • the label or true value (annotated information) of the image is called Ground Truth.
  • the Ground Truth of each image is used for subsequent comparison with the inference value (image analysis result) output by the image through the AI network processing.
  • the image processor can use the reference filter parameter set file to configure the hardware filter with the filter parameters used for processing each image in the image set.
  • the image processor can use one or more filter parameter set files selected by the user to configure the filter parameters for the hardware filter.
  • the filter parameter set file used by the hardware filter is no longer fixed, but the user can Choose it yourself.
  • users can also select multiple filter parameter set files.
  • the image processor uses each parameter set corpus in these filter parameter set files to configure filter parameters for the hardware filter, so that the user can determine the most effective filtering effect in these filter parameter set files.
  • a good filtering parameter set file It can be understood that the user can test the filtering effect of each filtering parameter set file, and then select a filtering parameter set file with the best filtering effect to use in subsequent image processing.
  • the image processor may configure the filtering parameters for the hardware filter according to the horizontal and vertical scaling factors of the reference image, so that the size of the filtered image of the reference image meets the requirements.
  • the scheduler 101 is further configured to send the N file names corresponding to the N filter parameter set files to the image processor 105 according to the parameter set selection instruction, and the N file names and The above N filter parameter set files are in one-to-one correspondence;
  • the image processor 105 is further configured to acquire the reference filter parameter set file from the memory 103 according to the reference file name, where the reference file name is the file name of the reference filter parameter set file and is included in the N file names.
  • FIG. 2 is a schematic diagram of a filtering parameter set selection interface provided by an embodiment of the present application.
  • the filtering parameter set selection interface includes file names of F filtering parameter set files, that is, the first file name to the Fth file name; the square in front of each file name is the filtering parameter set file corresponding to the file name After the user selects the square through the keyboard or the mouse, the square turns black (indicating that the corresponding selection interface of the square is selected).
  • the above parameter set selection instruction is an operation for the user to select the file name through the input device.
  • the filtering parameter set selection interface is an interface of the image processing program. As shown in FIG. 2, the second file name, the third file name, and the fifth file name are the file names selected by the user, and the three filter parameter files corresponding to the three file names are filter parameter files configured by the user, and the image processing device Use these three filter parameter files for image processing.
  • the scheduler 101 is also used to read the reference image from the memory 103 and send it to the image processor.
  • the scheduler 101 reads one image from the image set at a time, and passes the image to the image processor 105.
  • the scheduler sends the file name of the filter parameter set file to the image processor, so that the image processor reads the corresponding filter parameter set file from the memory according to the file name received; Make less resources.
  • FIG. 3 is a schematic structural diagram of another image processing device provided by the present application, which is a further refinement of the device shown in FIG. 1.
  • the image processing device in FIG. 3 adds an NPU 320 and a result comparator 340 that are both coupled to the scheduler 101 on the basis of the image processing device in FIG. 1.
  • the NPU 320 can implement various AI networks.
  • the NPU 320 can use the AI network to perform image analysis or image processing on the filtered image from the scheduler 101.
  • the result comparer 340 is used to compare the image analysis result (image processing result) with the real result (marking information of the test image), so as to determine the correctness of the image analysis or image processing.
  • the image processing device in FIG. 3 can realize the following operations:
  • the scheduler 101 obtains a parameter set selection instruction input by the input device 102.
  • the input device 102 may be a keyboard, a mouse, a touch screen, or the like. In practical applications, the operation of the user selecting the file name in the filter parameter set selection interface in FIG. 3 through the input device 102 can be understood as the parameter set selection instruction input by the input device 102.
  • the scheduler 101 reads the reference image from the memory 103.
  • the above reference image is any image in the image set stored in the memory 103.
  • the scheduler 101 sequentially reads each image in the image set and sends it to the image processor 105 for processing.
  • the scheduler 101 sends the N file names selected by the parameter set selection instruction to the image processor 105.
  • the above N file names are the file names corresponding to the N filter parameter set files among the F filter parameter set files stored in the memory 103.
  • the scheduler 101 sends one of the N file names to the image processor 105 each time.
  • the scheduler sends the above reference image together with at least one file name to the image processor 105.
  • the memory storing the F filter parameter set files and the memory storing the image set may be the same or different.
  • the image processor 105 obtains the reference filter parameter set file from the memory 103 using the reference file name.
  • the reference file name is the file name of the reference filter parameter set file and is included in the N file names.
  • the image processor 105 configures a set of filter parameters in the reference filter parameter set file as a filter parameter to be used by the hardware filter 104 to filter the reference image.
  • the foregoing embodiment details how the image processor 105 uses the reference filtering parameter set file to configure the filtering parameters for the hardware filter 104, which will not be described in detail here.
  • the hardware filter 104 uses the above set of filtering parameters to filter the reference image, and sends the filtered image of the reference image to the image processor 105.
  • the image processor 105 sends the filtered image of the reference image to the scheduler 101.
  • the scheduler 101 sends the filtered image of the reference image to the NPU 320.
  • the NPU 320 uses the target AI network to perform image analysis on the filtered image of the reference image, and sends the obtained image analysis result to the scheduler 101.
  • the scheduler 101 sends the image analysis result and the annotation information of the reference image to the result comparator 430.
  • the result comparator 340 stores the annotation information of the reference image, and the scheduler 101 only needs to send the image analysis result to the result comparator 340.
  • the result comparator 430 compares the image analysis result with the reference information of the reference image to obtain a comparison result of the parameter image.
  • the AI network used by the NPU 320 is different or the form of the image analysis result output by the AI network is different, and the comparison algorithm adopted by the result comparator 340 is different.
  • the AI network used by NPU320 is Resnet18 network or Resnet50 network, and the image analysis result output by NPU320 is the label (classification) obtained by identifying the image; the result comparator 340 compares the image analysis result output by NPU320 and the ground to get top1 ⁇ Top5.
  • top1 refers to the probability that the classification with the highest probability predicted by the NPU320 using the AI network is correct.
  • top5 refers to the probability that the NPU320 uses the AI network to predict the maximum probability of the five categories (labels) that have the correct classification.
  • top2 ⁇ top4 is similar to top5.
  • the AI network used by the NPU320 is the FasterRCNN network.
  • the image analysis result output by the NPU320 is the bounding box obtained by performing object detection on the image; the result comparator 340 uses the degree of overlap (Intersection over Union, IoU) comparison algorithm, that is, calculating the overlapping degree between the bounding box output by the NPU 320 and the bounding box (labeling information) marked in the image.
  • IoU defines the degree of overlap between two bounding boxes.
  • FIG. 4 is a schematic diagram of calculating the overlapping degree of two bounding boxes provided by an embodiment of the present application. As shown in Figure 4, the black area is the overlapping area of the two bounding boxes (A ⁇ B), and the entire area is the area where the two bounding boxes merge (A ⁇ B).
  • the scheduler 101 determines the filtering effect of the reference filter parameter set according to the comparison result of each image in the image set; separately determines the filtering effect of the filter parameter set other than the reference filter parameter set in the N filter parameter sets;
  • the target filtering parameter set with the best filtering effect in the N filtering parameter sets is configured as the filtering parameter set of the hardware filter.
  • the N filter parameter sets are N parameter sets obtained by the image processor parsing the N filter parameter set files.
  • the scheduler 101 determines the filtering effect of the filtering parameter sets other than the reference filtering parameter set in the N filtering parameter sets in the same manner as determining the filtering effect of the reference filtering parameter set. It can be understood that the better the image filtering effect of the image processing device, the better the effect of image processing or image analysis. Therefore, the advantages and disadvantages of the image analysis result obtained by the image processing device using each filter parameter set to process the image set can reflect the effect of using the filter parameter set to perform the filtering process.
  • the filtering effect of the aforementioned reference filtering parameter set may be obtained according to multiple comparison results (overlaps) output by the result comparator.
  • the filtering effect of each filtering parameter set in the N filtering parameter sets is the top1 obtained by the image processing device using the filtering parameter set to perform image recognition on each image in the image set.
  • the accuracy of image recognition is positively correlated with the filtering effect.
  • the filtering effect of each filtering parameter set in the N filtering parameter sets is the number of overlapping degrees that exceed the target threshold value in each overlapping degree obtained by the image processing device using the filtering parameter set to perform object detection on each image in the image set.
  • the target threshold may be 0.5, 0.6, 0.75, 0.8, etc.
  • the image processing apparatus uses the first filter parameter set to process the images in the image set to obtain 600 degrees of overlap that exceed the target threshold, and uses the second filter parameter set to process the images in the image set to obtain 800 degrees of overlap that exceeds the target threshold; Then, the filtering effect of the second filtering parameter set is better than the filtering effect of the first filtering parameter set.
  • various methods can be used to compare the filtering effects of different filtering parameter sets, which is not limited in this application.
  • the image processing device compares the filtering effects of multiple filtering parameter set files selected by the user, and selects one filtering parameter set file with the best filtering effect to quickly determine the filtering parameter set file with the best filtering effect, Improve the efficiency of image analysis.
  • FIG. 5 is a schematic structural diagram of an image processing apparatus provided by an embodiment of the present application.
  • the image processing device may be a device without a hardware filter and an NPU, such as a desktop computer, a notebook computer, etc., which can be applied to a developer scenario.
  • the image processing apparatus includes a main device 501 and an external device 500.
  • the external device 500 is coupled to the main device 501 through the IO interface 511.
  • the external device 500 is coupled to the main device 501 in other ways or the external device 100 is integrated with the main device (that is, the external device 500 is integrated into the main device 501).
  • the processor 503 and the memory 103 are coupled to the system bus 505.
  • the processor 503 may be one or more processors, where each processor may include one or more processor cores.
  • the video adapter 507 can drive the display 509, which is coupled to the system bus 505.
  • the display 509 can be used to display information input by the user or provided to the user and various program interfaces.
  • the system bus 505 is coupled to the I/O interface 511.
  • the I/O interface 511 communicates with various I/O devices, such as input device 102 (eg, keyboard, mouse, touch screen, etc.), multimedia disk (media) 515, (eg, CD-ROM, multimedia interface, etc.),
  • the transceiver 517 may transmit and/or receive radio communication signals.
  • the processor 503 may use a general-purpose central processing unit (Central Processing Unit, CPU), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits for executing related programs, to The technical solutions provided by the embodiments of the present application are implemented.
  • CPU Central Processing Unit
  • ASIC Application Specific Integrated Circuit
  • the memory 103 stores various software programs and/or multiple sets of instructions.
  • the memory 103 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage devices, flash memory devices, or other non-volatile solid-state storage devices.
  • the memory 103 may store an operating system (hereinafter referred to as a system), such as an embedded operating system such as ANDROID, IOS, WINDOWS, or LINUX.
  • the memory 103 may also store a network communication program, which may be used to communicate with one or more additional devices, one or more terminal devices, and one or more network devices.
  • the memory 103 can also store a user interface program, which can display the content of the application program vividly through a graphical operation interface, and receive user control operations on the application program through input controls such as menus, dialog boxes, and keys. .
  • the image processing apparatus can communicate with other devices through the network interface 521.
  • the network interface 521 communicates with other devices through the Internet, Ethernet, virtual private network, WiFi network, cellular network, and other networks.
  • the hard disk drive interface 523 is coupled to the system bus 505.
  • the hardware drive interface 523 and the hard disk drive 525 are coupled.
  • the system memory 527 is coupled to the system bus 505.
  • the data running in the system memory 527 may include the operating system 529 and application programs 531 of the image processing apparatus.
  • the application 531 may include a social application, an image management application (for example, an album), a map application (for example, Google Maps), a browser, a game application, programming software, and so on.
  • the operating system includes a shell 533 and a kernel 535.
  • the shell 533 is an interface between the user and the kernel of the operating system.
  • the shell is the outermost layer of the operating system.
  • the shell manages the interaction between the user and the operating system: waits for the user's input, interprets the user's input to the operating system, and processes the output of various operating systems.
  • the kernel 535 is composed of those parts of the operating system that are used to manage memory, files, peripherals, and system resources. Directly interacting with the hardware, the operating system kernel usually runs processes and provides communication between processes, providing CPU time slice management, interrupts, memory management, IO management, and so on.
  • the image processor 105 is coupled to the processor 503.
  • the image processor 105 is used to process the image. It is a hardware dedicated to image processing, and is used to configure the filtering parameters of the hardware filter 104.
  • the result comparator 340 is coupled to the processor 503, and the result comparator 340 is used to compare the image analysis result (image processing result) and the real result (marking information of the test image) in order to determine the image analysis or image processing Correctness.
  • the image analysis result may come from a neural network processor (Neural-network Processing Unit, NPU) 320.
  • the NPU320 can be replaced with a tensor processor (Tensor Processing Unit, TPU) and other processors that can perform machine learning.
  • the external device 500 may include a hardware filter 104, an NPU 320, and a scheduler 101.
  • the hardware filter 104 is coupled to the image processor 105, and the image processor 105 may configure the filtering parameters of the hardware filter 104.
  • the processor 503 allocates the image processing task to the scheduler 101, and the scheduler 101 completes the task assigned by the processor 503 by calling the hardware filter 104 and the NPU 320.
  • the processor 503 directly calls the hardware filter 104 and the NPU 320 to complete the image processing task, that is, the scheduler 101 is optional.
  • the NPU 320 can implement a variety of AI networks for image analysis and image processing.
  • the user can configure the desired network through the commands input by the input device 102.
  • the memory 103 stores at least two filter parameter set files that can be used by the hardware filter 104, and the user can configure the filter parameter set file used by the hardware filter 104 through an instruction input by the input device 102.
  • An objective of the present application is to configure the filter parameters for the hardware filter in the external device 500, that is, to complete the development of the hardware filter 104, and then the hardware filter 104 with the configured filter parameters can be directly provided to other devices.
  • the configured hardware filter is connected to a computer to provide hardware filtering for the computer.
  • the external device 500 and the main device 501 may be independent devices.
  • the main device 501 is a desktop computer
  • the external device 500 is a mobile device.
  • the external device 500 may be connected to the main device 501 through a USB interface or other interfaces.
  • Another objective of the present application is to enhance the image processing capability of a host device that does not have a hardware filter and NPU. At present, devices such as desktop computers and notebook computers do not have NPU and hardware filters. After the external device 500 is connected to these devices (main device 501), these devices can use the external device 500 to enhance their image processing performance. In this way, the image processing performance of these devices can be enhanced without changing the hardware structure of these devices, and the cost is low
  • the user can not only configure the filtering parameter set used by the image processing device, but also configure the AI network used by the image processing device.
  • the foregoing embodiments describe the implementation of the user-selected filter parameter set.
  • the following describes the implementation of the AI network used by the user to configure the image processing device.
  • the NPU 320 obtains the AI network selection instruction input by the input device 102; according to the above-mentioned AI network selection instruction, the network it adopts is configured as the target AI network.
  • the AI network selection instruction is used to select the target AI network among at least two AI networks to be selected.
  • the at least two AI networks to be selected may include resnet50 network, SSD (Single Shot MultiBox Detector) network, Faster RCNN network, resnet18 network, etc.
  • 6 is a schematic diagram of an AI network selection interface provided by an embodiment of the present application.
  • the AI network selection interface includes R AI network selection interfaces; the circle in front of each AI network name is the selection interface of the AI network. After the user selects the circle with the keyboard or mouse, the circle becomes black (Indicates that the corresponding AI network is selected).
  • the above AI network selection instruction is an operation for the user to select an AI network through an input device.
  • the AI network selection interface is an interface of an image processing program.
  • the user can start the image processing program to select the AI network and configure the filtering parameter set file.
  • the fifth AI network is a target AI network selected by the user, and the image processing device uses the fifth AI network for image processing.
  • the user selects the AI network used by the image processing device according to his own needs, which is simple to implement and can satisfy different image processing tasks.
  • the NPU 320 obtains the AI network programming code input by the input device 102; executes the AI network programming code to implement the target AI network.
  • users can write their own AI network in the AI network programming interface.
  • the AI network preset by the image processing device does not include the AI network required by the user, the user can write the AI network required for self-fetching.
  • users can write their own code to implement the required AI network, rather than being limited to the AI network preset by the image processing device, in order to develop an AI network with better performance.
  • FIG. 7 is a schematic structural diagram of a neural network processor provided by an embodiment of the present application.
  • the NPU 320 is mounted on the scheduler 101, and the core part of the NPU 320 is an arithmetic circuit 703, and the arithmetic circuit is controlled by a controller 704 703 Extract the matrix data in the memory and perform multiplication.
  • the processor 503 allocates tasks to the scheduler 101, and the scheduler 101 schedules the NPU 320, the hardware filter 104, and other components to perform corresponding tasks.
  • the arithmetic circuit 703 internally includes multiple processing units (Process Engine, PE). In some implementations, the arithmetic circuit 703 is a two-dimensional pulsating array. The arithmetic circuit 703 may also be a one-dimensional pulsating array or other electronic circuit capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 703 is a general-purpose matrix processor.
  • PE Processing Unit
  • the arithmetic circuit 703 is a two-dimensional pulsating array.
  • the arithmetic circuit 703 may also be a one-dimensional pulsating array or other electronic circuit capable of performing mathematical operations such as multiplication and addition.
  • the arithmetic circuit 703 is a general-purpose matrix processor.
  • the arithmetic circuit takes the data corresponding to the matrix B from the weight memory 702 and caches it on each PE in the arithmetic circuit.
  • the arithmetic circuit takes matrix A data and matrix B from the input memory 701 to perform matrix operation, and the partial result or final result of the obtained matrix is stored in the accumulator 708.
  • the unified memory 706 is used to store input data and output data.
  • the weight data is directly transferred to the weight memory 702 through a storage unit access controller (Direct Memory Access Controller, DMAC) 705.
  • the input data is also transferred to the unified memory 706 through the DMAC.
  • DMAC Direct Memory Access Controller
  • a bus interface unit (Bus Interface Unit, BIU) 710 is used for the interaction between the AXI bus and the DMAC and instruction retrieval memory (Instruction Fetch Buffer) 709.
  • the bus interface unit 710 is used to obtain the instruction from the instruction fetch memory 709, and is also used to access the controller 705 to obtain the original data of the input matrix A or the weight matrix B.
  • the DMAC is mainly used to carry input data to the unified memory 706 or weight data to the weight memory 702 or input data to the input memory 701.
  • the vector calculation unit 707 has a plurality of operation processing units. If necessary, it further processes the output of the operation circuit, such as vector multiplication, vector addition, exponential operation, logarithm operation, size comparison, and so on. It is mainly used for non-convolution/FC layer network calculation in neural networks, such as Pooling, Batch Normalization, Local Response Normalization, etc.
  • the vector calculation unit 707 can store the processed output vector to the unified buffer 706.
  • the vector calculation unit 707 may apply a non-linear function to the output of the arithmetic circuit 703, such as a vector of accumulated values, to generate an activation value.
  • the vector calculation unit 707 generates normalized values, merged values, or both.
  • the vector of the processed output can be used as an activation input to the arithmetic circuit 703, for example for use in subsequent layers in a neural network.
  • An instruction fetch memory (709) connected to the controller 704 is used to store instructions used by the controller 704.
  • the unified memory 706, the input memory 701, the weight memory 702, and the fetch memory 709 are all On-Chip memories.
  • FIG. 7 is only a schematic diagram of a hardware structure of an NPU provided by an embodiment of the present application. The present application does not limit the structure of the NPU.
  • FIG. 8 is a schematic flowchart of an image processing method provided by an embodiment of the present application.
  • the image processing method is applied to the image processing apparatuses in FIGS. 1, 3, and 5. As shown in FIG. 8, the method may include:
  • the scheduler 101 obtains a parameter set selection instruction input by the input device 102.
  • the above parameter set selection instruction is used to select N filter parameter set files among the F filter parameter set files stored in the memory 103, where F is an integer greater than 1, and N is an integer greater than 0.
  • the image processor 105 configures a set of filter parameters in the reference filter parameter set file as a filter parameter to be used by the hardware filter to filter the reference image.
  • the reference filtering parameter set file is any one of the N filtering parameter set files, and the reference image is any image in the image set stored in the memory 103.
  • the hardware filter 105 uses the above set of filtering parameters to filter the above reference image.
  • the user can configure the filter parameter file of the hardware filter according to oneself, so that the hardware filter uses the user-configured filter parameter file to filter the image, which can meet the needs of different scenarios and is simple to implement.
  • the image processing method in FIG. 8 describes a process in which the image processing device uses the filter parameter set file selected by the user to filter the images in the image set. The following describes how to determine the implementation of the parameter set file with the best filtering effect among the multiple filter parameter set files selected by the user.
  • FIG. 9 is a flowchart of a method for comparing filtering effects of multiple filtering parameter set files provided by an embodiment of the present application. The method is applied to the image processing apparatuses in FIGS. 1, 3, and 5. As shown in FIG. 9, the method may include:
  • the image processing device performs image preprocessing on the images in the image set.
  • Unified format that is, the format of each image in the image set is unified, for example, all are unified into the jpg format.
  • Grayscale Different image processing devices have different requirements for image sets. Some require grayscale images and some require RGB color images. Before processing an image, the image processing device needs to convert the image in the image set to an image that meets requirements, for example, to an RGB color image.
  • Filtering Image filtering in image preprocessing mainly includes adjusting the image size, and denoising and smoothing the noise in the scaled image.
  • Sample enhancement Some people think that neural networks are fed by data.
  • the image processing device respectively uses multiple filtering parameter set files selected by the user to filter the images in the image set. As shown in FIG. 9, first, the image processing device uses the filter parameter set file 1 to filter the image in the image set and performs subsequent image processing; then, uses the filter parameter set file 2 to filter the image in the image set and performs subsequent Image processing; Finally, the filtering parameter set file F is used to filter the images in the image set and perform subsequent image processing.
  • the implementation of the filtering operation can be referred to 301 to 306, and will not be described in detail here.
  • the image processing device performs image analysis on each image in the image set to obtain an image analysis result of each image.
  • the image processing device can use the AI network to perform image analysis on the preprocessed image, such as object detection and image classification.
  • the image analysis result may be a label (classification) obtained by the image processing device recognizing the image in the image set, or a bounding box obtained by the image processing device performing object detection on the image in the image set.
  • the implementation is the same as 309 in FIG. 3.
  • the image processing device compares the image analysis result of each image with the annotation information to obtain a comparison result of each image.
  • the image processing device determines a target filtering parameter set file with the best filtering effect among the N filtering parameter set files; and configures the target filtering parameter set file as the filtering parameter set file that it uses.
  • the image processing device can separately test the effect of using each filter parameter set file selected by the user to perform image analysis on the image in the image set, and then select the filter parameter set file with the best filtering effect as the filter parameter set to be adopted file.
  • the image processing device can determine the filter parameter set file with the best filtering effect among the multiple filter parameter set files selected by the user, which can further improve the image analysis performance of the image processing device.
  • An image processing scheme (first scheme) provided by an embodiment of the present application is as follows:
  • the image processing apparatus configures an optimal filter parameter set for 1000 test images (samples) of the resnet50 network, and then inputs the filter parameter to resnet50 after being filtered by a hardware filter On the network, the obtained output (image analysis result) is compared with ground truth to get top1 ⁇ top5.
  • the image processing scheme used for comparison (the second scheme) is as follows: 1000 test images of resnet50 network are input to pillow, after filtering, they are input to resnet50 network, and the obtained output (image analysis result) is compared with ground truth to get top1 ⁇ Top5.
  • PIL Pulthon Imaging Library
  • pillow is a friendly fork of PIL that provides extensive file format support and powerful image processing capabilities, including image storage, image display, format conversion, and basic Image processing operations, etc.
  • Table 1 is a comparison table of image recognition rates. It can be seen from Table 1 that the performance of the first scheme is better than that of the second scheme. For top1, the first plan exceeds the second plan (pillow) by 0.3%. Among the five statistical results from top1 to top5, top1 is the main evaluation index.
  • Another image processing scheme (third scheme) provided by the embodiment of the present application is as follows:
  • the image processing device configures an optimal filter parameter set for 2000 test images of the lane line recognition network, and then inputs the filter to the lane after being filtered by the hardware filter Line identification network, the obtained output is compared with ground truth to get the accuracy rate and recall rate.
  • the image processing scheme used for comparison (the fourth scheme) is as follows: input 2000 test images of the lane line recognition network to OpenCV, and then input the filtered line to the lane line recognition network. The obtained output is compared with the ground to obtain the accuracy rate And recall rate.
  • Precision refers to the number of correctly identified samples/the number of identified samples.
  • Recall refers to identifying the correct number of samples/the correct number of all samples.
  • Table 2 is a table of accuracy and recall rates for image analysis.
  • the overall accuracy rate in Table 2 refers to the accuracy rate of each lane line in the recognition image.
  • the current accuracy rate refers to the accuracy rate of the lane in which the vehicle is currently traveling.
  • the overall recall rate refers to the recall rate of each lane line in the recognition image.
  • the current recall The rate refers to the recall rate that identifies the lane in which the vehicle is currently traveling. It can be seen from Table 2 that the performance of the third scheme is better than that of the fourth scheme.
  • the third scheme exceeds the fourth scheme by 1.1% in the accuracy rate of identifying the current lane, and exceeds the fourth scheme by 0.3% in identifying the current lane recall rate.
  • the technical solution in this application can effectively improve the accuracy of image recognition.

Abstract

Disclosed are an image processing apparatus and an image processing method applied in the field of artificial intelligence (AI). The image processing apparatus comprises: a scheduler for obtaining a parameter set selection instruction input by an input device, wherein the parameter set selection instruction is an instruction input by a user by means of the input device and is used to instruct the selection of N filtering parameter set files from F filtering parameter set files stored in a memory, F being a positive integer greater than 1 and N being an integer greater than 0; and a hardware filter, coupled to the scheduler, for filtering a reference image by means of a set of filtering parameters included in one filtering parameter set file among the N filtering parameter set files. In the embodiments of the present application, a user can configure, at will, filtering parameter files of a hardware filter, so that the requirements of different scenarios can be met, and the implementation is simple.

Description

图像处理装置和图像处理方法Image processing device and image processing method 技术领域Technical field
本申请涉及电子技术领域,尤其涉及一种图像处理装置和图像处理方法。The present application relates to the field of electronic technology, and in particular, to an image processing device and an image processing method.
背景技术Background technique
人工智能(Artificial Intelligence,AI)是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。换句话说,人工智能是计算机科学的一个分支,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式作出反应的智能机器。人工智能也就是研究各种智能机器的设计原理与实现方法,使机器具有感知、推理与决策的功能。人工智能领域的研究包括机器人,自然语言处理,计算机视觉,决策与推理,人机交互,推荐与搜索,AI基础理论等。随着AI技术的发展,AI网络,例如神经网络(Neural Network,NN)、循环神经网络、卷积神经网络、深度神经网络等,在各领域的应用越来越广泛。在实际生活中,AI网络已在图像处理、图像识别、图像分类等领域得到应用广泛。Artificial Intelligence (AI) is a theory, method, technology, and application system that uses digital computers or digital computer-controlled machines to simulate, extend, and expand human intelligence, sense the environment, acquire knowledge, and use knowledge to obtain the best results. In other words, artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that the machine has the functions of perception, reasoning and decision-making. Research in the field of artificial intelligence includes robotics, natural language processing, computer vision, decision-making and reasoning, human-computer interaction, recommendation and search, basic AI theory, etc. With the development of AI technology, AI networks, such as Neural Networks (NN), Recurrent Neural Networks, Convolutional Neural Networks, and Deep Neural Networks, have become more and more widely used in various fields. In actual life, AI networks have been widely used in the fields of image processing, image recognition, and image classification.
采用AI网络对待处理图像做图像分析或图像处理前,通常需要对待处理图像进行预处理。图像预处理的主要目的是消除图像中无关的信息、恢复有用的真实信息、增强有关信息的可检测性、最大限度地简化数据,从而提高AI网络对图像做特征提取、图像分割、图像匹配以及图像识别等图像处理操作的可靠性和精度。图像滤波是图像预处理中不可缺少的操作,是在尽量保留图像细节特征的条件下对图像的噪声进行抑制,其处理效果的好坏将直接影响到后续图像处理和分析的有效性和可靠性。Before the AI network is used for image analysis or image processing, the image to be processed usually needs to be preprocessed. The main purpose of image preprocessing is to eliminate irrelevant information in the image, restore useful real information, enhance the detectability of relevant information, and simplify the data to the greatest extent, thereby improving AI network feature extraction, image segmentation, image matching and Reliability and accuracy of image processing operations such as image recognition. Image filtering is an indispensable operation in image preprocessing. It is to suppress image noise while preserving the details of the image as much as possible. Its processing effect will directly affect the effectiveness and reliability of subsequent image processing and analysis. .
图像预处理中的图像滤波主要包括调整图像尺寸,并对缩放后的图像中的噪声进行去噪平滑处理。举例来说,可使用中值硬件滤波器、高斯硬件滤波器等进行图像去噪处理。调整尺寸主要是根据AI网络对输入图像的尺寸要求,将AI网络的待处理图像进行裁剪和缩放,以适应特定AI网络要求的标准尺寸。当前,通常采用硬件滤波器来实现图像预处理过程中的图像滤波,例如常见的RC滤波、LC滤波等。由于硬件滤波器中的滤波参数是预先配置的,每种硬件滤波器最多满足有限几种图像滤波场景的图像滤波要求,而无法在任意一种图像滤波场景均获得较好的图像滤波效果。因此,需要解决硬件滤波器中的滤波参数无法调整的问题,以便于在任意一种图像滤波场景均获得较好的图像滤波效果。Image filtering in image preprocessing mainly includes adjusting the image size, and performing denoising and smoothing on the noise in the scaled image. For example, image denoising can be performed using median hardware filters, Gaussian hardware filters, and so on. Resizing is mainly based on the size requirements of the AI network for the input image, and the image to be processed of the AI network is cropped and scaled to adapt to the standard size required by the specific AI network. Currently, hardware filters are usually used to implement image filtering during image preprocessing, such as common RC filtering and LC filtering. Since the filtering parameters in the hardware filter are pre-configured, each hardware filter can meet the image filtering requirements of a limited number of image filtering scenarios at most, and no good image filtering effect can be obtained in any image filtering scenario. Therefore, it is necessary to solve the problem that the filtering parameters in the hardware filter cannot be adjusted, so as to obtain a better image filtering effect in any image filtering scene.
发明内容Summary of the invention
本申请实施例提供了一种图像处理装置和图像处理方法,硬件滤波器利用用户配置的滤波参数对图像进行滤波,可以解决硬件滤波器只能利用一组固定的滤波参数进行滤波的问题。The embodiments of the present application provide an image processing device and an image processing method. The hardware filter uses a user-configured filter parameter to filter an image, which can solve the problem that the hardware filter can only use a fixed set of filter parameters for filtering.
第一方面,本申请实施例提供了一种图像处理装置,包括:In a first aspect, an embodiment of the present application provides an image processing apparatus, including:
调度器,用于获得输入设备输入的参数集选择指令,所述参数集选择指令为用户通过所述输入设备输入的指令并且用于指示从存储器存储的F个滤波参数集文件中选择N个滤 波参数集文件,其中,F为大于1的正整数,N为大于0的整数;The scheduler is used to obtain a parameter set selection instruction input by the input device, the parameter set selection instruction is an instruction input by a user through the input device and is used to instruct to select N filters from the F filter parameter set files stored in the memory Parameter set file, where F is a positive integer greater than 1 and N is an integer greater than 0;
与所述调度器耦合的硬件滤波器,用于利用所述N个滤波参数集文件中一个滤波参数集文件所包含的一组滤波参数对参考图像进行滤波。A hardware filter coupled to the scheduler is used to filter the reference image using a set of filter parameters included in one filter parameter set file among the N filter parameter set files.
本申请实施例中,用户自行配置硬件滤波器中的滤波参数文件,以便于硬件滤波器利用用户配置的滤波参数文件对图像进行滤波,可以满足不同场景的需求、实现简单。In the embodiment of the present application, the user configures the filter parameter file in the hardware filter by himself, so that the hardware filter uses the user-configured filter parameter file to filter the image, which can meet the needs of different scenarios and is simple to implement.
在一个可选的实现方式中,分别与所述调度器和所述硬件滤波器耦合的图像处理器,用于解析所述一个滤波参数集文件,得到参考滤波参数集;根据所述参考图像在水平方向的第一缩放系数和在垂直方向的第二缩放系数,确定所述参考滤波参数集中的所述一组滤波参数为所述硬件滤波器利用所述参考滤波参数集对所述参考图像进行滤波待采用的参数。In an optional implementation, an image processor respectively coupled to the scheduler and the hardware filter is used to parse the one filter parameter set file to obtain a reference filter parameter set; according to the reference image in A first scaling factor in the horizontal direction and a second scaling factor in the vertical direction, determining that the set of filtering parameters in the reference filtering parameter set is the hardware filter using the reference filtering parameter set for the reference image Filter the parameters to be used.
所述参考滤波参数集文件包括至少两组滤波参数。The reference filtering parameter set file includes at least two sets of filtering parameters.
在该实现方式中,图像处理器根据参考图像在水平方向的第一缩放系数和在垂直方向的第二缩放系数,确定硬件滤波器利用参考滤波参数集对所述参考图像进行滤波待采用的参数;以便于该参考图像滤波后的图像的尺寸满足要求。In this implementation, the image processor determines the parameters to be used by the hardware filter to filter the reference image using the reference filtering parameter set according to the first scaling factor in the horizontal direction and the second scaling factor in the vertical direction of the reference image ; So that the size of the filtered image of the reference image meets the requirements.
在一个可选的实现方式中,所述调度器,还用于根据所述参数集选择指令,将所述N个滤波参数集文件对应的N个文件名发送给所述图像处理器,所述N个文件名与所述N个滤波参数集文件一一对应;In an optional implementation manner, the scheduler is further configured to send N file names corresponding to the N filter parameter set files to the image processor according to the parameter set selection instruction, the N file names correspond to the N filter parameter set files in one-to-one correspondence;
所述图像处理器,还用于根据参考文件名从所述存储器获取所述参考滤波参数集文件,所述参考文件名为所述参考滤波参数集文件的文件名且包含于所述N个文件名。The image processor is further configured to obtain the reference filter parameter set file from the memory according to a reference file name, the reference file name is the file name of the reference filter parameter set file and is included in the N files name.
可选的,所述调度器,还用于从所述存储器中读取所述参考图像,并发送给所述图像处理器。Optionally, the scheduler is further configured to read the reference image from the memory and send it to the image processor.
在该实现方式中,调度器通过向图像处理器发送参考文件名,以便于该图像处理器利用该参考文件名从存储器读取参考滤波参数集;实现简单、消耗的信令资源少。In this implementation, the scheduler sends the reference file name to the image processor, so that the image processor uses the reference file name to read the reference filtering parameter set from the memory; the implementation is simple and consumes little signaling resources.
在一个可选的实现方式中,所述图像处理器,具体用于根据所述第一缩放系数从所述参考滤波参数集中选择一组水平方向的滤波参数,以及根据所述第二缩放系数从所述参考滤波参数集中选择一组垂直方向的滤波参数;将所述一组水平方向的滤波参数和所述一组垂直方向的滤波参数作为所述一组滤波参数;将所述一组滤波参数配置到所述硬件滤波器的寄存器;In an optional implementation manner, the image processor is specifically configured to select a set of horizontal filtering parameters from the reference filtering parameter set according to the first scaling factor, and select The reference filtering parameter set collectively selects a group of vertical filtering parameters; the group of horizontal filtering parameters and the group of vertical filtering parameters are used as the group of filtering parameters; the group of filtering parameters A register configured to the hardware filter;
所述硬件滤波器,具体用于读取所述寄存器中的所述一组滤波参数,并利用所述一组滤波参数对所述参考图像进行滤波。The hardware filter is specifically used to read the set of filter parameters in the register and filter the reference image using the set of filter parameters.
所述参考滤波参数集文件包括至少两组水平方向的滤波参数和至少两组垂直方向的滤波参数。所述图像处理器可以利用图像水平方向的缩放系数与水平方向的滤波参数的映射关系,确定任一个水平方向的缩放系数对应的一组水平方向的滤波参数;可以利用图像垂直方向的缩放系数与垂直方向的滤波参数的映射关系,确定任一个垂直方向的缩放系数对应的一组垂直方向的滤波参数。可选的,图像水平方向的缩放系数对应H个参数区间,所述参考滤波参数集文件包括H组水平方向的滤波参数,所述H组水平方向的滤波参数与所述H个参数区间一一对应,H为大于1的整数。所述图像处理器可以从所述H组水平方向的滤波参数中选择与所述第一缩放系数所处的参数区间相对应的一组水平方向的滤波参 数。可选的,图像垂直方向的缩放系数对应G个参数区间,所述参考滤波参数集文件包括G组垂直方向的滤波参数,所述G组垂直方向的滤波参数与所述G个参数区间一一对应,G为大于1的整数。所述图像处理器可以从所述G组垂直方向的滤波参数中选择与所述第二缩放系数所处的参数区间相对应的一组垂直方向的滤波参数。The reference filtering parameter set file includes at least two sets of filtering parameters in the horizontal direction and at least two sets of filtering parameters in the vertical direction. The image processor may use the mapping relationship between the horizontal scaling factor and the horizontal filtering parameter to determine a set of horizontal filtering parameters corresponding to any horizontal scaling factor; the vertical scaling factor and The mapping relationship of the filter parameters in the vertical direction determines a set of filter parameters in the vertical direction corresponding to any vertical scaling factor. Optionally, the horizontal scaling factor of the image corresponds to H parameter intervals, and the reference filtering parameter set file includes H sets of horizontal filtering parameters, and the H sets of horizontal filtering parameters are in one-to-one relationship with the H parameter intervals Correspondingly, H is an integer greater than 1. The image processor may select a set of horizontal filtering parameters corresponding to the parameter interval where the first scaling factor is located from the H sets of horizontal filtering parameters. Optionally, the vertical scaling factor of the image corresponds to G parameter intervals, and the reference filtering parameter set file includes G sets of vertical filtering parameters, and the G sets of vertical filtering parameters are in one-to-one relationship with the G parameter intervals Correspondingly, G is an integer greater than 1. The image processor may select a group of vertical filtering parameters corresponding to the parameter interval where the second scaling factor is located from the G group of vertical filtering parameters.
在该实现方式中,图像处理器可以根据参考图像在水平方向的缩放系数以及在垂直方向的缩放系数为硬件滤波器配置滤波参数,以便于该参考图像滤波后的图像的尺寸满足要求。In this implementation, the image processor may configure the filtering parameters for the hardware filter according to the horizontal and vertical scaling factors of the reference image, so that the size of the filtered image of the reference image meets the requirements.
在一个可选的实现方式中,所述硬件滤波器,还用于将所述参考图像滤波后的图像发送给所述图像处理器;In an optional implementation manner, the hardware filter is further used to send the filtered image of the reference image to the image processor;
所述图像处理器,还用于将所述参考图像滤波后的图像发送给所述调度器;所述图像处理装置还包括:The image processor is further configured to send the filtered image of the reference image to the scheduler; the image processing device further includes:
与所述调度器耦合的神经网络处理器NPU;A neural network processor NPU coupled with the scheduler;
所述调度器,还用于将所述参考图像滤波后的图像输入至所述NPU;The scheduler is further configured to input the filtered image of the reference image to the NPU;
所述NPU,用于利用目标AI网络对所述参考图像滤波后的图像做图像分析,将得到的图像分析结果发送给所述调度器。The NPU is used to perform image analysis on the filtered image of the reference image using a target AI network, and send the obtained image analysis result to the scheduler.
在该实现方式中,利用AI网络对参考图像滤波后的图像做图像分析,图像处理效率高。In this implementation, the AI network is used to perform image analysis on the filtered image of the reference image, and the image processing efficiency is high.
在一个可选的实现方式中,所述图像处理装置还包括:In an optional implementation manner, the image processing apparatus further includes:
与所述调度器耦合的结果比对器;A result comparator coupled with the scheduler;
所述调度器,还用于将所述参考图像的标注信息和所述图像分析结果发送给所述结果比对器;The scheduler is also used to send the annotation information of the reference image and the image analysis result to the result comparator;
所述结果比对器,用于对所述图像分析结果和所述参考图像的标注信息做比对,得到所述参数图像的比对结果。The result comparator is used to compare the image analysis result with the reference information of the reference image to obtain the comparison result of the parameter image.
在该实现方式中,利用结果比对器对图像分析结果和图像的标注信息做比对,以便于确定硬件滤波器的滤波效果。In this implementation, the result comparison device is used to compare the image analysis result with the image annotation information, so as to determine the filtering effect of the hardware filter.
在一个可选的实现方式中,所述结果比对器,还用于将所述参考图像的比对结果以及所述图像集中除所述参考图像之外的每个图像的比对结果发送给所述调度器;其中,所述结果比对器得到所述图像集中除所述参考图像之外的每个图像的比对结果的方式与得到所述参考图像的比对结果的方式相同,所述图像集包括至少两个图像;In an optional implementation manner, the result comparator is further configured to send the comparison result of the reference image and the comparison result of each image in the image set except the reference image to The scheduler; wherein, the result aligner obtains the comparison result of each image in the image set except the reference image in the same way as the reference result. The image set includes at least two images;
所述调度器,还用于根据所述图像集中每个图像的比对结果,确定所述参考滤波参数集的滤波效果;分别确定N个滤波参数集中除所述参考滤波参数集之外的滤波参数集的滤波效果,所述N个滤波参数集为所述图像处理器解析所述N个滤波参数集文件得到的N个参数集;将所述N个滤波参数集中滤波效果最好的目标滤波参数集配置为所述硬件滤波器的滤波参数集;其中,所述调度器确定所述N个滤波参数集中除所述参考滤波参数集之外的滤波参数集的滤波效果的方式与确定所述参考滤波参数集的滤波效果的方式相同。The scheduler is further configured to determine the filtering effect of the reference filtering parameter set according to the comparison result of each image in the image set; separately determine the filtering other than the reference filtering parameter set in the N filtering parameter sets The filtering effect of the parameter set, where the N filtering parameter sets are N parameter sets obtained by the image processor parsing the N filtering parameter set files; the N filtering parameter set is the target filter with the best filtering effect The parameter set is configured as a filtering parameter set of the hardware filter; wherein, the manner in which the scheduler determines the filtering effect of the filtering parameter set other than the reference filtering parameter set in the N filtering parameter sets and determines the The filtering effect of the reference filtering parameter set is the same.
在该实现方式中,调度器将多个滤波参数集中滤波效果最好的目标滤波参数集配置为硬件滤波器的滤波参数集,可以提高图像处理的性能。In this implementation, the scheduler configures the target filtering parameter set with the best filtering effect in multiple filtering parameter sets as the filtering parameter set of the hardware filter, which can improve the performance of image processing.
在一个可选的实现方式中,所述NPU,还用于获得所述输入设备输入的AI网络选择指令,所述AI网络选择指令用于选择至少两个待选择的AI网络中的所述目标AI网络;根 据所述AI网络选择指令,将所述NPU采用的网络配置为所述目标AI网络;In an optional implementation manner, the NPU is further used to obtain an AI network selection instruction input by the input device, and the AI network selection instruction is used to select the target in at least two AI networks to be selected AI network; configure the network adopted by the NPU as the target AI network according to the AI network selection instruction;
或者,or,
所述NPU,还用于获得所述输入设备输入的AI网络编程代码;执行所述AI网络编程代码实现所述目标AI网络。The NPU is also used to obtain the AI network programming code input by the input device; execute the AI network programming code to implement the target AI network.
在该实现方式中,用户自行配置图像处理装置中的AI网络,以便于处理不同类型的图像或执行不同的图像处理操作,能够满足不同的需求。In this implementation manner, the user configures the AI network in the image processing apparatus to facilitate processing different types of images or performing different image processing operations, which can meet different needs.
第二方面本申请实施例提供了一种图像处理方法,应用于图像处理装置,所述图像处理装置包括调度器以及硬件滤波器,该方法包括:In a second aspect, an embodiment of the present application provides an image processing method, which is applied to an image processing apparatus. The image processing apparatus includes a scheduler and a hardware filter. The method includes:
所述调度器获得输入设备输入的参数集选择指令,所述参数集选择指令为用户通过所述输入设备输入的指令并且用于指示从存储器存储的F个滤波参数集文件中选择N个滤波参数集文件,其中,F为大于1的正整数,N为大于0的整数;The scheduler obtains a parameter set selection instruction input by the input device, where the parameter set selection instruction is an instruction input by the user through the input device and is used to instruct the selection of N filter parameters from the F filter parameter set files stored in the memory Set file, where F is a positive integer greater than 1 and N is an integer greater than 0;
所述硬件滤波器利用所述N个滤波参数集文件中一个滤波参数集文件所包含的一组滤波参数对参考图像进行滤波。The hardware filter uses a set of filtering parameters included in one filtering parameter set file among the N filtering parameter set files to filter the reference image.
本申请实施例中,用户可以根据自行配置硬件滤波器的滤波参数文件,以便于硬件滤波器利用用户配置的滤波参数文件对图像进行滤波,可以满足不同场景的需求、实现简单。In the embodiment of the present application, the user can configure the filter parameter file of the hardware filter according to oneself, so that the hardware filter uses the user-configured filter parameter file to filter the image, which can meet the needs of different scenarios and is simple to implement.
在一个可选的实现方式中,所述图像处理器还包括分别与所述调度器和所述硬件滤波器耦合的图像处理器;所述硬件滤波器利用所述N个滤波参数集文件中一个滤波参数集文件所包含的一组滤波参数对参考图像进行滤波之前,所述方法还包括:In an optional implementation manner, the image processor further includes an image processor respectively coupled to the scheduler and the hardware filter; the hardware filter uses one of the N filtering parameter set files Before filtering the reference image with a set of filtering parameters included in the filtering parameter set file, the method further includes:
所述图像处理器解析所述一个滤波参数集文件,得到参考滤波参数集;根据所述参考图像在水平方向的第一缩放系数和在垂直方向的第二缩放系数,确定所述参考滤波参数集中的所述一组滤波参数为所述硬件滤波器利用所述参考滤波参数集对所述参考图像进行滤波待采用的参数。The image processor parses the one filtering parameter set file to obtain a reference filtering parameter set; and determines the reference filtering parameter set according to the first scaling factor of the reference image in the horizontal direction and the second scaling factor in the vertical direction The set of filtering parameters is a parameter to be used by the hardware filter to filter the reference image by using the reference filtering parameter set.
在一个可选的实现方式中,所述图像处理器将参考滤波参数集文件中的一组滤波参数配置为所述硬件滤波器对参考图像进行滤波待采用的滤波参数之前,所述方法还包括:In an optional implementation manner, before the image processor configures a set of filter parameters in the reference filter parameter set file as the filter parameters to be used by the hardware filter to filter the reference image, the method further includes :
所述调度器根据所述参数集选择指令,将所述N个滤波参数集文件对应的N个文件名发送给所述图像处理器,所述N个文件名与所述N个滤波参数集文件一一对应;The scheduler sends N file names corresponding to the N filter parameter set files to the image processor according to the parameter set selection instruction, the N file names and the N filter parameter set files One-to-one correspondence
所述图像处理器根据参考文件名从所述第一存储器获取所述参考滤波参数集文件,所述参考文件名为所述参考滤波参数集文件的文件名且包含于所述N个文件名。The image processor obtains the reference filter parameter set file from the first memory according to a reference file name, where the reference file name is the file name of the reference filter parameter set file and is included in the N file names.
在一个可选的实现方式中,所述根据所述参考图像在水平方向的第一缩放系数和在垂直方向的第二缩放系数,确定所述参考滤波参数集中的所述一组滤波参数为所述硬件滤波器利用所述参考滤波参数集对所述参考图像进行滤波待采用的参数包括:In an optional implementation manner, the determining of the set of filtering parameters in the reference filtering parameter set is based on the first scaling factor in the horizontal direction and the second scaling factor in the vertical direction of the reference image The hardware filter uses the reference filtering parameter set to filter the reference image, and the parameters to be adopted include:
所述图像处理器根据所述第一缩放系数从所述参考滤波参数集中选择一组水平方向的滤波参数,以及根据所述第二缩放系数从所述参考滤波参数集中选择一组垂直方向的滤波参数;将所述一组水平方向的滤波参数和所述一组垂直方向的滤波参数作为所述一组滤波参数;将所述一组滤波参数配置到所述硬件滤波器的寄存器;The image processor selects a set of horizontal filtering parameters from the reference filtering parameter set according to the first scaling factor, and selects a set of vertical filtering from the reference filtering parameter set according to the second scaling factor Parameters; the set of horizontal filtering parameters and the set of vertical filtering parameters as the set of filtering parameters; configuring the set of filtering parameters to the register of the hardware filter;
所述硬件滤波器利用所述N个滤波参数集文件中一个滤波参数集文件所包含的一组滤波参数对参考图像进行滤波包括:The hardware filter filtering the reference image using a set of filtering parameters included in one filtering parameter set file among the N filtering parameter set files includes:
所述硬件滤波器读取所述寄存器中的所述一组滤波参数,并利用所述一组滤波参数对 所述参考图像进行滤波。The hardware filter reads the set of filter parameters in the register and uses the set of filter parameters to filter the reference image.
在一个可选的实现方式中,所述图像处理装置还包括与所述调度器耦合的神经网络处理器NPU;所述硬件滤波器利用所述N个滤波参数集文件中一个滤波参数集文件所包含的一组滤波参数对参考图像进行滤波之后,所述方法还包括:In an optional implementation manner, the image processing device further includes a neural network processor NPU coupled to the scheduler; the hardware filter utilizes a filtering parameter set file among the N filtering parameter set files After filtering the reference image with the included set of filtering parameters, the method further includes:
所述硬件滤波器将所述参考图像滤波后的图像发送给所述图像处理器;The hardware filter sends the filtered image of the reference image to the image processor;
所述图像处理器将所述参考图像滤波后的图像发送给所述调度器;The image processor sends the filtered image of the reference image to the scheduler;
所述调度器将所述参考图像滤波后的图像输入至所述NPU;The scheduler inputs the filtered image of the reference image to the NPU;
所述NPU利用目标AI网络对所述参考图像滤波后的图像做图像分析,将得到的图像分析结果发送给所述调度器。The NPU uses the target AI network to perform image analysis on the filtered image of the reference image, and sends the obtained image analysis result to the scheduler.
在一个可选的实现方式中,所述图像处理装置还包括与所述调度器耦合的结果比对器;所述NPU利用目标AI网络对所述参考图像滤波后的图像做图像分析,将得到的图像分析结果发送给所述调度器之后,所述方法还包括:In an optional implementation manner, the image processing device further includes a result comparator coupled with the scheduler; the NPU performs image analysis on the filtered image of the reference image by using a target AI network, and will obtain After the image analysis result of is sent to the scheduler, the method further includes:
所述调度器将所述参考图像的标注信息和所述图像分析结果发送给所述结果比对器;The scheduler sends the annotation information of the reference image and the image analysis result to the result comparator;
所述结果比对器对所述图像分析结果和所述参考图像的标注信息做比对,得到所述参数图像的比对结果。The result comparison device compares the image analysis result with the reference information of the reference image to obtain a comparison result of the parameter image.
在一个可选的实现方式中,所述结果比对器对所述图像分析结果和所述参考图像的标注信息做比对,得到所述参数图像的比对结果之后,所述方法还包括:In an optional implementation manner, the result comparator compares the image analysis result with the reference information of the reference image, and after obtaining the comparison result of the parameter image, the method further includes:
所述结果比对器将所述参考图像的比对结果以及图像集中除所述参考图像之外的每个图像的比对结果发送给所述调度器;其中,所述结果比对器得到所述图像集中除所述参考图像之外的每个图像的比对结果的方式与得到所述参考图像的比对结果的方式相同,所述图像集包括至少两个图像;The result comparator sends the comparison result of the reference image and the comparison result of each image in the image set except the reference image to the scheduler; wherein, the result comparator obtains the result The way of comparing the results of each image in the image set except the reference image is the same as the way of obtaining the results of the comparison of the reference image, and the image set includes at least two images;
所述调度器根据所述图像集中每个图像的比对结果,确定所述参考滤波参数集的滤波效果;分别确定N个滤波参数集中除所述参考滤波参数集之外的滤波参数集的滤波效果,所述N个滤波参数集为所述图像处理器解析所述N个滤波参数集文件得到的N个参数集;将所述N个滤波参数集中滤波效果最好的目标滤波参数集配置为所述硬件滤波器的滤波参数集;其中,所述调度器确定所述N个滤波参数集中除所述参考滤波参数集之外的滤波参数集的滤波效果的方式与确定所述参考滤波参数集的滤波效果的方式相同。The scheduler determines the filtering effect of the reference filtering parameter set according to the comparison result of each image in the image set; separately determines the filtering of the filtering parameter sets other than the reference filtering parameter set in the N filtering parameter sets Effect, the N filter parameter sets are N parameter sets obtained by the image processor parsing the N filter parameter set files; the target filter parameter set with the best filtering effect in the N filter parameter sets is configured as A filtering parameter set of the hardware filter; wherein, the manner in which the scheduler determines a filtering effect of a filtering parameter set other than the reference filtering parameter set in the N filtering parameter sets and determines the reference filtering parameter set The filtering effect is the same.
在一个可选的实现方式中,所述NPU利用目标AI网络对所述参考图像滤波后的图像做图像分析,将得到的图像分析结果发送给所述调度器之前,所述方法还包括:In an optional implementation manner, before the NPU uses the target AI network to perform image analysis on the filtered image of the reference image, and before sending the obtained image analysis result to the scheduler, the method further includes:
所述NPU获得所述输入设备输入的AI网络选择指令,所述AI网络选择指令用于选择至少两个待选择的AI网络中的所述目标AI网络;根据所述AI网络选择指令,将所述NPU采用的网络配置为所述目标AI网络;The NPU obtains an AI network selection instruction input by the input device, and the AI network selection instruction is used to select the target AI network in at least two AI networks to be selected; according to the AI network selection instruction, the The network configuration adopted by the NPU is the target AI network;
或者,or,
所述NPU获得所述输入设备输入的AI网络编程代码;执行所述AI网络编程代码实现所述目标AI网络。The NPU obtains the AI network programming code input by the input device; executes the AI network programming code to implement the target AI network.
附图说明BRIEF DESCRIPTION
图1为本申请实施例提供的一种图像处理装置的结构示意图;1 is a schematic structural diagram of an image processing apparatus provided by an embodiment of the present application;
图2为本申请实施例提供的一种滤波参数集选择界面的示意图;2 is a schematic diagram of a filtering parameter set selection interface provided by an embodiment of the present application;
图3为本申请提供的另一种图像处理装置的结构示意图;3 is a schematic structural diagram of another image processing device provided by the present application;
图4为本申请实施例提供的一种计算两个边界框的重叠度的示意图;4 is a schematic diagram of calculating the overlapping degree of two bounding boxes provided by an embodiment of the present application;
图5为本申请实施例提供的另一种图像处理装置的结构示意图;5 is a schematic structural diagram of another image processing device provided by an embodiment of the present application;
图6为本申请实施例提供的一种AI网络选择界面的示意图;6 is a schematic diagram of an AI network selection interface provided by an embodiment of this application;
图7为本申请实施例提供的一种神经网络处理器的结构示意图;7 is a schematic structural diagram of a neural network processor provided by an embodiment of the present application;
图8为本申请实施例提供的一种图像处理方法的流程示意图;8 is a schematic flowchart of an image processing method according to an embodiment of the present application;
图9为本申请实施例提供的一种比较多个滤波参数集文件的滤波效果的方法流程图。9 is a flowchart of a method for comparing filtering effects of multiple filtering parameter set files according to an embodiment of the present application.
具体实施方式detailed description
为了使本技术领域的人员更好地理解本申请实施例方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚地描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。In order to enable those skilled in the art to better understand the solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be described clearly in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only It is a part of the embodiments of this application, but not all the embodiments.
本申请的说明书实施例和权利要求书及上述附图中的术语“第一”、“第二”、和“第三”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元。方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", and "third" in the description examples and claims of the present application and the above drawings are used to distinguish similar objects, and are not required to describe a specific order or The order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, including a series of steps or units. A method, system, product, or device need not be limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or equipment.
图1为本申请实施例提供的另一种图像处理装置的结构示意图。如图1所示,该图像处理装置10包括:FIG. 1 is a schematic structural diagram of another image processing apparatus provided by an embodiment of the present application. As shown in FIG. 1, the image processing apparatus 10 includes:
调度器101,用于获得输入设备102输入的参数集选择指令,所述参数集选择指令为用户通过输入设备102输入的指令并且用于指示从存储器103存储的F个滤波参数集文件中选择N个滤波参数集文件,其中,F为大于1的正整数,N为大于0的整数;The scheduler 101 is used to obtain a parameter set selection instruction input by the input device 102, where the parameter set selection instruction is an instruction input by a user through the input device 102 and is used to instruct to select N from F filter parameter set files stored in the memory 103 Filter parameter set files, where F is a positive integer greater than 1 and N is an integer greater than 0;
与调度器101耦合的硬件滤波器104,用于利用所述N个滤波参数集文件中一个滤波参数集文件所包含的一组滤波参数对参考图像进行滤波。A hardware filter 104 coupled to the scheduler 101 is used to filter the reference image by using a set of filter parameters included in one filter parameter set file among the N filter parameter set files.
输入设备102可以是键盘,鼠标,触摸屏等。存储器103存储的F个滤波参数集文件可以是图像处理装置出厂时预先配置的,也可以是用户自行配置的。下面介绍一种生成滤波参数集文件的方法:首先制定参数策略,例如迭代步长(Kaiser步长以及Gauss步长)、滤波参数区间等,从而尽可能快速而且全面的遍历该滤波参数区间;然后,根据制定的参数策略,把迭代步长和滤波参数区间作为输入参数,利用编写的系数生成脚本,生成多个滤波参数集文件。不同的参数策略产生的滤波参数集文件个数不同。用户或者研发人员可以根据需要制定不同的参数策略来生成所需的滤波参数文件。举例来说,生成200多个滤波参数集文件,每个滤波参数集文件中有1000多组水平方向的滤波参数以及1000多组垂直方向的滤波参数。可选的,图像处理装置将每个滤波参数集文件的文件名暴露给用户,用户通过输入设备102选择滤波参数集文件名来配置相应的滤波参数集。由于硬件滤波器是做图像滤波,任一滤波参数集文件中的一组滤波参数为硬件滤波器在空间域上的一组滤波参数。The input device 102 may be a keyboard, a mouse, a touch screen, or the like. The F filter parameter set files stored in the memory 103 may be pre-configured when the image processing apparatus is shipped from the factory, or may be configured by the user. The following describes a method of generating a filter parameter set file: first formulate parameter strategies, such as iterative step size (Kaiser step size and Gauss step size), filter parameter interval, etc., so as to traverse the filter parameter interval as quickly and comprehensively as possible; then According to the formulated parameter strategy, the iteration step and filter parameter interval are used as input parameters, and the script is used to generate a script to generate multiple filter parameter set files. The number of filter parameter set files generated by different parameter strategies is different. Users or R&D personnel can formulate different parameter strategies according to their needs to generate the required filter parameter files. For example, more than 200 filtering parameter set files are generated, and each filtering parameter set file has more than 1000 sets of filtering parameters in the horizontal direction and more than 1000 sets of filtering parameters in the vertical direction. Optionally, the image processing apparatus exposes the file name of each filter parameter set file to the user, and the user selects the file name of the filter parameter set through the input device 102 to configure the corresponding filter parameter set. Since the hardware filter is used for image filtering, a set of filter parameters in any filter parameter set file is a set of filter parameters in the spatial domain of the hardware filter.
本申请实施例中,用户可以根据自行配置硬件滤波器的滤波参数文件,以便于硬件滤 波器利用用户配置的滤波参数文件对图像进行滤波,可以满足不同场景的需求、实现简单。In the embodiment of the present application, the user can configure the filter parameter file of the hardware filter according to oneself, so that the hardware filter uses the user-configured filter parameter file to filter the image, which can meet the needs of different scenarios and be simple to implement.
在一个可选的实现方式中,所述图像处理装置还包括分别与调度器101和硬件滤波器104耦合的图像处理器105:In an optional implementation manner, the image processing apparatus further includes an image processor 105 coupled to the scheduler 101 and the hardware filter 104, respectively:
图像处理器105,用于解析所述一个滤波参数集文件,得到参考滤波参数集;根据所述参考图像在水平方向的第一缩放系数和在垂直方向的第二缩放系数,确定所述参考滤波参数集中的所述一组滤波参数为所述硬件滤波器利用所述参考滤波参数集对所述参考图像进行滤波待采用的参数。The image processor 105 is configured to parse the one filter parameter set file to obtain a reference filter parameter set; determine the reference filter according to the first scaling factor of the reference image in the horizontal direction and the second scaling factor in the vertical direction The set of filtering parameters in the parameter set is a parameter to be used by the hardware filter to filter the reference image by using the reference filtering parameter set.
可选的,图像处理器105,具体用于根据所述第一缩放系数从所述参考滤波参数集中选择一组水平方向的滤波参数,以及根据所述第二缩放系数从所述参考滤波参数集中选择一组垂直方向的滤波参数;将所述一组水平方向的滤波参数和所述一组垂直方向的滤波参数作为所述一组滤波参数;将所述一组滤波参数配置到硬件滤波器101的寄存器;Optionally, the image processor 105 is specifically configured to select a set of horizontal filtering parameters from the reference filtering parameter set according to the first scaling factor, and from the reference filtering parameter set according to the second scaling factor Select a set of vertical filtering parameters; use the set of horizontal filtering parameters and the set of vertical filtering parameters as the set of filtering parameters; configure the set of filtering parameters to the hardware filter 101 Register of
硬件滤波器104,具体用于读取所述寄存器中的所述一组滤波参数,并利用所述一组滤波参数对所述参考图像进行滤波。The hardware filter 104 is specifically used to read the set of filter parameters in the register and filter the reference image using the set of filter parameters.
上述参考图像在水平方向的第一缩放系数是指上述参考图像调整为图像处理装置要求的输入图像的标准大小在水平方向对应的缩放系数。上述参考图像在垂直方向的第二缩放系数是指上述参考图像调整为图像处理装置要求的输入图像的标准大小在垂直方向对应的缩放系数。上述参考滤波参数集文件包括至少两组水平方向的滤波参数和至少两组垂直方向的滤波参数。上述图像处理器可以利用图像水平方向的缩放系数与水平方向的滤波参数的映射关系,确定任一个水平方向的缩放系数对应的一组水平方向的滤波参数;可以利用图像垂直方向的缩放系数与垂直方向的滤波参数的映射关系,确定任一个垂直方向的缩放系数对应的一组垂直方向的滤波参数。可选的,图像水平方向的缩放系数对应H个参数区间,上述参考滤波参数集文件包括H组水平方向的滤波参数,上述H组水平方向的滤波参数与上述H个参数区间一一对应,H为大于1的整数。上述图像处理器可以从上述H组水平方向的滤波参数中选择与上述第一缩放系数所处的参数区间相对应的一组水平方向的滤波参数。可选的,图像垂直方向的缩放系数对应G个参数区间,上述参考滤波参数集文件包括G组垂直方向的滤波参数,上述G组垂直方向的滤波参数与上述G个参数区间一一对应,G为大于1的整数。上述图像处理器可以从上述G组垂直方向的滤波参数中选择与上述第二缩放系数所处的参数区间相对应的一组垂直方向的滤波参数。The first scaling factor of the reference image in the horizontal direction refers to a scaling factor corresponding to the standard size of the input image required by the image processing device adjusted in the horizontal direction corresponding to the reference image. The second vertical scaling factor of the reference image refers to a scaling factor corresponding to the vertical size of the reference image adjusted to the standard size of the input image required by the image processing device. The above reference filtering parameter set file includes at least two sets of filtering parameters in the horizontal direction and at least two sets of filtering parameters in the vertical direction. The above image processor can use the mapping relationship between the horizontal scaling factor and the horizontal filtering parameter to determine a set of horizontal filtering parameters corresponding to any horizontal scaling factor; the vertical scaling factor and the vertical can be used The mapping relationship of the filter parameters in the direction determines a set of filter parameters in the vertical direction corresponding to any vertical scaling factor. Optionally, the horizontal scaling factor of the image corresponds to H parameter intervals. The reference filter parameter set file includes H sets of horizontal filtering parameters. The H sets of horizontal filtering parameters correspond to the H parameter intervals in one-to-one correspondence. It is an integer greater than 1. The image processor may select a group of horizontal filtering parameters corresponding to the parameter interval where the first scaling factor is located from the H group of horizontal filtering parameters. Optionally, the scaling factor in the vertical direction of the image corresponds to G parameter intervals. The above reference filter parameter set file includes G sets of vertical filtering parameters, and the G sets of vertical filtering parameters correspond one-to-one to the G parameter intervals. G It is an integer greater than 1. The image processor may select a group of vertical filter parameters corresponding to the parameter interval in which the second scaling factor is located from the G group of vertical filter parameters.
所述参考图像为数据处理装置当前待处理的图像且为图像集中的一个图像。存储器103存储有所述图像集。所述图像集中每个图像都是标注过的,即每个图像都有一个标注信息(标签或真实值)。可以理解,上述图像集中的每个图像都为测试图像,用于测试图像处理装置的图像处理效果。图像被标注的标签或真实值(标注信息)称为Ground Truth,每个图像的Ground Truth用于后续和该图像经过AI网络处理输出的推理值(图像分析结果)进行比对。The reference image is an image currently to be processed by the data processing device and is an image in the image set. The memory 103 stores the image set. Each image in the image set is annotated, that is, each image has an annotation information (label or true value). It can be understood that each image in the above image set is a test image, which is used to test the image processing effect of the image processing device. The label or true value (annotated information) of the image is called Ground Truth. The Ground Truth of each image is used for subsequent comparison with the inference value (image analysis result) output by the image through the AI network processing.
在实际应用中,图像处理器可以利用参考滤波参数集文件为硬件滤波器配置其处理图像集中的每个图像采用的滤波参数。也就是说,图像处理器可以利用用户选择的一个或多个滤波参数集文件为硬件滤波器配置滤波参数,硬件滤波器使用的滤波参数集文件不再是固定不变的,而是用户根据需要自行选择的。另外,用户还可以选择多个滤波参数集文件, 图像处理器利用这些滤波参数集文件中的每个参数集文集为硬件滤波器配置滤波参数,以便于用户确定这些滤波参数集文件中滤波效果最好的一个滤波参数集文件。可以理解,用户可以测试各滤波参数集文件的滤波效果,进而选择一个滤波效果最好的滤波参数集文件在后续做图像处理时使用。In practical applications, the image processor can use the reference filter parameter set file to configure the hardware filter with the filter parameters used for processing each image in the image set. In other words, the image processor can use one or more filter parameter set files selected by the user to configure the filter parameters for the hardware filter. The filter parameter set file used by the hardware filter is no longer fixed, but the user can Choose it yourself. In addition, users can also select multiple filter parameter set files. The image processor uses each parameter set corpus in these filter parameter set files to configure filter parameters for the hardware filter, so that the user can determine the most effective filtering effect in these filter parameter set files. A good filtering parameter set file. It can be understood that the user can test the filtering effect of each filtering parameter set file, and then select a filtering parameter set file with the best filtering effect to use in subsequent image processing.
在该实现方式中,图像处理器可以根据参考图像在水平方向的缩放系数以及在垂直方向的缩放系数为硬件滤波器配置滤波参数,以便于该参考图像滤波后的图像的尺寸满足要求。In this implementation, the image processor may configure the filtering parameters for the hardware filter according to the horizontal and vertical scaling factors of the reference image, so that the size of the filtered image of the reference image meets the requirements.
在一个可选的实现方式中,调度器101,还用于根据上述参数集选择指令,将上述N个滤波参数集文件对应的N个文件名发送给图像处理器105,上述N个文件名与上述N个滤波参数集文件一一对应;In an alternative implementation, the scheduler 101 is further configured to send the N file names corresponding to the N filter parameter set files to the image processor 105 according to the parameter set selection instruction, and the N file names and The above N filter parameter set files are in one-to-one correspondence;
图像处理器105,还用于根据参考文件名从存储器103获取上述参考滤波参数集文件,上述参考文件名为上述参考滤波参数集文件的文件名且包含于上述N个文件名。The image processor 105 is further configured to acquire the reference filter parameter set file from the memory 103 according to the reference file name, where the reference file name is the file name of the reference filter parameter set file and is included in the N file names.
图2为本申请实施例提供的一种滤波参数集选择界面的示意图。如图2所示,滤波参数集选择界面包括F个滤波参数集文件的文件名,即第一文件名至第F文件名;每个文件名前面的正方形为该文件名对应的滤波参数集文件的选择接口,用户通过键盘或鼠标选中该正方形后,该正方形变为黑色(表示该正方形对应的选择接口被选中)。上述参数集选择指令为用户通过输入设备选择文件名的操作。该滤波参数集选择界面为图像处理程序的一个界面。如图2所示,第二文件名、第三文件名以及第五文件名为用户选中的文件名,这三个文件名对应的3个滤波参数文件为用户配置的滤波参数文件,图像处理装置采用这三个滤波参数文件做图像处理。FIG. 2 is a schematic diagram of a filtering parameter set selection interface provided by an embodiment of the present application. As shown in FIG. 2, the filtering parameter set selection interface includes file names of F filtering parameter set files, that is, the first file name to the Fth file name; the square in front of each file name is the filtering parameter set file corresponding to the file name After the user selects the square through the keyboard or the mouse, the square turns black (indicating that the corresponding selection interface of the square is selected). The above parameter set selection instruction is an operation for the user to select the file name through the input device. The filtering parameter set selection interface is an interface of the image processing program. As shown in FIG. 2, the second file name, the third file name, and the fifth file name are the file names selected by the user, and the three filter parameter files corresponding to the three file names are filter parameter files configured by the user, and the image processing device Use these three filter parameter files for image processing.
可选的,调度器101,还用于从存储器103中读取上述参考图像,并发送给上述图像处理器。在实际应用中,调度器101每次从图像集中读取一个图像,并把该图像传递给图像处理器105。Optionally, the scheduler 101 is also used to read the reference image from the memory 103 and send it to the image processor. In practical applications, the scheduler 101 reads one image from the image set at a time, and passes the image to the image processor 105.
在该实现方式中,调度器向图像处理器发送滤波参数集文件的文件名,以便于该图像处理器根据接收到的文件名从存储器读取相应的滤波参数集文件;实现简单、消耗的信令资源少。In this implementation, the scheduler sends the file name of the filter parameter set file to the image processor, so that the image processor reads the corresponding filter parameter set file from the memory according to the file name received; Make less resources.
图3为本申请提供的另一种图像处理装置的结构示意图,是对图1所示装置的进一步细化。如图3所示,图3中的图像处理装置在图1中的图像处理装置的基础上增加了均与调度器101耦合的NPU320和结果比对器340。NPU320可实现多种AI网络,NPU320可采用AI网络对来自调度器101的滤波后的图像做图像分析或图像处理。结果比对器340用于对图像分析结果(图像处理结果)和真实结果(测试图像的标注信息)做比对,以便于确定图像分析或图像处理的正确性。图3中的图像处理装置可实现如下操作:FIG. 3 is a schematic structural diagram of another image processing device provided by the present application, which is a further refinement of the device shown in FIG. 1. As shown in FIG. 3, the image processing device in FIG. 3 adds an NPU 320 and a result comparator 340 that are both coupled to the scheduler 101 on the basis of the image processing device in FIG. 1. The NPU 320 can implement various AI networks. The NPU 320 can use the AI network to perform image analysis or image processing on the filtered image from the scheduler 101. The result comparer 340 is used to compare the image analysis result (image processing result) with the real result (marking information of the test image), so as to determine the correctness of the image analysis or image processing. The image processing device in FIG. 3 can realize the following operations:
301、调度器101获得输入设备102输入的参数集选择指令。301. The scheduler 101 obtains a parameter set selection instruction input by the input device 102.
输入设备102可以是键盘、鼠标、触摸屏等。在实际应用中,用户通过输入设备102选择图3中的滤波参数集选择界面中的文件名的操作可以理解为输入设备102输入的参数集选择指令。The input device 102 may be a keyboard, a mouse, a touch screen, or the like. In practical applications, the operation of the user selecting the file name in the filter parameter set selection interface in FIG. 3 through the input device 102 can be understood as the parameter set selection instruction input by the input device 102.
302、调度器101从存储器103读取参考图像。302. The scheduler 101 reads the reference image from the memory 103.
上述参考图像为存储器103存储的图像集中的任一图像。在实际应用中,调度器101 依次读取图像集中的每个图像,并发送给图像处理器105处理。The above reference image is any image in the image set stored in the memory 103. In practical applications, the scheduler 101 sequentially reads each image in the image set and sends it to the image processor 105 for processing.
303、调度器101将上述参数集选择指令选中的N个文件名发送给图像处理器105。303. The scheduler 101 sends the N file names selected by the parameter set selection instruction to the image processor 105.
上述N个文件名为存储器103存储的F个滤波参数集文件中的N个滤波参数集文件对应的文件名。可选的,调度器101每次将上述N个文件名中的一个文件名发送给图像处理器105。可选的,调度器将上述参考图像和至少一个文件名一起发送给图像处理器105。存储F个滤波参数集文件的存储器和存储图像集的存储器可以相同,也可以不同。The above N file names are the file names corresponding to the N filter parameter set files among the F filter parameter set files stored in the memory 103. Optionally, the scheduler 101 sends one of the N file names to the image processor 105 each time. Optionally, the scheduler sends the above reference image together with at least one file name to the image processor 105. The memory storing the F filter parameter set files and the memory storing the image set may be the same or different.
304、图像处理器105利用参考文件名从存储器103获取参考滤波参数集文件。304. The image processor 105 obtains the reference filter parameter set file from the memory 103 using the reference file name.
上述参考文件名为上述参考滤波参数集文件的文件名且包含于上述N个文件名。The reference file name is the file name of the reference filter parameter set file and is included in the N file names.
305、图像处理器105将上述参考滤波参数集文件中的一组滤波参数配置为硬件滤波器104对参考图像进行滤波待采用的滤波参数。305. The image processor 105 configures a set of filter parameters in the reference filter parameter set file as a filter parameter to be used by the hardware filter 104 to filter the reference image.
前述实施例中详述了图像处理器105如何利用参考滤波参数集文件为硬件滤波器104配置滤波参数的实现方式,这里不再详述。The foregoing embodiment details how the image processor 105 uses the reference filtering parameter set file to configure the filtering parameters for the hardware filter 104, which will not be described in detail here.
306、硬件滤波器104利用上述一组滤波参数对上述参考图像进行滤波,并将上述参考图像滤波后的图像发送给图像处理器105。306. The hardware filter 104 uses the above set of filtering parameters to filter the reference image, and sends the filtered image of the reference image to the image processor 105.
307、图像处理器105将上述参考图像滤波后的图像发送给调度器101。307. The image processor 105 sends the filtered image of the reference image to the scheduler 101.
308、调度器101将上述参考图像滤波后的图像发送给NPU320。308. The scheduler 101 sends the filtered image of the reference image to the NPU 320.
309、NPU320利用目标AI网络对上述参考图像滤波后的图像做图像分析,将得到的图像分析结果发送给调度器101。309. The NPU 320 uses the target AI network to perform image analysis on the filtered image of the reference image, and sends the obtained image analysis result to the scheduler 101.
310、调度器101将上述图像分析结果以及上述参考图像的标注信息发送给结果比对器430。310. The scheduler 101 sends the image analysis result and the annotation information of the reference image to the result comparator 430.
可选的,结果比对器340存储有上述参考图像的标注信息,调度器101仅需将上述图像分析结果发送至结果比对器340。Optionally, the result comparator 340 stores the annotation information of the reference image, and the scheduler 101 only needs to send the image analysis result to the result comparator 340.
311、结果比对器430对上述图像分析结果和上述参考图像的标注信息做比对,得到上述参数图像的比对结果。311. The result comparator 430 compares the image analysis result with the reference information of the reference image to obtain a comparison result of the parameter image.
NPU320利用的AI网络不同或者AI网络输出的图像分析结果的形式不同,结果比对器340采用的比对算法不同。举例来说,NPU320利用的AI网络为Resnet18网络或Resnet50网络,NPU320输出的图像分析结果为识别图像得到的标签(分类);结果比对器340比对NPU320输出的图像分析结果和ground truth得到top1~top5。top1是指NPU320利用AI网络预测出来最大概率的那个分类是正确的概率。top5指NPU320利用AI网络预测出来最大概率的5个分类(标签)里有正确分类的概率。top2~top4的意义与top5类似。又举例来说,NPU320利用的AI网络为FasterRCNN网络,NPU320输出的图像分析结果是对图像进行物体检测得到的边界框(bounding box);结果比对器340采用的是重叠度(Intersection over Union,IoU)比对算法,即计算NPU320输出的边界框和图像中标注的边界框(标注信息)的重叠度。IoU定义了两个边界框的重叠度,第一边界框和第二边界框的重叠度IoU计算公式为:IoU=(A∩B)/(A∪B)。其中,A表示第一边界框占用的区域,B表示第二边界框占用的区域,A∩B表示第一边界框和第二边界框重叠的区域,A∪B表示合并第一边界框和第二边界框得到的区域。图4为本申请实施例提供的一种计算两个边界框的重叠度的示意图。如图4所示,黑色区域为两个边界框的重叠区域(A∩B),整个区域为两个边界 框合并的区域(A∪B)。The AI network used by the NPU 320 is different or the form of the image analysis result output by the AI network is different, and the comparison algorithm adopted by the result comparator 340 is different. For example, the AI network used by NPU320 is Resnet18 network or Resnet50 network, and the image analysis result output by NPU320 is the label (classification) obtained by identifying the image; the result comparator 340 compares the image analysis result output by NPU320 and the ground to get top1 ~ Top5. top1 refers to the probability that the classification with the highest probability predicted by the NPU320 using the AI network is correct. top5 refers to the probability that the NPU320 uses the AI network to predict the maximum probability of the five categories (labels) that have the correct classification. The meaning of top2~top4 is similar to top5. For another example, the AI network used by the NPU320 is the FasterRCNN network. The image analysis result output by the NPU320 is the bounding box obtained by performing object detection on the image; the result comparator 340 uses the degree of overlap (Intersection over Union, IoU) comparison algorithm, that is, calculating the overlapping degree between the bounding box output by the NPU 320 and the bounding box (labeling information) marked in the image. IoU defines the degree of overlap between two bounding boxes. The formula for calculating the degree of overlap between the first bounding box and the second bounding box is: IoU = (A∩B)/(A∪B). Among them, A represents the area occupied by the first bounding box, B represents the area occupied by the second bounding box, A∩B represents the area where the first bounding box and the second bounding box overlap, and A∪B represents the combination of the first bounding box and the second bounding box The area obtained by the second bounding box. FIG. 4 is a schematic diagram of calculating the overlapping degree of two bounding boxes provided by an embodiment of the present application. As shown in Figure 4, the black area is the overlapping area of the two bounding boxes (A∩B), and the entire area is the area where the two bounding boxes merge (A∪B).
重复302至311,直到调度器101得到利用参考滤波参数集文件处理图像集中每个图像的比对结果;重复301至311,直到调度器101得到利用上述N个滤波参数集文件处理图像集中每个图像的比对结果。Repeat 302 to 311 until the scheduler 101 obtains the comparison result of processing each image in the image set using the reference filtering parameter set file; repeat 301 to 311 until the scheduler 101 obtains each processing in the image set using the above N filtering parameter set files Comparison results of images.
312、调度器101根据上述图像集中每个图像的比对结果,确定上述参考滤波参数集的滤波效果;分别确定N个滤波参数集中除上述参考滤波参数集之外的滤波参数集的滤波效果;将上述N个滤波参数集中滤波效果最好的目标滤波参数集配置为上述硬件滤波器的滤波参数集。312. The scheduler 101 determines the filtering effect of the reference filter parameter set according to the comparison result of each image in the image set; separately determines the filtering effect of the filter parameter set other than the reference filter parameter set in the N filter parameter sets; The target filtering parameter set with the best filtering effect in the N filtering parameter sets is configured as the filtering parameter set of the hardware filter.
上述N个滤波参数集为上述图像处理器解析上述N个滤波参数集文件得到的N个参数集。调度器101确定上述N个滤波参数集中除上述参考滤波参数集之外的滤波参数集的滤波效果的方式与确定上述参考滤波参数集的滤波效果的方式相同。可以理解,图像处理装置的图像滤波效果越好,其做图像处理或图像分析的效果也越好。因此,图像处理装置利用每个滤波参数集对图像集做处理得到的图像分析结果的优劣可以反映利用该滤波参数集做滤波处理的效果的优劣。上述参考滤波参数集的滤波效果可以是根据结果比对器输出的多个比对结果(重叠度)得到的。可选的,N个滤波参数集中每个滤波参数集的滤波效果为图像处理装置利用该滤波参数集对图像集中的每个图像做图像识别得到的top1。也就是说,图像识别的准确率与滤波效果正相关。可选的,N个滤波参数集中每个滤波参数集的滤波效果为图像处理装置利用该滤波参数集对图像集中的每个图像做物体检测得到的各重叠度中超过目标阈值的个数。目标阈值可以是0.5、0.6、0.75、0.8等。举例来说,图像处理装置利用第一滤波参数集处理图像集中的图像得到600个超过目标阈值的重叠度,利用第二滤波参数集处理图像集中的图像得到800个超过该目标阈值的重叠度;则该第二滤波参数集的滤波效果优于该第一滤波参数集的滤波效果。在实际应用中,可以采用多种方式来比较不同滤波参数集的滤波效果,本申请不做限定。The N filter parameter sets are N parameter sets obtained by the image processor parsing the N filter parameter set files. The scheduler 101 determines the filtering effect of the filtering parameter sets other than the reference filtering parameter set in the N filtering parameter sets in the same manner as determining the filtering effect of the reference filtering parameter set. It can be understood that the better the image filtering effect of the image processing device, the better the effect of image processing or image analysis. Therefore, the advantages and disadvantages of the image analysis result obtained by the image processing device using each filter parameter set to process the image set can reflect the effect of using the filter parameter set to perform the filtering process. The filtering effect of the aforementioned reference filtering parameter set may be obtained according to multiple comparison results (overlaps) output by the result comparator. Optionally, the filtering effect of each filtering parameter set in the N filtering parameter sets is the top1 obtained by the image processing device using the filtering parameter set to perform image recognition on each image in the image set. In other words, the accuracy of image recognition is positively correlated with the filtering effect. Optionally, the filtering effect of each filtering parameter set in the N filtering parameter sets is the number of overlapping degrees that exceed the target threshold value in each overlapping degree obtained by the image processing device using the filtering parameter set to perform object detection on each image in the image set. The target threshold may be 0.5, 0.6, 0.75, 0.8, etc. For example, the image processing apparatus uses the first filter parameter set to process the images in the image set to obtain 600 degrees of overlap that exceed the target threshold, and uses the second filter parameter set to process the images in the image set to obtain 800 degrees of overlap that exceeds the target threshold; Then, the filtering effect of the second filtering parameter set is better than the filtering effect of the first filtering parameter set. In practical applications, various methods can be used to compare the filtering effects of different filtering parameter sets, which is not limited in this application.
本申请实施例中,图像处理装置比较用户选择的多个滤波参数集文件的滤波效果,并选用滤波效果最好的一个滤波参数集文件,可以快速地确定滤波效果最好的滤波参数集文件,提高图像分析的效率。In the embodiment of the present application, the image processing device compares the filtering effects of multiple filtering parameter set files selected by the user, and selects one filtering parameter set file with the best filtering effect to quickly determine the filtering parameter set file with the best filtering effect, Improve the efficiency of image analysis.
图5本申请实施例提供的一种图像处理装置的结构示意图。图像处理装置可以是不具备硬件滤波器和NPU的设备,例如台式电脑,笔记本电脑等,可以应用于开发者场景。如图1所示,图像处理装置包括主设备501以及外接设备500。外接设备500通过IO接口511与主设备501耦合。可选的,外接设备500通过其他方式与主设备501耦合或者外接设备100与主设备集成到一起(即将外接设备500集成到主设备501内部)。处理器503、存储器103均与系统总线505耦合。处理器503可以是一个或者多个处理器,其中每个处理器都可以包括一个或多个处理器核。显示适配器(video adapter)507,显示适配器507可以驱动显示器509,显示器509和系统总线505耦合。显示器509可用于显示由用户输入的信息或提供给用户的信息以及各种程序界面。系统总线505与I/O接口511耦合。I/O接口511和多种I/O设备进行通信,比如输入设备102(如:键盘,鼠标,触摸屏等),多媒体盘(media tray)515,(例如,CD-ROM,多媒体接口等),收发器517(可以发送和/或接受无线电通信信号。FIG. 5 is a schematic structural diagram of an image processing apparatus provided by an embodiment of the present application. The image processing device may be a device without a hardware filter and an NPU, such as a desktop computer, a notebook computer, etc., which can be applied to a developer scenario. As shown in FIG. 1, the image processing apparatus includes a main device 501 and an external device 500. The external device 500 is coupled to the main device 501 through the IO interface 511. Optionally, the external device 500 is coupled to the main device 501 in other ways or the external device 100 is integrated with the main device (that is, the external device 500 is integrated into the main device 501). The processor 503 and the memory 103 are coupled to the system bus 505. The processor 503 may be one or more processors, where each processor may include one or more processor cores. A video adapter 507. The video adapter 507 can drive the display 509, which is coupled to the system bus 505. The display 509 can be used to display information input by the user or provided to the user and various program interfaces. The system bus 505 is coupled to the I/O interface 511. The I/O interface 511 communicates with various I/O devices, such as input device 102 (eg, keyboard, mouse, touch screen, etc.), multimedia disk (media) 515, (eg, CD-ROM, multimedia interface, etc.), The transceiver 517 (may transmit and/or receive radio communication signals.
处理器503可以采用通用的中央处理器(Central Processing Unit,CPU),微处理器,应用专用集成电路(Application Specific Integrated Circuit,ASIC),或者一个或多个集成电路,用于执行相关程序,以实现本申请实施例所提供的技术方案。The processor 503 may use a general-purpose central processing unit (Central Processing Unit, CPU), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits for executing related programs, to The technical solutions provided by the embodiments of the present application are implemented.
存储器103存储各种软件程序和/或多组指令。具体实现中,存储器103可包括高速随机存取的存储器,并且也可包括非易失性存储器,例如一个或多个磁盘存储设备、闪存设备或其他非易失性固态存储设备。存储器103可以存储操作系统(下述简称系统),例如ANDROID,IOS,WINDOWS,或者LINUX等嵌入式操作系统。存储器103还可以存储网络通信程序,该网络通信程序可用于与一个或多个附加设备,一个或多个终端设备,一个或多个网络设备进行通信。存储器103还可以存储用户接口程序,该用户接口程序可以通过图形化的操作界面将应用程序的内容形象逼真的显示出来,并通过菜单、对话框以及按键等输入控件接收用户对应用程序的控制操作。The memory 103 stores various software programs and/or multiple sets of instructions. In a specific implementation, the memory 103 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage devices, flash memory devices, or other non-volatile solid-state storage devices. The memory 103 may store an operating system (hereinafter referred to as a system), such as an embedded operating system such as ANDROID, IOS, WINDOWS, or LINUX. The memory 103 may also store a network communication program, which may be used to communicate with one or more additional devices, one or more terminal devices, and one or more network devices. The memory 103 can also store a user interface program, which can display the content of the application program vividly through a graphical operation interface, and receive user control operations on the application program through input controls such as menus, dialog boxes, and keys. .
图像处理装置可以通过网络接口521与其他设备进行通信。可选的,网络接口521通过因特网、以太网、虚拟私人网络、WiFi网络,蜂窝网络等网络与其他设备进行通信。The image processing apparatus can communicate with other devices through the network interface 521. Optionally, the network interface 521 communicates with other devices through the Internet, Ethernet, virtual private network, WiFi network, cellular network, and other networks.
硬盘驱动接口523和系统总线505耦合。硬件驱动接口523和硬盘驱动器525相耦合。系统内存527和系统总线505耦合。运行在系统内存527的数据可以包括图像处理装置的操作系统529和应用程序531。应用程序531可包括社交应用程序,图像管理应用程序(例如相册),地图类应用程序(例如谷歌地图),浏览器,游戏应用,编程软件等等。The hard disk drive interface 523 is coupled to the system bus 505. The hardware drive interface 523 and the hard disk drive 525 are coupled. The system memory 527 is coupled to the system bus 505. The data running in the system memory 527 may include the operating system 529 and application programs 531 of the image processing apparatus. The application 531 may include a social application, an image management application (for example, an album), a map application (for example, Google Maps), a browser, a game application, programming software, and so on.
操作系统包括壳(shell)533和内核(kernel)535。壳533是介于使用者和操作系统之内核(kernel)间的一个接口。shell是操作系统最外面的一层。shell管理使用者与操作系统之间的交互:等待使用者的输入,向操作系统解释使用者的输入,并且处理各种各样的操作系统的输出结果。The operating system includes a shell 533 and a kernel 535. The shell 533 is an interface between the user and the kernel of the operating system. The shell is the outermost layer of the operating system. The shell manages the interaction between the user and the operating system: waits for the user's input, interprets the user's input to the operating system, and processes the output of various operating systems.
内核535由操作系统中用于管理存储器、文件、外设和系统资源的那些部分组成。直接与硬件交互,操作系统内核通常运行进程,并提供进程间的通信,提供CPU时间片管理、中断、内存管理、IO管理等等。The kernel 535 is composed of those parts of the operating system that are used to manage memory, files, peripherals, and system resources. Directly interacting with the hardware, the operating system kernel usually runs processes and provides communication between processes, providing CPU time slice management, interrupts, memory management, IO management, and so on.
图像处理器105与处理器503耦合,图像处理器105用于对图像进行处理,是一个专门做图像处理的硬件,用于配置硬件滤波器104的滤波参数。结果比对器340与处理器503耦合,结果比对器340用于对图像分析结果(图像处理结果)和真实结果(测试图像的标注信息)做比对,以便于确定图像分析或图像处理的正确性。该图像分析结果可以来自神经网络处理器(Neural-network Processing Unit,NPU)320。NPU320可以替换为张量处理器(Tensor Processing Unit,TPU)以及其他可进行机器学习的处理器。外接设备500可包括硬件滤波器104、NPU320以及调度器101。硬件滤波器104与图像处理器105耦合,图像处理器105可配置硬件滤波器104的滤波参数。可选的,处理器503分配图像处理任务给调度器101,调度器101通过调用硬件滤波器104和NPU320来完成处理器503分配的任务。可选的,处理器503直接调用硬件滤波器104和NPU320来完成图像处理任务,即调度器101是可选的。NPU320可实现多种AI网络来做图像分析以及图像处理,用户可以通过输入设备102输入的指令来配置所需的网络。存储器103存储有硬件滤波器104可使用的至少两个滤波参数集文件,用户可以通过输入设备102输入的指令来配置硬件滤波器104采用的滤波参数集文件。The image processor 105 is coupled to the processor 503. The image processor 105 is used to process the image. It is a hardware dedicated to image processing, and is used to configure the filtering parameters of the hardware filter 104. The result comparator 340 is coupled to the processor 503, and the result comparator 340 is used to compare the image analysis result (image processing result) and the real result (marking information of the test image) in order to determine the image analysis or image processing Correctness. The image analysis result may come from a neural network processor (Neural-network Processing Unit, NPU) 320. The NPU320 can be replaced with a tensor processor (Tensor Processing Unit, TPU) and other processors that can perform machine learning. The external device 500 may include a hardware filter 104, an NPU 320, and a scheduler 101. The hardware filter 104 is coupled to the image processor 105, and the image processor 105 may configure the filtering parameters of the hardware filter 104. Optionally, the processor 503 allocates the image processing task to the scheduler 101, and the scheduler 101 completes the task assigned by the processor 503 by calling the hardware filter 104 and the NPU 320. Optionally, the processor 503 directly calls the hardware filter 104 and the NPU 320 to complete the image processing task, that is, the scheduler 101 is optional. The NPU 320 can implement a variety of AI networks for image analysis and image processing. The user can configure the desired network through the commands input by the input device 102. The memory 103 stores at least two filter parameter set files that can be used by the hardware filter 104, and the user can configure the filter parameter set file used by the hardware filter 104 through an instruction input by the input device 102.
本申请的一个目标是给外接设备500中的硬件滤波器配置滤波参数,即完成对硬件滤波器104的开发,后续可以直接将配置了滤波参数的硬件滤波器104提供给其他设备。例如,将配置好的硬件滤波器接入到一台电脑中,为该电脑提供硬件滤波功能。外接设备500和主设备501可以为独立的设备。举例来说,主设备501为台式电脑,外接设备500为一个移动设备,外接设备500可以通过USB接口或者其他接口与主设备501连接。本申请的另一个目标是增强不具备硬件滤波器和NPU的主设备的图像处理能力。目前,台式电脑、笔记本电脑等设备中不具备NPU以及硬件滤波器,外接设备500与这些设备(主设备501)连接后,这些设备可以利用外接设备500来增强其图像处理性能。这样不需要改变这些设备的硬件结构就可以增强这些设备的图像处理性能,成本低。An objective of the present application is to configure the filter parameters for the hardware filter in the external device 500, that is, to complete the development of the hardware filter 104, and then the hardware filter 104 with the configured filter parameters can be directly provided to other devices. For example, the configured hardware filter is connected to a computer to provide hardware filtering for the computer. The external device 500 and the main device 501 may be independent devices. For example, the main device 501 is a desktop computer, and the external device 500 is a mobile device. The external device 500 may be connected to the main device 501 through a USB interface or other interfaces. Another objective of the present application is to enhance the image processing capability of a host device that does not have a hardware filter and NPU. At present, devices such as desktop computers and notebook computers do not have NPU and hardware filters. After the external device 500 is connected to these devices (main device 501), these devices can use the external device 500 to enhance their image processing performance. In this way, the image processing performance of these devices can be enhanced without changing the hardware structure of these devices, and the cost is low.
本申请实施例中,用户不仅可以配置图像处理装置采用的滤波参数集,还可以配置该图像处理装置采用的AI网络。前述实施例介绍了用户选择滤波参数集的实现方式,下面介绍用户配置图像处理装置采用的AI网络的实现方式。In the embodiment of the present application, the user can not only configure the filtering parameter set used by the image processing device, but also configure the AI network used by the image processing device. The foregoing embodiments describe the implementation of the user-selected filter parameter set. The following describes the implementation of the AI network used by the user to configure the image processing device.
在一个可选的实现方式中,NPU320获得输入设备102输入的AI网络选择指令;根据上述AI网络选择指令,将其采用的网络配置为目标AI网络。In an optional implementation manner, the NPU 320 obtains the AI network selection instruction input by the input device 102; according to the above-mentioned AI network selection instruction, the network it adopts is configured as the target AI network.
上述AI网络选择指令用于选择至少两个待选择的AI网络中的上述目标AI网络。上述至少两个待选择的AI网络可以包括resnet50网络、SSD(Single Shot MultiBox Detector)网络、Faster RCNN网络、resnet18网络等。图6为本申请实施例提供的一种AI网络选择界面的示意图。如图6所示,AI网络选择界面包括R个AI网络的选择接口;每个AI网络名称前面的圆圈为该AI网络的选择接口,用户通过键盘或鼠标选中该圆圈后,该圆圈变为黑色(表示选中相应的AI网络)。上述AI网络选择指令为用户通过输入设备选择AI网络的操作。该AI网络选择界面为图像处理程序的一个界面。用户可以启动图像处理程序来选择AI网络以及配置滤波参数集文件。如图6所示,第五AI网络为用户选中的目标AI网络,图像处理装置采用该第五AI网络做图像处理。The AI network selection instruction is used to select the target AI network among at least two AI networks to be selected. The at least two AI networks to be selected may include resnet50 network, SSD (Single Shot MultiBox Detector) network, Faster RCNN network, resnet18 network, etc. 6 is a schematic diagram of an AI network selection interface provided by an embodiment of the present application. As shown in Figure 6, the AI network selection interface includes R AI network selection interfaces; the circle in front of each AI network name is the selection interface of the AI network. After the user selects the circle with the keyboard or mouse, the circle becomes black (Indicates that the corresponding AI network is selected). The above AI network selection instruction is an operation for the user to select an AI network through an input device. The AI network selection interface is an interface of an image processing program. The user can start the image processing program to select the AI network and configure the filtering parameter set file. As shown in FIG. 6, the fifth AI network is a target AI network selected by the user, and the image processing device uses the fifth AI network for image processing.
在该实现方式中,用户根据自己的需要选择图像处理装置采用的AI网络,实现简单,可以满足不同的图像处理任务。In this implementation, the user selects the AI network used by the image processing device according to his own needs, which is simple to implement and can satisfy different image processing tasks.
在一个可选的实现方式中,NPU320获得上述输入设备102输入的AI网络编程代码;执行上述AI网络编程代码实现上述目标AI网络。In an optional implementation manner, the NPU 320 obtains the AI network programming code input by the input device 102; executes the AI network programming code to implement the target AI network.
在实际应用中,用户可以在AI网络编程界面编写自己所需的AI网络。当图像处理装置预置的AI网络中未包括用户所需的AI网络时,用户可以编写自取所需的AI网络。In practical applications, users can write their own AI network in the AI network programming interface. When the AI network preset by the image processing device does not include the AI network required by the user, the user can write the AI network required for self-fetching.
在该实现方式中,用户可以自行编写代码以实现所需的AI网络,而不是受限于图像处理装置预置的AI网络,以便于开发性能更好的AI网络。In this implementation, users can write their own code to implement the required AI network, rather than being limited to the AI network preset by the image processing device, in order to develop an AI network with better performance.
图7为本申请实施例提供的一种神经网络处理器的结构示意图,如图7所示,NPU320挂载在调度器101上,NPU320的核心部分为运算电路703,通过控制器704控制运算电路703提取存储器中的矩阵数据并进行乘法运算。可选的,处理器503为调度器101分配任务,调度器101调度NPU320、硬件滤波器104以及其他组件执行相应的任务。7 is a schematic structural diagram of a neural network processor provided by an embodiment of the present application. As shown in FIG. 7, the NPU 320 is mounted on the scheduler 101, and the core part of the NPU 320 is an arithmetic circuit 703, and the arithmetic circuit is controlled by a controller 704 703 Extract the matrix data in the memory and perform multiplication. Optionally, the processor 503 allocates tasks to the scheduler 101, and the scheduler 101 schedules the NPU 320, the hardware filter 104, and other components to perform corresponding tasks.
在一些实现中,运算电路703内部包括多个处理单元(Process Engine,PE)。在一些实现中,运算电路703是二维脉动阵列。运算电路703还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路703是通用的 矩阵处理器。In some implementations, the arithmetic circuit 703 internally includes multiple processing units (Process Engine, PE). In some implementations, the arithmetic circuit 703 is a two-dimensional pulsating array. The arithmetic circuit 703 may also be a one-dimensional pulsating array or other electronic circuit capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 703 is a general-purpose matrix processor.
举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器702中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器701中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器708中。For example, suppose there is an input matrix A, a weight matrix B, and an output matrix C. The arithmetic circuit takes the data corresponding to the matrix B from the weight memory 702 and caches it on each PE in the arithmetic circuit. The arithmetic circuit takes matrix A data and matrix B from the input memory 701 to perform matrix operation, and the partial result or final result of the obtained matrix is stored in the accumulator 708.
统一存储器706用于存放输入数据以及输出数据。权重数据直接通过存储单元访问控制器(Direct Memory Access Controller,DMAC)705被搬运到权重存储器702中。输入数据也通过DMAC被搬运到统一存储器706中。The unified memory 706 is used to store input data and output data. The weight data is directly transferred to the weight memory 702 through a storage unit access controller (Direct Memory Access Controller, DMAC) 705. The input data is also transferred to the unified memory 706 through the DMAC.
总线接口单元(Bus Interface Unit,BIU)710,用于AXI总线与DMAC和取指存储器(Instruction Fetch Buffer)709的交互。A bus interface unit (Bus Interface Unit, BIU) 710 is used for the interaction between the AXI bus and the DMAC and instruction retrieval memory (Instruction Fetch Buffer) 709.
总线接口单元710,用于取指存储器709获取指令,还用于存储单元访问控制器705获取输入矩阵A或者权重矩阵B的原数据。The bus interface unit 710 is used to obtain the instruction from the instruction fetch memory 709, and is also used to access the controller 705 to obtain the original data of the input matrix A or the weight matrix B.
DMAC主要用于将输入数据搬运到统一存储器706或将权重数据搬运到权重存储器702中或将输入数据数据搬运到输入存储器701中。The DMAC is mainly used to carry input data to the unified memory 706 or weight data to the weight memory 702 or input data to the input memory 701.
向量计算单元707多个运算处理单元,在需要的情况下,对运算电路的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。主要用于神经网络中非卷积/FC层网络计算,如Pooling(池化),Batch Normalization(批归一化),Local Response Normalization(局部响应归一化)等。The vector calculation unit 707 has a plurality of operation processing units. If necessary, it further processes the output of the operation circuit, such as vector multiplication, vector addition, exponential operation, logarithm operation, size comparison, and so on. It is mainly used for non-convolution/FC layer network calculation in neural networks, such as Pooling, Batch Normalization, Local Response Normalization, etc.
在一些实现种,向量计算单元能707将经处理的输出的向量存储到统一缓存器706。例如,向量计算单元707可以将非线性函数应用到运算电路703的输出,例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元707生成归一化的值、合并值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路703的激活输入,例如用于在神经网络中的后续层中的使用。In some implementations, the vector calculation unit 707 can store the processed output vector to the unified buffer 706. For example, the vector calculation unit 707 may apply a non-linear function to the output of the arithmetic circuit 703, such as a vector of accumulated values, to generate an activation value. In some implementations, the vector calculation unit 707 generates normalized values, merged values, or both. In some implementations, the vector of the processed output can be used as an activation input to the arithmetic circuit 703, for example for use in subsequent layers in a neural network.
控制器704连接的取指存储器(instruction fetch buffer)709,用于存储控制器704使用的指令。统一存储器706,输入存储器701,权重存储器702以及取指存储器709均为On-Chip存储器。An instruction fetch memory (709) connected to the controller 704 is used to store instructions used by the controller 704. The unified memory 706, the input memory 701, the weight memory 702, and the fetch memory 709 are all On-Chip memories.
应理解,图7仅是本申请实施例提供的一种NPU的硬件结构示意图,本申请不对NPU的结构做限定。It should be understood that FIG. 7 is only a schematic diagram of a hardware structure of an NPU provided by an embodiment of the present application. The present application does not limit the structure of the NPU.
图8为本申请实施例提供的一种图像处理方法的流程示意图,该图像处理方法应用于图1、图3以及图5中的图像处理装置。如图8所示,该方法可包括:FIG. 8 is a schematic flowchart of an image processing method provided by an embodiment of the present application. The image processing method is applied to the image processing apparatuses in FIGS. 1, 3, and 5. As shown in FIG. 8, the method may include:
801、调度器101获得输入设备102输入的参数集选择指令。801. The scheduler 101 obtains a parameter set selection instruction input by the input device 102.
上述参数集选择指令用于选择存储器103存储的F个滤波参数集文件中的N个滤波参数集文件,F为大于1的整数,N为大于0的整数。The above parameter set selection instruction is used to select N filter parameter set files among the F filter parameter set files stored in the memory 103, where F is an integer greater than 1, and N is an integer greater than 0.
802、图像处理器105将参考滤波参数集文件中的一组滤波参数配置为硬件滤波器对参考图像进行滤波待采用的滤波参数。802. The image processor 105 configures a set of filter parameters in the reference filter parameter set file as a filter parameter to be used by the hardware filter to filter the reference image.
上述参考滤波参数集文件为上述N个滤波参数集文件中的任一个参数集文件,上述参考图像为存储器103存储的图像集中的任一图像。The reference filtering parameter set file is any one of the N filtering parameter set files, and the reference image is any image in the image set stored in the memory 103.
803、硬件滤波器105利用上述一组滤波参数对上述参考图像进行滤波。803. The hardware filter 105 uses the above set of filtering parameters to filter the above reference image.
本申请实施例中,用户可以根据自行配置硬件滤波器的滤波参数文件,以便于硬件滤波器利用用户配置的滤波参数文件对图像进行滤波,可以满足不同场景的需求、实现简单。In the embodiment of the present application, the user can configure the filter parameter file of the hardware filter according to oneself, so that the hardware filter uses the user-configured filter parameter file to filter the image, which can meet the needs of different scenarios and is simple to implement.
图8中的图像处理方法描述了图像处理装置利用用户选择的滤波参数集文件对图像集中的图像做滤波的过程。下面介绍如何确定用户选择的多个滤波参数集文件中滤波效果最好的参数集文件的实现方式。The image processing method in FIG. 8 describes a process in which the image processing device uses the filter parameter set file selected by the user to filter the images in the image set. The following describes how to determine the implementation of the parameter set file with the best filtering effect among the multiple filter parameter set files selected by the user.
图9为本申请实施例提供的一种比较多个滤波参数集文件的滤波效果的方法流程图,该方法应用于图1、图3以及图5中的图像处理装置。如图9所示,该方法可包括:FIG. 9 is a flowchart of a method for comparing filtering effects of multiple filtering parameter set files provided by an embodiment of the present application. The method is applied to the image processing apparatuses in FIGS. 1, 3, and 5. As shown in FIG. 9, the method may include:
901、图像处理装置对图像集中的图像做图像预处理。901. The image processing device performs image preprocessing on the images in the image set.
图像预处理的一般流程如下:统一格式、灰度化、滤波、样本增强。统一格式:即统一图像集中每个图像的格式,例如全部统一为jpg格式。灰度化:不同的图像处理装置对图像集有不同的需求,有些要求输入灰度图像,有些要求输入RGB彩色图像。图像处理装置在处理图像之前,需要将图像集中的图像转换为符合要求的图像,例如转换为RGB彩色图像。滤波:图像预处理中的图像滤波主要包括调整图像尺寸,并对缩放后的图像中的噪声进行去噪平滑。样本增强:有观点认为神经网络是靠数据喂出来的,如果能够增加训练数据的样本量,提供海量数据进行训练,则能够有效提升图像分析算法的质量。常见的样本增强方式有:水平翻转图像、随机裁剪、平移变换,颜色、光照变换等。图像预处理是本领域常用的技术手段,这里不再详述。The general process of image preprocessing is as follows: unified format, grayscale, filtering, and sample enhancement. Unified format: that is, the format of each image in the image set is unified, for example, all are unified into the jpg format. Grayscale: Different image processing devices have different requirements for image sets. Some require grayscale images and some require RGB color images. Before processing an image, the image processing device needs to convert the image in the image set to an image that meets requirements, for example, to an RGB color image. Filtering: Image filtering in image preprocessing mainly includes adjusting the image size, and denoising and smoothing the noise in the scaled image. Sample enhancement: Some people think that neural networks are fed by data. If you can increase the sample size of training data and provide massive data for training, you can effectively improve the quality of image analysis algorithms. Common sample enhancement methods are: horizontal flip image, random cropping, translation transformation, color, lighting transformation, etc. Image preprocessing is a common technical method in the art, and will not be described in detail here.
图像处理装置在做图像预处理的过程中,分别采用用户选择的多个滤波参数集文件对图像集中的图像进行滤波。如图9所示,首先,图像处理装置利用滤波参数集文件1对图像集中的图像进行滤波以及执行后续的图像处理;然后,利用滤波参数集文件2对图像集中的图像进行滤波以及执行后续的图像处理;最后,利用滤波参数集文件F对图像集中的图像进行滤波以及执行后续的图像处理。滤波操作的实现方式可参见301至306,这里不再详述。In the process of image preprocessing, the image processing device respectively uses multiple filtering parameter set files selected by the user to filter the images in the image set. As shown in FIG. 9, first, the image processing device uses the filter parameter set file 1 to filter the image in the image set and performs subsequent image processing; then, uses the filter parameter set file 2 to filter the image in the image set and performs subsequent Image processing; Finally, the filtering parameter set file F is used to filter the images in the image set and perform subsequent image processing. The implementation of the filtering operation can be referred to 301 to 306, and will not be described in detail here.
902、图像处理装置对图像集中的每个图像做图像分析,得到每个图像的图像分析结果。902. The image processing device performs image analysis on each image in the image set to obtain an image analysis result of each image.
图像处理装置可利用AI网络对预处理后的图像做图像分析,例如物体检测和图像分类。图像分析结果可以是图像处理装置识别图像集中的图像得到的标签(分类),也可以是图像处理装置对图像集中的图像进行物体检测得到的边界框。实现方式与图3中309的方式相同。The image processing device can use the AI network to perform image analysis on the preprocessed image, such as object detection and image classification. The image analysis result may be a label (classification) obtained by the image processing device recognizing the image in the image set, or a bounding box obtained by the image processing device performing object detection on the image in the image set. The implementation is the same as 309 in FIG. 3.
903、图像处理装置对每个图像的图像分析结果和标注信息做比对,得到每个图像的比对结果。903. The image processing device compares the image analysis result of each image with the annotation information to obtain a comparison result of each image.
图像处理装置比对每个图像的图像分析结果和标注信息的方式可参考图3中311。For the method of the image processing device comparing the image analysis result of each image and the annotation information, refer to 311 in FIG. 3.
904、图像处理装置确定N个滤波参数集文件中滤波效果最好的目标滤波参数集文件;将该目标滤波参数集文件配置为其采用的滤波参数集文件。904. The image processing device determines a target filtering parameter set file with the best filtering effect among the N filtering parameter set files; and configures the target filtering parameter set file as the filtering parameter set file that it uses.
在实际应用中,图像处理装置可以分别测试利用用户选择的每个滤波参数集文件对图像集中的图像做图像分析的效果,进而选择滤波效果最好的滤波参数集文件作为待采用的滤波参数集文件。In practical applications, the image processing device can separately test the effect of using each filter parameter set file selected by the user to perform image analysis on the image in the image set, and then select the filter parameter set file with the best filtering effect as the filter parameter set to be adopted file.
本申请实施例中,图像处理装置可以确定用户选择的多个滤波参数集文件中滤波效果最好的滤波参数集文件,可以进一步提高图像处理装置的图像分析性能。In the embodiment of the present application, the image processing device can determine the filter parameter set file with the best filtering effect among the multiple filter parameter set files selected by the user, which can further improve the image analysis performance of the image processing device.
前述实施例中介绍了本申请的技术方案,下面介绍采用本申请的技术方案达到的有益效果。The technical solutions of the present application are introduced in the foregoing embodiments, and the beneficial effects achieved by the technical solutions of the present application are described below.
本申请实施例提供的一种图像处理方案(第一方案)如下:图像处理装置为resnet50网络的1000张测试图像(样本)配置最优滤波参数集,经过硬件滤波器的滤波处理后输入至resnet50网络,得到的输出(图像分析结果)和ground truth比对得到top1~top5。An image processing scheme (first scheme) provided by an embodiment of the present application is as follows: The image processing apparatus configures an optimal filter parameter set for 1000 test images (samples) of the resnet50 network, and then inputs the filter parameter to resnet50 after being filtered by a hardware filter On the network, the obtained output (image analysis result) is compared with ground truth to get top1~top5.
用作对比的图像处理方案(第二方案)如下:把resnet50网络的1000张测试图像输入至pillow,经过滤波处理后输入至resnet50网络,得到的输出(图像分析结果)和ground truth比对得到top1~top5。PIL(Python Imaging Library)是Python常用的图像处理库,而pillow是PIL的一个友好Fork,提供了广泛的文件格式支持,强大的图像处理能力,主要包括图像储存、图像显示、格式转换以及基本的图像处理操作等。The image processing scheme used for comparison (the second scheme) is as follows: 1000 test images of resnet50 network are input to pillow, after filtering, they are input to resnet50 network, and the obtained output (image analysis result) is compared with ground truth to get top1 ~ Top5. PIL (Python Imaging Library) is a commonly used image processing library in Python, and pillow is a friendly fork of PIL that provides extensive file format support and powerful image processing capabilities, including image storage, image display, format conversion, and basic Image processing operations, etc.
表1Table 1
Figure PCTCN2018123160-appb-000001
Figure PCTCN2018123160-appb-000001
表1为一种图像识别率的对比表。从表1可以看出,第一方案的性能优于第二方案的性能。针对top1,第一方案超过第二方案(pillow)0.3%。top1~top5五个统计结果中以top1为主要评价指标。Table 1 is a comparison table of image recognition rates. It can be seen from Table 1 that the performance of the first scheme is better than that of the second scheme. For top1, the first plan exceeds the second plan (pillow) by 0.3%. Among the five statistical results from top1 to top5, top1 is the main evaluation index.
本申请实施例提供的另一种图像处理方案(第三方案)如下:图像处理装置为车道线识别网络的2000张测试图像配置最优滤波参数集,经过硬件滤波器的滤波处理后输入至车道线识别网络,得到的输出和ground truth比对得到精确率和召回率。Another image processing scheme (third scheme) provided by the embodiment of the present application is as follows: The image processing device configures an optimal filter parameter set for 2000 test images of the lane line recognition network, and then inputs the filter to the lane after being filtered by the hardware filter Line identification network, the obtained output is compared with ground truth to get the accuracy rate and recall rate.
用作对比的图像处理方案(第四方案)如下:把车道线识别网络的2000张测试图像输入至OpenCV,经过滤波处理后输入至车道线识别网络,得到的输出和ground truth比对得到精确率和召回率。The image processing scheme used for comparison (the fourth scheme) is as follows: input 2000 test images of the lane line recognition network to OpenCV, and then input the filtered line to the lane line recognition network. The obtained output is compared with the ground to obtain the accuracy rate And recall rate.
精确率(precision)是指识别正确的样本数/识别出来的样本数。召回率(recall)是指识别正确的样本数/所有样本中正确的数。Precision refers to the number of correctly identified samples/the number of identified samples. Recall (recall) refers to identifying the correct number of samples/the correct number of all samples.
表2Table 2
图像处理方案Image processing scheme 整体精确率Overall accuracy 整体召回率Overall recall rate 当前精确率Current accuracy 当前召回率Current recall rate
第三方案Third option 0.94460.9446 0.66820.6682 0.93180.9318 0.90580.9058
第四方案Fourth option 0.95360.9536 0.64670.6467 0.94280.9428 0.90610.9061
表2为一种图像分析的精确率和召回率表。表2中整体精确率是指识别图像中各车道线的精确率,当前精确率是指识别车辆当前行驶的车道的精确率;整体召回率是指识别图像中各车道线的召回率,当前召回率是指识别车辆当前行驶的车道的召回率。从表2可以看出,第三方案的性能优于第四方案的性能。第三方案在识别当前车道的精确率上超过第四方案1.1%,在识别当前车道召回率上超过第四方案0.3%。Table 2 is a table of accuracy and recall rates for image analysis. The overall accuracy rate in Table 2 refers to the accuracy rate of each lane line in the recognition image. The current accuracy rate refers to the accuracy rate of the lane in which the vehicle is currently traveling. The overall recall rate refers to the recall rate of each lane line in the recognition image. The current recall The rate refers to the recall rate that identifies the lane in which the vehicle is currently traveling. It can be seen from Table 2 that the performance of the third scheme is better than that of the fourth scheme. The third scheme exceeds the fourth scheme by 1.1% in the accuracy rate of identifying the current lane, and exceeds the fourth scheme by 0.3% in identifying the current lane recall rate.
从上述可以看出,本申请中的技术方案可以有效提高图像识别的准确率。As can be seen from the above, the technical solution in this application can effectively improve the accuracy of image recognition.
上述实施例,可以全部或部分地通过软件、硬件、固件或其他任意组合来实现。当使用软件实现时,上述实施例可以全部或部分地以计算机程序产品的形式实现。The above embodiments can be implemented in whole or in part by software, hardware, firmware, or any other combination. When implemented using software, the above-described embodiments may be fully or partially implemented in the form of computer program products.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above is only the specific implementation of this application, but the scope of protection of this application is not limited to this, any person skilled in the art can easily think of various equivalents within the technical scope disclosed in this application Modifications or replacements, these modifications or replacements should be covered within the scope of protection of this application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (14)

  1. 一种图像处理装置,其特征在于,包括:An image processing device, characterized in that it includes:
    调度器,用于获得输入设备输入的参数集选择指令,所述参数集选择指令为用户通过所述输入设备输入的指令并且用于指示从存储器存储的F个滤波参数集文件中选择N个滤波参数集文件,其中,F为大于1的正整数,N为大于0的整数;The scheduler is used to obtain a parameter set selection instruction input by the input device, the parameter set selection instruction is an instruction input by a user through the input device and is used to instruct to select N filters from the F filter parameter set files stored in the memory Parameter set file, where F is a positive integer greater than 1 and N is an integer greater than 0;
    与所述调度器耦合的硬件滤波器,用于利用所述N个滤波参数集文件中一个滤波参数集文件所包含的一组滤波参数对参考图像进行滤波。A hardware filter coupled to the scheduler is used to filter the reference image using a set of filter parameters included in one filter parameter set file among the N filter parameter set files.
  2. 根据权利要求1所述的图像处理装置,其特征在于,The image processing apparatus according to claim 1, wherein:
    分别与所述调度器和所述硬件滤波器耦合的图像处理器,用于解析所述一个滤波参数集文件,得到参考滤波参数集;根据所述参考图像在水平方向的第一缩放系数和在垂直方向的第二缩放系数,确定所述参考滤波参数集中的所述一组滤波参数为所述硬件滤波器利用所述参考滤波参数集对所述参考图像进行滤波待采用的参数。Image processors coupled to the scheduler and the hardware filter, respectively, for parsing the one filter parameter set file to obtain a reference filter parameter set; based on the first scaling factor of the reference image in the horizontal direction and the The second scaling factor in the vertical direction determines that the set of filter parameters in the reference filter parameter set is a parameter to be used by the hardware filter to filter the reference image by using the reference filter parameter set.
  3. 根据权利要求2所述的图像处理装置,其特征在于,The image processing apparatus according to claim 2, wherein:
    所述图像处理器,具体用于根据所述第一缩放系数从所述参考滤波参数集中选择一组水平方向的滤波参数,以及根据所述第二缩放系数从所述参考滤波参数集中选择一组垂直方向的滤波参数;将所述一组水平方向的滤波参数和所述一组垂直方向的滤波参数作为所述一组滤波参数;将所述一组滤波参数配置到所述硬件滤波器的寄存器;The image processor is specifically configured to select a group of horizontal filtering parameters from the reference filtering parameter set according to the first scaling factor, and select a group of reference filtering parameter sets from the reference filtering parameter set according to the second scaling factor Vertical filtering parameters; the set of horizontal filtering parameters and the set of vertical filtering parameters as the set of filtering parameters; configuring the set of filtering parameters to the register of the hardware filter ;
    所述硬件滤波器,具体用于读取所述寄存器中的所述一组滤波参数,并利用所述一组滤波参数对所述参考图像进行滤波。The hardware filter is specifically used to read the set of filter parameters in the register and filter the reference image using the set of filter parameters.
  4. 根据权利要求3所述的图像处理装置,其特征在于,The image processing apparatus according to claim 3, wherein
    所述硬件滤波器,还用于将所述参考图像滤波后的图像发送给所述图像处理器;The hardware filter is also used to send the filtered image of the reference image to the image processor;
    所述图像处理器,还用于将所述参考图像滤波后的图像发送给所述调度器;所述图像处理装置还包括:The image processor is further configured to send the filtered image of the reference image to the scheduler; the image processing device further includes:
    与所述调度器耦合的神经网络处理器NPU;A neural network processor NPU coupled with the scheduler;
    所述调度器,还用于将所述参考图像滤波后的图像输入至所述NPU;The scheduler is further configured to input the filtered image of the reference image to the NPU;
    所述NPU,用于利用目标AI网络对所述参考图像滤波后的图像做图像分析,将得到的图像分析结果发送给所述调度器。The NPU is used to perform image analysis on the filtered image of the reference image using a target AI network, and send the obtained image analysis result to the scheduler.
  5. 根据权利要求4所述的图像处理装置,其特征在于,所述图像处理装置还包括:The image processing device according to claim 4, wherein the image processing device further comprises:
    与所述调度器耦合的结果比对器;A result comparator coupled with the scheduler;
    所述调度器,还用于将所述参考图像的标注信息和所述图像分析结果发送给所述结果比对器;The scheduler is also used to send the annotation information of the reference image and the image analysis result to the result comparator;
    所述结果比对器,用于对所述图像分析结果和所述参考图像的标注信息做比对,得到所述参数图像的比对结果。The result comparator is used to compare the image analysis result with the reference information of the reference image to obtain the comparison result of the parameter image.
  6. 根据权利要求5所述的图像处理装置,其特征在于,The image processing apparatus according to claim 5, wherein:
    所述结果比对器,还用于将所述参考图像的比对结果以及图像集中除所述参考图像之外的每个图像的比对结果发送给所述调度器;其中,所述结果比对器得到所述图像集中除所述参考图像之外的每个图像的比对结果的方式与得到所述参考图像的比对结果的方式相同,所述图像集包括至少两个图像;The result comparison device is further used to send the comparison result of the reference image and the comparison result of each image in the image set except the reference image to the scheduler; wherein, the result comparison The matcher obtains the comparison result of each image in the image set except the reference image in the same way as the comparison result of the reference image, and the image set includes at least two images;
    所述调度器,还用于根据所述图像集中每个图像的比对结果,确定所述参考滤波参数集的滤波效果;分别确定N个滤波参数集中除所述参考滤波参数集之外的滤波参数集的滤波效果,所述N个滤波参数集为所述图像处理器解析所述N个滤波参数集文件得到的N个参数集;将所述N个滤波参数集中滤波效果最好的目标滤波参数集配置为所述硬件滤波器的滤波参数集;其中,所述调度器确定所述N个滤波参数集中除所述参考滤波参数集之外的滤波参数集的滤波效果的方式与确定所述参考滤波参数集的滤波效果的方式相同。The scheduler is further configured to determine the filtering effect of the reference filtering parameter set according to the comparison result of each image in the image set; separately determine the filtering other than the reference filtering parameter set in the N filtering parameter sets The filtering effect of the parameter set, where the N filtering parameter sets are N parameter sets obtained by the image processor parsing the N filtering parameter set files; the N filtering parameter set is the target filter with the best filtering effect The parameter set is configured as a filtering parameter set of the hardware filter; wherein, the manner in which the scheduler determines the filtering effect of the filtering parameter set other than the reference filtering parameter set in the N filtering parameter sets and determines the The filtering effect of the reference filtering parameter set is the same.
  7. 根据权利要求4至6任意一项所述的图像处理装置,其特征在于,The image processing device according to any one of claims 4 to 6, wherein
    所述NPU,还用于获得所述输入设备输入的AI网络选择指令,所述AI网络选择指令用于选择至少两个待选择的AI网络中的所述目标AI网络;根据所述AI网络选择指令,将所述NPU采用的网络配置为所述目标AI网络;The NPU is also used to obtain an AI network selection instruction input by the input device, and the AI network selection instruction is used to select the target AI network among at least two AI networks to be selected; the selection is based on the AI network Instruction to configure the network adopted by the NPU as the target AI network;
    或者,or,
    所述NPU,还用于获得所述输入设备输入的AI网络编程代码;执行所述AI网络编程代码实现所述目标AI网络。The NPU is also used to obtain the AI network programming code input by the input device; execute the AI network programming code to implement the target AI network.
  8. 一种图像处理方法,应用于图像处理装置,其特征在于,所述图像处理装置包括调度器以及硬件滤波器,所述方法包括:An image processing method is applied to an image processing device. The image processing device includes a scheduler and a hardware filter. The method includes:
    所述调度器获得输入设备输入的参数集选择指令,所述参数集选择指令为用户通过所述输入设备输入的指令并且用于指示从存储器存储的F个滤波参数集文件中选择N个滤波参数集文件,其中,F为大于1的正整数,N为大于0的整数;The scheduler obtains a parameter set selection instruction input by the input device, where the parameter set selection instruction is an instruction input by the user through the input device and is used to instruct the selection of N filter parameters from the F filter parameter set files stored in the memory Set file, where F is a positive integer greater than 1 and N is an integer greater than 0;
    所述硬件滤波器利用所述N个滤波参数集文件中一个滤波参数集文件所包含的一组滤波参数对参考图像进行滤波。The hardware filter uses a set of filtering parameters included in one filtering parameter set file among the N filtering parameter set files to filter the reference image.
  9. 根据权利要求8所述的方法,其特征在于,所述图像处理器还包括分别与所述调度器和所述硬件滤波器耦合的图像处理器;所述硬件滤波器利用所述N个滤波参数集文件中一个滤波参数集文件所包含的一组滤波参数对参考图像进行滤波之前,所述方法还包括:The method according to claim 8, wherein the image processor further comprises an image processor respectively coupled to the scheduler and the hardware filter; the hardware filter uses the N filtering parameters Before filtering a reference image by a set of filtering parameters contained in a filtering parameter set file in the set file, the method further includes:
    所述图像处理器解析所述一个滤波参数集文件,得到参考滤波参数集;根据所述参考图像在水平方向的第一缩放系数和在垂直方向的第二缩放系数,确定所述参考滤波参数集中的所述一组滤波参数为所述硬件滤波器利用所述参考滤波参数集对所述参考图像进行滤波待采用的参数。The image processor parses the one filtering parameter set file to obtain a reference filtering parameter set; and determines the reference filtering parameter set according to the first scaling factor of the reference image in the horizontal direction and the second scaling factor in the vertical direction The set of filtering parameters is a parameter to be used by the hardware filter to filter the reference image by using the reference filtering parameter set.
  10. 根据权利要求9所述的方法,其特征在于,所述根据所述参考图像在水平方向的第一缩放系数和在垂直方向的第二缩放系数,确定所述参考滤波参数集中的所述一组滤波 参数为所述硬件滤波器利用所述参考滤波参数集对所述参考图像进行滤波待采用的参数包括:The method according to claim 9, wherein the group of the reference filter parameter set is determined according to a first scaling factor in the horizontal direction and a second scaling factor in the vertical direction of the reference image The filtering parameters are the parameters to be adopted by the hardware filter for filtering the reference image by using the reference filtering parameter set, including:
    所述图像处理器根据所述第一缩放系数从所述参考滤波参数集中选择一组水平方向的滤波参数,以及根据所述第二缩放系数从所述参考滤波参数集中选择一组垂直方向的滤波参数;将所述一组水平方向的滤波参数和所述一组垂直方向的滤波参数作为所述一组滤波参数;将所述一组滤波参数配置到所述硬件滤波器的寄存器;The image processor selects a set of horizontal filtering parameters from the reference filtering parameter set according to the first scaling factor, and selects a set of vertical filtering from the reference filtering parameter set according to the second scaling factor Parameters; the set of horizontal filtering parameters and the set of vertical filtering parameters as the set of filtering parameters; configuring the set of filtering parameters to the register of the hardware filter;
    所述硬件滤波器利用所述N个滤波参数集文件中一个滤波参数集文件所包含的一组滤波参数对参考图像进行滤波包括:The hardware filter filtering the reference image using a set of filtering parameters included in one filtering parameter set file among the N filtering parameter set files includes:
    所述硬件滤波器读取所述寄存器中的所述一组滤波参数,并利用所述一组滤波参数对所述参考图像进行滤波。The hardware filter reads the set of filter parameters in the register and uses the set of filter parameters to filter the reference image.
  11. 根据权利要求10所述的方法,其特征在于,所述图像处理装置还包括与所述调度器耦合的神经网络处理器NPU;所述硬件滤波器利用所述N个滤波参数集文件中一个滤波参数集文件所包含的一组滤波参数对参考图像进行滤波之后,所述方法还包括:The method according to claim 10, wherein the image processing device further comprises a neural network processor NPU coupled to the scheduler; the hardware filter uses one of the N filtering parameter set files for filtering After filtering the reference image by a set of filtering parameters contained in the parameter set file, the method further includes:
    所述硬件滤波器将所述参考图像滤波后的图像发送给所述图像处理器;The hardware filter sends the filtered image of the reference image to the image processor;
    所述图像处理器将所述参考图像滤波后的图像发送给所述调度器;The image processor sends the filtered image of the reference image to the scheduler;
    所述调度器将所述参考图像滤波后的图像输入至所述NPU;The scheduler inputs the filtered image of the reference image to the NPU;
    所述NPU利用目标AI网络对所述参考图像滤波后的图像做图像分析,将得到的图像分析结果发送给所述调度器。The NPU uses the target AI network to perform image analysis on the filtered image of the reference image, and sends the obtained image analysis result to the scheduler.
  12. 根据权利要求11所述的方法,其特征在于,所述图像处理装置还包括与所述调度器耦合的结果比对器;所述NPU利用目标AI网络对所述参考图像滤波后的图像做图像分析,将得到的图像分析结果发送给所述调度器之后,所述方法还包括:The method according to claim 11, wherein the image processing device further comprises a result comparator coupled with the scheduler; the NPU uses the target AI network to image the filtered image of the reference image After analyzing and sending the obtained image analysis result to the scheduler, the method further includes:
    所述调度器将所述参考图像的标注信息和所述图像分析结果发送给所述结果比对器;The scheduler sends the annotation information of the reference image and the image analysis result to the result comparator;
    所述结果比对器对所述图像分析结果和所述参考图像的标注信息做比对,得到所述参数图像的比对结果。The result comparison device compares the image analysis result with the reference information of the reference image to obtain a comparison result of the parameter image.
  13. 根据权利要求12所述的方法,其特征在于,所述结果比对器对所述图像分析结果和所述参考图像的标注信息做比对,得到所述参数图像的比对结果之后,所述方法还包括:The method according to claim 12, wherein the result comparator compares the image analysis result with the reference information of the reference image, and after obtaining the comparison result of the parameter image, the The method also includes:
    所述结果比对器将所述参考图像的比对结果以及图像集中除所述参考图像之外的每个图像的比对结果发送给所述调度器;其中,所述结果比对器得到所述图像集中除所述参考图像之外的每个图像的比对结果的方式与得到所述参考图像的比对结果的方式相同,所述图像集包括至少两个图像;The result comparator sends the comparison result of the reference image and the comparison result of each image in the image set except the reference image to the scheduler; wherein, the result comparator obtains the result The way of comparing the results of each image in the image set except the reference image is the same as the way of obtaining the results of the comparison of the reference image, and the image set includes at least two images;
    所述调度器根据所述图像集中每个图像的比对结果,确定所述参考滤波参数集的滤波效果;分别确定N个滤波参数集中除所述参考滤波参数集之外的滤波参数集的滤波效果,所述N个滤波参数集为所述图像处理器解析所述N个滤波参数集文件得到的N个参数集;将所述N个滤波参数集中滤波效果最好的目标滤波参数集配置为所述硬件滤波器的滤波参数集;其中,所述调度器确定所述N个滤波参数集中除所述参考滤波参数集之外的滤波参 数集的滤波效果的方式与确定所述参考滤波参数集的滤波效果的方式相同。The scheduler determines the filtering effect of the reference filtering parameter set according to the comparison result of each image in the image set; separately determines the filtering of the filtering parameter sets other than the reference filtering parameter set in the N filtering parameter sets Effect, the N filter parameter sets are N parameter sets obtained by the image processor parsing the N filter parameter set files; the target filter parameter set with the best filtering effect in the N filter parameter sets is configured as A filtering parameter set of the hardware filter; wherein, the manner in which the scheduler determines a filtering effect of a filtering parameter set other than the reference filtering parameter set in the N filtering parameter sets and determines the reference filtering parameter set The filtering effect is the same.
  14. 根据权利要求11至13任意一项所述的方法,其特征在于,所述NPU利用目标AI网络对所述参考图像滤波后的图像做图像分析,将得到的图像分析结果发送给所述调度器之前,所述方法还包括:The method according to any one of claims 11 to 13, wherein the NPU performs image analysis on the filtered image of the reference image using a target AI network, and sends the obtained image analysis result to the scheduler Previously, the method also included:
    所述NPU获得所述输入设备输入的AI网络选择指令,所述AI网络选择指令用于选择至少两个待选择的AI网络中的所述目标AI网络;根据所述AI网络选择指令,将所述NPU采用的网络配置为所述目标AI网络;The NPU obtains an AI network selection instruction input by the input device, and the AI network selection instruction is used to select the target AI network in at least two AI networks to be selected; according to the AI network selection instruction, the The network configuration adopted by the NPU is the target AI network;
    或者,or,
    所述NPU获得所述输入设备输入的AI网络编程代码;执行所述AI网络编程代码实现所述目标AI网络。The NPU obtains the AI network programming code input by the input device; executes the AI network programming code to implement the target AI network.
PCT/CN2018/123160 2018-12-24 2018-12-24 Image processing apparatus and image processing method WO2020132825A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201880098076.9A CN112771566A (en) 2018-12-24 2018-12-24 Image processing apparatus, image processing method, and program
PCT/CN2018/123160 WO2020132825A1 (en) 2018-12-24 2018-12-24 Image processing apparatus and image processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/123160 WO2020132825A1 (en) 2018-12-24 2018-12-24 Image processing apparatus and image processing method

Publications (1)

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

Family

ID=71126441

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/123160 WO2020132825A1 (en) 2018-12-24 2018-12-24 Image processing apparatus and image processing method

Country Status (2)

Country Link
CN (1) CN112771566A (en)
WO (1) WO2020132825A1 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009087095A1 (en) * 2008-01-08 2009-07-16 Telefonaktiebolaget Lm Ericsson (Publ) Encoding filter coefficients
US20120076430A1 (en) * 2010-09-28 2012-03-29 Segall Christopher A Methods and Systems for Noise Reduction and Image Enhancement
US20120189216A1 (en) * 2010-09-28 2012-07-26 Segall Christopher A Methods and Systems for Image Enhancement and Estimation of Compression Noise
CN103208094A (en) * 2012-01-12 2013-07-17 索尼公司 Method and system for applying filter to image
CN108897777A (en) * 2018-06-01 2018-11-27 深圳市商汤科技有限公司 Target object method for tracing and device, electronic equipment and storage medium
CN109003252A (en) * 2017-05-30 2018-12-14 正凯人工智能私人有限公司 Image processing method and system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07121702A (en) * 1993-10-22 1995-05-12 Canon Inc Image processor
KR100665969B1 (en) * 2003-10-25 2007-01-10 학교법인 인하학원 Reconfigurable, real-time hardware filter
JP2007288587A (en) * 2006-04-18 2007-11-01 Pioneer Electronic Corp Video adjusting device, video adjusting method and video processing program

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009087095A1 (en) * 2008-01-08 2009-07-16 Telefonaktiebolaget Lm Ericsson (Publ) Encoding filter coefficients
US20120076430A1 (en) * 2010-09-28 2012-03-29 Segall Christopher A Methods and Systems for Noise Reduction and Image Enhancement
US20120189216A1 (en) * 2010-09-28 2012-07-26 Segall Christopher A Methods and Systems for Image Enhancement and Estimation of Compression Noise
CN103208094A (en) * 2012-01-12 2013-07-17 索尼公司 Method and system for applying filter to image
CN109003252A (en) * 2017-05-30 2018-12-14 正凯人工智能私人有限公司 Image processing method and system
CN108897777A (en) * 2018-06-01 2018-11-27 深圳市商汤科技有限公司 Target object method for tracing and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112771566A (en) 2021-05-07

Similar Documents

Publication Publication Date Title
US9349076B1 (en) Template-based target object detection in an image
US10936919B2 (en) Method and apparatus for detecting human face
WO2020224403A1 (en) Classification task model training method, apparatus and device and storage medium
US10936911B2 (en) Logo detection
US20230087526A1 (en) Neural network training method, image classification system, and related device
Li et al. Deepsaliency: Multi-task deep neural network model for salient object detection
US9773196B2 (en) Utilizing deep learning for automatic digital image segmentation and stylization
WO2019100724A1 (en) Method and device for training multi-label classification model
US10892050B2 (en) Deep image classification of medical images
CN110349147B (en) Model training method, fundus macular region lesion recognition method, device and equipment
WO2018021942A2 (en) Facial recognition using an artificial neural network
WO2019033715A1 (en) Human-face image data acquisition method, apparatus, terminal device, and storage medium
CN110889446A (en) Face image recognition model training and face image recognition method and device
WO2020098257A1 (en) Image classification method and device and computer readable storage medium
US20220198836A1 (en) Gesture recognition method, electronic device, computer-readable storage medium, and chip
CN109034206A (en) Image classification recognition methods, device, electronic equipment and computer-readable medium
WO2021098300A1 (en) Facial parsing method and related devices
US20220075994A1 (en) Real-time facial landmark detection
CN109033935B (en) Head-up line detection method and device
WO2023284182A1 (en) Training method for recognizing moving target, method and device for recognizing moving target
JP2017527013A (en) Adaptive characterization as a service
WO2022111387A1 (en) Data processing method and related apparatus
US9081800B2 (en) Object detection via visual search
WO2019100348A1 (en) Image retrieval method and device, and image library generation method and device
WO2020199498A1 (en) Palmar digital vein comparison method and device, computer apparatus, 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: 18944225

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

Country of ref document: EP

Kind code of ref document: A1