Image recognition method and system based on deep learning
Through multi-scale feature extraction and dynamic threshold generation methods, combined with gradient intensity weight allocation and iterative calibration, the problem of difficult feature extraction in weak texture image recognition is solved, and the recognition accuracy and robustness are improved.
Patent Information
- Application Number
- CN202510966318.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-14
- Publication Date
- 2025-10-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing image recognition technologies have difficulty in accurately extracting effective features when processing weak texture images, resulting in low recognition accuracy and prone to false detection and missed detection.
Dynamic thresholds are generated through multi-scale feature extraction, spatial density features and cross-channel correlation indicators. Decision weights are allocated in combination with gradient intensity to generate weighted feature energy values. It is then iteratively calibrated using a preset weak texture classification model to finally mark the weak texture recognition area.
The accuracy and robustness of weak texture image recognition are improved, and the method can better adapt to the feature distribution density in different regions, thereby enhancing the effectiveness of feature representation and improving the recognition accuracy.
Smart Images

Figure CN120807965A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, in particular to an image recognition method and system based on deep learning. BACKGROUND
[0002] In today's digital age, image recognition technology, as a core branch of computer vision, has shown great application value in many fields, including security monitoring, medical image analysis, autonomous driving, and industrial detection. With the rapid development of deep learning technology, image recognition technology has made significant breakthroughs, especially the widespread application of convolutional neural networks (CNN), which has greatly improved the accuracy and efficiency of image recognition.
[0003] Traditional image recognition methods mainly rely on manually designed feature extraction algorithms, such as scale-invariant feature transform (SIFT) and histogram of oriented gradients (HOG). These methods require professionals to carefully design feature extraction rules based on specific tasks, which is not only tedious but also has limited feature representation capabilities, making it difficult to cope with complex and variable image scenarios. The advent of deep learning technology has changed this situation by building deep neural networks that can automatically learn rich feature representations from large amounts of image data without human intervention in the feature design process, greatly improving the generalization ability and performance of image recognition.
[0004] However, despite the great success of deep learning in image recognition, it still faces many challenges when dealing with some specific types of image recognition tasks. Among them, weak texture image recognition is a representative problem. Weak texture images usually refer to images with unclear texture features and less detailed information, such as smooth metal surfaces, transparent glass products, and certain types of medical images. Due to the lack of obvious feature differences in weak texture images, traditional image recognition methods and general image recognition algorithms based on deep learning often struggle to accurately extract effective features when processing such images, resulting in low recognition accuracy and prone to false positives and false negatives.
[0005] Therefore, it is necessary to provide an image recognition method and system based on deep learning to solve the above technical problems. SUMMARY
[0006] To solve the above technical problems, the present application provides an image recognition method and system based on deep learning, which effectively solves the problems existing in the prior art in weak texture image recognition.
[0007] The present application provides an image recognition method based on deep learning, which comprises the following steps:
[0008] Multi-scale feature extraction is performed on the input image to obtain a multi-scale feature map containing spatial position and channel information;
[0009] Calculate the feature energy value of each spatial position based on the multi-scale feature map, and simultaneously perform the following operations:
[0010] Extracting the spatial density features of the spatial position,
[0011] Calculate the cross-channel correlation index based on the channel information,
[0012] Generate regional sparsity index;
[0013] Based on the statistical distribution of the characteristic energy values, and in combination with the cross-channel correlation index and the regional sparsity index, a dynamic threshold corresponding to each spatial position is generated;
[0014] Dynamically adjusting the size of the detection window based on the spatial density feature, assigning a decision weight to the feature points in each adjusted detection window according to their gradient strength, and generating a weighted feature energy value;
[0015] Comparing the weighted feature energy value with the dynamic threshold of the corresponding position in real time, and aggregating continuous spatial regions exceeding the dynamic threshold as candidate regions;
[0016] Confidence information of the candidate area output by a preset weak texture classification model is obtained, the dynamic threshold is iteratively calibrated according to the confidence information, and the candidate area that meets the preset confidence condition is marked as the final weak texture recognition area.
[0017] Preferably, the step of performing multi-scale feature extraction on the input image to obtain a multi-scale feature map containing spatial position and channel information includes:
[0018] Performing a spatial pyramid decomposition operation on the input image to generate a first scale feature map and a second scale feature map, wherein the spatial resolution of the second scale feature map is lower than that of the first scale feature map;
[0019] Performing depthwise separable convolution operations on the first scale feature map and the second scale feature map, respectively, to obtain a first optimized feature map with enhanced spatial position information and a second optimized feature map with enhanced channel information;
[0020] The first optimized feature map and the second optimized feature map are fused, a bilinear upsampling operation is performed on the second optimized feature map, the upsampling result is concatenated with the first optimized feature map along the channel dimension, and a multi-scale feature map containing spatial position and channel information is generated through convolution compression.
[0021] Preferably, the feature energy value of each spatial position is calculated according to the multi-scale feature map, and the following operations are performed simultaneously:
[0022] extracting a spatial density feature of the spatial position,
[0023] calculating a cross-channel correlation index based on the channel information,
[0024] generating a region sparsity index, comprising:
[0025] for each spatial position of the multi-scale feature map, calculating a square root of a sum of squares of feature intensity of all channels as the feature energy value;
[0026] for each spatial position, counting a number of feature points and a distribution density within a preset neighborhood range corresponding to the spatial position to generate the spatial density feature, wherein the preset neighborhood range is a configurable graph region;
[0027] performing covariance matrix calculation using the channel information, and extracting a maximum eigenvalue of the covariance matrix as the cross-channel correlation index;
[0028] calculating a dispersion coefficient of the feature energy value based on a distribution of the feature energy value within a preset region corresponding to the spatial position, and taking an inverse of the dispersion coefficient as the region sparsity index.
[0029] Preferably, the dynamic threshold corresponding to each spatial position is generated based on a statistical distribution of the feature energy value in combination with the cross-channel correlation index and the region sparsity index, comprising:
[0030] calculating a global mean and a standard deviation of the feature energy value of all spatial positions;
[0031] for each spatial position, performing the following operations:
[0032] inputting the cross-channel correlation index into a first normalization function to obtain a channel correlation factor,
[0033] inputting the region sparsity index into a second normalization function to obtain a sparsity factor;
[0034] calculating a dynamic adjustment coefficient according to the channel correlation factor and the sparsity factor, and generating a dynamic threshold corresponding to the spatial position according to the dynamic adjustment coefficient.
[0035] Preferably, the size of the detection window is dynamically adjusted based on the spatial density feature, and for each feature point in the adjusted detection window, a decision weight is assigned according to the gradient intensity, and a weighted feature energy value is generated, comprising:
[0036] determining the size of the detection window according to a preset density interval to which the spatial density feature value belongs;
[0037] For each feature point in the detection window, a gradient intensity value thereof is calculated and a decision weight is generated by applying a weight mapping function;
[0038] A weighted feature energy value is generated by performing weighted aggregation on all feature points in the detection window according to the decision weight.
[0039] Preferably, the confidence information output by the preset weak texture classification model is acquired, the dynamic threshold is iteratively calibrated according to the confidence information, and the candidate region meeting the preset confidence condition is marked as the final weak texture recognition region, comprising:
[0040] The candidate region is input into a preset weak texture classification model to output a confidence value, and the candidate region is classified into a high-confidence region and an optimization region according to the confidence value, and a sparsity index of the corresponding region is extracted;
[0041] A threshold correction coefficient is generated by calculating the difference between the sparsity of the optimization region and the sparsity of the high-confidence region, and the dynamic threshold is updated based on the threshold correction coefficient and the candidate region is re-divided to obtain a re-divided region;
[0042] The re-divided region with a confidence value exceeding a set value is marked as the final weak texture recognition region.
[0043] The application also provides an image recognition system based on deep learning, which is used to execute an image recognition method based on deep learning, and the system comprises:
[0044] A feature map acquisition module is configured to perform multi-scale feature extraction on an input image to obtain a multi-scale feature map containing spatial position and channel information;
[0045] A parameter acquisition module is configured to calculate a feature energy value of each spatial position according to the multi-scale feature map, and simultaneously perform the following operations:
[0046] extracting a spatial density feature of the spatial position,
[0047] calculating a cross-channel correlation index based on the channel information,
[0048] generating a region sparsity index;
[0049] A threshold generation module is configured to generate a dynamic threshold corresponding to each spatial position based on a statistical distribution of the feature energy value, and in combination with the cross-channel correlation index and the region sparsity index;
[0050] A weighted calculation module is configured to dynamically adjust the size of a detection window based on the spatial density feature, assign a decision weight to a feature point in each adjusted detection window according to the gradient intensity of the feature point, and generate a weighted feature energy value;
[0051] The candidate region generation module is configured to compare the weighted feature energy value with a dynamic threshold value of the corresponding position in real time, and aggregate a continuous spatial region exceeding the dynamic threshold value as a candidate region;
[0052] The result output module is configured to obtain confidence information output by the preset weak texture classification model for the candidate region, iteratively calibrate the dynamic threshold value according to the confidence information, and mark a candidate region meeting a preset confidence condition as a final weak texture recognition region.
[0053] Compared with the related art, the image recognition method and system based on deep learning provided by the present application have the following beneficial effects:
[0054] The present application obtains a multi-scale feature map containing rich spatial position and channel information by performing spatial pyramid decomposition and depth separable convolution operation on the input image. This multi-scale feature extraction method can comprehensively capture the feature changes of the weak texture image at different scales, and provide more accurate and comprehensive feature representation for subsequent recognition.
[0055] Based on the statistical distribution of the feature energy value, and in combination with the cross-channel correlation index and the region sparsity index, a dynamic threshold value is generated for each spatial position. This dynamic threshold value can be adaptively adjusted according to the local characteristics of the image, effectively solving the limitations of the fixed threshold value in weak texture image recognition, and improving the accuracy and robustness of detection.
[0056] According to the spatial density feature, the size of the detection window is dynamically adjusted, which can better adapt to the feature distribution density of different regions in the weak texture image. At the same time, the decision weight is distributed according to the gradient intensity of the feature point, and the weighted feature energy value is generated, which further improves the effectiveness of feature representation and helps to more accurately detect and recognize the weak texture region.
[0057] The confidence information output by the preset weak texture classification model for the candidate region is obtained, and the dynamic threshold value is iteratively calibrated according to the confidence information. This iterative calibration mechanism can make full use of the feedback information of the classification model, continuously optimize the recognition result, mark the candidate region meeting the preset confidence condition as the final weak texture recognition region, and greatly improve the accuracy of weak texture image recognition. BRIEF DESCRIPTION OF DRAWINGS
[0058] Figure 1 A flowchart of the image recognition method based on deep learning provided by the present application;
[0059] Figure 2 A module structure diagram of the image recognition system based on deep learning provided by the present application. DETAILED DESCRIPTION
[0060] The application will be described in further detail below with reference to the drawings and embodiments. It is to be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. In addition, it should be noted that, for the sake of brevity, only the portions of the drawings that are necessary for an understanding of the present application are shown in the drawings. Further, the embodiments of the present application and the features thereof can be combined with each other, if not in conflict.
[0061] In addition, it should be noted that, for the sake of brevity, only the portions of the drawings that are necessary for an understanding of the present application are shown in the drawings. Before discussing the example embodiments in more detail, it is noted that some example embodiments are described as processes depicted as flow diagrams. Although the processes are described in a particular sequential order, many of the processes can be performed concurrently, in parallel, or simultaneously. In addition, the order of the processes can be re-arranged. The processes can terminate when their operations are completed, but the processes can also terminate in response to events that are external to the processes' operations. The processes can correspond to methods, functions, procedures, subroutines, subprograms, etc.
[0062] Embodiment One
[0063] The present application provides a deep learning-based image recognition method, as shown in Figure 1 The method comprises the following steps:
[0064] S1: performing multi-scale feature extraction on an input image to obtain a multi-scale feature map containing spatial position and channel information.
[0065] Specifically, step S1 comprises the following steps:
[0066] S11: performing a spatial pyramid decomposition operation on the input image to generate a first scale feature map and a second scale feature map, wherein the spatial resolution of the second scale feature map is lower than that of the first scale feature map.
[0067] In implementation, the input image is first preprocessed by standardization, normalizing the image data according to the preset RGB mean and standard deviation. A guided filter is then applied for image smoothing, with a filter radius of 3 pixels and a tolerance parameter of 0.01 to preserve edge details. A two-scale spatial pyramid decomposition is implemented, with the first scale maintaining the original resolution and the second scale set to 50% of the original size. During downsampling, Gaussian filtering is used to preemptively eliminate aliasing effects, with a Gaussian kernel size of 5×5 pixels and a standard deviation of 2.0. The INTER_AREA interpolation algorithm is used during downsampling to ensure texture integrity. Feature validation is performed during implementation. If insufficient feature map gradient energy is detected, the pyramid parameters are readjusted: the scaling factor is optimized within a ±10% range, and the standard deviation is increased by 20% until the gradient energy threshold is met.
[0068] S12: Performing a depthwise separable convolution operation on the first scale feature map and the second scale feature map, respectively, to obtain a first optimized feature map with enhanced spatial position information and a second optimized feature map with enhanced channel information.
[0069] In this embodiment, depthwise separable convolution optimization is implemented on the first-scale feature map: first, a 3×3 deep convolution layer is used to extract spatial features with a depth multiplier of 4; then, the feature channels are reorganized through 1×1 point convolution, with 64 filters and the ELU activation function; finally, a spatial attention mechanism is introduced, using parallel 3×3 maximum pooling and average pooling layers to capture spatial context, and then a 7×7 convolution layer is used to generate attention weights, which are multiplied with the feature map to enhance salient areas. Channel optimization is implemented on the second-scale feature map: channel statistics are obtained through global maximum pooling and average pooling, and channel attention vectors are generated after processing through a fully connected layer; 1×1 convolution and swish activation function are used for feature reorganization; finally, the channel attention weights are multiplied point by point with the feature map to enhance key channels.
[0070] S13: Fusing the first optimized feature map and the second optimized feature map, performing a bilinear upsampling operation on the second optimized feature map, concatenating the upsampling result with the first optimized feature map along the channel dimension, and generating a multi-scale feature map containing spatial position and channel information through convolution compression.
[0071] In this embodiment, the feature fusion operation is implemented in three steps: 1) performing bilinear up-sampling on the second optimized feature map to restore the original resolution, and the up-sampling ratio is set to 200%; 2) performing channel alignment processing, and if the channel numbers of the first and second feature maps are inconsistent, a 1x1 convolution is used to align the channel dimensions; and 3) splicing the feature maps along the channel dimension. The feature compression adopts a hybrid attention mechanism: first, the channel number is compressed to 96 through a 3x3 convolution; then, spatial gating and channel gating are implemented in parallel: the spatial gating adopts a cross-pooling structure to capture the spatial dependency, the channel gating learns the channel correlation through a fully connected layer, and the compression ratio is set to 8; and finally, the dual-path feature outputs are fused at a ratio of 0.7:0.3.
[0072] S2: calculating a feature energy value of each spatial position according to the multi-scale feature map, and synchronously performing the following operations:
[0073] extracting a spatial density feature of the spatial position,
[0074] calculating a cross-channel correlation index based on the channel information,
[0075] generating a region sparsity index.
[0076] Specifically, step S2 includes the following steps:
[0077] S21: for each spatial position of the multi-scale feature map, calculating a square root of a sum of squares of feature intensities of all channels as the feature energy value.
[0078] In specific implementation, a pixel-by-pixel traversal manner is used to process the multi-scale feature map. For each spatial position (x, y), the following operations are performed: first, the feature values of the position on all channels are extracted, and a sum of squares of the feature values of the channels is calculated; then, a square root operation is performed on the sum of squares result to obtain the original feature energy value. To process the image boundary positions, a mirror padding strategy is implemented: the first 2 rows of pixels are copied for the upper boundary, the second 2 rows of pixels are copied for the lower boundary, and the same is true for the left and right boundaries. After completing the calculation of the whole image, linear normalization processing is performed: scanning the energy values of all positions, recording the global maximum value and the minimum value, and mapping each energy value to the [0, 1] interval.
[0079] S22: for each spatial position, counting the number and distribution density of feature points within a preset neighborhood range corresponding to the spatial position to generate the spatial density feature, wherein the preset neighborhood range is a configurable graph region.
[0080] In this embodiment, the implementation process includes dynamic neighborhood configuration and intelligent density statistics. The neighborhood form supports both circular (default radius of 3 pixels) and rectangular (default size of 5*5 pixels) modes, and the user can switch according to the scene requirements. In the density statistics stage: first, filter the effective feature points in the preset neighborhood, requiring that the feature energy value is greater than 20% of the global maximum value and the gradient direction change is less than 15 degrees; then calculate the effective point density (effective point number / neighborhood area); finally, perform logarithmic transformation on the density value to enhance the sensitivity in the low-density area. In the implementation, an adaptive adjustment mechanism is set: when the density value of 10 consecutive positions is lower than 0.01, the neighborhood size is automatically expanded by 50% and recalculated. For high-texture areas, local gradient consistency detection is deployed to remove abnormal points with a direction change of more than 30 degrees, ensuring the robustness of the density feature.
[0081] S23: Perform covariance matrix calculation using the channel information, and extract the maximum eigenvalue of the covariance matrix as the cross-channel correlation indicator.
[0082] In this embodiment, a hierarchical calculation strategy is adopted to deal with images of different sizes: for images with less than 10,000 pixels, the C*C covariance matrix (C is the number of channels) is directly calculated; for large-scale images, a block calculation method is used: the feature map is divided into sub-regions of 1024 pixels per block, and the sub-covariance matrices are calculated and then weighted averaged. The eigenvalue decomposition uses the Lanczos iterative algorithm, with a convergence threshold of |Δλ| / λ<10 -6 , and switches to the power iteration method when the iteration exceeds 50 times to ensure stability. The calculation result is smoothed by 3*3 Gaussian filtering (σ equal to 0.8) and is constrained in the range of [0.5μ, 1.5μ] (μ is the mean of eigenvalues).
[0083] S24: Calculate the dispersion coefficient of the feature energy value based on the distribution of the feature energy value in the spatial position corresponding to the preset region, and take the reciprocal of the dispersion coefficient as the region sparsity indicator.
[0084] In this embodiment, a four-order adaptive process is implemented: first, dynamically define the statistical region according to the spatial density feature - use a 9*9 small region for high-density areas (greater than 0.7) and a 25*25 large region for low-density areas (less than 0.3), and use a 15*15 region by default. In the defined region: perform outlier filtering (remove points with energy values less than 10% of the maximum value of the region), calculate the energy mean and standard deviation, and obtain the dispersion coefficient CV (when the mean is less than 0.01, the dispersion coefficient CV is forced to be 1). The sparsity conversion adopts a two-stage processing: the basic conversion S_base = 1 / (1+CV), and then the hyperbolic tangent is enhanced to improve the sensitivity around 0.5.
[0085] S3: generating a dynamic threshold value corresponding to each spatial position based on the statistical distribution of the feature energy values, in combination with the cross-channel correlation indicator and the region sparsity indicator.
[0086] Specifically, step S3 includes the following steps:
[0087] S31: calculating the global mean and standard deviation of the feature energy values of all spatial positions.
[0088] In the implementation of global statistical quantity calculation, a distributed processing architecture is used to deal with large-scale feature maps. First, the feature map is divided into 16x16 pixel square blocks (the edge blocks automatically adapt to the remaining size), and each block independently and in parallel calculates two core statistical quantities: the local feature energy mean (the arithmetic mean of the energy values of all positions in the block) and the local energy sum of squares (the square accumulation of the energy values of each position). After completing the block-level calculation, the global aggregation operation is performed: the global mean is synthesized by weighted average method (the weight is the number of pixels of each block), and the global standard deviation is synthesized by using the modified standard deviation formula (based on the relationship between the block sum of squares and the global mean). Multiple safeguard mechanisms are deployed in the implementation process: when it is detected that the variance of a block exceeds 10 times the global variance, it is determined that the block is abnormal and the resampling-removal of the block data is started, and the bilinear interpolation of the mean value of the adjacent blocks is used instead; when the feature energy is all zero, the safety parameters (mean = 0.01, standard deviation = 0.001) are forcibly set. Finally, the statistical rationality verification is performed: the ratio of the standard deviation to the mean value needs to be between 0.001 and 100, and when it exceeds the range, a three-level response mechanism is triggered (log recording → parameter reset → service degradation).
[0089] S32: for each spatial position, the following operations are performed:
[0090] inputting the cross-channel correlation indicator into a first normalization function to obtain a channel correlation factor,
[0091] inputting the region sparsity indicator into a second normalization function to obtain a sparsity factor.
[0092] In this embodiment, a double-path processing architecture is used in the implementation process to generate the channel correlation factor and the sparsity factor respectively:
[0093] Channel correlation factor calculation:
[0094] The S-shaped curve normalization function is used to process the cross-channel correlation indicator. The function compresses the input value to the [0, 1] interval, and the core calculation includes exponential decay transformation and ratio scaling. In the implementation, an input value protection mechanism is set: when the indicator value is lower than 0.001, 0 is forced to be output, and when it is higher than 10, 0.99 is output. At the same time, real-time change rate monitoring is deployed to limit the change speed of the factor to no more than 0.1 units per millisecond.
[0095] Sparsity factor calculation:
[0096] A piecewise function strategy is used to process the regional sparsity index. A power function transformation (with an exponent of 0.7) is used for intervals with sparsity ≤ 1, and a natural logarithmic transformation is used for intervals with sparsity greater than 1. The function output is adjusted by a scaling factor (default 0.8) and then filtered through a sliding window median filter to eliminate sudden noise. Adaptive adjustment is implemented: if 20 consecutive position factor values are below 0.2, the scaling factor is automatically increased by 10% to enhance sensitivity.
[0097] S33: Calculate a dynamic adjustment coefficient according to the channel correlation factor and the sparsity factor, and generate a dynamic threshold corresponding to a spatial position according to the dynamic adjustment coefficient.
[0098] In this embodiment, a dynamic threshold is synthesized through a spatial adaptive mechanism:
[0099] Adjustment coefficient synthesis:
[0100] The channel-related factor and the sparsity factor are combined to generate a dynamic adjustment coefficient. This uses a linear weighted model consisting of three components: a primary channel factor, a primary sparsity factor, and a cross-coupling term (the geometric mean of the two factors). The weighting configuration supports scenario adaptation: urban road scenarios prioritize the channel factor (weight 0.6), outdoor environments balance the two factors (weights 0.5 each), and indoor scenarios emphasize the cross-coupling term (weight 0.3).
[0101] Threshold calculation:
[0102] A basic threshold is generated based on the global mean and standard deviation, combined with a dynamic adjustment coefficient. A boundary enhancement item is added, with its intensity controlled by the spatial density characteristics: weak enhancement (intensity 0.2) is used in high-density areas (density greater than 0.8), strong enhancement (intensity 0.5) is used in low-density areas (density less than 0.3), and the median value (intensity 0.35) is used in transition areas.
[0103] S4: Dynamically adjust the size of the detection window based on the spatial density feature, assign decision weights to the feature points in each adjusted detection window according to their gradient strengths, and generate weighted feature energy values.
[0104] Specifically, step S4 includes the following steps:
[0105] S41: Determine the size of the detection window according to the preset density interval to which the spatial density characteristic value belongs.
[0106] In this embodiment, during implementation, a three-level density interval division mechanism is adopted to dynamically configure the detection window size. The preset density threshold divides the spatial density feature value into three intervals: high density area (≥0.7) corresponds to a small size window (default 3x3 pixels), medium density area (0.3-0.7) corresponds to a medium size window (default 7x7 pixels), and low density area (<0.3) corresponds to a large size window (default 15x15 pixels). A 0.05 interval tolerance band is set in the implementation to prevent frequent switching, and a real-time monitoring mechanism is deployed: when it is detected that the density change rate of 5 consecutive positions exceeds 10% / pixel, the window size is automatically increased by one level (e.g. from 3x3 to 5x5); meanwhile, texture complexity compensation is introduced, the gradient variance in the window is calculated, and if the variance exceeds the threshold, the window size is reduced (1 pixel is reduced for every 20% increase in variance). The mirror filling strategy is adopted for boundary processing: the upper and lower boundaries copy the 2nd and the last 2nd rows of pixels, and the left and right boundaries are the same, and the actual calculation area is scaled by the effective pixel number.
[0107] S42: For each feature point in the detection window, calculate its gradient intensity value and apply a weight mapping function to generate a decision weight.
[0108] In this embodiment, the implementation process is divided into three stages: first, use the Sobel operator to calculate the gradient amplitude of each point in the window, and map the gradient value to the [0, 1] interval through local normalization processing (add 1e-6 protection item to prevent zero). Then apply a nonlinear weight mapping function: use hyperbolic tangent transformation to enhance the weight of the edge area (enhancement coefficient default 2.5), and forcibly set the basic weight to 0.2 for flat areas (window maximum gradient less than 0.1). Finally, perform weight optimization: improve spatial consistency through 3x3 Gaussian filtering (standard deviation 0.5), and reset the abnormal weight to the neighborhood median value if it exceeds 2 times the neighborhood mean.
[0109] S43: Perform weighted aggregation on all feature points in the detection window according to the decision weight to generate a weighted feature energy value.
[0110] In this embodiment, the final energy value is generated through a weighted aggregation mechanism: the numerator calculates the sum of the product of each point feature energy value and weight in the window, the denominator calculates the sum of all weights and adds a 1e-6 protection item, and the ratio of the two is the weighted feature energy value. Special scene processing includes: when the sum of all weights is less than 0.01, switch to arithmetic average calculation; implement weight halving suppression for energy mutation points (deviation from the mean exceeds 3 times the standard deviation). Dynamic range compression is performed in the output stage: use logarithmic transformation to compress the energy value distribution range (scaling base 10), and then use a 3-time detection window size sliding average filter to enhance the consistency across windows.
[0111] S5: Real-time comparison of the weighted feature energy value with the dynamic threshold value of the corresponding position, and aggregation of the continuous spatial region exceeding the dynamic threshold value as a candidate region.
[0112] In this embodiment, the implementation process adopts a hierarchical processing architecture:
[0113] Point-by-point threshold comparison: For each spatial position, the weighted feature energy value and the dynamic threshold value are read synchronously. The comparison operation introduces a sensitivity factor grading mechanism: a strict decision mode (sensitivity factor 0.05) is adopted in high-density areas (spatial density greater than 0.7), a lenient mode (sensitivity factor 0.15) is adopted in low-density areas (spatial density less than 0.3), and the default scenario takes the median value (sensitivity factor 0.1). When the weighted energy value exceeds (1 + sensitivity factor) times the dynamic threshold value, it is marked as an active state, otherwise it is marked as an inactive state. In the implementation, anomaly detection is deployed: when 50 consecutive position state anomalies are detected, the region is frozen and an alarm is triggered.
[0114] Continuous region aggregation is based on the activation state map to perform a region growing algorithm, including:
[0115] Seed point scanning: scanning unmarked active points as seeds in raster order;
[0116] Region growing: taking the seed point as the center, checking the 8-neighbor positions, and recursively aggregating adjacent active points to form a connected region;
[0117] Boundary optimization: performing a morphological closing operation (3x3 circular structural element) on the generated region contour;
[0118] Fragment filtering: automatically removing isolated regions with an area less than 25 pixels.
[0119] Intelligent region merging adopts HSV color space histogram similarity analysis, including:
[0120] Extracting the HSV color histogram (hue / saturation / lightness three channels) of the candidate region;
[0121] Calculating the histogram similarity between regions: taking the arithmetic mean of the three-channel similarity;
[0122] When the similarity is greater than 0.7 and the region center distance is less than 20 pixels, perform region merging;
[0123] Simultaneously implementing hole filling: automatically filling internal holes with an area ratio less than 15%.
[0124] S6: Obtaining the confidence information output by the pre-set weak texture classification model for the candidate region, iteratively calibrating the dynamic threshold value according to the confidence information, and marking the candidate region that meets the pre-set confidence condition as the final weak texture recognition region.
[0125] Specifically, step S6 includes the following steps:
[0126] S61: input the candidate region into a preset weak texture classification model to output a confidence value, and classify the candidate region into a high-confidence region and an optimization region according to the confidence value, and extract a sparsity index of the corresponding region.
[0127] In this embodiment, a lightweight convolutional neural network is used to process the candidate region: a 64x64-pixel candidate block is input, 4 groups of convolutional layers (including batch normalization and ReLU activation) are used to extract features, and finally a global pooling and a fully connected layer are used to output probabilities of sky, ground and shadow. The confidence value is the highest probability value, and is classified according to a threshold value: a confidence value greater than 0.9 is a high-confidence region, and a confidence value between 0.4 and 0.6 is an optimization region. A fast channel mechanism is used to directly mark a high-confidence for a small area region (less than 25 pixels). A conflict resolution mechanism is used in the classification process: when the classification of adjacent regions is contradictory, a 3x3 window voting decision is used to determine the final category. A sparsity index of the corresponding region is extracted synchronously, and a correlation mapping between the confidence and the sparsity is established.
[0128] S62: calculate a difference value between the sparsity of the optimization region and the sparsity of the high-confidence region to generate a threshold correction coefficient, update a dynamic threshold value based on the threshold correction coefficient, and re-segment the candidate region to obtain a re-segmented region.
[0129] In this embodiment, the calibration process is divided into three steps: first, calculate the relative difference value of the sparsity of the optimization region and the adjacent high-confidence region (add a 0.1 denominator protection item to prevent zero); then generate a threshold correction coefficient through an S-shaped curve transformation (a basic adjustment amplitude of 30% and a sensitivity coefficient of 1.5); finally, scale the original threshold value with the correction coefficient, and constrain the scaling range to be between 0.5 and 1.5 times. The updated threshold value is propagated to a 3x3 neighborhood centered on the optimization region. The region re-segmentation performs a closed-loop optimization: the original candidate region is re-segmented using the new threshold value, and after generating a new boundary, a hole filling (automatic filling of internal holes with an area ratio less than 15%) and a fragment filtering (removal of isolated regions with an area less than 25 pixels) are performed.
[0130] S63: mark the re-segmented region with a confidence value exceeding a set value as a final weak texture recognition region.
[0131] In this embodiment, the basic requirement is that the re-segmentation region confidence is greater than 0.85; for critical regions (0.8-0.85), secondary verification is started, and 70% confidence and 30% texture uniformity scores are fused. The marking visualization scheme is: the sky area is covered with a blue semi-transparent mask (RGB 0, 0, 255, transparency 50%), the ground area is covered with green grid lines (line width 1 pixel, interval 3 pixels), and the shadow area is filled with gray solid (RGB 100, 100, 100). Three optimizations are performed before output: Gaussian smoothing contour (standard deviation 1.5 pixels), broken boundary bridging (automatic connection if the interval is less than 2 pixels), and run-length encoding compression data. Deploy a quality monitoring panel to real-time statistics of the area ratio of each region type and the boundary smoothness.
[0132] Embodiment two
[0133] The application also provides an image recognition system based on deep learning, which is used to execute an image recognition method based on deep learning, as shown in Figure 2 The system comprises:
[0134] A feature map acquisition module 100 is configured to perform multi-scale feature extraction on an input image to obtain a multi-scale feature map containing spatial position and channel information.
[0135] A parameter acquisition module 200 is configured to calculate a feature energy value of each spatial position according to the multi-scale feature map, and simultaneously perform the following operations:
[0136] extracting the spatial density feature of the spatial position,
[0137] calculating a cross-channel correlation index based on the channel information,
[0138] generating a region sparsity index.
[0139] A threshold generation module 300 is configured to generate a dynamic threshold corresponding to each spatial position based on the statistical distribution of the feature energy value, and in combination with the cross-channel correlation index and the region sparsity index.
[0140] A weighted calculation module 400 is configured to dynamically adjust the size of a detection window based on the spatial density feature, and assign a decision weight to each feature point in the adjusted detection window according to its gradient intensity, and generate a weighted feature energy value.
[0141] A candidate region generation module 500 is configured to compare the weighted feature energy value with the dynamic threshold of the corresponding position in real time, and aggregate the continuous spatial region exceeding the dynamic threshold as a candidate region.
[0142] The result output module 600 is configured to acquire confidence information output by the preset weak texture classification model for the candidate region, iteratively calibrate a dynamic threshold according to the confidence information, and mark a candidate region meeting a preset confidence condition as a final weak texture recognition region.
[0143] The present application is described with reference to flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams can be implemented by computer program instructions, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in one flow or multiple flows and / or blocks. Figure 1 The device that implements the functions specified in one block or multiple blocks.
[0144] Those skilled in the art can understand that all or part of the steps in the above-mentioned embodiments can be completed by programs instructing relevant hardware, and the programs can be stored in a computer readable storage medium, including Read-Only Memory (ROM), Random Access Memory (RAM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), One-time Programmable Read-Only Memory (OTPROM), Electrically-Erasable Programmable Read-Only Memory (EEPROM), Compact Disc Read-Only Memory (CD-ROM) or other optical disk memories, magnetic disk memories, magnetic tape memories, or any other computer readable medium capable of carrying or storing data.
[0145] It is also to be noted that the terms "comprising", "including", and any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises a... " does not, without further restriction, exclude the existence of additional elements of the process, method, article, or apparatus that comprises the element.
Claims
1. An image recognition method based on deep learning, characterized in that: The method comprises the following steps: Perform multi-scale feature extraction on the input image to obtain a multi-scale feature map containing spatial position and channel information; Calculate the feature energy value of each spatial position based on the multi-scale feature map, and simultaneously perform the following operations: Extracting the spatial density features of the spatial position, Calculate the cross-channel correlation index based on the channel information, Generate regional sparsity index; Based on the statistical distribution of the characteristic energy values, and in combination with the cross-channel correlation index and the regional sparsity index, a dynamic threshold corresponding to each spatial position is generated; Dynamically adjusting the size of the detection window based on the spatial density feature, assigning a decision weight to the feature points in each adjusted detection window according to their gradient strength, and generating a weighted feature energy value; Comparing the weighted feature energy value with the dynamic threshold of the corresponding position in real time, and aggregating continuous spatial regions exceeding the dynamic threshold as candidate regions; Confidence information of the candidate area output by a preset weak texture classification model is obtained, the dynamic threshold is iteratively calibrated according to the confidence information, and the candidate area that meets the preset confidence condition is marked as the final weak texture recognition area.
2. The image recognition method based on deep learning according to claim 1, characterized in that: The multi-scale feature extraction is performed on the input image to obtain a multi-scale feature map containing spatial position and channel information, including: Performing a spatial pyramid decomposition operation on the input image to generate a first scale feature map and a second scale feature map, wherein the spatial resolution of the second scale feature map is lower than that of the first scale feature map; Performing depthwise separable convolution operations on the first scale feature map and the second scale feature map, respectively, to obtain a first optimized feature map with enhanced spatial position information and a second optimized feature map with enhanced channel information; The first optimized feature map and the second optimized feature map are fused, a bilinear upsampling operation is performed on the second optimized feature map, the upsampling result is concatenated with the first optimized feature map along the channel dimension, and a multi-scale feature map containing spatial position and channel information is generated through convolution compression.
3. The image recognition method based on deep learning according to claim 2, characterized in that: The feature energy value of each spatial position is calculated according to the multi-scale feature map, and the following operations are performed simultaneously: Extracting the spatial density features of the spatial position, Calculate the cross-channel correlation index based on the channel information, Generates regional sparsity metrics, including: For each spatial position of the multi-scale feature map, calculating the square root of the sum of the squares of the feature intensities of all channels as the feature energy value; For each spatial position, the number and distribution density of feature points are counted within the corresponding preset neighborhood range to generate the spatial density feature, wherein the preset neighborhood range is a configurable graphic area; Calculating a covariance matrix using the channel information and extracting a maximum eigenvalue of the covariance matrix as the cross-channel correlation indicator; The dispersion coefficient of the characteristic energy value is calculated based on the distribution of the characteristic energy value in the preset area corresponding to the spatial position, and the inverse of the dispersion coefficient is used as the area sparsity index.
4. The image recognition method based on deep learning according to claim 3, characterized in that: The generating of the dynamic threshold corresponding to each spatial position based on the statistical distribution of the characteristic energy value and in combination with the cross-channel correlation index and the regional sparsity index includes: Calculate the global mean and standard deviation of the characteristic energy values at all spatial locations; For each spatial location, do the following: Input the cross-channel correlation index into the first normalization function to obtain the channel correlation factor, Inputting the regional sparsity index into a second normalization function to obtain a sparsity factor; A dynamic adjustment coefficient is calculated according to the channel correlation factor and the sparsity factor, and a dynamic threshold corresponding to a spatial position is generated according to the dynamic adjustment coefficient.
5. The image recognition method based on deep learning according to claim 4, characterized in that: The dynamically adjusting the size of the detection window based on the spatial density feature, assigning a decision weight to the feature points in each adjusted detection window according to their gradient strength, and generating a weighted feature energy value, includes: Determining the size of the detection window according to the preset density interval to which the spatial density characteristic value belongs; For each feature point in the detection window, calculate its gradient strength value and apply the weight mapping function to generate the decision weight; Weighted aggregation is performed on all feature points in the detection window according to the decision weights to generate weighted feature energy values.
6. The image recognition method based on deep learning according to claim 5, characterized in that: The step of obtaining confidence information of the candidate region output by a preset weak texture classification model, iteratively calibrating a dynamic threshold according to the confidence information, and marking the candidate region that meets the preset confidence condition as a final weak texture recognition region includes: Inputting the candidate region into a preset weak texture classification model to output a confidence value, and classifying the candidate region into a high confidence region and a region to be optimized according to the confidence value, and extracting a sparsity index of the corresponding region; Calculating the difference between the sparsity of the area to be optimized and the sparsity of the high confidence area to generate a threshold correction coefficient, and updating the dynamic threshold based on the threshold correction coefficient and re-segmenting the candidate area to obtain a re-segmented area; The re-segmented area whose confidence exceeds the set value is marked as the final weak texture recognition area.
7. A deep learning-based image recognition system, configured to execute the deep learning-based image recognition method according to any one of claims 1 to 6, characterized in that: The system comprises: The feature map acquisition module is used to extract multi-scale features from the input image and obtain a multi-scale feature map containing spatial position and channel information; The parameter acquisition module is used to calculate the feature energy value of each spatial position according to the multi-scale feature map and simultaneously perform the following operations: Extracting the spatial density features of the spatial position, Calculate the cross-channel correlation index based on the channel information, Generate regional sparsity index; A threshold generation module, configured to generate a dynamic threshold corresponding to each spatial position based on the statistical distribution of the characteristic energy value and in combination with the cross-channel correlation index and the regional sparsity index; A weighted calculation module, configured to dynamically adjust the size of the detection window based on the spatial density feature, assign a decision weight to each feature point within the adjusted detection window according to its gradient strength, and generate a weighted feature energy value; A candidate region generation module is used to compare the weighted feature energy value with the dynamic threshold of the corresponding position in real time, and aggregate the continuous spatial regions exceeding the dynamic threshold as candidate regions; The result output module is used to obtain the confidence information of the candidate area output by the preset weak texture classification model, iteratively calibrate the dynamic threshold according to the confidence information, and mark the candidate area that meets the preset confidence condition as the final weak texture recognition area.