Image recognition method, device, equipment and storage medium

By extracting image component features of different frequency bands and training of the recognition network, combining fast recognition of low frequency bands and detailed features of high frequency bands, the recognition efficiency problem of traditional image recognition methods in complex scenes and resource-constrained devices is solved. Achieve high accuracy and high speed image recognition effects.

CN118570609BActive Publication Date: 2025-02-25BEIJING ZHONGKE RONGWEI TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410928010.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-11
Publication Date
2025-02-25
Estimated Expiration
2044-07-11

AI Technical Summary

Technical Problem

Traditional image recognition methods are difficult to achieve the expected recognition effect when processing complex scenes and changing image features, and are large in calculations and slow in recognition speed, making them difficult to meet real-time requirements.

Method used

By extracting and identifying the image component features of different frequency bands in sequence, using series of filters to obtain image component features of multiple frequency bands, and input them into the recognition network of different frequency bands for training and identification, finally combining the fast recognition of low frequency bands and Detailed features of high frequency bands improve the accuracy and speed of identification.

Benefits of technology

It realizes the speed of image recognition without reducing recognition accuracy, reduces the hardware overhead in the image recognition process, and is suitable for devices with resource limitations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570609B_ABST
    Figure CN118570609B_ABST
Patent Text Reader

Abstract

The present invention discloses an image recognition method, device, equipment and storage medium, and relates to the field of image processing technology. The present invention includes a camera, an image recognition device and a display module, wherein the image recognition device includes, obtaining a sample image and a corresponding recognition result; filtering the sample image using a series of filters to obtain image component features of each sample image in multiple frequency bands; inputting the multiple image component features and the corresponding recognition results of each sample image into the input layer and output layer of different recognition networks according to the corresponding different frequency bands and training and converging to obtain a recognition network for each frequency band; obtaining a target image; extracting the image analysis features of the target image in order from low to high according to the frequency band; inputting the image analysis features of the target image in order from low to high according to the corresponding frequency size into the input layer of the recognition network of the corresponding frequency band until the recognition result of the target image is obtained. The present invention takes into account both the accuracy and speed of image recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of image processing technology, and in particular relates to an image recognition method, device, equipment and storage medium. Background Art

[0002] With the development of artificial intelligence technology, image recognition has been widely used in various fields, including but not limited to security monitoring, medical diagnosis, autonomous driving, industrial inspection, etc. Image recognition technology is based on computer vision and pattern recognition, and processes and analyzes the captured image data to identify specific patterns, objects or information in the image.

[0003] Traditional image recognition methods mainly rely on feature extraction and feature matching. These methods usually include edge detection, color analysis, shape matching and other steps. However, these methods often fail to achieve the expected recognition results when faced with complex scenes and ever-changing image features. In addition, traditional methods have large computational complexity and slow recognition speed when processing large-scale data, making it difficult to meet real-time requirements.

[0004] In recent years, deep learning technology, especially convolutional neural networks (CNNs), has made remarkable progress in the field of image recognition. By learning from a large amount of data, CNNs can automatically extract deep features of images, thereby significantly improving recognition accuracy. However, deep learning models usually require a lot of computing resources and storage space, which limits their application on resource-constrained devices. Summary of the invention

[0005] The purpose of the present invention is to provide an image recognition method, apparatus, device and storage medium, which take into account the accuracy and speed of image recognition by extracting and identifying the characteristics of image components in different frequency bands of the target image in turn, and also reduce the hardware overhead in the image recognition process.

[0006] In order to solve the above technical problems, the present invention is achieved through the following technical solutions:

[0007] The present invention provides an image recognition method, comprising:

[0008] Obtain sample images and corresponding recognition results;

[0009] Filtering the sample images using a series of filters to obtain image component features of each sample image in multiple frequency bands;

[0010] Inputting the plurality of image component features and the corresponding recognition results of each sample image into the input layer and output layer of different recognition networks according to the corresponding different frequency bands and training and converging to obtain the recognition network of each frequency band;

[0011] Get the target image;

[0012] Extracting image analysis features of the target image in order from low to high frequency bands;

[0013] The image analysis features of the target image are sequentially input into the input layer of the recognition network corresponding to the frequency band from low to high according to the corresponding frequency until the recognition result of the target image is obtained.

[0014] The present invention also discloses an image recognition method, comprising:

[0015] Get the target image;

[0016] Receiving a recognition result of a target image;

[0017] The recognition result of the target image is marked and displayed on the target image.

[0018] The present invention also discloses an image recognition device, comprising:

[0019] Network training module, used to obtain sample images and corresponding recognition results;

[0020] Filtering the sample images using a series of filters to obtain image component features of each sample image in multiple frequency bands;

[0021] Inputting the plurality of image component features and the corresponding recognition results of each sample image into the input layer and output layer of different recognition networks according to the corresponding different frequency bands and training and converging to obtain the recognition network of each frequency band;

[0022] as well as,

[0023] A recognition module is used to obtain a target image;

[0024] Extracting image analysis features of the target image in order from low to high frequency bands;

[0025] Inputting the image analysis features of the target image into the input layer of the recognition network corresponding to the frequency band in order from low to high according to the corresponding frequency until the recognition result of the target image is obtained;

[0026] Output the recognition result of the target image.

[0027] The present invention also discloses an image recognition device, comprising:

[0028] A camera, used to collect target images;

[0029] An image recognition device;

[0030] as well as,

[0031] A display module is used to obtain a target image;

[0032] Receiving a recognition result of a target image;

[0033] The recognition result of the target image is marked and displayed on the target image.

[0034] The present invention also discloses a storage medium, comprising: at least one command, at least one program, code set or instruction set is stored in the storage medium; the at least one command, the at least one program, the code set or instruction set is loaded and executed by a processor to implement the image recognition method.

[0035] The present invention obtains a recognition network suitable for image component features of different frequency bands through network training module training. In the specific recognition process, the recognition module reads the target image and extracts the image component features in order from low to high frequency bands, and successively attempts to obtain the recognition results through the recognition network of the corresponding frequency band. Since the image component feature extraction speed of the low-frequency band is faster, the recognition network of the low-frequency band is also faster, so this solution can take into account the accuracy and rate of image recognition, and effectively reduce the computing power requirements in the image recognition process.

[0036] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for describing the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0038] Figure 1 A schematic diagram of functional modules and information flow of an image recognition device according to an embodiment of the present invention;

[0039] Figure 2 A schematic diagram of a process flow of an image recognition device according to an embodiment of the present invention;

[0040] Figure 3 A schematic diagram of a process flow of a display module according to an embodiment of the present invention;

[0041] Figure 4 The step S6 of the present invention is a schematic diagram of a step flow in an embodiment. Figure 1 ;

[0042] Figure 5 The step S6 of the present invention is a schematic diagram of a step flow in an embodiment. Figure 2 ;

[0043] Figure 6 A schematic diagram of a step flow chart of step S65 of the present invention in an embodiment;

[0044] Figure 7 A schematic diagram of a step flow chart of step S654 in an embodiment of the present invention;

[0045] Figure 8 This is a schematic diagram of a step flow chart of step S6542 in an embodiment of the present invention;

[0046] In the accompanying drawings, the components represented by the reference numerals are listed as follows:

[0047] 1- Camera;

[0048] 2-image recognition device, 21-network training module, 22-recognition module;

[0049] 3-Display module. DETAILED DESCRIPTION

[0050] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0051] It should be noted that the terms "first", "second", etc. in this application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0052] Image recognition refers to the use of computer vision and machine learning technology to automatically analyze and understand the input image to determine the object, scene or specific attribute in the image. Image recognition tasks usually require a lot of computing resources and computing power support, especially when using deep learning models for image classification. Image recognition tasks have a high demand for computing power. In order to improve the recognition speed without reducing the recognition accuracy, the present invention provides the following solution.

[0053] See also Figures 1 to 3 As shown, the present invention provides an image recognition device, which includes a camera 1, an image recognition device 2 and a display module 3 in terms of functional modules. The camera 1 captures an image, the image recognition device 2 recognizes the captured image, and the display module 3 displays the image.

[0054] Before the operation of this device, the network training module 21 in the image recognition device 2 needs to first execute step S1 to obtain the sample image and the corresponding recognition result. Next, step S2 can be executed to filter the sample image using a series of filters to obtain the image component features of each sample image in multiple frequency bands. Finally, step S3 can be executed to input the multiple image component features and corresponding recognition results of each sample image into the input layer and output layer of different recognition networks according to the corresponding different frequency bands and train and converge to obtain the recognition network of each frequency band. Thus, the recognition network suitable for different frequency bands is obtained. The recognition network in this scheme can be a convolutional neural network. Convolutional Neural Network (CNN) is a deep learning model specifically used for processing tasks with grid structured data (such as images, audio, etc.). The core idea of ​​the convolutional neural network is to extract local features in the image through the convolutional layer and the pooling layer, and classify or predict through the fully connected layer. The training process usually uses backpropagation and optimization algorithms (such as stochastic gradient descent) to adjust the weights and biases of the model to minimize the loss function. The training data set contains input images and corresponding labels. Through continuous iterative training, CNN can learn the features in the image and make accurate classification or predictions.

[0055] During the operation of the device, the camera 1 first executes step S001 to collect the target image, and then the recognition module 22 in the image recognition device 2 executes step S4 to obtain the target image. Next, step S5 can be executed to extract the image analysis features of the target image in order from low to high frequency bands. Next, step S6 can be executed to input the image analysis features of the target image into the input layer of the recognition network corresponding to the frequency band in order from low to high according to the corresponding frequency size until the recognition result of the target image is obtained. Since the information content of the image component features with low frequency bands is low, the judgment and recognition speed of the corresponding recognition network is faster.

[0056] After that, the image recognition device 2 outputs the recognition result of the target image and the display module 3 executes step S031 to obtain the target image for reception. Next, step S032 may be executed to receive the recognition result of the target image, and finally step S033 may be executed to mark and display the recognition result of the target image on the target image, which may be displayed by text annotation, or by graphics or colors.

[0057] Image component features of different frequency bands refer to obtaining feature information of different scales or frequency ranges from an image. This can be achieved by using different image processing methods and filters. It can be obtained by processing using scale-space pyramid, Gaussian pyramid, wavelet transform, and fast Fourier transform (FFT).

[0058] Scale space pyramid is a method to construct a multi-scale representation by smoothing and downsampling an image at different scales. By extracting features in different levels of the pyramid, details and structural information at different scales can be captured. Gaussian pyramid is a method to obtain multi-scale images by continuously smoothing and downsampling an image. Feature extraction algorithms can be applied at different levels of the pyramid to obtain features in different frequency ranges. Wavelet transform is a multi-scale analysis method based on signal decomposition and reconstruction. By applying wavelet transform, an image can be decomposed into sub-band images of different frequencies. Some of the sub-band images can be selected for feature extraction to obtain feature information in different frequency ranges. Fast Fourier transform is a method to convert an image from the spatial domain to the frequency domain. By applying FFT, an image can be decomposed into spectral components of different frequencies. Some of the spectral components can be selected for feature extraction to capture information in different frequency ranges.

[0059] Since the image contains image component features of various frequency bands, and since the image component features of lower frequency bands are extracted and recognized quickly, the image component features of lower frequency bands can be extracted and recognized first. If the image component features of lower frequency bands can be reliably recognized, the target image can be recognized. In view of this, please refer to Figures 4 to 5 As shown, first, step S61 can be executed to use the lowest frequency band as the preliminary frequency band, because the image classification feature with the lowest frequency has the fastest extraction speed and the fastest recognition speed. Next, step S62 can be executed to input the image analysis features of the preliminary frequency band of the target image into the input layer of the recognition network of the corresponding frequency band to obtain the probability value of each output item in the output layer, because the recognition network does not output an exact result in principle, but the probability value of each output item being true. Generally speaking, the output item with the largest probability value will be output as the recognition result.

[0060] However, in this scheme, the maximum probability value in the output item of the image classification feature recognition with a lower frequency may be misjudged. In order to effectively avoid this situation, the recognition output items of the image classification features of several frequencies can be calculated and analyzed from low to high, so as to obtain accurate recognition results while taking into account the recognition speed. First, step S63 can be executed to use the previous frequency band of the preliminary frequency band as the verification frequency band in order from low to high. The previous frequency band here refers to the previous frequency band with a larger frequency value. Next, step S64 can be executed to input the image analysis features of the verification frequency band of the target image into the input layer of the recognition network of the corresponding frequency band to obtain the probability value of each output item in the output layer.

[0061] Although each output item of the recognition network has a maximum probability, the probability of other output items may also have a greater possibility of being true, so it is necessary to analyze and exclude to determine whether there is a reliable output item in the output item. Therefore, step S65 can be executed next to determine whether a reliable output item can be obtained according to the probability value of each output item in the output layer corresponding to the preliminary frequency band and the verification frequency band. If so, step S66 can be executed next to use the reliable output item as the recognition result of the target image. If not, step S67 can be executed next to use the verification frequency band as the updated preliminary frequency band. Next, step S68 can be executed to use the previous frequency band of the updated preliminary frequency band as the updated verification frequency band in order from low to high. Finally, steps S62 to S65 can be returned to continuously update the probability value of each output item in the output layer corresponding to the preliminary frequency band and the verification frequency band and determine whether a reliable output item can be obtained until a reliable output item is obtained. In the above process, the reliability analysis is iterated from low to high for the probability of each output item of the output layer corresponding to different frequency bands until a reliable output item is obtained. Since it is not necessary to extract and identify the image component features of higher frequency bands after obtaining the reliable output item, it is not necessary to extract, identify and perform reliability analysis on the image component features of all frequency bands, thereby improving the image recognition speed and achieving the technical effect of improving the recognition rate of the target image without reducing the recognition accuracy.

[0062] In order to supplement the implementation process of the above steps S61 to S68, the source code of some functional modules is provided, and the explanation is compared in the comment section. In order to avoid the leakage of data involving commercial secrets, some data that does not affect the implementation of the solution are desensitized, the same below.

[0063] #include <iostream>

[0064] #include <vector>

[0065] #include <cmath>

[0066] / / Example image feature vector type

[0067] typedef std::vector <float>ImageFeatures;

[0068] / / Example identification network output type

[0069] typedef std::vector <float>NetworkOutput;

[0070] / / Identification network class, simulating identification networks of different frequency bands

[0071] class RecognitionNetwork {

[0072] public:

[0073] / / Calculate the probability value based on image features

[0074] NetworkOutput classify(const ImageFeatures& features) {

[0075] NetworkOutput output(features.size(), 0.0f);

[0076] / / Simulate network calculations, here we use a simple sine function to generate probability values

[0077] for (size_t i = 0; i < features.size(); ++i) {

[0078] output[i] = std::sin(features[i]);

[0079] }

[0080] return output;

[0081] }

[0082] };

[0083] / / Check whether the output item is reliable. Here, the maximum probability value is greater than a certain threshold.

[0084] bool isReliable(const NetworkOutput& output, float threshold) {

[0085] for (float prob : output) {

[0086] if (prob > threshold) {

[0087] return true;

[0088] }

[0089] }

[0090] return false;

[0091] }

[0092] / / Main function

[0093] int main() {

[0094] / / Example image features

[0095] ImageFeatures features = {0.5, 1.5, 2.5}; / / just for example

[0096] / / Identify network instances and simulate networks of different frequency bands

[0097] RecognitionNetwork network_low_freq, network_high_freq;

[0098] / / Reliable output judgment threshold

[0099] const float reliability_threshold = 0.8f;

[0100] / / Preliminary frequency band

[0101] NetworkOutput low_freq_output = network_low_freq.classify(features);

[0102] if (isReliable(low_freq_output, reliability_threshold)) {

[0103] / / Output reliable results

[0104] std::cout << "Low frequency output is reliable." << std::endl;

[0105] } else {

[0106] / / Verify frequency band

[0107] NetworkOutput high_freq_output = network_high_freq.classify(features);

[0108] if (isReliable(high_freq_output, reliability_threshold)) {

[0109] / / Output reliable results

[0110] std::cout << "High frequency output is reliable." < <std::endl;

[0111] } else {

[0112] / / If the high frequency is also unreliable, the loop continues. Here the example does not continue the loop

[0113] std::cout << "No reliable output found." << std::endl;

[0114] }

[0115] }

[0116] return 0;

[0117] }

[0118] The above code simulates the steps of image recognition. The code first defines the types of simulated image features and recognition network outputs, and then defines a recognition network class RecognitionNetwork, which has a classify method to simulate the probability output of calculating image features. The main function creates two frequency band recognition network instances and classifies them using an example image feature. The classification result is checked by a simple reliability check function isReliable to determine whether a predefined reliability threshold is reached. If the output of the preliminary frequency band is unreliable, the high frequency band network will be used.

[0119] See also Figure 6 As shown, if there are reliable output items in the output layer, two conditions need to be met. First, the probability of a reliable output item is the largest in the output layer, and the probability of a reliable output item will increase or remain unchanged when a more frequent image analysis feature is used for identification. In view of this, in order to determine whether there are reliable output items in the output layer, the above-mentioned step S65 can firstly perform step S651 in the specific implementation process to obtain the output item with the maximum probability in the output layer corresponding to the preliminary frequency band and the verification frequency band according to the probability value of each output item in the output layer corresponding to the preliminary frequency band and the verification frequency band. Next, step S652 can be performed to determine whether the output items with the maximum probability in the output layer corresponding to the preliminary frequency band and the verification frequency band are the same. If not, step S653 can be performed next to determine whether a reliable output item can be obtained. If so, step S654 can be performed next to determine whether the output items with the maximum probability in the output layer corresponding to the preliminary frequency band and the verification frequency band are both valid according to the probability value of each output item in the output layer corresponding to the preliminary frequency band and the verification frequency band. If not, then step S655 can be executed to determine whether a reliable output item can be obtained. If so, then step S656 can be executed to determine whether the probability value of the output item with the highest probability in the output layer corresponding to the preliminary frequency band is less than or equal to the probability value of the output item with the highest probability in the output layer corresponding to the verification frequency band. If not, then step S657 can be executed to determine whether a reliable output item can be obtained. If so, then step S658 can be executed to determine whether a reliable output item can be obtained, and the output item with the highest probability in the output layer corresponding to the preliminary frequency band or the verification frequency band is used as a reliable output item.

[0120] In order to provide additional explanation for the implementation process of the above-mentioned steps S651 to S658, source code of some functional modules is provided, and comparative explanation is provided in the comment section.

[0121] #include <iostream>

[0122] #include <vector>

[0123] #include <algorithm>

[0124] / / Example identification network output type

[0125] typedef std::vector <float>NetworkOutput;

[0126] / / Get the index of the output item with the highest probability

[0127] size_t getMaxProbabilityIndex(const NetworkOutput& output) {

[0128] return std::distance(output.begin(), std::max_element(output.begin(), output.end()));

[0129] }

[0130] / / Determine whether all output items are valid

[0131] bool areOutputsEffective(const NetworkOutput& low_freq_output, constNetworkOutput& high_freq_output, float threshold) {

[0132] size_t low_index = getMaxProbabilityIndex(low_freq_output);

[0133] size_t high_index = getMaxProbabilityIndex(high_freq_output);

[0134] return low_freq_output[low_index] > threshold && high_freq_output[high_index] > threshold;

[0135] }

[0136] / / Main function

[0137] int main() {

[0138] / / Network output for preliminary and validation bands of the example

[0139] NetworkOutput low_freq_output = {0.1f, 0.7f, 0.2f}; / / Just an example, probability value

[0140] NetworkOutput high_freq_output = {0.1f, 0.5f, 0.4f}; / / Just an example, probability value

[0141] / / Reliability threshold

[0142] const float reliability_threshold = 0.5f;

[0143] / / Get the output item with the highest probability in the two frequency bands

[0144] size_t low_freq_max_index = getMaxProbabilityIndex(low_freq_output);

[0145] size_t high_freq_max_index = getMaxProbabilityIndex(high_freq_output);

[0146] / / Determine whether the output items with the highest probability in the two frequency bands are the same

[0147] if (low_freq_max_index != high_freq_max_index) {

[0148] std::cout << "The maximum probability output items in different frequency bands are different, and reliable output items cannot be obtained." << std::endl;

[0149] } else if (!areOutputsEffective(low_freq_output, high_freq_output, reliability_threshold)) {

[0150] std::cout << "The maximum probability output is invalid and no reliable output can be obtained." < <std::endl;

[0151] } else if (low_freq_output[low_freq_max_index] > high_freq_output[high_freq_max_index]) {

[0152] std::cout << "The probability value of the maximum output item of the preliminary frequency band is greater than that of the verification frequency band, and no reliable output item can be obtained." << std::endl;

[0153] } else {

[0154] std::cout << "A reliable output item can be obtained. The output item is: " << low_freq_max_index << ", and the probability value is: " << low_freq_output[low_freq_max_index] << std::endl;

[0155] }

[0156] return 0;

[0157] }

[0158] In this code, NetworkOutput is first defined to represent the probability value of the network output. The getMaxProbabilityIndex function is used to find the index of the output item with the largest probability value. The areOutputsEffective function is used to determine whether the maximum probability values ​​of the two frequency bands exceed a set threshold, thereby determining whether the output item is effective. The output probability values ​​of the two frequency bands are simulated in the main function, and a series of judgments are used to determine the reliable output items.

[0159] The core of the code is to compare the maximum probability output items of the preliminary band and the verification band, and judge whether these output items are reliable enough based on a series of conditions. If the maximum output items are the same in both bands and both are valid, and the probability value of the preliminary band is not greater than the probability value of the verification band, then it is considered that a reliable output item has been found.

[0160] See also Figure 7 As shown, if the output item with the maximum probability of the output layer is valid, then the probability value of the output item with the maximum probability needs to be much greater than the probability values ​​of all other output items. In order to perform quantitative calculation and judgment on this, for the output layer corresponding to each preliminary frequency band and the verification frequency band, the above-mentioned step S654 can firstly execute step S6541 to obtain the maximum probability value output item, the second largest probability value output item and the remaining probability value output items during the specific implementation process. Next, step S6542 can be executed to calculate the probability fluctuation amplitude of the output layer according to the second largest probability value output item and the remaining probability value output items. Next, step S6543 can be executed to take the probability value of the second largest probability value output item and the cumulative value of the probability fluctuation amplitude as the critical probability value. Next, step S6544 can be executed to determine whether the probability value of the maximum probability value output item is greater than the critical probability value. If so, then step S6545 can be executed to determine whether the maximum probability output item in the output layer is valid, if not, then step S6546 can be executed to determine whether the maximum probability output item in the output layer is invalid. Finally, step S6547 may be executed to summarize whether the output items with the highest probability in the output layer corresponding to the preliminary frequency band and the verification frequency band are all valid.

[0161] See also Figure 8 As shown, in order to adaptively adjust the probability fluctuation amplitude in the above step S6542 in combination with the probability values ​​of different output items in the output layer, first, step S65421 can be executed to obtain the number of the remaining probability numerical output items. Next, step S65422 can be executed to obtain the maximum probability value and the minimum probability value in the remaining probability numerical output items. Next, step S65423 can be executed to calculate the ratio of the difference between the maximum probability value and the minimum probability value in the remaining probability numerical output items and the number of the remaining probability numerical output items as the probability cardinality. Next, step S65424 can be executed to obtain the probability value of the second largest output item in the output layer. Next, step S65425 can be executed to calculate the ratio of the difference between the probability value of the second largest output item and the probability value of the second largest output item and the probability cardinality as the critical multiple. Finally, step S65426 can be executed to calculate the product of the difference between the probability value of the second largest output item and the probability value of the second largest output item and the critical multiple as the probability fluctuation amplitude.

[0162] #include <iostream>

[0163] #include <vector>

[0164] #include <algorithm>

[0165] / / Define the data structure of the output layer probability value

[0166] typedef std::vector <float>Probabilities;

[0167] / / Get the maximum and minimum values ​​of the remaining output items except the maximum probability value, and return their difference

[0168] float getMaxMinDifference(const Probabilities& probabilities, size_tmaxIndex) {

[0169] float maxValue = 0.0f;

[0170] float minValue = 1.0f;

[0171] for (size_t i = 0; i < probabilities.size(); ++i) {

[0172] if (i == maxIndex) continue; / / Skip the output item corresponding to the maximum probability value

[0173] if (probabilities[i] > maxValue) maxValue = probabilities[i];

[0174] if (probabilities[i] < minValue) minValue = probabilities[i];

[0175] }

[0176] return maxValue - minValue; / / Returns the difference between the maximum and minimum values

[0177] }

[0178] / / Calculate the probability fluctuation range

[0179] float calculateProbabilityFluctuation(const Probabilities&probabilities) {

[0180] / / First find the output item with the largest probability value

[0181] auto maxIt = std::max_element(probabilities.begin(),probabilities.end());

[0182] size_t maxIndex = std::distance(probabilities.begin(), maxIt);

[0183] / / Get the number of output items except the maximum probability value

[0184] size_t remainingItemCount = probabilities.size() - 1;

[0185] / / Get the difference between the maximum and minimum values ​​of the remaining output items except the maximum probability value

[0186] float maxMinDiff = getMaxMinDifference(probabilities, maxIndex);

[0187] / / Calculate the probability base

[0188] float probabilityBase = maxMinDiff / static_cast <float>(remainingItemCount);

[0189] / / Get the probability value of the output item with the second largest probability value

[0190] float secondMaxProb = 0.0f;

[0191] for (float prob : probabilities) {

[0192] if (prob != *maxIt && prob > secondMaxProb) {

[0193] secondMaxProb = prob;

[0194] }

[0195] }

[0196] / / Get the probability value of the output item with the highest probability value

[0197] float thirdMaxProb = 0.0f;

[0198] for (float prob : probabilities) {

[0199] if (prob != *maxIt && prob != secondMaxProb && prob >thirdMaxProb) {

[0200] thirdMaxProb = prob;

[0201] }

[0202] }

[0203] / / Calculate critical multiplier

[0204] float criticalRatio = (secondMaxProb - thirdMaxProb) / probabilityBase;

[0205] / / Calculate the probability fluctuation range

[0206] float probabilityFluctuation = (secondMaxProb - thirdMaxProb) *criticalRatio;

[0207] return probabilityFluctuation;

[0208] }

[0209] / / Main function

[0210] int main() {

[0211] / / Example output layer probability value

[0212] Probabilities probabilities = {0.1f, 0.3f, 0.2f, 0.4f};

[0213] / / Calculate the probability fluctuation range

[0214] float fluctuation = calculateProbabilityFluctuation(probabilities);

[0215] std::cout << "Output layer probability fluctuation amplitude: " << fluctuation << std::endl;

[0216] return 0;

[0217] }

[0218] This code first defines the Probabilities type to store the probability values ​​of the output layer. Then the getMaxMinDifference function is used to obtain the difference between the maximum and minimum values ​​of the probability values ​​other than the maximum probability value. Then the calculateProbabilityFluctuation function divides this difference by the number of remaining probability output items to calculate the probability cardinality. After that, by finding the second largest and the second largest probability values, the ratio of the difference between the two and the probability cardinality is calculated to obtain the critical multiple. Finally, this critical multiple is multiplied by the difference between the second largest and the second largest probability values ​​to obtain the probability fluctuation range. In the main function, these steps are used to calculate the probability fluctuation range of an example probability distribution and output the result.

[0219] The overall function of this code is to calculate the fluctuation range of the second most likely value relative to the second most likely value in a given probability distribution (output layer). This fluctuation range helps to understand the stability of the probability distribution and the relative importance of the second most likely value in the overall distribution.

[0220] The present solution also provides a storage medium, including at least one command, at least one program, code set or instruction set stored in the storage medium, and the at least one command, at least one program, code set or instruction set is loaded and executed by a processor to implement the above-mentioned image recognition method.

[0221] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the device, system, method and computer program product according to multiple embodiments of the present application. In this regard, each square frame in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the functions marked in the square frame can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square frames can actually be executed substantially in parallel, and they can also be executed in reverse order sometimes, depending on the functions involved.

[0222] It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented by hardware that performs the corresponding function or action, such as a circuit or ASIC (Application Specific Integrated Circuit), or can be implemented by a combination of hardware and software, such as firmware.

[0223] Although the present invention is described herein in conjunction with various embodiments, in the process of implementing the claimed invention, those skilled in the art may understand and implement other variations of the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.

[0224] The embodiments of the present application have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes are obvious to those of ordinary skill in the art without departing from the scope of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.< / float> < / float> < / algorithm> < / vector> < / iostream> < / float> < / algorithm> < / vector> < / iostream> < / float> < / float> < / cmath> < / vector> < / iostream>

Claims

1. An image recognition method, characterized in that: include, Obtain sample images and corresponding recognition results; Filtering the sample images using a series of filters to obtain image component features of each sample image in multiple frequency bands; Inputting the plurality of image component features and the corresponding recognition results of each sample image into the input layer and output layer of different recognition networks according to the corresponding different frequency bands and training and converging to obtain the recognition network of each frequency band; Get the target image; Extracting image analysis features of the target image in order from low to high frequency bands; Inputting the image analysis features of the target image into the input layer of the recognition network corresponding to the frequency band in order from low to high according to the corresponding frequency until the recognition result of the target image is obtained; The step of inputting the image analysis features of the target image into the input layer of the recognition network corresponding to the frequency band in order from low to high according to the corresponding frequency until the recognition result of the target image is obtained includes: The lowest stated frequency band shall be regarded as the preliminary frequency band; Inputting the image analysis features of the preliminary frequency band of the target image into the input layer of the recognition network corresponding to the frequency band to obtain the probability value of each output item in the output layer; The last frequency band of the preliminary frequency band is used as the verification frequency band in descending order; Inputting the image analysis features of the verification frequency band of the target image into the input layer of the recognition network corresponding to the frequency band to obtain the probability value of each output item in the output layer; Judging whether reliable output items can be obtained according to the probability value of each output item in the output layer corresponding to the preliminary frequency band and the verification frequency band; If so, the reliable output item is used as the recognition result of the target image.

2. The method according to claim 1, characterized in that The step of inputting the image analysis features of the target image into the input layer of the recognition network corresponding to the frequency band in order from low to high according to the corresponding frequency until the recognition result of the target image is obtained also includes: If not, the verification band will be used as the updated preliminary band; The last frequency band of the updated preliminary frequency band is used as the updated verification frequency band in descending order; The probability value of each output item in the output layer corresponding to the preliminary frequency band and the verification frequency band is continuously updated, and it is determined whether a reliable output item can be obtained, until a reliable output item is obtained.

3. The method according to claim 1 or 2, characterized in that: The step of judging whether a reliable output item can be obtained according to the probability value of each output item in the output layer corresponding to the preliminary frequency band and the verification frequency band, include, According to the probability value of each output item in the output layer corresponding to the preliminary frequency band and the verification frequency band, the output item with the maximum probability in the output layer corresponding to the preliminary frequency band and the verification frequency band is obtained; Determine whether the output items with the highest probability in the output layer corresponding to the preliminary frequency band and the verification frequency band are the same; If not, it is judged that no reliable output item can be obtained; If so, determine whether the output items with the highest probability in the output layer corresponding to the preliminary frequency band and the verification frequency band are all valid according to the probability value of each output item in the output layer corresponding to the preliminary frequency band and the verification frequency band; If not, it is judged that no reliable output item can be obtained; If so, determine whether the probability value of the output item with the highest probability in the output layer corresponding to the preliminary frequency band is less than or equal to the probability value of the output item with the highest probability in the output layer corresponding to the verification frequency band; If not, it is judged that no reliable output item can be obtained; If so, it is determined that a reliable output item can be obtained, and the output item with the maximum probability in the output layer corresponding to the preliminary frequency band or the verification frequency band is taken as the reliable output item.

4. The method according to claim 3, characterized in that The step of judging whether the output items with the maximum probability in the output layer corresponding to the preliminary frequency band and the verification frequency band are all valid according to the probability value of each output item in the output layer corresponding to the preliminary frequency band and the verification frequency band, include, For each preliminary band and validation band corresponding to the output layer, Get the output item with the largest probability value, the output item with the second largest probability value, and the output items with the remaining probability values. The probability fluctuation amplitude of the output layer is calculated based on the second largest probability value output item and the remaining probability value output items. The cumulative value of the probability value of the output item with the second largest probability value and the probability fluctuation amplitude is taken as the critical probability value. Determine whether the probability value of the maximum probability value output item is greater than the critical probability value, If so, then the output item with the highest probability in the output layer is determined to be valid. If not, then the output item with the highest probability in the output layer is judged to be invalid; It is summarized to determine whether the output items with the highest probability in the output layer corresponding to the preliminary frequency band and the verification frequency band are all valid.

5. The method according to claim 4, characterized in that The step of calculating the probability fluctuation amplitude of the output layer according to the second largest probability value output item and the remaining probability value output items, include, Get the number of remaining probability numerical output items, Get the maximum and minimum probability values ​​among the remaining probability numerical output items. Calculate the ratio of the difference between the maximum probability value and the minimum probability value in the remaining probability numerical output items to the number of remaining probability numerical output items as the probability base. Get the probability value of the output item with the second largest probability value in the output layer, The critical multiple is calculated as the ratio of the difference between the probability value of the output item with the second largest probability value and the probability value of the output item with the second largest probability value and the probability base. The product of the difference between the probability value of the output item with the second largest probability value and the probability value of the output item with the second largest probability value and the critical multiplier is calculated as the probability fluctuation amplitude.

6. An image recognition method, characterized in that: include, Get the target image; Receiving a recognition result of a target image in an image recognition method according to any one of claims 1 to 5; The recognition result of the target image is marked and displayed on the target image.

7. An image recognition device, characterized in that: include, Network training module, used to obtain sample images and corresponding recognition results; Filtering the sample images using a series of filters to obtain image component features of each sample image in multiple frequency bands; Inputting the plurality of image component features and the corresponding recognition results of each sample image into the input layer and output layer of different recognition networks according to the corresponding different frequency bands and training and converging to obtain the recognition network of each frequency band; as well as, A recognition module is used to obtain a target image; Extracting image analysis features of the target image in order from low to high frequency bands; Inputting the image analysis features of the target image into the input layer of the recognition network corresponding to the frequency band in order from low to high according to the corresponding frequency until the recognition result of the target image is obtained; Output the recognition result of the target image; The step of inputting the image analysis features of the target image into the input layer of the recognition network corresponding to the frequency band in order from low to high according to the corresponding frequency until the recognition result of the target image is obtained includes: The lowest stated frequency band shall be regarded as the preliminary frequency band; Inputting the image analysis features of the preliminary frequency band of the target image into the input layer of the recognition network corresponding to the frequency band to obtain the probability value of each output item in the output layer; The last frequency band of the preliminary frequency band is used as the verification frequency band in descending order; Inputting the image analysis features of the verification frequency band of the target image into the input layer of the recognition network corresponding to the frequency band to obtain the probability value of each output item in the output layer; Judging whether reliable output items can be obtained according to the probability value of each output item in the output layer corresponding to the preliminary frequency band and the verification frequency band; If so, the reliable output item is used as the recognition result of the target image.

8. An image recognition device, characterized in that: include, A camera, used to collect target images; An image recognition device as claimed in claim 7; as well as, A display module is used to obtain a target image; Receiving a recognition result of a target image; The recognition result of the target image is marked and displayed on the target image.

9. A storage medium, characterized in that: Including, the storage medium stores at least one command, at least one program, code set or instruction set, and the at least one command, at least one program, code set or instruction set is loaded and executed by the processor to implement the image recognition method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Image moire recognition method and device, computer equipment and storage medium

    CN110059700A

  • Image recognition network training method, electronic equipment and storage medium

    CN113033525A