A method for ancient character image recognition and semantic analysis
Through the combination of adaptive filtering, stroke feature correction and deep convolutional network, the problem of material and deformation interference in ancient character image recognition was solved, high-precision character segmentation and semantic analysis were achieved, and the intelligent level of ancient character research was improved.
Patent Information
- Application Number
- CN202510550749.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-04-29
AI Technical Summary
When processing ancient text images, existing technologies have difficulty adapting to irregular surfaces and material diversity, resulting in insufficient recognition accuracy and semantic analysis reliability, especially in inclination recognition.
Adaptive filtering is used to eliminate noise and light interference, the main inclination angle is calculated based on stroke features for inclination correction, the region growing algorithm is used to separate characters, and a deep convolutional network is used for recognition. Semantic analysis is performed in combination with the ancient character corpus, and the inclination correction parameters are iteratively optimized to improve recognition accuracy.
It effectively handles irregular deformation and material diversity in ancient character images, improves recognition accuracy and the reliability of semantic analysis, ensures that image correction provides standardized input for subsequent processing, and promotes the intelligent process of ancient character research.
Smart Images

Figure CN120472471B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of ancient character semantic analysis, and in particular relates to an ancient character image recognition and semantic analysis method. Background Art
[0002] As a crucial vehicle for the inheritance of human civilization, the study of ancient characters not only carries a profound legacy of history and culture but also provides irreplaceable source material for fields like linguistics and archaeology. With the rise of digital technology, ancient character image recognition and semantic parsing have become a hot topic in interdisciplinary research. The key lies in unlocking the meaning behind ancient characters and reconstructing historical information through technological means. However, current methods often struggle with complex scenarios, with recognition accuracy and semantic parsing reliability failing to meet academic and application requirements. This directly limits the depth and breadth of ancient character research.
[0003] Existing solutions often rely on traditional image processing techniques or general machine learning models. While these methods perform adequately for standardized modern text, they exhibit significant shortcomings when it comes to ancient Chinese character recognition. This is particularly true for text inscribed on irregular surfaces, such as oracle bones and bronze artifacts. Existing technologies struggle to adapt to the diverse materials and deformations, leading to significant discrepancies in recognition results. Furthermore, semantic parsing is also limited due to a lack of in-depth optimization tailored to the specific characteristics of ancient Chinese characters.
[0004] In this field, the core challenges focus on the accuracy and adaptability of image recognition, among which inclination recognition has become a particularly prominent technical bottleneck. Because ancient text images often exhibit irregular inclinations due to the preservation status of cultural relics or writing habits, traditional direction correction methods have difficulty accurately capturing the main trends of text strokes, which in turn affects subsequent character segmentation and semantic extraction. More specifically, the unresolved problem of inclination correction leads to poor image preprocessing effects, which directly causes the recognition system to misjudge the stroke features. This misjudgment is particularly significant in text with irregular surfaces, becoming a constraint on technological breakthroughs.
[0005] Therefore, how to develop a technology in ancient character image recognition that can adapt to the complex conditions on the surface of cultural relics, accurately calculate the inclination of characters and realize image correction has become a key issue in improving the overall recognition accuracy and semantic analysis reliability. Summary of the Invention
[0006] In response to the shortcomings of the existing technology, the present invention provides a method for ancient character image recognition and semantic analysis. This method not only overcomes the interference of material and deformation, but also ensures that the corrected image can provide standardized input for subsequent processing, greatly promoting the intelligent process of ancient character research.
[0007] In order to achieve the above object, the technical solution of the present invention is: a method for ancient character image recognition and semantic analysis, the method comprising the following steps:
[0008] Scan the surface of the cultural relic using scanning equipment, extract the original image of the ancient characters containing irregular deformation and material diversity from the surface of the cultural relic, and process the original image of the ancient characters to determine the initial data baseline;
[0009] Performing image preprocessing on the original image of ancient characters to eliminate noise and light interference, and obtaining a first processed image by calculating the local pixel gradient;
[0010] Extracting stroke features from the first processed image, calculating the main inclination angle based on the distribution range of the stroke features, and detecting the angle of the stroke lines to determine the text inclination measurement value;
[0011] Performing tilt correction based on the text tilt measurement value, applying affine transformation to adjust the angle of the first processed image, and repairing the deformed area through an interpolation algorithm to obtain a second processed image;
[0012] Performing character segmentation on the second processed image, separating independent characters using a region growing algorithm based on stroke features, and obtaining a segmented character set through bounding box detection;
[0013] Extract feature vectors from the segmented character set, analyze stroke features and structural information based on a deep convolutional network, and obtain character recognition results through pre-trained model mapping;
[0014] Generate semantic analysis through character recognition results, combine with ancient character corpus to match context information, and use conditional random field algorithm to optimize sequence annotation to obtain the final semantic output;
[0015] If the final semantic output does not match the preset threshold, the tilt correction parameters are retroactively adjusted to improve the quality of the second processed image by iteratively optimizing the directional trend calculation;
[0016] Obtain the optimized second processed image and re-perform character segmentation and semantic analysis, and determine whether the overall recognition accuracy reaches the standard threshold by comparing the results before and after.
[0017] Preferably, the method of scanning the surface of the cultural relic using a scanning device, extracting the original image of the ancient characters containing irregular deformation and material diversity characteristics from the surface of the cultural relic, and processing the original image of the ancient characters to determine the initial data baseline includes:
[0018] The surface image of the cultural relic is collected by scanning equipment to obtain the original image of the ancient characters;
[0019] Processing the original image of the ancient characters to remove image noise and obtain a denoised image;
[0020] Extracting the ancient character image contour from the denoised image to obtain a contour image;
[0021] Extracting edge information from irregular deformation features in the contour image to obtain an edge image;
[0022] Determine the deformation distribution area according to the edge image to obtain a deformation area image;
[0023] Analyzing material diversity from the deformed region image and calculating texture features using a gray-level co-occurrence matrix to obtain texture classification data;
[0024] After acquiring the texture classification data, applying a convolutional neural network to recognize the ancient character image to obtain a recognition result, determining the character boundary based on the recognition result to obtain a character boundary image, and processing the character boundary image using an image registration method to obtain a corrected image;
[0025] After obtaining the corrected image, a complete ancient character data set is generated, and the complete ancient character data set is divided using an image segmentation method to obtain a segmented image;
[0026] For the segmented image, a labeling method is used to determine data consistency to obtain a consistency determination result. If the consistency determination result meets a preset threshold, it is determined that the complete ancient character data set is valid.
[0027] extracting target ancient character features from the complete ancient character data set to obtain feature data;
[0028] Based on the feature data, determining the material distribution of the ancient character image to obtain a material distribution result;
[0029] Adjust the recognition parameters according to the material distribution result to obtain an optimized recognition result;
[0030] After obtaining the optimized recognition result, the final boundary of the ancient character image is determined to obtain a final boundary image.
[0031] Preferably, the image preprocessing is performed on the original image of the ancient characters to eliminate noise and light interference, and the first processed image is obtained by calculating the local pixel gradient, including:
[0032] Adaptive filtering algorithm is used to denoise the original image of ancient characters. The weighted average value of local pixels is calculated through a 3×3 convolution kernel to obtain the denoised image.
[0033] Based on the denoised image, the Sobel operator is used to calculate the gradient components in the x-direction and y-direction, and the gradient magnitude and direction are combined to generate a gradient image;
[0034] For gradient images, if the difference in the gradient direction of adjacent pixels is greater than 30 degrees, it is determined to be a direction mutation area and the original value is retained without smoothing;
[0035] The Canny operator is used to detect the edge of the gradient image. Through double threshold judgment and hysteresis threshold processing, significant edge features are extracted to obtain the feature image.
[0036] According to the difference in pixel grayscale values in the feature image and the 8-neighborhood connectivity judgment, continuous edge points are marked as boundaries to generate a boundary image;
[0037] For the boundary image, a 3×3 square structure element is used to perform a closing operation, first dilating and then corroding to fill the holes to obtain an optimized image;
[0038] The effective edge pixel ratio of the optimized image is counted. When the ratio exceeds 60%, it is determined to be a valid processing result and the final image is output.
[0039] Preferably, extracting stroke features from the first processed image, calculating the main inclination angle based on the distribution range of the stroke features, detecting the line angle, and determining the text inclination measurement value includes:
[0040] Obtaining stroke features through the first processed image, extracting stroke feature distribution using a convolution operation, and obtaining preliminary stroke distribution data;
[0041] Extract the stroke distribution pattern from the preliminary stroke distribution data, and use Hough transform to detect the stroke line angle and determine the distribution range of the stroke features;
[0042] According to the distribution range of stroke features, the main inclination angle is calculated using the angle histogram to obtain the main inclination angle value;
[0043] According to the main tilt angle value, the preset threshold is used to judge the tilt direction of the text and determine the tilt trend;
[0044] Through the tilt trend, the metric value is calculated using the angle difference to obtain the quantitative tilt result;
[0045] Using the quantified tilt results, a preset threshold is used to determine the overall tilt state and determine the text tilt metric value;
[0046] From the text tilt measurement value, the adjustment parameters are extracted using the angle adjustment function to obtain the basis for text correction.
[0047] Preferably, performing tilt correction according to the text tilt measurement value, applying affine transformation to adjust the angle of the first processed image, and repairing the deformed area by an interpolation algorithm to obtain the second processed image includes:
[0048] The character tilt measurement value is obtained by analyzing the stroke features, and the tilt correction requirement is determined using a preset threshold to obtain the correction parameters;
[0049] Performing tilt correction according to the correction parameters, adjusting the angle of the first processed image using affine transformation to obtain a preliminary adjusted image;
[0050] Extract the deformed area from the preliminary adjusted image, repair the deformed area using a bilinear interpolation algorithm to obtain a repaired image;
[0051] The image angle is detected for the restored image. If the angle deviation exceeds the preset threshold, the affine transformation adjustment is repeated to obtain the angle-corrected image.
[0052] Obtain edge features of the angle-corrected image, determine the restoration integrity of the deformed area by comparing it with the first processed image, and obtain an integrity assessment result;
[0053] The interpolation algorithm parameters are adjusted according to the integrity assessment results, and a second processed image is generated by optimizing the repaired area.
[0054] Preferably, the character segmentation is performed on the second processed image, the independent characters are separated by using a region growing algorithm based on stroke features, and the segmented character set is obtained by bounding box detection, including:
[0055] Extracting stroke features from the second processed image using a preset threshold to obtain an initial feature set;
[0056] According to the gradient amplitude ranking of the pixels in the initial feature set, the first 10% are selected as seed points of the region growing algorithm, and the region growing algorithm is used to expand the seed points to generate independent character regions;
[0057] The region growing algorithm is used to expand the seed points, and the growth is stopped when the grayscale difference between adjacent pixels is less than 15 or the iterations exceed 100 times.
[0058] Use the Canny operator to calculate the edge gradient amplitude of the independent character area. If the average gradient amplitude exceeds 50, it is determined to be a clear-boundary area. The minimum bounding rectangle detection is performed on the clear-boundary area to obtain a preliminary character set.
[0059] Calculate the IoU value of the rectangular boxes in the preliminary character set. If the IoU is greater than 0.3, it is considered overlapping. Segment the overlapping area through vertical projection to obtain the optimized character set.
[0060] Extract the centroid coordinates, width and height of each character from the optimized character set to form a spatial distribution feature matrix;
[0061] The DBSCAN clustering algorithm is used to process the feature matrix, with the neighborhood radius set to 1.5 times the average character width and the minimum number of samples set to 2 to obtain the final segmentation set;
[0062] The characters in the final segmentation set are analyzed for connected domains. If there are multiple disconnected regions, they are considered broken characters. Morphological closing operations are used to repair them and output independent character sequences.
[0063] Preferably, extracting feature vectors from the segmented character set, analyzing stroke features and structural information based on a deep convolutional network, and obtaining character recognition results through pre-trained model mapping include:
[0064] Separate independent character regions from the binary image through connected component analysis to obtain the initial character image, perform convolution on the initial character image, and extract a 64-dimensional feature vector containing the stroke direction;
[0065] Input the 64-dimensional feature vector into the pre-trained character embedding model CharBERT, and output a 256-dimensional character semantic vector;
[0066] Perform principal component analysis on the character semantic vector. When the variance contribution rate of the first principal component exceeds 85%, it is determined to be a valid feature.
[0067] Use bilinear interpolation to adjust the convolution kernel parameters and regenerate the 128-dimensional optimized feature vector;
[0068] Calculate the edge gradient amplitude of the 128-dimensional optimized feature vector in the HSV color space. When the maximum gradient value exceeds the preset threshold of 120, it is determined to be a character vector with clear boundaries.
[0069] Input the character vector with clear boundaries into the character embedding model CharBERT, output the top three candidate character codes, calculate the stroke difference of the candidate character codes based on the Unicode standard font library, and determine the recognition as valid when the minimum difference is less than 5%;
[0070] Adjust the morphological kernel size for connected domain segmentation based on the stroke difference results, and re-execute the feature extraction process until the error rate is less than 5%;
[0071] Perform bidirectional longest match on the final recognition result and merge adjacent character codes to generate a complete text sequence.
[0072] Preferably, the method of generating semantic analysis through character recognition results, combining ancient character corpus with matching context information, and using conditional random field algorithm to optimize sequence annotation to obtain final semantic output includes:
[0073] The input image is binarized and denoised using TesseractOCR to obtain initial text data. Low-confidence characters are filtered according to a preset character error rate threshold to obtain preliminary text information.
[0074] Extracting glyph structural features from preliminary text information, calculating edit distance with ancient Chinese character corpus, matching character sequences with an error rate of less than 5 percent, and determining the serialized text content;
[0075] For the serialized text content, the conditional random field algorithm is used to annotate the character position, number of strokes, and adjacent character categories to obtain the annotated sequence data;
[0076] According to the character category labels in the annotation sequence, the adjacent label transition probability is analyzed to generate preliminary semantic parsing results;
[0077] Adjust character annotations based on preset disambiguation rules, including prioritizing high-frequency characters and contextual coherence constraints, to obtain optimized semantic information.
[0078] The optimized semantics are weightedly matched with the frequency of occurrence of characters in the ancient character library, and the final semantic result is output. If the weighted matching score of the final semantic result is lower than 70%, the feature weights in the conditional random field are recalculated to generate a revised output.
[0079] Preferably, if the final semantic output does not match a preset threshold, then retroactively adjusting the tilt correction parameters and improving the quality of the second processed image by iteratively optimizing the direction trend calculation include:
[0080] Extract SIFT feature points from the input image to generate a semantic description vector. Compare the vector norm with a preset threshold. When the norm is lower than the threshold, use the LM algorithm to optimize the initial tilt parameter matrix and update the parameters to the spatial transformation module.
[0081] Perform Gaussian pyramid layered calculation on the corrected intermediate data, and calculate the Harris corner motion vector field on each pyramid layer;
[0082] Adjust the optical flow calculation weight coefficient according to the direction of the principal component of the vector field to generate a dedistorted second image;
[0083] Extract PSNR and SSIM indicators from the dedistorted second image. When PSNR is lower than 30dB, return to the tilt parameter optimization step.
[0084] The process is terminated when the cosine similarity between the output image and the semantic description vector reaches more than 90% through SI FT feature matching verification.
[0085] Preferably, the step of obtaining the optimized second processed image and re-performing character segmentation and semantic analysis, and comparing the results before and after to determine whether the overall recognition accuracy reaches a standard threshold, includes:
[0086] Obtaining a second processed image and generating an optimized image through preprocessing;
[0087] A segmentation algorithm is used to perform character segmentation on the optimized image to obtain a character sequence;
[0088] The BERT model is used to extract semantic information from the character sequence, and the obtained semantic information is compared with the final semantic output to obtain the change in accuracy.
[0089] If the accuracy rate changes beyond a preset threshold, character segmentation is re-executed by adjusting the segmentation parameters; semantic information is extracted again based on the adjusted character sequence to obtain an updated result;
[0090] By comparing the updated results with the final semantic output results, it is determined whether the accuracy reaches the preset threshold.
[0091] Technical effects and advantages of the present invention:
[0092] The present invention discloses a method for ancient character image recognition and semantic analysis, which first obtains an original image containing irregular deformation and material diversity features from the surface of a cultural relic, and eliminates noise and light interference through adaptive filtering; then calculates the main inclination angle based on the stroke feature distribution, performs inclination correction to obtain a processed image; then adopts a region growing algorithm based on stroke features to separate independent characters, and uses a deep convolutional network to extract feature vectors for recognition; finally, combines the ancient character corpus with matching context information, adopts a conditional random field algorithm to optimize sequence annotation to obtain semantic output; if the result is not ideal, adjusts the inclination correction parameters by backtracking and iteratively optimizes to improve the overall recognition accuracy; and the present application can effectively deal with the problems of irregular deformation and material diversity in ancient character images, and improve recognition accuracy and semantic analysis reliability. BRIEF DESCRIPTION OF THE DRAWINGS
[0093] Figure 1 It is a flow chart of the ancient character image recognition and semantic analysis method of the present invention. DETAILED DESCRIPTION
[0094] The present invention will be further described in detail below with reference to the embodiments given in the accompanying drawings.
[0095] See also Figure 1 As shown, the present application discloses a method for ancient character image recognition and semantic analysis, which includes the following steps:
[0096] S101. Scan the surface of the cultural relic using a scanning device, extract the original image of the ancient characters containing irregular deformation and material diversity characteristics from the surface of the cultural relic, and process the original image of the ancient characters to determine the initial data baseline, including:
[0097] The surface image of the cultural relic is collected by scanning equipment to obtain the original image of the ancient characters;
[0098] Processing the original image of the ancient characters to remove image noise and obtain a denoised image;
[0099] Extracting the ancient character image contour from the denoised image to obtain a contour image;
[0100] Extracting edge information from irregular deformation features in the contour image to obtain an edge image;
[0101] Determine the deformation distribution area according to the edge image to obtain a deformation area image;
[0102] Analyzing material diversity from the deformed region image and calculating texture features using a gray-level co-occurrence matrix to obtain texture classification data;
[0103] After acquiring the texture classification data, applying a convolutional neural network (CNN) to recognize the ancient character image to obtain a recognition result, determining the character boundary based on the recognition result to obtain a character boundary image, and processing the character boundary image using an image registration method to obtain a corrected image;
[0104] After obtaining the corrected image, a complete ancient character data set is generated, and the complete ancient character data set is divided using an image segmentation method to obtain a segmented image;
[0105] For the segmented image, a labeling method is used to determine data consistency to obtain a consistency determination result. If the consistency determination result meets a preset threshold, it is determined that the complete ancient character data set is valid.
[0106] extracting target ancient character features from the complete ancient character data set to obtain feature data;
[0107] Based on the feature data, determining the material distribution of the ancient character image to obtain a material distribution result;
[0108] Adjust the recognition parameters according to the material distribution result to obtain an optimized recognition result;
[0109] After obtaining the optimized recognition result, the final boundary of the ancient character image is determined to obtain a final boundary image.
[0110] For example, in the process of obtaining ancient text image data, the surface of the cultural relic is first digitally collected using high-precision scanning equipment, such as using a scanner with a resolution of 1200dpi, to ensure that each pixel can clearly capture the subtle texture and deformation characteristics of the surface of the cultural relic.
[0111] For example, a 3D laser scanner was used to scan the surface of a bronze artifact. The resulting image point cloud data was then reconstructed using a Poisson reconstruction algorithm to generate a high-precision 3D model with an accuracy of less than 0.1 mm. Subsequently, image processing techniques were used to pre-process the original images of the ancient characters, including denoising, contrast enhancement, and edge detection.
[0112] For example, we first use the Gaussian filter algorithm to remove image noise, with a filter kernel size of 3×3 and a standard deviation of 1.0, and then use the histogram equalization algorithm to enhance the image contrast and make the outline of the ancient characters clearer;
[0113] To address irregular deformation issues, a deformation correction algorithm based on thin plate spline interpolation is used to perform geometric correction on the text area in the image to ensure the accuracy of the text shape.
[0114] For the diversity characteristics of materials, multispectral imaging technology is used to obtain image data in different bands, and the principal component analysis algorithm is used to extract material characteristics. For example, images are collected in the visible light and near-infrared bands respectively, and the key feature vectors of the material are extracted after dimensionality reduction using the PCA algorithm.
[0115] Finally, the processed images are subjected to feature extraction and classification through a deep learning model. For example, a convolutional neural network (CNN) is used to recognize ancient characters. The network structure adopts ResNet-50. The training set contains 5,000 annotated images, and the accuracy of the test set reaches more than 95%, thereby determining the initial data baseline.
[0116] S102, performing image preprocessing on the original image of the ancient characters to eliminate noise and light interference, and obtaining a first processed image by calculating local pixel gradients, including:
[0117] Adaptive filtering algorithm is used to denoise the original image of ancient characters. The weighted average value of local pixels is calculated through a 3×3 convolution kernel to obtain the denoised image.
[0118] Based on the denoised image, the Sobel operator is used to calculate the gradient components in the x-direction and y-direction, and the gradient magnitude and direction are combined to generate a gradient image;
[0119] For gradient images, if the difference in the gradient direction of adjacent pixels is greater than 30 degrees, it is determined to be a direction mutation area and the original value is retained without smoothing;
[0120] The Canny operator is used to detect the edge of the gradient image. Through double threshold judgment and hysteresis threshold processing, significant edge features are extracted to obtain the feature image.
[0121] According to the difference in pixel grayscale values in the feature image and the 8-neighborhood connectivity judgment, continuous edge points are marked as boundaries to generate a boundary image;
[0122] For the boundary image, a 3×3 square structure element is used to perform a closing operation, first dilating and then corroding to fill the holes to obtain an optimized image;
[0123] The effective edge pixel ratio of the optimized image is counted. When the ratio exceeds 60%, it is determined to be a valid processing result and the final image is output.
[0124] For example, in the image preprocessing stage, an adaptive filtering algorithm is first used to eliminate noise and suppress light interference from the original image of ancient characters.
[0125] In the specific implementation, an adaptive median filter based on local statistical characteristics is used. This filter can dynamically adjust the filter window size according to the grayscale value of the pixel neighborhood, thereby effectively removing salt and pepper noise and Gaussian noise.
[0126] For example, for a 512×512 pixel image, the initial filtering window is set to 3×3. When noisy pixels are detected, the window is automatically expanded to 5×5, and then to a maximum window size of 7×7. In this way, the effect of noise can be significantly reduced while preserving image details.
[0127] Next, to address the problem of uneven illumination, an image enhancement algorithm based on Retinex theory is used to decompose the image through multi-scale Gaussian filtering, extract the illumination components and perform equalization processing.
[0128] For example, a convolution operation is performed on the image using Gaussian kernels with scale parameters of 15, 80, and 250 to obtain illumination components of different scales. The final illumination-balanced image is then obtained through weighted averaging. After eliminating noise and illumination interference, the first processed image is obtained by calculating the local pixel gradient.
[0129] Specifically, the Sobel operator is used to calculate the gradient, and the horizontal kernel [-1, 0, 1; -2, 0, 2; -1, 0, 1] and the vertical kernel [-1, -2, -1; 0, 0, 0; 1, 2, 1] are used to perform convolution operations on the image to obtain the horizontal gradient Gx and the vertical gradient Gy, and then the formula G = √(Gx 2 +Gy2) calculates the gradient magnitude of each pixel, and finally obtains a first processed image reflecting the edge information of the image.
[0130] S103, extracting stroke features from the first processed image, calculating the main inclination angle based on the distribution range of the stroke features, detecting the stroke line angle, and determining the text inclination measurement value, including:
[0131] Obtaining stroke features through the first processed image, extracting stroke feature distribution using a convolution operation, and obtaining preliminary stroke distribution data;
[0132] Extract the stroke distribution pattern from the preliminary stroke distribution data, and use Hough transform to detect the stroke line angle and determine the distribution range of the stroke features;
[0133] According to the distribution range of stroke features, the main inclination angle is calculated using the angle histogram to obtain the main inclination angle value;
[0134] According to the main tilt angle value, the preset threshold is used to judge the tilt direction of the text and determine the tilt trend;
[0135] Through the tilt trend, the metric value is calculated using the angle difference to obtain the quantitative tilt result;
[0136] Using the quantified tilt results, a preset threshold is used to determine the overall tilt state and determine the text tilt metric value;
[0137] From the text tilt measurement value, the adjustment parameters are extracted using the angle adjustment function to obtain the basis for text correction.
[0138] For example, in image processing, the input image is first converted into a black and white binary image by grayscale and binarization, for example, the threshold is automatically determined using the Otsu algorithm, and pixel values greater than 128 are set to 255, and pixel values less than 128 are set to 0;
[0139] Next, the main inclination angle is calculated based on the distribution of stroke features. The Sobel operator is used to extract image edges. The gradient direction of each pixel is calculated and a histogram of the gradient directions is compiled. The angle with the highest frequency is found as the main inclination angle. For example, within the range of 0 to 180 degrees, every 10 degrees is a interval. The number of gradient directions in each interval is counted. Assuming that the interval with the highest number of gradient directions is 30 to 40 degrees, the main inclination angle is 35 degrees.
[0140] Then, the line angle is detected through Hough transform, mapping the points in the image space to the parameter space. Each cell in the accumulator matrix represents a possible straight line. The line angle is determined by finding the peak in the accumulator matrix. For example, the angle corresponding to the peak in the accumulator matrix is 37 degrees, which is close to the main tilt angle of 35 degrees, further confirming the tilt angle of the text.
[0141] Finally, the text tilt measurement value is calculated based on the detected line angle. For example, 37 degrees is used as the tilt angle, and its deviation from the horizontal direction is calculated. Assuming that the horizontal direction is 0 degrees, the tilt measurement value is 37 degrees, which is used for subsequent image correction processing.
[0142] S104, performing tilt correction according to the text tilt measurement value, applying affine transformation to adjust the angle of the first processed image, and repairing the deformed area through an interpolation algorithm to obtain a second processed image, including:
[0143] The character tilt measurement value is obtained by analyzing the stroke features, and the tilt correction requirement is determined using a preset threshold to obtain the correction parameters;
[0144] Performing tilt correction according to the correction parameters, adjusting the angle of the first processed image using affine transformation to obtain a preliminary adjusted image;
[0145] Extract the deformed area from the preliminary adjusted image, repair the deformed area using a bilinear interpolation algorithm to obtain a repaired image;
[0146] The image angle is detected for the restored image. If the angle deviation exceeds the preset threshold, the affine transformation adjustment is repeated to obtain the angle-corrected image.
[0147] Obtain edge features of the angle-corrected image, determine the restoration integrity of the deformed area by comparing it with the first processed image, and obtain an integrity assessment result;
[0148] The interpolation algorithm parameters are adjusted according to the integrity assessment results, and a second processed image is generated by optimizing the repaired area.
[0149] For example, during the image processing, tilt correction is first performed based on the text tilt measurement value by calculating the tilt angle of the main lines in the image. For example, if it is detected that the horizontal line in the image is tilted by 5 degrees, a rotation matrix is used for correction, and the image is rotated by -5 degrees to restore the horizontal state.
[0150] Next, apply an affine transformation to adjust the angle of the first processed image. Suppose the image needs to be rotated 10 degrees to match the target angle. Use the affine transformation matrix to transform it, ensuring that the geometric shape of the image remains unchanged.
[0151] Then, the deformed area is repaired by an interpolation algorithm to obtain a second processed image.
[0152] For example, a bilinear interpolation algorithm is used to calculate the pixel values of the rotated image to ensure a smooth transition of the image edges and avoid jagged or blurry phenomena. Throughout the entire process, each step uses precise numerical calculations and algorithm applications to ensure the accuracy and quality of image processing, ultimately obtaining a second processed image that meets the requirements.
[0153] S105: performing character segmentation on the second processed image, separating independent characters using a region growing algorithm based on stroke features, and obtaining a segmented character set through bounding box detection, including:
[0154] Extract stroke features from the second processed image to obtain an initial feature set, sort the pixels in the initial feature set according to their gradient amplitudes, select the top 10% as seed points for a region growing algorithm, and use the region growing algorithm to expand the seed points to generate independent character regions;
[0155] In specific implementation, when the region growing algorithm is used to expand the seed point, the growth is stopped when the grayscale difference between adjacent pixels is less than 15 or the iterations exceed 100 times;
[0156] Use the Canny operator to calculate the edge gradient amplitude of the independent character area. If the average gradient exceeds 50, it is determined that the boundary is clear. The minimum bounding rectangle detection is used for the clear area to obtain the preliminary character set.
[0157] Calculate the IoU value of the rectangular boxes in the preliminary character set. If the IoU is greater than 0.3, it is considered overlapping. Segment the overlapping area through vertical projection to obtain the optimized character set.
[0158] The centroid coordinates, width, and height of each character are extracted from the optimized character set to form a spatial distribution feature matrix. The spatial distribution feature matrix is then processed using the DBSCAN clustering algorithm to obtain the final segmentation set. In the specific implementation, the neighborhood radius is set to 1.5 times the average width of the character, and the minimum number of samples is set to 2.
[0159] The characters in the final segmentation set are analyzed for connected domains. If there are multiple disconnected regions, they are considered broken characters. Morphological closing operations are used to repair them and output independent character sequences.
[0160] For example, when processing the second image, a stroke-based region growing algorithm is first used for character segmentation. This algorithm determines the character boundaries by analyzing the stroke features of each pixel in the image, such as stroke width, direction, and curvature. For example, the stroke width threshold is set to 3 pixels, the direction change angle threshold is set to 15 degrees, and the curvature change threshold is set to 0.1. With these parameters, the algorithm can accurately identify the outline of the character.
[0161] Next, we use bounding box detection technology to accurately locate the segmented characters. Bounding box detection uses a minimum bounding rectangle algorithm to calculate the minimum bounding rectangle of the character area to obtain the precise position and size of each character. For example, the minimum bounding rectangle of a character is detected to be 20 pixels wide and 30 pixels high, with the upper left corner coordinates at (50, 100).
[0162] Through this series of processing, a set of segmented characters is finally obtained. Each character contains its bounding box information and stroke features, providing basic data for subsequent character recognition and classification.
[0163] S106, extracting feature vectors from the segmented character set, analyzing stroke features and structural information based on a deep convolutional network, and obtaining character recognition results through pre-trained model mapping, including:
[0164] Separate independent character regions from the binary image through connected component analysis to obtain the initial character image, perform convolution on the initial character image, and extract a 64-dimensional feature vector containing the stroke direction;
[0165] Input the 64-dimensional feature vector into the pre-trained character embedding model CharBERT, and output a 256-dimensional character semantic vector;
[0166] Perform principal component analysis on the character semantic vector. When the variance contribution rate of the first principal component exceeds 85%, it is determined to be a valid feature.
[0167] Use bilinear interpolation to adjust the convolution kernel parameters and regenerate the 128-dimensional optimized feature vector;
[0168] Calculate the edge gradient amplitude of the 128-dimensional optimized feature vector in the HSV color space. When the maximum gradient value exceeds the preset threshold of 120, it is determined to be a character vector with clear boundaries.
[0169] Input the character vector with clear boundaries into the character embedding model CharBERT, output the top three candidate character codes, calculate the stroke difference of the candidate character codes based on the Unicode standard font library, and determine the recognition as valid when the minimum difference is less than 5%;
[0170] Adjust the morphological kernel size for connected domain segmentation based on the stroke difference results, and re-execute the feature extraction process until the error rate is less than 5%;
[0171] Perform bidirectional longest match on the final recognition result and merge adjacent character codes to generate a complete text sequence;
[0172] During specific implementation, a GB18030 encoding compliance check is performed before outputting the complete text sequence to ensure that there are no garbled characters.
[0173] For example, in the character recognition task, feature vectors are first extracted from the segmented character set, and a method based on a deep convolutional network is used to analyze the stroke features and structural information. For example, for a dataset containing 1,000 characters, a convolutional neural network (CNN) is used for feature extraction. The network structure includes three convolutional layers, each layer uses 32, 64, and 128 3x3 convolution kernels, with a stride of 1 and a ReLU activation function. The pooling layer uses a 2x2 maximum pooling with a stride of 2. In this way, a 128-dimensional feature vector can be extracted from each character image;
[0174] Next, we use a pre-trained model such as ResNet-50 for feature mapping, mapping the extracted 128-dimensional feature vector to a higher-dimensional feature space, such as 2048 dimensions. During the mapping process, we use transfer learning technology to freeze the first 49 layers of ResNet-50 and only train the last fully connected layer to adapt to the specific character recognition task.
[0175] Finally, the mapped feature vector is classified by the softmax classifier to obtain the character recognition result. For example, for a 10-category character classification task, the softmax layer outputs 10 probability values, and the category with the highest probability is selected as the final recognition result.
[0176] Throughout the process, the cross-entropy loss function was used for model training, the learning rate was set to 0.001, the Adam optimizer was used, 100 epochs were trained, and the batch size was 32. In this way, the stroke features and structural information can be effectively extracted from the character images, and high-precision character recognition can be achieved.
[0177] S107. Generate semantic analysis based on the character recognition results, combine with the ancient character corpus to match context information, and use the conditional random field algorithm to optimize sequence annotation to obtain the final semantic output, including:
[0178] The input image is binarized and denoised using TesseractOCR to obtain initial text data. Low-confidence characters are filtered according to a preset character error rate threshold to obtain preliminary text information.
[0179] Extracting glyph structural features from preliminary text information, calculating edit distance with ancient Chinese character corpus, matching character sequences with an error rate of less than 5 percent, and determining the serialized text content;
[0180] For the serialized text content, the conditional random field algorithm is used to annotate the character position, number of strokes, and adjacent character categories to obtain the annotated sequence data;
[0181] According to the character category labels in the annotation sequence, the adjacent label transition probability is analyzed to generate preliminary semantic parsing results;
[0182] Adjust character annotations based on preset disambiguation rules, including prioritizing high-frequency characters and contextual coherence constraints, to obtain optimized semantic information.
[0183] The optimized semantics are weightedly matched with the frequency of occurrence of characters in the ancient character library, and the final semantic result is output. If the weighted matching score of the final semantic result is lower than 70%, the feature weights in the conditional random field are recalculated to generate a revised output.
[0184] Exemplarily, in the character recognition stage, a convolutional neural network is used to extract features from the input ancient literature image, and the probability distribution of each character is recognized. For example, for an image containing the character '天', the probability of the model outputting '天' is 0.92, the probability of '夫' is 0.05, and the probabilities of other characters are all less than 0.01. Next, in combination with the ancient character corpus, context information is used for semantic parsing. Suppose in the corpus, the character '天' often appears in combination with the character '地', and the probability that the character '天' represents '天空' in a specific context is 0.85, and the probability of representing '天命' is 0.10. Based on this information, the conditional random field algorithm is used to optimize the annotation of the character sequence.
[0185] For example, for the sequence "天高地厚", the model calculates the transition probability and emission probability to determine that the probability that the character '天' represents '天空' at the current position is 0.90, and the probability of representing '天命' is 0.08. Finally, through maximum a posteriori probability estimation, the semantics of the character '天' is output as '天空', and the complete semantic parsing result "天空高远,大地深厚" is generated.
[0186] S108. If the final semantic output does not match the preset threshold, then backtrack and adjust the tilt correction parameter, and improve the quality of the second processed image through iterative optimization of the direction trend calculation, including:
[0187] Extract SIFT feature points from the input image to generate a semantic description vector, compare the vector norm with the preset threshold, and when the norm is lower than the threshold, use the LM algorithm to optimize the initial tilt parameter matrix and update the parameters to the spatial transformation module;
[0188] Perform Gaussian pyramid hierarchical calculation on the corrected intermediate data, and calculate the Harris corner motion vector field on each layer of the pyramid;
[0189] Adjust the optical flow calculation weight coefficient according to the principal component direction of the vector field to generate a second undistorted image;
[0190] Extract the PSNR and SSIM metrics from the second undistorted image, and return to the tilt parameter optimization link when the PSNR is lower than 30dB;
[0191] Terminate the process when the cosine similarity between the output image and the semantic description vector reaches more than 90% through SIFT feature matching verification.
[0192] Exemplarily, in the image processing process, if the final semantic output does not match the preset threshold, the system will automatically backtrack and adjust the tilt correction parameter.
[0193] For example, when the preset threshold is 0.85 and the actual output is 0.78, the system will improve the quality of the second processed image by iteratively optimizing the stroke feature calculation. Specifically, the system will use a gradient descent algorithm with the initial learning rate set to 0.01. By calculating the gradient of the loss function, the inclination correction parameters are gradually adjusted so that the output value gradually approaches the preset threshold. In each iteration, the system calculates the difference between the current output and the preset threshold, and dynamically adjusts the learning rate according to the size of the difference to ensure the stability and efficiency of the optimization process. After multiple iterations, when the output value reaches 0.9, the system will stop optimization and output the final inclination correction parameters.
[0194] In this way, the system can effectively improve the quality of the second processed image and ensure its consistency with the preset threshold.
[0195] S109: Obtain the optimized second processed image and re-perform character segmentation and semantic analysis, and determine whether the overall recognition accuracy reaches the standard threshold by comparing the results before and after, including:
[0196] Obtaining a second processed image and generating an optimized image through preprocessing;
[0197] A segmentation algorithm is used to perform character segmentation on the optimized image to obtain a character sequence;
[0198] The BERT model is used to extract semantic information from the character sequence, and the obtained semantic information is compared with the final semantic output to obtain the change in accuracy.
[0199] If the accuracy rate changes beyond a preset threshold, character segmentation is re-executed by adjusting the segmentation parameters; semantic information is extracted again based on the adjusted character sequence to obtain an updated result;
[0200] By comparing the updated results with the final semantic output results, it is determined whether the accuracy reaches the preset threshold.
[0201] For example, after obtaining the optimized second processed image, a deep learning-based character segmentation algorithm, such as a U-Net network, is first used to accurately segment the image. This network, through a combination of convolutional and deconvolutional layers, can effectively extract character regions in the image, achieving a segmentation accuracy of over 95%.
[0202] Next, a semantic parsing model, such as BERT, is used to perform semantic understanding on the segmented characters. The BERT model, through its multi-layer Transformer structure, can capture the contextual relationship between characters, and its parsing accuracy can reach 90%. In order to determine whether the overall recognition accuracy reaches the standard threshold, the character segmentation and semantic parsing results before and after optimization are compared. By calculating the accuracy, recall rate and F1 value at the character level, if the F1 value exceeds the preset threshold (such as 0.85), the overall recognition accuracy is considered to meet the standard.
[0203] For example, before optimization, the F1 value of character segmentation was 0.78, and the F1 value of semantic parsing was 0.82. After optimization, they increased to 0.92 and 0.89 respectively. The overall F1 value reached 0.90, exceeding the threshold, indicating that the optimization effect is significant.
[0204] The solution of the present invention revolves around the goals of image recognition accuracy and semantic analysis reliability. The original image is preprocessed to generate a first processed image, and the first processed image is used to generate a second processed image through tilt correction. The second processed image is used for character segmentation. The segmentation result drives feature extraction and recognition, and the recognition result supports semantic analysis. If the analysis is insufficient, the tilt correction is backtracked and optimized, and the adjusted image enters the segmentation and analysis process again. The logical chain runs from image preprocessing to semantic output, and each link is closely connected. It not only overcomes the interference of material and deformation, but also ensures that the corrected image can provide standardized input for subsequent processing, greatly improving the recognition accuracy and semantic analysis reliability, and greatly promoting the intelligent process of ancient character research.
[0205] The above description is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this field, several variations and improvements can be made without departing from the creative concept of the present invention, which all fall within the scope of protection of the present invention.
Claims
1. A method for ancient character image recognition and semantic analysis, characterized in that: The method comprises the following steps: Scan the surface of the cultural relic using scanning equipment, extract the original image of the ancient characters containing irregular deformation and material diversity from the surface of the cultural relic, and process the original image of the ancient characters to determine the initial data baseline; Performing image preprocessing on the original image of ancient characters to eliminate noise and light interference, and obtaining a first processed image by calculating the local pixel gradient; Extracting stroke features from the first processed image, calculating the main inclination angle based on the distribution range of the stroke features, and detecting the angle of the stroke lines to determine the text inclination measurement value; Performing tilt correction based on the text tilt measurement value, applying affine transformation to adjust the angle of the first processed image, and repairing the deformed area through an interpolation algorithm to obtain a second processed image; Performing character segmentation on the second processed image, separating independent characters using a region growing algorithm based on stroke features, and obtaining a segmented character set through bounding box detection; Extract feature vectors from the segmented character set, analyze stroke features and structural information based on a deep convolutional network, and obtain character recognition results through pre-trained model mapping; Generate semantic analysis through character recognition results, combine with ancient character corpus to match context information, and use conditional random field algorithm to optimize sequence annotation to obtain the final semantic output; If the final semantic output does not match the preset threshold, the tilt correction parameters are retroactively adjusted to improve the quality of the second processed image by iteratively optimizing the directional trend calculation; Obtain the optimized second processed image and re-perform character segmentation and semantic analysis, and determine whether the overall recognition accuracy reaches the standard threshold by comparing the results before and after.
2. The method for ancient Chinese character image recognition and semantic analysis according to claim 1, characterized in that: The method of scanning the surface of the cultural relic using a scanning device, extracting the original image of the ancient characters containing irregular deformation and material diversity characteristics from the surface of the cultural relic, and processing the original image of the ancient characters to determine the initial data baseline includes: The surface image of the cultural relic is collected by scanning equipment to obtain the original image of the ancient characters; Processing the original image of the ancient characters to remove image noise and obtain a denoised image; Extracting the ancient character image contour from the denoised image to obtain a contour image; Extracting edge information from irregular deformation features in the contour image to obtain an edge image; Determine the deformation distribution area according to the edge image to obtain a deformation area image; Analyzing material diversity from the deformed region image and calculating texture features using a gray-level co-occurrence matrix to obtain texture classification data; After acquiring the texture classification data, applying a convolutional neural network to recognize the ancient character image to obtain a recognition result, determining the character boundary based on the recognition result to obtain a character boundary image, and processing the character boundary image using an image registration method to obtain a corrected image; After obtaining the corrected image, a complete ancient character data set is generated, and the complete ancient character data set is divided using an image segmentation method to obtain a segmented image; For the segmented image, a labeling method is used to determine data consistency to obtain a consistency determination result. If the consistency determination result meets a preset threshold, it is determined that the complete ancient character data set is valid. extracting target ancient character features from the complete ancient character data set to obtain feature data; Based on the feature data, determining the material distribution of the ancient character image to obtain a material distribution result; Adjust the recognition parameters according to the material distribution result to obtain an optimized recognition result; After obtaining the optimized recognition result, the final boundary of the ancient character image is determined to obtain a final boundary image.
3. The method for ancient Chinese character image recognition and semantic analysis according to claim 2, characterized in that: The method of performing image preprocessing on the original image of the ancient characters to eliminate noise and light interference and obtaining a first processed image by calculating local pixel gradients includes: Adaptive filtering algorithm is used to denoise the original image of ancient characters. The weighted average value of local pixels is calculated through a 3×3 convolution kernel to obtain the denoised image. Based on the denoised image, the Sobel operator is used to calculate the gradient components in the x-direction and y-direction, and the gradient magnitude and direction are combined to generate a gradient image; For gradient images, if the difference in the gradient direction of adjacent pixels is greater than 30 degrees, it is determined to be a direction mutation area and the original value is retained without smoothing; The Canny operator is used to detect the edge of the gradient image. Through double threshold judgment and hysteresis threshold processing, significant edge features are extracted to obtain the feature image. According to the difference in pixel grayscale values in the feature image and the 8-neighborhood connectivity judgment, continuous edge points are marked as boundaries to generate a boundary image; For the boundary image, a 3×3 square structure element is used to perform a closing operation, first dilating and then corroding to fill the holes to obtain an optimized image; The effective edge pixel ratio of the optimized image is counted. When the ratio exceeds 60%, it is determined to be a valid processing result and the final image is output.
4. The method for ancient Chinese character image recognition and semantic analysis according to claim 3, characterized in that: The step of extracting stroke features from the first processed image, calculating the main inclination angle based on the distribution range of the stroke features, detecting the line angle, and determining the text inclination measurement value includes: Obtaining stroke features through the first processed image, extracting stroke feature distribution using a convolution operation, and obtaining preliminary stroke distribution data; Extract the stroke distribution pattern from the preliminary stroke distribution data, and use Hough transform to detect the stroke line angle and determine the distribution range of the stroke features; According to the distribution range of stroke features, the main inclination angle is calculated using the angle histogram to obtain the main inclination angle value; According to the main tilt angle value, the preset threshold is used to judge the tilt direction of the text and determine the tilt trend; Through the tilt trend, the metric value is calculated using the angle difference to obtain the quantitative tilt result; Using the quantified tilt results, a preset threshold is used to determine the overall tilt state and determine the text tilt metric value; From the text tilt measurement value, the adjustment parameters are extracted using the angle adjustment function to obtain the basis for text correction.
5. The method for ancient Chinese character image recognition and semantic analysis according to claim 4, characterized in that: The method of performing tilt correction according to the text tilt measurement value, applying affine transformation to adjust the angle of the first processed image, and repairing the deformed area by an interpolation algorithm to obtain the second processed image includes: The character tilt measurement value is obtained by analyzing the stroke features, and the tilt correction requirement is determined using a preset threshold to obtain the correction parameters; Performing tilt correction according to the correction parameters, adjusting the angle of the first processed image using affine transformation to obtain a preliminary adjusted image; Extract the deformed area from the preliminary adjusted image, repair the deformed area using a bilinear interpolation algorithm to obtain a repaired image; The image angle is detected for the restored image. If the angle deviation exceeds the preset threshold, the affine transformation adjustment is repeated to obtain the angle-corrected image. Obtain edge features of the angle-corrected image, determine the restoration integrity of the deformed area by comparing it with the first processed image, and obtain an integrity assessment result; The interpolation algorithm parameters are adjusted according to the integrity assessment results, and a second processed image is generated by optimizing the repaired area.
6. The method for ancient Chinese character image recognition and semantic analysis according to claim 5, characterized in that: The character segmentation is performed on the second processed image, the independent characters are separated by using a region growing algorithm based on stroke features, and the segmented character set is obtained by bounding box detection, including: Extracting stroke features from the second processed image using a preset threshold to obtain an initial feature set; According to the gradient amplitude ranking of the pixels in the initial feature set, the first 10% are selected as seed points of the region growing algorithm, and the region growing algorithm is used to expand the seed points to generate independent character regions; Use the Canny operator to calculate the edge gradient amplitude of the independent character area. If the average gradient amplitude exceeds 50, it is determined to be a clear-boundary area. The minimum bounding rectangle detection is performed on the clear-boundary area to obtain a preliminary character set. Calculate the IoU value of the rectangular boxes in the preliminary character set. If the IoU is greater than 0.3, it is considered overlapping. Segment the overlapping area through vertical projection to obtain the optimized character set. Extract the centroid coordinates, width and height of each character from the optimized character set to form a spatial distribution feature matrix; The DBSCAN clustering algorithm is used to process the feature matrix, with the neighborhood radius set to 1.5 times the average character width and the minimum number of samples set to 2 to obtain the final segmentation set; The characters in the final segmentation set are analyzed for connected domains. If there are multiple disconnected regions, they are considered broken characters. Morphological closing operations are used to repair them and output independent character sequences.
7. The method for ancient Chinese character image recognition and semantic analysis according to claim 6, characterized in that: The method extracts feature vectors from the segmented character set, analyzes stroke features and structural information based on a deep convolutional network, and obtains character recognition results through pre-trained model mapping, including: Separate independent character regions from the binary image through connected component analysis to obtain the initial character image, perform convolution on the initial character image, and extract a 64-dimensional feature vector containing the stroke direction; Input the 64-dimensional feature vector into the pre-trained character embedding model CharBERT, and output a 256-dimensional character semantic vector; Perform principal component analysis on the character semantic vector. When the variance contribution rate of the first principal component exceeds 85%, it is determined to be a valid feature. Use bilinear interpolation to adjust the convolution kernel parameters and regenerate the 128-dimensional optimized feature vector; Calculate the edge gradient amplitude of the 128-dimensional optimized feature vector in the HSV color space. When the maximum gradient value exceeds the preset threshold of 120, it is determined to be a character vector with clear boundaries. Input the character vector with clear boundaries into the character embedding model CharBERT, output the top three candidate character codes, calculate the stroke difference of the candidate character codes based on the Unicode standard font library, and determine the recognition as valid when the minimum difference is less than 5%; Adjust the morphological kernel size for connected domain segmentation based on the stroke difference results, and re-execute the feature extraction process until the error rate is less than 5%; Perform bidirectional longest match on the final recognition result and merge adjacent character codes to generate a complete text sequence.
8. The method for ancient Chinese character image recognition and semantic analysis according to claim 7, characterized in that: The semantic analysis is generated by character recognition results, combined with the ancient character corpus to match context information, and the conditional random field algorithm is used to optimize sequence annotation to obtain the final semantic output, including: The input image is binarized and denoised using TesseractOCR to obtain initial text data. Low-confidence characters are filtered according to a preset character error rate threshold to obtain preliminary text information. Extracting glyph structural features from preliminary text information, calculating edit distance with ancient Chinese character corpus, matching character sequences with an error rate of less than 5 percent, and determining the serialized text content; For the serialized text content, the conditional random field algorithm is used to annotate the character position, number of strokes, and adjacent character categories to obtain the annotated sequence data; According to the character category labels in the annotation sequence, the adjacent label transition probability is analyzed to generate preliminary semantic parsing results; Adjust character annotations based on preset disambiguation rules, including prioritizing high-frequency characters and contextual coherence constraints, to obtain optimized semantic information. The optimized semantics are weightedly matched with the frequency of occurrence of characters in the ancient character library, and the final semantic result is output. If the weighted matching score of the final semantic result is lower than 70%, the feature weights in the conditional random field are recalculated to generate a revised output.
9. The method for ancient Chinese character image recognition and semantic analysis according to claim 8, characterized in that: If the final semantic output does not match the preset threshold, the tilt correction parameter is retroactively adjusted to improve the quality of the second processed image by iteratively optimizing the direction trend calculation, including: Extract SIFT feature points from the input image to generate a semantic description vector. Compare the vector norm with a preset threshold. When the norm is lower than the threshold, use the LM algorithm to optimize the initial tilt parameter matrix and update the parameters to the spatial transformation module. Perform Gaussian pyramid layered calculation on the corrected intermediate data, and calculate the Harris corner motion vector field on each pyramid layer; Adjust the optical flow calculation weight coefficient according to the direction of the principal component of the vector field to generate a dedistorted second image; Extract PSNR and SSIM indicators from the dedistorted second image. When PSNR is lower than 30dB, return to the tilt parameter optimization step. The process is terminated when the cosine similarity between the output image and the semantic description vector reaches more than 90% through SI FT feature matching verification.
10. The method for ancient Chinese character image recognition and semantic analysis according to claim 9, characterized in that: The step of obtaining the optimized second processed image and re-performing character segmentation and semantic analysis, and comparing the results before and after to determine whether the overall recognition accuracy reaches a standard threshold, includes: Obtaining a second processed image and generating an optimized image through preprocessing; A segmentation algorithm is used to perform character segmentation on the optimized image to obtain a character sequence; The BERT model is used to extract semantic information from the character sequence, and the obtained semantic information is compared with the final semantic output to obtain the change in accuracy. If the accuracy rate changes beyond a preset threshold, character segmentation is re-executed by adjusting the segmentation parameters; semantic information is extracted again based on the adjusted character sequence to obtain an updated result; By comparing the updated results with the final semantic output results, it is determined whether the accuracy reaches the preset threshold.
Citation Information
Patent Citations
Tilt correction method and device for hand input
CN102855469A
Method for character recognition based on gabor filters
US20040017944A1