Object recognition method and related device
By combining multi-scale Retinex with adaptive directional Gabor filtering for illumination compensation and texture enhancement, along with local texture statistical features and an adaptive texture attention mechanism, the problems of uneven illumination and texture weakening in cultural relic image recognition are solved, thereby improving the accuracy and robustness of cultural relic type identification.
Patent Information
- Application Number
- CN202511615371.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-06
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2045-11-06
AI Technical Summary
The technology for recognizing cultural relics suffers from problems such as uneven lighting, weakened texture, and subtle differences between classes, resulting in low recognition accuracy, unstable feature extraction, and poor robustness. Conventional methods are unable to effectively enhance inter-class differentiation and intra-class cohesion, especially in the recognition of highly similar cultural relics, where the accuracy is low.
An enhancement algorithm combining multi-scale Retinex and adaptive directional Gabor filtering is used for illumination compensation and texture enhancement. An intermediate image is generated by linear superposition and fusion. A weight initialization strategy based on local texture statistical features and an adaptive texture attention mechanism are combined to design a total discriminative loss function that integrates cross-entropy, center loss and adaptive marginal loss. A recognition model is constructed and a cultural relics knowledge graph is applied to interpret the recognition results and display them in a three-dimensional interactive manner.
It improves the contrast, clarity, and texture resolution of cultural relic images, enhances the ability to identify high-frequency details, and improves the accuracy and robustness of object type identification, thus achieving efficient cultural relic type identification.
Smart Images

Figure CN121074530A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of object recognition technology, and in particular to an object recognition method and related apparatus. Background Technology
[0002] With the development of science and technology, object classification is becoming increasingly important. Taking cultural relics as an example, with the advancement of digital cultural relic protection and the construction of smart museums, cultural relic image recognition technology has shown broad application prospects in fields such as cultural relic digitization, automatic classification, and virtual display. However, cultural relic images typically have highly complex texture features, diverse material representations, and subtle differences between categories, making it difficult to accurately identify the type of cultural relic. Summary of the Invention
[0003] In view of the above problems, this application provides an object recognition method and related apparatus to accurately identify the type of object. The specific solution is as follows:
[0004] The first aspect of this application provides an object recognition method, comprising:
[0005] Obtain the initial image of the target object;
[0006] The illumination compensation result and texture enhancement result of the initial image are linearly superimposed and fused to obtain an intermediate image;
[0007] The intermediate image is convolved to obtain an output feature map. An attention weight map is obtained by using a preset attention weight function and the output feature map.
[0008] The output feature map and the attention weight map are multiplied element-wise to obtain an attention-weighted feature map. The attention-weighted feature map is then classified to obtain the object type recognition result of the target object.
[0009] A second aspect of this application provides an object recognition device, comprising:
[0010] The image acquisition module is used to acquire the initial image of the target object;
[0011] The fusion module is used to linearly superimpose and fuse the illumination compensation result and texture enhancement result of the initial image to obtain an intermediate image;
[0012] The processing module is used to perform a convolution operation on the intermediate image to obtain an output feature map, and to obtain an attention weight map using a preset attention weight function and the output feature map;
[0013] The recognition module is used to perform element-wise multiplication of the output feature map and the attention weight map to obtain an attention-weighted feature map, and to perform a classification operation on the attention-weighted feature map to obtain the object type recognition result of the target object.
[0014] A third aspect of this application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0015] The memory is used to store computer programs;
[0016] The processor is used to execute the computer program so that the electronic device can implement the object recognition method described above.
[0017] A fourth aspect of this application provides a computer storage medium carrying one or more computer programs, which, when executed by an electronic device, enable the electronic device to implement the object recognition method described above.
[0018] By employing the above technical solutions, this application provides an object recognition method and related apparatus. In this application, the illumination compensation result and texture enhancement result of the initial image are linearly superimposed and fused. This superposition of illumination compensation and texture enhancement operations can solve the problems of uneven illumination and weakened texture when acquiring object images, thereby improving the accuracy of object type recognition. Furthermore, a convolution operation is performed on the intermediate image to obtain an output feature map. Using a preset attention weight function and the output feature map, an attention weight map is obtained. The output feature map and the attention weight map are then multiplied element-wise to obtain an attention-weighted feature map, which improves the recognition ability of high-frequency details, thereby improving the accuracy of object type recognition. Attached Figure Description
[0019] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0020] Figure 1 A flowchart of an object recognition method provided in this application;
[0021] Figure 2 A schematic diagram of an initial image provided for this application;
[0022] Figure 3 A flowchart of a method for obtaining an intermediate image provided in this application;
[0023] Figure 4A schematic diagram of an image processed after illumination compensation, as provided in this application;
[0024] Figure 5 A schematic diagram of a texture-enhanced image provided in this application;
[0025] Figure 6 A schematic diagram of an intermediate image provided for this application;
[0026] Figure 7 A performance comparison chart provided for this application;
[0027] Figure 8 A flowchart of a method for determining initial weights provided in this application;
[0028] Figure 9 Another performance comparison chart provided for this application;
[0029] Figure 10 A schematic diagram of an output feature map provided in this application;
[0030] Figure 11 A schematic diagram of a feature heatmap for texture enhancement provided in this application;
[0031] Figure 12 This is a schematic diagram of the structure of an object recognition device provided in this application. Detailed Implementation
[0032] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is only for explaining specific embodiments and is not intended to limit the application. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0033] With the advancement of digital cultural relic protection and the construction of smart museums, cultural relic image recognition technology has shown broad application prospects in fields such as cultural relic digitization, automatic classification, and virtual display. However, cultural relic images typically have highly complex texture features, diverse material representations, and subtle differences between classes. In addition, they are often affected by factors such as uneven lighting, changing viewing angles, and background interference during actual acquisition. This leads to problems such as low recognition accuracy, unstable feature extraction, and poor robustness when traditional image enhancement methods and general recognition models are used to process cultural relic images.
[0034] In addition, conventional techniques also use methods such as histogram equalization and global normalization to process images. However, images of cultural relics are sensitive to changes in lighting and texture, which can easily lead to texture loss or over-enhancement.
[0035] In addition, conventional techniques may employ random initialization or global mean initialization, ignoring the texture distribution of artifact images, which leads to unstable training and inaccurate feature extraction.
[0036] In addition, conventional techniques that rely solely on cross-entropy cannot effectively enhance inter-class differentiation and intra-class cohesion, resulting in low accuracy, especially in the identification of highly similar cultural relics.
[0037] To address these issues, this application's embodiments employ an enhancement algorithm combining multi-scale Retinex (Retina + Cortex, retinal-cortical theory) and adaptive directional Gabor filtering in image preprocessing. This effectively solves the problems of uneven illumination and texture weakening. Regarding model structure, a weight initialization strategy incorporating local texture statistical features and an adaptive texture attention mechanism are designed to improve the recognition of high-frequency details. In terms of training mechanism, a total discriminative loss function integrating cross-entropy, center loss, and adaptive marginal loss is used to enhance the discriminative and convergent properties of the feature space.
[0038] In addition, in terms of the application of recognition results, it is the first to connect the classification output with the cultural relics knowledge graph, supporting cultural interpretation and three-dimensional interactive display, so as to build a closed-loop system for the entire process from recognition to popular science.
[0039] Based on the above, one embodiment of this application provides an object recognition method, referring to... Figure 1 It can include:
[0040] S11. Obtain the initial image of the target object.
[0041] In this embodiment, the target object can be cultural relics, antiques, rare items, collectibles, or other similar objects. Taking cultural relics as an example, they can be porcelain, bronzes, calligraphy, or paintings. In a standardized photography studio environment, a high-resolution digital camera is used to capture clear images of the cultural relics from one or more fixed angles (such as frontal, top, or side views) to ensure that the main feature surfaces of the cultural relics are covered.
[0042] The clear images collected are the initial images in this application. The initial images can focus on key visual features that can reflect the differences in categories, such as the overall shape of the object, typical decorative patterns, and material surface characteristics.
[0043] In one example, the initial image taken could be a celadon four-handled jar housed in a museum, specifically as follows: Figure 2 As shown.
[0044] S12. The illumination compensation result and texture enhancement result of the initial image are linearly superimposed and fused to obtain the intermediate image.
[0045] Specifically, cultural relic image data often suffers from uneven lighting, low contrast, blurred details, and background noise interference, making it difficult to effectively extract key texture features. Conventional global normalization techniques, such as min-max scaling, cannot adaptively handle local feature differences, are sensitive to changes in lighting and loss of detail, and are prone to losing subtle texture information, thereby reducing the model's recognition accuracy.
[0046] Therefore, in this embodiment, a multi-scale Retinex method is first used to perform illumination compensation on the initial image. Illumination correction results at different scales are fused using dynamic weights to eliminate uneven illumination and improve overall contrast, resulting in an illumination compensation result. Then, an adaptive directional Gabor filter is used to perform convolution operations on the image, enhancing key texture features in specific directions and suppressing background noise, resulting in a texture enhancement result. Finally, the illumination compensation result and the texture enhancement result are linearly superimposed and fused to generate the final intermediate image.
[0047] In one implementation, refer to Figure 3 Step S12 may include:
[0048] S21. Perform illumination component decomposition on the initial image, and fuse the illumination correction results at each scale using dynamic weights to obtain the illumination compensation result.
[0049] Specifically, in performing multi-scale Retinex illumination compensation, multi-scale Gaussian convolution is used to decompose the illumination components of the initial image. The illumination correction results at each scale are then fused using dynamic weights to eliminate uneven illumination and improve overall contrast. The specific calculation formula is as follows:
[0050] ;
[0051] in, This represents the Retinex output at the s-th scale, characterizing the illumination correction result, which can specifically be the illumination normalization result.
[0052] For the first There is one initial image; if there is only one initial image, then The value is 1.
[0053] The standard deviation of the Gaussian kernel at the s-th scale controls the extraction range of the illumination component;
[0054] The standard deviation is Gaussian filter kernel;
[0055] This represents a convolution operation used to extract illumination components;
[0056] This is a logarithmic transformation function, with the default base being the natural constant.
[0057] Retinex is an image enhancement and color constancy theory. Specifically, it is an image enhancement framework that simulates the human visual mechanism. By separating the illumination and reflection components, it achieves dynamic range compression, color constancy, and detail enhancement.
[0058] In one example, for Figure 2 The initial image in the image is processed after multi-scale Retinex illumination compensation. (Image reference) Figure 4 As shown.
[0059] S22. Based on the weight decay coefficient and the difference between the gradient matrix of the initial image and the gradient clustering centers at each scale, the adaptive weights are calculated.
[0060] Specifically, after obtaining the illumination compensation result, it is also necessary to calculate the adaptive weight of the illumination compensation result. The adaptive weight specifically refers to the adaptive multi-scale weight, and its specific calculation process is as follows:
[0061] Based on the difference between the gradient matrix of the initial image and the gradient cluster centers at each scale, the sensitivity is controlled by a weight decay coefficient, and the weights at each scale are dynamically allocated to preserve local detail features. The specific calculation formula is as follows:
[0062] ;
[0063] in, The adaptive weights for the s-th scale determine the contribution of that scale in the fusion.
[0064] For the initial image The gradient matrix represents the edge intensity distribution; if there is only one initial image, then The value is 1. The gradient matrix is obtained by applying the initial image... The image was obtained through standard edge detection, specifically by using the Sobel operator to calculate the gradient components in the horizontal direction. and gradient components in the vertical direction Then through The gradient magnitude is calculated pixel by pixel, and finally a gradient matrix representing the intensity distribution of image edges is generated.
[0065] The gradient cluster centers corresponding to the s-th scale are obtained by clustering the sample gradients using the K-means algorithm.
[0066] For example, the weight decay coefficient. =1.5, to control the sensitivity to gradient differences;
[0067] The total number of multiple scales is automatically determined by cluster analysis based on the complexity of the illumination distribution;
[0068] It is an L2 norm;
[0069] It is an exponential function.
[0070] S23. Filter the initial image using an adaptive orientation angle to obtain the texture enhancement result.
[0071] Specifically, adaptive directional Gabor texture enhancement can be used for filtering. Specifically, the adaptive directional angle is determined by maximizing the variance of the Gabor filter response. A Gabor filter kernel with this adaptive directional angle is then used to perform a convolution operation on the initial image, enhancing texture features in a specific direction and suppressing noise. The specific calculation formula is as follows:
[0072] ;
[0073] ;
[0074] in, For the first The adaptive orientation angle of an initial image is determined by maximizing the variance of the filter response; if there is only one initial image, then... The value is 1;
[0075] For the first There is one initial image; if there is only one initial image, then The value is 1;
[0076] For adaptive direction angle Gabor filter kernel;
[0077] For adaptive direction angle Gabor filter kernel;
[0078] is the variance function, which measures the significance of texture direction after filtering;
[0079] This indicates selecting the adaptive direction angle that maximizes the variance. ;
[0080] The Gabor filter output image, i.e. the texture enhancement result, is used to enhance texture features in a specific direction.
[0081] In one embodiment, the image after adaptive orientation Gabor texture enhancement can be referenced. Figure 5 As shown.
[0082] In this embodiment, the texture direction is automatically selected by maximizing the variance of the filter response, the texture of key directions is enhanced and the background noise is suppressed, and the key details of cultural relic identification are preserved.
[0083] S24. Using adaptive weights, the illumination compensation result and the texture enhancement result are linearly superimposed and fused to obtain an intermediate image.
[0084] Specifically, the illumination compensation results and texture enhancement results are linearly superimposed through multimodal enhancement fusion. Specifically, the multi-scale illumination compensation results from dynamic weight fusion are linearly superimposed with the texture enhancement results from adaptive directional Gabor texture enhancement. The texture intensity is adjusted by the texture enhancement coefficient, and the final preprocessed intermediate image is generated through fusion. The specific calculation formula is as follows:
[0085] ;
[0086] in, For the first Intermediate images after preprocessing an initial image;
[0087] For texture enhancement coefficients, such as, =0.8, controlling the strength of the Gabor term to suppress background noise;
[0088] The total number of multiple scales is automatically determined by cluster analysis based on the complexity of the illumination distribution;
[0089] For the adaptive weights at the s-th scale;
[0090] This represents the Retinex output at the s-th scale, characterizing the illumination correction result;
[0091] This is the Gabor filter output image, i.e., the texture enhancement result.
[0092] In one embodiment, the preprocessed intermediate image can be referenced. Figure 6 As shown.
[0093] In one embodiment, refer to Figure 7A comparative analysis of preprocessing effects was conducted to evaluate the effectiveness of different preprocessing methods in improving the image quality of cultural relics, thereby verifying the advantages of the multi-scale Retinex illumination compensation and adaptive orientation Gabor texture enhancement fusion technology proposed in this application. This application is compared with global normalization (conventional technique), histogram equalization (conventional technique), and Retinex + traditional Gabor (improved conventional technique), with bar charts showing three core indicators:
[0094] Contrast improvement rate (measures the effect of illumination compensation): The bars of contrast improvement rate in this application are significantly higher than those of other methods, indicating that multi-scale dynamic weight fusion effectively eliminates illumination unevenness;
[0095] Detail retention (a measure of the ability to retain texture features): The height of the bars in the detail retention of this application is prominent, demonstrating that the adaptive directional Gabor filtering accurately enhances key textures;
[0096] Noise suppression rate (measures the effectiveness of background interference reduction): The highest bar in this application represents the noise suppression rate, reflecting the texture enhancement coefficient. Effectively suppresses noise.
[0097] Experimental results show that conventional methods exhibit large data fluctuations (reflected by column errors), indicating poor adaptability to different cultural relics. In contrast, the data from this application shows high stability (with minimal column errors), demonstrating strong robustness. Therefore, this application leads in all three indicators, with the noise suppression rate being the most significant advantage.
[0098] In this embodiment, by fusing illumination compensation and texture enhancement, image contrast, sharpness, and texture resolution are improved, providing high-quality input for subsequent recognition. Furthermore, multi-scale fusion and gradient-aware adaptive weights are employed to dynamically adjust the illumination compensation effect, thereby enhancing local image contrast.
[0099] S13. Perform a convolution operation on the intermediate image to obtain the output feature map. Use the preset attention weight function and the output feature map to obtain the attention weight map.
[0100] In this embodiment, the cultural relic images possess high detail richness and inter-class similarity. Conventional convolutional neural networks, using only standard convolutional layers during forward propagation, struggle to effectively distinguish subtle features, resulting in a lack of discriminative power in the feature maps. Key texture regions fail to be focused, and irrelevant background noise is preserved, thus reducing classification accuracy. Furthermore, traditional methods neglect dynamic feature selection mechanisms, failing to adaptively enhance high-frequency details and performing poorly in scenarios with blurred details and high inter-class similarity. Therefore, in this embodiment, during the forward propagation computation of the convolutional neural network, standard convolution operations are performed on the input intermediate image to obtain the output feature map. Then, a dynamic, preset attention weight function is calculated. This function combines the global average information and local texture energy information of the output feature map, generating an attention weight map that focuses on high-frequency detail regions through a sigmoid activation function.
[0101] S14. Multiply the output feature map and the attention weight map element by element to obtain the attention weighted feature map. Perform a classification operation on the attention weighted feature map to obtain the object type recognition result of the target object.
[0102] Specifically, the output feature map of the standard convolution is multiplied element-wise with the dynamically generated attention weight map to generate an attention-weighted feature map. This dynamically suppresses irrelevant background noise and enhances the texture features of the main area of the cultural relic, thereby improving feature discrimination. Subsequently, the attention-weighted feature map is output to subsequent network layers for cultural relic type identification, resulting in the object type identification result of the target object.
[0103] In this embodiment, the illumination compensation results and texture enhancement results of the initial image are linearly superimposed and fused. This superposition of illumination compensation and texture enhancement operations can solve the problems of uneven illumination and weakened texture when acquiring object images, thereby improving the accuracy of object type recognition. Furthermore, a convolution operation is performed on the intermediate image to obtain an output feature map. Using a preset attention weight function and the output feature map, an attention weight map is obtained. The output feature map and the attention weight map are then multiplied element-wise to obtain an attention-weighted feature map, which improves the recognition ability of high-frequency details, thereby enhancing the accuracy of object type recognition.
[0104] Based on any of the above embodiments, in one implementation, steps S13-S14 are implemented using an object recognition model. This object recognition model can be a cultural relic recognition model, and it can employ a hierarchical convolutional neural network architecture. The object recognition model includes: a feature extraction backbone network, an adaptive attention module, and a classification output layer.
[0105] The feature extraction backbone network comprises multiple sets of convolutional-pooling cascaded units. The first set of convolutional-pooling cascaded units captures morphological features from a specified viewpoint, while the other sets extract texture at specified granularities step-by-step. The feature extraction backbone network utilizes these multiple sets of convolutional-pooling cascaded units to perform convolution operations on intermediate images to obtain output feature maps.
[0106] In one example, the feature extraction backbone network contains four sets of convolution-pooling cascaded units: the first layer uses a 7×7 large convolution kernel to capture morphological features from a specified perspective, specifically macroscopic morphological features; the subsequent three layers use 5×5, 3×3, and 3×3 convolution kernels to extract textures of a specified granularity, specifically fine-grained textures; and each set of convolutions is followed by a max pooling layer to compress spatial dimensions and retain salient features.
[0107] In this application, standard convolution operations are performed through convolutional layers in a convolution-pooling cascade unit to obtain the output feature map. The output feature map is then obtained through max pooling after the standard convolution operation.
[0108] After the adaptive attention module is embedded into the convolutional pooling cascaded unit of the specified group, it is used to obtain the attention weight map by using the preset attention weight function and the output feature map. The output feature map and the attention weight map are then multiplied element-wise to obtain the attention weighted feature map.
[0109] Specifically, the adaptive attention module is embedded after the third convolutional layer. It enhances the high-frequency texture response through the feature map channel weighting mechanism. It uses the preset attention weight function and the output feature map to obtain the attention weight map. The output feature map and the attention weight map are multiplied element-wise to obtain the attention weighted feature map.
[0110] The classification output layer consists of a multi-level fully connected network, which performs classification operations on the attention-weighted feature map through dimensionality reduction and object classification operations to obtain the object category recognition result of the target object.
[0111] Specifically, the classification layer is implemented by a two-level fully connected network. The first-level fully connected network reduces the attention feature vector to a 256-dimensional discriminative feature vector. The second-level fully connected network uses this 256-dimensional discriminative feature vector to measure the distance between the feature centers of each category formed during the training phase and outputs the classification probability distribution corresponding to the number of cultural relic categories. Finally, the category center with the smallest Euclidean distance is selected as the cultural relic type as the recognition result, thus obtaining the object type recognition result of the target object.
[0112] Based on this embodiment, in one implementation, refer to Figure 8 The convolutional layers in the convolutional pooling cascade unit are configured with initial weights. The process of determining the initial weights includes:
[0113] S31. Use the average value of the gradient matrix of the enhanced sample as the baseline weight component.
[0114] The enhanced sample is obtained by linearly superimposing and fusing the illumination compensation result and texture enhancement result of the image sample.
[0115] Specifically, the image samples are high-quality base datasets built during the training of the object recognition model. The image sample collection process is as follows: For the target cultural relic category, such as porcelain, bronzes, calligraphy and paintings, clear images of each cultural relic are taken from multiple fixed angles (such as front view, top view, and side view) using a high-resolution digital camera in a standardized photography studio environment, ensuring that the main feature surfaces of the cultural relic are covered. The collection focuses on key visual features that can reflect the differences between categories, such as the overall shape of the object, typical decorative patterns, and material surface characteristics.
[0116] In one implementation, to address potential issues in the real-world environment, such as partial occlusion or slight angle changes, a limited amount of natural background or slightly non-uniform lighting samples are appropriately introduced during image acquisition to enhance data robustness.
[0117] Furthermore, the collected data is labeled, and professional cultural heritage personnel use their knowledge of cultural relic typology to accurately label each image with the cultural relic category tag, such as "Yuan Dynasty blue and white peony pattern plum vase" and "Warring States period bronze taotie pattern tripod".
[0118] After obtaining the image samples, an enhancement algorithm combining multi-scale Retinex and adaptive directional Gabor filtering is used to linearly superimpose and fuse the illumination compensation results and texture enhancement results of the image samples to obtain enhanced samples.
[0119] In real-world scenarios, when faced with high-dimensional artifact image features, the random weight initialization of conventional convolutional neural networks can easily lead to slow training convergence or getting stuck in local optima, making it difficult to adapt to the complex spatial distribution of artifact textures. Global mean initialization methods cannot handle the problem of uneven distribution of local textures (dense or sparse), and are prone to failure in complex texture regions, reducing the model's sensitivity to subtle features.
[0120] To this end, this application embodiment calculates the initial weights of the convolutional layers in the convolutional neural network based on the global gradient statistical characteristics and local texture clustering information of the preprocessed image. First, the arithmetic mean of the gradient matrices of all enhanced samples is calculated as the baseline weight component, representing the global edge distribution. Then, a texture weighting factor is calculated based on the difference between the sample texture enhancement result and the center of its respective texture cluster, and the texture correction increment is obtained by weighted summation of the sample texture enhancement results accordingly. Finally, the baseline weight component is added to the texture correction increment to generate the initial weight matrix of the convolutional layer, which integrates global edge features and local texture adaptability, allowing the model to focus on key texture features from the initial training stage. The specific steps are as follows:
[0121] Calculate the arithmetic mean of the gradient matrices of all enhanced samples to establish the baseline weight components characterizing the global edge feature distribution. The specific calculation formula is as follows:
[0122] ;
[0123] in, Provides a global edge feature distribution for the baseline weight components;
[0124] For the first The intermediate image after preprocessing the initial image specifically refers to the first image during model training. Augmented samples of image samples;
[0125] for The gradient matrix represents the edge features;
[0126] This represents the total number of training samples.
[0127] S32. Calculate the texture weighting factor of the image sample by using the difference between the texture enhancement result of the image sample and the texture cluster center to which the texture enhancement result of the image sample belongs.
[0128] Specifically, based on the difference between the texture enhancement result of an image sample after adaptive directional Gabor texture enhancement and the center of its texture cluster, a texture weighting factor for the image sample is generated by controlling the sensitivity through texture influence hyperparameters to address the uneven distribution problem. The specific calculation formula is as follows:
[0129] ;
[0130] in, The texture weighting factor function outputs... Range values;
[0131] for The center of the texture cluster;
[0132] For texture-affecting hyperparameters, such as, =1.2, controlling the sensitivity to differences in texture density;
[0133] This is the Gabor filter output image, i.e., the texture enhancement result.
[0134] S33. The texture enhancement result of the image sample is corrected by using the texture weighting factor of the image sample to obtain the texture correction increment.
[0135] Specifically, the texture enhancement results of the image samples are summed using a texture weighting factor. The response intensity is controlled by adjusting the rate to generate a texture correction increment that compensates for local texture differences. The specific calculation formula is as follows:
[0136] ;
[0137] in, This is an incremental correction for textures, compensating for local texture differences.
[0138] To adjust the rate, for example, =0.05, controlling the response strength to clustering information;
[0139] The total number of training samples;
[0140] This is the Gabor filter output image, i.e., the texture enhancement result.
[0141] S34. Add the baseline weight components to the texture correction increment to obtain the initial weights of the convolutional layers in the convolutional pooling cascade unit.
[0142] Specifically, the baseline weight components are added to the texture correction increment to generate the convolutional layer initialization weight matrix that fuses global edge features and local texture adaptation, as shown below:
[0143] ;
[0144] in, Initialize the weight matrix for the convolutional layer as the starting point for network training;
[0145] Use the baseline weight components to capture global edge features;
[0146] This provides incremental texture correction to enhance local texture adaptability.
[0147] In this embodiment, based on the global gradient statistical characteristics and local texture clustering information of the preprocessed image, the initial weights of the convolutional layers in the convolutional neural network are calculated, so that the model focuses on key texture features in the early stage of training.
[0148] In addition, global gradient statistics and local texture clustering are used to correct weight initialization, which enhances the model's sensitivity to subtle features and improves training efficiency and recognition accuracy.
[0149] It should be noted that the remaining trainable parameters of the object recognition model can be initialized using the conventional random initialization method.
[0150] Based on any of the above embodiments, after the initial values of the trainable parameters of the object recognition model are known, subsequent parameter updates are required during training; that is, the parameters in the object recognition model need to be updated during training. In one implementation, the parameter update process in the object recognition model includes:
[0151] 1) Calculate the historical cumulative value of the variance of the attention-weighted feature map of the enhanced sample. Based on the historical variance decay factor and the historical cumulative value, obtain the variance cumulative term used for adaptive scaling of the learning rate.
[0152] Specifically, in order to avoid the risk of uneven distribution of training data for cultural relic images and the model being prone to getting trapped in local optima, the conventional SGD (Stochastic Gradient Descent) optimizer uses a fixed learning rate, which can cause the convergence process to oscillate or stagnate. The traditional Adagrad (Adaptive Gradient) method only accumulates the squared gradient and ignores the volatility of the feature space, making it difficult to adaptively balance the parameter update amplitude in regions with different texture complexity.
[0153] To address this, this application employs a variant of the optimizer based on feature variance to update the convolutional layer weights, iteratively accumulating the historical variance values of the attention-weighted feature map to generate a variance accumulation term for adaptively scaling the learning rate. During parameter updates, this variance accumulation term is used to construct an adaptive scaling factor to scale the gradient of the total discriminative loss function. When the feature space fluctuates, the effective learning rate decreases, and vice versa. This dynamically adjusts the parameter update step size based on feature stability, helping to balance convergence speed and stability and reducing the risk of getting trapped in local optima. The specific steps are as follows:
[0154] The historical cumulative value of the variance of the attention-weighted feature map is iteratively updated. The old and new statistics are balanced by a historical variance decay factor to generate a variance accumulation term for adaptive scaling of the learning rate. The specific calculation formula is as follows:
[0155] ;
[0156] in, This is the variance accumulation term, used in iterative updates to scale the learning rate; the update step size is reduced when the feature variance increases.
[0157] This is a historical variance decay factor, controlling the proportion of old variance values retained. The larger the value, the more dependent it is on long-term statistics;
[0158] The variance calculation function is used to calculate the attention-weighted feature map. (For example, attention-weighted feature maps of enhanced samples) Calculate the variance of all elements and obtain the historical cumulative value, which characterizes the fluctuation intensity of the feature space;
[0159] This indicates an iterative assignment operation.
[0160] 2) Construct an adaptive scaling factor using the variance accumulation term and the smoothing constant.
[0161] Specifically, the formula for calculating the adaptive scaling factor is as follows:
[0162] ;
[0163] in, This is the cumulative variance term. For example, a smoothing constant. .
[0164] 3) After scaling the gradient of the convolutional layer weights using an adaptive scaling factor, perform a parameter update operation to obtain the updated parameters of the object recognition model.
[0165] Specifically, the parameters are updated after scaling the gradient of the convolutional layer weights using an adaptive scaling factor, balancing feature stability and convergence speed. The specific calculation formula is as follows:
[0166] ;
[0167] in, These are the updated weights, which are the updated parameters of the object recognition model.
[0168] These are the current weights, which are the parameters before the object recognition model was updated;
[0169] The initial learning rate controls the basic update step size, such as... ;
[0170] To ensure smoothness and prevent the denominator from being zero, for example, ;
[0171] Total discriminative loss function For the current weight The gradient;
[0172] For adaptive scaling factor, The larger the value, the smaller the effective learning rate.
[0173] The model parameter update process includes a stopping condition, and convergence metrics must be monitored synchronously during model training to determine whether to execute a stopping decision. First, the validation set accuracy is tracked; a primary stopping condition is triggered when the accuracy fluctuation is less than 0.2% over 10 consecutive training epochs. Second, the decay rate of the total discriminative loss function is calculated; if the loss value decreases by less than 0.1% over 20 epochs, it is determined to have entered a plateau phase.
[0174] The iteration terminates when all of the above conditions are met, or when the total training cycle reaches a preset upper limit (e.g., 3000 rounds).
[0175] It should be noted that each trainable parameter in the model is updated using the method described above.
[0176] In this embodiment, the improved initialization method of the initial weights of the convolutional layer and the use of an adaptive optimizer with an adaptive learning rate for parameter update operations can effectively avoid local optimum traps, accelerate training, and improve robustness in complex texture scenes.
[0177] In one example, after training, the model can be used to identify cultural relics through an end-to-end inference process. Specifically, after inputting the image of the cultural relic to be identified (such as the initial image mentioned above), multi-scale Retinex illumination compensation and adaptive directional Gabor texture enhancement preprocessing are first performed to generate a standardized enhanced image (such as the intermediate image mentioned above). Then, it is input into the initial object recognition model for forward propagation. After convolutional feature extraction, key texture regions are dynamically weighted by the attention module, finally generating a 256-dimensional discriminative feature vector. The distance between this vector and the feature centers of each category formed during the training phase is measured, and the category center with the smallest Euclidean distance corresponding to the cultural relic type is selected as the recognition result.
[0178] In one embodiment, a comparative analysis of classification accuracy is performed to evaluate the performance advantages of the overall architecture of this application embodiment in the fine-grained classification task of cultural relics. The accuracy of conventional convolutional neural networks, deep residual networks (ResNet50, Residual Network 50, 50 layers), and the model in this application embodiment on five types of cultural relics is compared. Figure 9As shown, the horizontal axis represents the cultural relic category (bronze / porcelain / calligraphy and painting / jade / gold and silver / average), and the vertical axis represents the classification accuracy (unit: percentage, presented as a decimal). Experimental results show that the calligraphy and painting category has the largest gap, with our application significantly outperforming the others, as the ink texture of calligraphy and painting requires adaptive directional Gabor enhancement. Jade has a clear advantage, and the lighting compensation for translucent materials relies on multi-scale Retinex. Furthermore, conventional methods exhibit large fluctuations in performance across different categories (high for bronzes, low for calligraphy and painting), while the height of the bars in our application is uniform across all categories, demonstrating the strong generalization ability of our model.
[0179] Based on any of the above embodiments, an attention weight map is obtained using a preset attention weight function and an output feature map, including:
[0180] Using global average information and local texture energy information, a preset attention weight function is calculated, and the output feature map is processed using the preset attention weight function to obtain the attention weight map.
[0181] Specifically, the preset attention weight function compresses the global features extracted by average pooling through a multilayer perceptron, superimposes the texture energy term extracted by high-pass filtering, and generates attention weights for dynamically focusing on high-frequency detail regions through a sigmoid activation function. The specific calculation formula is as follows:
[0182] ;
[0183] in, The feature map represents the preset attention weight function; The output feature map can be taken as the value of the convolutional layer's output; in one embodiment, the output feature map can refer to Figure 10 As shown.
[0184] This represents the Sigmoid activation function, which outputs weights in the range [0, 1], ensuring the interpretability and non-linearity of the weights.
[0185] This represents a multilayer perceptron, used to compress feature dimensions and reduce computational cost.
[0186] This indicates an average pooling operation, extracting... The global average features (also known as global average information) reduce the spatial dimension;
[0187] This represents the texture energy term (also known as local texture energy information), characterizing local texture saliency. High-frequency details are enhanced through high-pass filtering, and the calculation method is as follows: ;
[0188] in, for The number of channels;
[0189] For the first Feature maps of each channel;
[0190] It is a high-pass filter core used to extract high-frequency details;
[0191] This indicates an absolute value operation, ensuring that the energy value is positive.
[0192] Once the preset attention weight function is known, it can be used to... The value is the output feature map of the convolutional layer, and the calculation method is expressed as follows: ,Will Substituting the values into the preset attention weight function yields the attention weight map. The attention weight map is... .in, This represents the standard convolution operation. This is the output feature map obtained after standard convolution operation. Initialize the weights for the convolutional layer. For the first An intermediate image after preprocessing an initial image.
[0193] Subsequently, the output feature map and the attention weight map can be multiplied element-wise to obtain an attention-weighted feature map. Specifically, when calculating the attention-weighted feature map, the output feature map obtained from the standard convolution operation is multiplied element-wise with the attention weight map to generate an attention-weighted feature map that dynamically suppresses background noise and enhances the main area of the cultural relic. This map is then output to subsequent network layers. The specific calculation formula is as follows:
[0194] ;
[0195] in, Representing the attention-weighted feature map, such as the first... The attention-weighted feature map of the initial image is used to suppress irrelevant backgrounds and enhance the main body area of the cultural relics through dynamic weights, thus solving the problem of inter-class similarity.
[0196] This represents the standard convolution operation;
[0197] Initialize the weights for the convolutional layer;
[0198] This indicates a preset attention weight function used to generate dynamic weights;
[0199] This represents element-wise multiplication, applying attention weights to the feature map;
[0200] For image indexing;
[0201] For the first An intermediate image after preprocessing an initial image.
[0202] In this embodiment, an adaptive texture attention mechanism is used to accurately focus on high-frequency areas, enhance texture differences, and solve the problem of blurred boundaries between classes.
[0203] Based on any of the above embodiments, the total discriminative loss function of the object recognition model is:
[0204] ;
[0205] in, The total discriminative loss function for the object recognition model. For cross-entropy loss, Loss at the center For adaptive marginal loss, The center loss weighting coefficient, This is the marginal loss weighting coefficient.
[0206] In practical implementation, given the high similarity between cultural relic categories, conventional cross-entropy loss only focuses on the matching degree between the predicted probability and the true label, ignoring the distribution characteristics of the feature space. This leads to scattered intra-class features and blurred inter-class boundaries, making misclassification prone to occur between highly similar categories. Traditional methods lack explicit constraints on the compactness and discriminativeness of the feature space, and cannot effectively address the challenge of inter-class similarity.
[0207] This application employs a total discriminative loss function that incorporates three constraints. First, the basic cross-entropy loss is calculated to ensure that the model prediction matches the true label. Then, the center loss is calculated to measure the distance between a sample feature and its class center, forcing features of similar samples to aggregate within the embedding space. Finally, the adaptive marginal loss is calculated, dynamically adjusting the inter-class margin threshold based on sample gradient information to forcibly increase the distance between feature centers of similar categories. The center loss and adaptive marginal loss are weighted and added to the cross-entropy loss to form the total discriminative loss function, jointly constraining the compactness and discriminativeness of the feature space. The specific steps are as follows:
[0208] 1) Calculate the cross-entropy loss
[0209] Based on the difference between the model's predicted probability distribution and the true labels, the basic cross-entropy loss value that guarantees correct classification is calculated and expressed as:
[0210] ;
[0211] in, This represents the cross-entropy loss value, which serves as a fundamental component of the total loss, ensuring that the model correctly matches the labels.
[0212] This represents the total number of cultural relic categories, reflecting the complexity of the classification task.
[0213] For the first The sample at the th The true label on the class, when the sample belongs to the class. The value is 1 when the time is right, and 0 otherwise.
[0214] The model predicts the first The sample belongs to the first The probability of a class, representing the classification confidence, is calculated by the Softmax function of the classification layer.
[0215] 2) Calculate the central loss
[0216] The distance between the attention-weighted feature map and its class center is measured. Similar samples are filtered using an indicator function, forcing similar features to aggregate in the embedding space, as shown below:
[0217] ;
[0218] in, The center loss value is used to constrain the features of similar samples to be close to the class center;
[0219] For the first The attention-weighted feature map of each sample represents the texture-enhanced feature representation; in one embodiment, the texture-enhanced feature heatmap can be referenced. Figure 11 .
[0220] For the first The feature centers of the class are initialized to the mean of the features of the samples within the class and are dynamically updated during training.
[0221] As an indicator function, when the sample Category Output 1 if the condition is met, otherwise output 0.
[0222] For the first The true category label of each sample;
[0223] For category indexing.
[0224] 3) Calculate adaptive marginal loss
[0225] An adaptive adjustment factor is generated based on the Frobenius norm of the image gradient, dynamically adjusting the threshold of the inter-class feature center distance. The hinge function is used to forcibly expand the feature interval of similar classes, as follows:
[0226] ;
[0227] in, This represents an adaptive marginal loss value that forcibly expands the feature distance between similar categories;
[0228] As the baseline marginal constant, such as, =1.0, setting the minimum inter-class distance;
[0229] For category Feature center;
[0230] Characterizes the distance between feature centers of different classes;
[0231] This is an adaptive adjustment factor; a larger value indicates that the sample needs a larger inter-class margin. The calculation method is expressed as follows: ;
[0232] Using the Frobenius norm, calculate the overall gradient strength of the image;
[0233] The hinge function returns the loss to zero when the inter-class distance is greater than the adjusted threshold.
[0234] 4) Calculate the total discriminative loss
[0235] The cross-entropy loss, weighted center loss, and weighted adaptive marginal loss are summed to generate the overall discriminative loss function that coordinates classification accuracy and feature distribution optimization, expressed as:
[0236] ;
[0237] In the formula, This is the total discriminative loss function, which is output to the optimizer for parameter updates;
[0238] For center loss weighting coefficients, such as, =0.01, controlling the intra-class aggregation intensity;
[0239] For example, the marginal loss weighting coefficient. =0.005, controlling the inter-class separation strength.
[0240] In this embodiment, the discriminative and aggregate properties of the feature space are enhanced and the feature space structure is optimized by integrating the total discriminative loss function, which combines cross-entropy, center loss, and adaptive marginal loss.
[0241] Based on any of the above embodiments, in one implementation, after obtaining the object type identification result of the target object, the object information corresponding to the object type identification result can also be matched using the knowledge graph corresponding to the target object.
[0242] Specifically, the object type identification results are input into the large model knowledge engine in a structured data format. The object type identification results may include three core attributes: cultural relic category, age, and material, as well as feature vector fingerprints.
[0243] The large model first retrieves the internally constructed knowledge graph of cultural relics and matches authoritative object information such as the historical background, craftsmanship characteristics and cultural value of the cultural relic.
[0244] Based on any of the above embodiments, in one implementation, after obtaining the object type identification result of the target object, similar objects of the target object can also be located.
[0245] Specifically, by combining the texture fingerprints in the feature vectors of intermediate images, similar museum artifacts can be located, and analogies can be drawn to explain these similar artifacts. Subsequently, multimodal popular science content can be generated: the text side adopts a "core facts + storytelling" structure, focusing on explaining the symbolic meaning and production process of the decorative symbols.
[0246] Based on any of the above embodiments, in one implementation, after obtaining the object type identification result of the target object, a three-dimensional model of the object type identification result can also be generated.
[0247] Specifically, the visual interface calls the 3D reconstruction module to generate a 3D model of the cultural relic, followed by a dynamic demonstration of the relic's cross-section. Key texture areas enhanced in the preprocessing stage are then used for focused interpretation. After verification by a knowledge base of cultural relic experts, the output content provides in-depth Q&A and virtual restoration experiences through an interactive interface.
[0248] In this embodiment, the cultural relic identification results are integrated with a knowledge graph to support human-computer interaction applications such as 3D display, storytelling, and virtual restoration, thereby expanding the technological value, meeting the public's deeper needs for popular science and cultural heritage education, and enhancing the cultural dissemination capabilities of cultural relics.
[0249] In summary, this application proposes a comprehensive technical solution that integrates image enhancement, recognition modeling, and semantic linkage to address the practical problems of complex acquisition environments, delicate texture features, and minimal differences between categories in cultural relic images. The solution aims to improve image quality through multi-scale Retinex illumination compensation and adaptive directional Gabor texture enhancement, construct a deep neural network based on texture statistical characteristics to enhance the model's sensitivity to detailed features, optimize the feature space structure by introducing a total discriminative loss function, and output the recognition results in a structured manner and connect them to a cultural relic knowledge graph. This achieves a closed-loop processing of cultural relic images from high-precision classification to cultural semantic popularization, comprehensively improving the system's recognition accuracy, robustness, and ability to convey cultural value.
[0250] Based on the embodiments of the object recognition method described above, another embodiment of this application provides an object recognition device, referring to... Figure 12 ,include:
[0251] Image acquisition module 11 is used to acquire the initial image of the target object;
[0252] The fusion module 12 is used to linearly superimpose and fuse the illumination compensation result and texture enhancement result of the initial image to obtain an intermediate image;
[0253] Processing module 13 is used to perform convolution operation on the intermediate image to obtain the output feature map, and to obtain the attention weight map using the preset attention weight function and the output feature map;
[0254] The recognition module 14 is used to multiply the output feature map and the attention weight map element by element to obtain the attention weighted feature map, and to perform a classification operation on the attention weighted feature map to obtain the object type recognition result of the target object.
[0255] It should be noted that the working process of each module and sub-module in this embodiment is described in the corresponding descriptions in the above embodiments, and will not be repeated here.
[0256] This application also provides an electronic device, including at least one processor and a memory connected to the processor, wherein:
[0257] Memory is used to store computer programs;
[0258] The processor is used to execute computer programs so that the electronic device can implement the object recognition method described above.
[0259] This application also provides a computer program product including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the object recognition methods provided in this application.
[0260] This application also provides a computer-readable storage medium that carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the object recognition methods provided in this application.
Claims
1. A method of object recognition, characterized by, The method comprises the following steps: obtaining an initial image of a target object; performing linear superposition fusion on the illumination compensation result and the texture enhancement result of the initial image to obtain an intermediate image; performing convolution operation on the intermediate image to obtain an output feature map, and using a preset attention weight function and the output feature map to obtain an attention weight map; performing element-by-element multiplication on the output feature map and the attention weight map to obtain an attention weighted feature map, and performing classification operation on the attention weighted feature map to obtain an object category recognition result of the target object.
2. The object recognition method of claim 1, wherein, The method comprises the following steps: performing illumination component decomposition on the initial image, and obtaining an illumination compensation result by fusing illumination correction results at different scales through dynamic weight; calculating an adaptive weight based on a weight decay coefficient and the difference between the gradient matrix of the initial image and the gradient clustering center at each scale; performing filtering operation on the initial image using the adaptive direction angle to obtain a texture enhancement result; performing linear superposition fusion on the illumination compensation result and the texture enhancement result using the adaptive weight to obtain an intermediate image.
3. The object recognition method of claim 1, wherein, The object recognition model comprises a feature extraction backbone network, an adaptive attention module and a classification output layer. The feature extraction backbone network comprises a plurality of convolution-pooling cascade units; the feature extraction backbone network is configured to perform convolution operation on the intermediate image using the plurality of convolution-pooling cascade units to obtain an output feature map; The adaptive attention module is embedded after a specified convolution-pooling cascade unit, and is configured to obtain an attention weight map using a preset attention weight function and the output feature map, perform element-by-element multiplication on the output feature map and the attention weight map to obtain an attention weighted feature map, and perform classification operation on the attention weighted feature map to obtain an object category recognition result of the target object. The classification output layer comprises a multi-level fully connected network, and is configured to perform classification operation on the attention weighted feature map through dimension reduction and object classification operation to obtain the object category recognition result of the target object.
4. The object recognition method of claim 3, wherein, The convolution layer in the convolution-pooling cascade unit is configured with an initial weight, and the determination process of the initial weight comprises the following steps: taking the average value of the gradient matrix of an enhanced sample as a reference weight component, wherein the enhanced sample is obtained by performing linear superposition fusion on the illumination compensation result and the texture enhancement result of an image sample; calculating a texture weighting factor of the image sample using the difference between the texture enhancement result of the image sample and the texture cluster center to which the texture enhancement result belongs; performing correction operation on the texture enhancement result of the image sample using the texture weighting factor of the image sample to obtain a texture correction increment; adding the reference weight component and the texture correction increment to obtain the initial weight of the convolution layer in the convolution-pooling cascade unit.
5. The object recognition method of claim 3, wherein, The parameters in the object recognition model need to be updated in the training process, and the parameter updating process comprises the following steps: calculating a historical cumulative value of the variance of the attention weighted feature map of the enhanced sample, and obtaining a variance cumulative term for adaptive scaling of the learning rate based on a historical variance decay factor and the historical cumulative value; An adaptive scaling factor is constructed using the variance cumulative term and a smoothing constant; A parameter update operation is performed after scaling the convolution layer weight gradient using the adaptive scaling factor, to obtain updated parameters of the object recognition model.
6. The object recognition method of claim 1, wherein, An attention weight map is obtained using a preset attention weight function and the output feature map, including: The preset attention weight function is calculated using global average information and local texture energy information; The output feature map is processed using the preset attention weight function to obtain an attention weight map.
7. The object recognition method of claim 1, wherein, After obtaining the object category recognition result of the target object, further including: The object information corresponding to the object category recognition result is matched out using the knowledge graph corresponding to the target object; And / or, positioning similar objects of the target object; And / or, generating a three-dimensional model of the object category recognition result.
8. An object recognition apparatus characterized by comprising: Including: An image acquisition module is configured to acquire an initial image of a target object; A fusion module is configured to perform linear superposition fusion on illumination compensation results and texture enhancement results of the initial image to obtain an intermediate image; A processing module is configured to perform convolution operation on the intermediate image to obtain an output feature map, and obtain an attention weight map using a preset attention weight function and the output feature map; An identification module is configured to multiply the output feature map and the attention weight map element by element to obtain an attention weighted feature map, and perform classification operation on the attention weighted feature map to obtain an object category recognition result of the target object.
9. An electronic device, comprising: An electronic device includes at least one processor and a memory connected to the processor, wherein: The memory is configured to store a computer program; The processor is configured to execute the computer program to enable the electronic device to implement the object recognition method according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that, The storage medium carries one or more computer programs, which, when executed by an electronic device, enable the electronic device to implement the object recognition method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Picture recognition method and system
CN108171260A
Bone focus identification auxiliary method for orthopaedic imaging diagnosis
CN118485852A
Highway scene reconstruction method based on low-light image enhancement
CN119006657A
Robot alarm processing method and system based on target detection algorithm and cloud platform
CN119418174A
Method for reducing multi-modal characteristic quantity of large model based on multi-level coding
CN119559477A