Method and system for determining oracle based on lightweight network model
The oracle bone inscriptions measurement method based on a lightweight network model solves the problems of overfitting and waste of computing resources in oracle bone inscriptions recognition, and achieves fast and accurate oracle bone inscriptions search. It is suitable for scientific research and science popularization, and has good general applicability.
Patent Information
- Application Number
- CN202410759312.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-09-06
AI Technical Summary
The existing technology has the problems of over-fitting and waste of computing resources in oracle bone inscription recognition, and the manual search speed is slow, making it difficult to meet the rapid search requirements of scientific research or popular science.
An oracle bone inscription measurement method based on a lightweight network model is designed, including glyph file extraction, deep reinforcement learning model training, glyph image recognition and word key information matching. It uses depth separable convolution and hardware activation function to reduce parameters and Reduce the amount of calculation and improve the recognition accuracy.
It achieves fast and accurate Oracle search, with a single search time of 0.5 seconds and a top-1 accuracy of 98%, which is better than existing methods and has good versatility and is suitable for mobile terminals and embedded devices.
Smart Images

Figure CN118609141A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning technology, and in particular to an oracle bone inscription determination method and system based on a lightweight network model. Background Art
[0002] Since the discovery of oracle bone inscriptions in 1899, countless oracle bone inscriptions have been unearthed in the past 100 years, spanning Henan and Shaanxi in terms of region, and spanning from the Shang Dynasty to the Spring and Autumn Period in terms of time. For these newly discovered oracle bone inscriptions, the ancients and moderns have combined their thoughts and proposed many characteristic methods for identification. Kong Anguo's restoration of the Book of Documents provides us with inspiration. In some later ancient characters, there are many classics, many of which have been passed down, so that we can compare the interpretation of the oracle bone characters one by one through the classics and ancient characters preserved today.
[0003] However, the comparison work is complicated and tedious, and the manual search is slow, which consumes a lot of unnecessary time. It is worth thinking about how to use the existing image classification deep learning framework to quickly and accurately meet the search requirements of scientific research or popular science. Therefore, it is very important to build a network model suitable for oracle bone inscriptions Chinese character recognition and classification. Classic image classification neural network models include AlexNet, VGG, GoogleNet, ResNet and DenseNet. AlexNet is a milestone in deep learning. It made a major breakthrough in the ImageNet image recognition challenge in 2012. VGG is a convolutional neural network model with a depth of 16 to 19 layers, which is simple and easy to understand. VGG constructs a deep network by stacking multiple small-sized convolution kernels and pooling layers to extract rich image features. GoogleNet uses the "Inception" module to capture features of different scales through multiple parallel convolution operations. This modular design makes the network have high computational efficiency and good performance. ResNet is a deep convolutional neural network model with residual connections, which solves the gradient disappearance problem in deep network training. Residual connections allow information to skip some layers directly in the network, which helps improve the training effect and accuracy of the network.
[0004] Increasing the depth of a neural network can improve its performance, but this also brings two major problems. First, increasing the depth of the network may lead to overfitting, that is, the network performs too well on the training data, but performs poorly on new data. The second problem is the waste of computational resources in deep networks. Since there are a large number of neurons in deep networks whose activation function outputs are zero, these neurons do not contribute to the final output. Summary of the invention
[0005] The purpose of the present invention is to provide an oracle bone inscription determination method and system based on a lightweight network model.
[0006] To achieve this purpose, the present invention designs an oracle bone determination method based on a lightweight network model, which includes the following steps:
[0007] Step 1: extract the glyph files from the existing oracle bone script library files, and convert the glyph files into recognizable images to obtain an oracle bone script font image library;
[0008] Step 2: Using the oracle bone inscriptions font image library, a deep reinforcement learning model is obtained based on lightweight network model training;
[0009] Step 3: The oracle bone script image to be measured is identified through the deep reinforcement learning model to obtain the corresponding Chinese character corresponding to the oracle bone script;
[0010] Step 4: Match the existing oracle bone dictionary with the oracle bone dictionary to obtain the key information of each oracle bone word in the existing oracle bone dictionary;
[0011] Step 5: Establish an oracle bone word database based on the key information of oracle bone words, and use the deep reinforcement learning model to identify the corresponding Chinese characters of the oracle bone words, and put them into the oracle bone word database to obtain complete oracle bone information.
[0012] An oracle bone inscription determination system based on a lightweight network model includes a glyph file extraction module, a deep reinforcement learning model training module, an oracle bone inscription glyph image recognition module, an oracle bone inscription word key information matching module and an oracle bone inscription information query module:
[0013] The glyph file extraction module is used to extract glyph files from existing oracle bone script library files and convert the glyph files into recognizable pictures to obtain an oracle bone script font picture library;
[0014] The deep reinforcement learning model training module is used to obtain a deep reinforcement learning model based on a lightweight network model training by using an oracle bone inscription font image library;
[0015] The oracle bone script image recognition module is used to identify the oracle bone script image to be measured through a deep reinforcement learning model to obtain the corresponding Chinese character corresponding to the oracle bone script;
[0016] The oracle word key information matching module is used to match the existing oracle word dictionary with the oracle word dictionary to obtain the key word information of each oracle word in the existing oracle word dictionary;
[0017] The oracle bone script information query module is used to establish an oracle bone script word database through the key information of the oracle bone script words, and to identify the corresponding Chinese characters of the corresponding oracle bone script shapes through the deep reinforcement learning model, and put them into the oracle bone script word database to obtain complete oracle bone script information.
[0018] Beneficial effects of the present invention:
[0019] 1. The present invention uses the Zhejiang Normal University oracle bone script dictionary / lexicon as a training data set and provides a complete oracle bone script image-character-word-pinyin database, which greatly improves the speed of systematic search for oracle bone scripts, fills in the search gaps, and provides effective assistance for the scientific research of oracle bone scripts.
[0020] 2. Use lightweight neural network models to reduce parameters and calculations while improving accuracy. Later, it can be used on various mobile terminals including mobile phones and embedded devices such as Atlas 2000, and has good versatility.
[0021] 3. The search time for a single oracle is accurate to 0.5 seconds, and the top-1 accuracy is above 98%, which is better than most existing oracle search methods. For example, the search time of AlexNet is 1.1 seconds, and the top-1 accuracy is only 86%, and the search time of Inception-V3 is 1.3 seconds, and the top-1 accuracy is 96%. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 This is a flow chart of the oracle bone determination method;
[0023] Figure 2 Lightweight network model structure diagram;
[0024] Figure 3 It is the downsampling layer module;
[0025] Figure 4 It is the feature vector extraction module;
[0026] Figure 5 This is an example of a convolution module;
[0027] Figure 6 It is a structural schematic diagram of the present invention. DETAILED DESCRIPTION
[0028] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments:
[0029] Example 1
[0030] like Figure 1 A method for determining oracle bone inscriptions based on a lightweight network model is shown, which comprises the following steps:
[0031] Step 1: extract the glyph files from the existing oracle bone script library files, and convert the glyph files into recognizable images to obtain an oracle bone script font image library;
[0032] Step 2: Using the oracle bone inscriptions font image library, a deep reinforcement learning model is obtained based on lightweight network model training;
[0033] Step 3: The oracle bone script image to be measured is identified through the deep reinforcement learning model to obtain the corresponding Chinese character corresponding to the oracle bone script;
[0034] Step 4: Match the existing oracle bone dictionary with the oracle bone dictionary to obtain the key information of each oracle bone word in the existing oracle bone dictionary;
[0035] Step 5: Establish an oracle bone word database based on the key information of oracle bone words, and use the deep reinforcement learning model to identify the corresponding Chinese characters of the oracle bone words, and put them into the oracle bone word database to obtain complete oracle bone information.
[0036] The step 1: extracting the glyph files from the existing oracle bone script library files and converting the glyph files into recognizable pictures to provide a training data set for the following steps. The specific method for obtaining the oracle bone script glyph picture library is:
[0037] Font information is extracted based on all glyph files of the existing oracle bone script library. In the present invention, the font glyphs in the ttf file are used. The position information of the glyph black pixel value is obtained by the fontforge tool. A Python program for image processing based on the position information is written to obtain a transparent oracle bone script font template with unequal length and width, which is between 120-220 pixels. The oracle bone script font template is placed in the center of the white background. After scaling, an oracle bone script glyph image with equal length and width and uniform size of the first preset size is obtained. The present invention is a png format image of 400*400 pixels; the oracle bone script font image library contains a total of m oracle bone script glyph images of different specified formats, and m is 13038 in the present invention. The glyphs all correspond to an oracle bone script glyph image of the first preset size, so as to construct a training object of a lightweight neural network. It is used to establish an oracle bone script glyph image library as a lightweight model training set.
[0038] like Figure 2 to Figure 4 As shown, the specific method of step 2 using the oracle bone inscription font image library to obtain a deep reinforcement learning model based on lightweight network model training is:
[0039] Step 2-1: The oracle bone script glyph image library data is an oracle bone script glyph image of a first preset size. During training, the oracle bone script glyph image i of the first preset size, 1≤i≤m, m is the number of oracle bone script glyph images in the oracle bone script font image library, is further scaled as a whole to obtain an oracle bone script glyph image of a second preset size, which is 48*48 pixels in the present invention. Under the premise of ensuring that the key pixel point information of the image is not lost, that is, the relative position information is not lost, the oracle bone script font image of the second preset size is data enhanced to meet the recognition accuracy and robustness of the neural network. Since various distortions, color inconsistencies, deformations, quality degradation, and blurring may occur in actual application scenarios, the present invention scales the size of the oracle bone script image each time a new sample i′ is generated, and then randomly selects three enhancement methods from five different enhancement methods, namely rotation, brightness, contrast, affine, and Gaussian noise, and sets a uniform enhancement amplitude with a gradient of 10% according to the degree of change, to finally obtain an enhanced oracle bone script glyph image.
[0040] Step 2-2: randomly select a certain proportion of the data in the enhanced oracle bone script image library data, 30% in the present invention, and use an image enhancement method that adjusts the overall quality and local features simultaneously by global distortion and local distortion, to simulate the morphology of ancient oracle bone script Chinese characters and use it as a test set;
[0041] Global distortion is used to change the overall oracle bone script morphology, and local distortion is used to change the local vector features of the oracle bone script, so as to simulate the inscription state of the ancient text on the stone tablet as much as possible; global distortion is achieved by random affine transformation, and the local distortion operation first selects a specific area containing oracle bone script in the oracle bone script image i, and then applies coordinate offsets Δx, Δy and grayscale offset Δg to the area p to generate a new image area p′. The calculation formula is as follows:
[0042] p′=p+Δp=(x+Δx,y+Δy,g+Δg) (1)
[0043] Among them, x and y are the horizontal and vertical coordinates, g is the image grayscale value, and Δp is the overall offset.
[0044] Step 2-3: Randomly adjust the initial weight of the model for the oracle bone script glyph image through the python3.0 framework, and put the enhanced oracle bone script glyph image into the lightweight network learning model;
[0045] Since the data set is rare and unique, the model initialization weights of the present invention are randomly generated in the python framework to achieve the best training effect. The weights include the weight matrix and bias vector parameters of each layer of the model.
[0046] Step 2-4: The lightweight network model is trained by using a convolutional neural network based on deep separable convolution and reducing the number of channels in each layer. The specific training process is as follows:
[0047] The enhanced oracle bone script glyph image is subjected to a 1×1 convolution layer, a batch normalization layer BN layer and a hard-swish activation function to obtain a feature map of a third preset size, which is 24×24×64 pixels in the present invention. The feature map of the third preset size is then input into an inverse residual combination layer with a channel number of 24, and the size is reduced to obtain a feature map of a fourth preset size, which is 12×12×64 pixels in the present invention. The feature map is then input into two inverse residual combination layers with a channel number of 32, five inverse residual combination layers with a channel number of 64 and three inverse residual combination layers with a channel number of 128 in turn to obtain a classification feature map of each category.
[0048] The specific calculation methods of activation functions Relu6 and hard-swish are as follows:
[0049] Relu6:f(x)=min(max(0,x),6) (2)
[0050]
[0051] Depthwise separable convolution includes depthwise convolution and pointwise convolution. In depthwise convolution, one convolution kernel corresponds to one input channel, and one channel is convolved by only one convolution kernel; while pointwise convolution uses a 1x1xM convolution kernel. This implementation method uses depthwise convolution to convolve different input channels separately, and then uses pointwise convolution to perform weighted combination of the above outputs in the depth direction. Under the condition of ensuring accuracy, the number of calculation parameters is reduced from 14.15 million of traditional convolution layers to 2.31 million, and the calculation time is reduced from 2.15 seconds to 0.36 seconds.
[0052] Step 2-5: Each detection branch extracts feature maps of different steps and sends them to the feature fusion module. After performing the nearest neighbor interpolation and superposition processing on each feature map, the corresponding feature maps are output to their respective context units.
[0053] Specifically, the lightweight neural network captures features at different levels by setting different branches or modules in the network. These branches or modules usually have different receptive fields and resolution feature maps so as to extract features at different semantic levels. At the same time, the present invention selects the nearest neighbor interpolation method to adjust the resolution by copying the nearest pixel value.
[0054] When performing feature fusion, feature maps with higher resolution and richer semantic information are usually selected and fed into the context unit. These feature maps may come from deeper layers of the network, because deep feature maps have higher-level semantic information and are more useful for tasks such as object detection. On the other hand, feature maps in shallower layers usually have higher spatial resolution and can capture the details and edge information of the object. These feature maps can be upsampled by nearest neighbor interpolation to match the resolution of feature maps from other different steps, and then superimposed with feature maps from other different steps. The corresponding feature maps are output to their respective context units.
[0055] Step 2-6: Use the cross entropy loss function to calculate the loss function of the feature map, and use the back propagation algorithm to derive the model parameters according to the loss value of the current classification of the model, calculate the contribution of each parameter to the loss, and use this to calculate the gradient of each parameter to adjust the back propagation rate. The calculation formula of the back propagation algorithm is as follows:
[0056]
[0057]
[0058] Where α is the learning rate, J(W,b) is the loss function, and W ij is the value of the jth weight parameter of the i-th layer, b i is the update formula of the bias of the i-th layer, is the value of the jth updated weight parameter in the i-th layer and b i l is the update formula of the bias of the i-th layer after updating. W in J represents the weight parameters of all layers in the neural network, and b represents the bias parameters of all layers in the neural network.
[0059] Determine the cross entropy loss function obtained by the back propagation algorithm during training Whether it converges to 0.03 bits or less, if not, proceed to the next step; if yes, but the accuracy is less than 90%, then re-perform the data enhancement method of steps 2-1 to 2-2 on the data set, and re-perform steps 2-3 to 2-6; if yes, and the accuracy reaches more than 90%, output the deep reinforcement learning model with the highest accuracy and clear weight parameters;
[0060] The calculation formula of the cross entropy loss function is as follows, where N is the number of images, C is the number of categories, and Loss is the loss:
[0061]
[0062] where p n,c is the model prediction distribution, y n,c is the true distribution of the sample
[0063] Step 2-6-1: Update the training weight parameters according to the convergence result of the loss function, and continuously iterate to complete the optimization of the weight parameters;
[0064] Step 2-6-2: Initialize the model, re-extract the image, and go to step 2-3 to reduce the loss.
[0065] After completing step 2, you can obtain a trained lightweight model that can recognize oracle bone script images to meet the recognition requirements in different environments mentioned in step 3.
[0066] Step 3: To address the unclear recognition problem of scientific research oracle bone inscriptions, we introduced data enhancement methods for targeted training to ensure that the oracle bone inscriptions can be accurately recognized in various scientific research environments. At the same time, we also ensured that the model can judge the oracle bone inscriptions in daily environments. The Top-1 probability of single font recognition is above 95%, which allows archaeologists to quickly and accurately recognize oracle bone inscriptions under different conditions.
[0067] The specific method of step 3 is to identify the oracle bone script image to be measured through the deep reinforcement learning model to obtain the corresponding Chinese character of the oracle bone script:
[0068] Step 3-1: Put the oracle bone script image to be recognized into the prediction folder;
[0069] Specifically, the sampler takes pictures or captures the oracle bone characters that need to be identified according to various demand environments, such as the oracle bone inscriptions images scanned during scientific research, and puts the collected pictures into the prediction folder;
[0070] Step 3-2: With the help of the python language image processing function, the grayscale value of the oracle bone glyph image to be identified is converted, and then the shape function in the python image class is used to crop it into a square image of the fifth preset size. The present invention is a square image of 48*48 pixels. Finally, the image tensor of the oracle bone glyph image to be identified is expanded through the unsqueeze function; the reason for choosing an image of 48*48 pixels is that it reduces the image's occupancy of computer memory while retaining complete information, so as to meet the test in a batch size of 64 and ensure the accuracy of the test classification. As for the unsqueeze function, its function is to expand the dimension of the tensor and add a dimension of size 1 at the specified position to meet the conditions for performing operations with other tensors in data processing.
[0071] Step 3-3: For each oracle bone script image to be recognized, adjust the model to the evaluation mode, wherein each input image tensor, in the present invention, complies with the batch size (batch size) of 64, the number of channels is 1, the height is 128, and the width is 128, so as to ensure that the input data is consistent with the expected input size of the model to avoid errors caused by dimension mismatch;
[0072] In this step, batch size refers to the number of samples processed simultaneously during training or inference, which affects the performance, convergence speed, and memory consumption of the model. The number of channels refers to the number of independent channels in the input data or feature map. Since the test image is transmitted into the model as a grayscale image, the number of channels is set to 1. The number of channels, height, and width play an important role in the design of convolutional neural networks and image processing. They determine the shape of the input data and the organization of features, and also affect the layer parameters and computational complexity of the convolutional neural network.
[0073] Step 3-4: Through forward propagation, the oracle bone script image vector to be recognized is input into the lightweight network model for layer-by-layer calculation and conversion. Through the depth-separable convolution, linear bottleneck, and inverted residual lightweight network structure, the feature extraction of the oracle bone script image vector data to be recognized is performed;
[0074] Depthwise separable convolution: Figure 5 The figure shows that the convolution operation is divided into deep convolution and point-by-point convolution. The deep convolution uses a small-size convolution kernel to extract the image feature X of the oracle bone script image to be recognized. The point-by-point convolution then linearly combines the results of the deep convolution to obtain the convolution layer output feature X of the oracle bone script image to be recognized. p1 ;
[0075] Linear bottleneck: First, use 1*1 convolution to transform the input feature X of the oracle bone script image to be recognized. p Dimensionality reduction, and then adjust the input depth separable convolutional layer output feature X through the nonlinear activation function H-Swish p1 , and continue to enter the depth-separable stacked convolution training to obtain the output feature X with 128 dimensional subdivisions p2 ;
[0076] Inverse residual: For the obtained X p2 , using the bottleneck layer, the 1*1 convolution kernel is used to reduce the computational complexity and dimension. After the depth-separable convolution kernel, the spatial resolution of the feature map is restored by upsampling. Finally, the upsampled oracle bone script image detail features to be recognized are compared with the bottleneck layer output feature X output by the bottleneck layer. p3Multiply them together, and finally output the complete oracle bone script image feature X' that needs to be recognized to complete feature recognition extraction. The depth-separable convolution will extract X in the above step for each input image. p1 , X p2 , X p3 Perform feature calculations to meet the classification requirements of oracle bone script images. Convolutional features include spatial position information and information integration between feature channels. Upsampling features include image spatial distribution and detail stepping before outputting features.
[0077] Step 3-5: Perform global average pooling or global maximum pooling on the feature vector of the oracle bone script image to be recognized obtained by forward propagation, and convert the feature vector into a fixed-length representation, which will be mapped to the final output space through a fully connected layer or a convolutional layer; wherein, global average pooling is: averaging the features of each channel of the entire feature map to obtain a feature vector with a constant number of channels;
[0078] Global maximum pooling is: When focusing on explicit features, global maximum pooling can help highlight important structures or textures in the image while reducing the number of parameters and computation of the model.
[0079] Step 3-6: Use the softmax function to perform the final classification on the output feature X' of the oracle bone script image to be recognized, map the classification results of the output feature X' of the oracle bone script image to be recognized to the representation vectors of the different Chinese character categories represented by each oracle bone script, select the top five categories with the highest output probability as the final classification results, and return the type number and confidence corresponding to the final classification result. If the highest confidence is lower than 75%, return an error result and add the new data obtained after the oracle bone script image data enhancement for training; if the highest confidence is higher than 75%, perform boundary processing on the original image according to the obtained image type number to correspond to the oracle bone script library, and return the final detection result, and the output category accurately obtains the correct Chinese character corresponding to the oracle bone script.
[0080] The softmax function converts a set of real numbers into values representing probability distribution, so that the probability of each category is between 0 and 1, and the sum of the probabilities of all categories is 1. Specifically, it converts the unnormalized classification score tensor obtained by calculation into classification probability, and outputs the top five categories to obtain the confidence of the image. Users can accurately obtain the correct Chinese characters corresponding to the oracle bone script through the output categories.
[0081] Step 4: The specific method of matching the existing oracle bone script dictionary with the oracle bone script dictionary to obtain the key information of each oracle bone script in the existing oracle bone script dictionary is as follows:
[0082] The oracle-bone script dictionary and the oracle-bone script dictionary are matched one-to-one through modern Chinese characters. The Chinese characters in the oracle-bone script dictionary can be found in the corresponding specific pages in the oracle-bone script dictionary. At the same time, the complete word order relationship of the existing oracle-bone script can be found in the oracle-bone script dictionary, and the key information of the oracle-bone script words can be obtained. Each entry is saved in the font file through screenshots to obtain the complete key information of the oracle-bone script words, which is ready for establishing the oracle-bone script database in step 5.
[0083] Step 5: Establish an oracle bone word database based on the key information of oracle bone words, and identify the corresponding Chinese characters of the oracle bone words through the deep reinforcement learning model, and put them into the oracle bone word database to obtain complete oracle bone information. The specific method is:
[0084] Step 5-1: Establish an oracle database through the key information of the word found, wherein the word information includes the character category to which the character belongs and the character number itself, the page number of the oracle dictionary, the page number of the oracle dictionary, and the page number of the character category entry;
[0085] Step 5-2: Through the modern Chinese language system architecture, add the pinyin and tones of Chinese characters into the database to complete the information search method;
[0086] Step 5-3: Pinyin recognition and Chinese character recognition are performed through corresponding database entries to obtain complete oracle bone inscription information;
[0087] Step 5-4: Photo recognition uses the trained lightweight network model to build an API interface, identify the oracle bone script image under different input conditions, and return the oracle bone script database constraint primary key. Based on the primary key, the complete oracle bone script information is obtained, and the function is completed.
[0088] Example 2
[0089] An oracle bone inscription determination system based on a lightweight network model includes a glyph file extraction module, a deep reinforcement learning model training module, an oracle bone inscription glyph image recognition module, an oracle bone inscription word key information matching module and an oracle bone inscription information query module, such as Figure 6 As shown:
[0090] The glyph file extraction module is used to extract glyph files from existing oracle bone script library files and convert the glyph files into recognizable pictures to obtain an oracle bone script font picture library;
[0091] The deep reinforcement learning model training module is used to obtain a deep reinforcement learning model based on a lightweight network model training by using an oracle bone inscription font image library;
[0092] The oracle bone script image recognition module is used to identify the oracle bone script image to be measured through a deep reinforcement learning model to obtain the corresponding Chinese character corresponding to the oracle bone script;
[0093] The oracle word key information matching module is used to match the existing oracle word dictionary with the oracle word dictionary to obtain the key word information of each oracle word in the existing oracle word dictionary;
[0094] The oracle bone script information query module is used to establish an oracle bone script word database through the key information of the oracle bone script words, and to identify the corresponding Chinese characters of the corresponding oracle bone script shapes through the deep reinforcement learning model, and put them into the oracle bone script word database to obtain complete oracle bone script information.
[0095] Example 3
[0096] A computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in Example 1 when executed by a processor.
[0097] Example 4
[0098] An electronic device comprises: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the steps of the method described in Example 1 by executing the computer instructions.
[0099] Example 5
[0100] A computer program product includes a computer program, wherein the computer program implements the steps of the method described in Example 1 when executed by a processor.
[0101] The contents not described in detail in this specification belong to the prior art known to professional and technical personnel in this field.
Claims
1. A method for determining oracle bone inscriptions based on a lightweight network model. Features: It includes the following steps: Step 1: extract the glyph files from the existing oracle bone script library files, and convert the glyph files into recognizable images to obtain an oracle bone script font image library; Step 2: Using the oracle bone inscriptions font image library, a deep reinforcement learning model is obtained based on lightweight network model training; Step 3: The oracle bone script image to be measured is identified through the deep reinforcement learning model to obtain the corresponding Chinese character corresponding to the oracle bone script; Step 4: Match the existing oracle bone dictionary with the oracle bone dictionary to obtain the key information of each oracle bone word in the existing oracle bone dictionary; Step 5: Establish an oracle bone word database based on the key information of oracle bone words, and use the deep reinforcement learning model to identify the corresponding Chinese characters of the oracle bone words, and put them into the oracle bone word database to obtain complete oracle bone information.
2. The oracle bone inscription determination method based on a lightweight network model according to claim 1, Features: The specific method of step 1: extracting the glyph files from the existing oracle bone script library files and converting the glyph files into recognizable pictures to obtain the oracle bone script font picture library is as follows: Font information is extracted based on all glyph files in the existing oracle bone script library to obtain the position information of the black pixel value of the glyph, and the oracle bone script font template is processed to generate an oracle bone script glyph image of a first preset size. The oracle bone script font image library contains a total of m oracle bone script glyph images of different specified formats, and each oracle bone script glyph corresponds to an oracle bone script glyph image of a first preset size, so as to construct a training object for a lightweight neural network.
3. The oracle bone inscription determination method based on a lightweight network model according to claim 1, Features: The specific method of step 2 using the oracle bone inscription font image library to obtain a deep reinforcement learning model based on lightweight network model training is: Step 2-1: The oracle bone script font image library data is an oracle bone script glyph image of a first preset size. During training, the oracle bone script glyph image i of the first preset size, 1≤i≤m, m is the number of oracle bone script glyph images in the oracle bone script font image library, is further scaled as a whole to obtain an oracle bone script glyph image of a second preset size, and data enhancement is performed on the oracle bone script font image of the second preset size to finally obtain an enhanced oracle bone script glyph image; Step 2-2: Randomly select a certain proportion of the data in the enhanced oracle bone script image library data, use the image enhancement method that adjusts the overall quality and local features simultaneously by global distortion and local distortion, simulate the morphology of oracle bone script Chinese characters written in ancient texts and use it as a test set; Global distortion is used to change the overall oracle bone script shape, and local distortion is used to change the local vector features of the oracle bone script; The global distortion is achieved by random affine transformation. The local distortion operation first selects a specific area containing oracle bone glyphs in the oracle bone glyph image i, and then applies coordinate offsets Δx, Δy and grayscale offset Δg to the area p to generate a new 'image area p. The calculation formula is as follows: p′=p+Δp=(x+Δx,y+Δy,g+Δg) (1) Among them, x and y are horizontal and vertical coordinates, g is the image gray value, and Δp is the overall offset; Step 2-3: Randomly adjust the initialization weight of the lightweight network model for the oracle bone script glyph image, and put the enhanced oracle bone script glyph image into the lightweight network learning model; Step 2-4: The lightweight network model uses a convolutional neural network based on deep separable convolution and trains by reducing the number of channels in each layer of the convolutional neural network. The specific training process is as follows: The enhanced oracle bone script glyph image is passed through a convolution layer, a batch normalization layer BN layer and a hard-swish activation function to obtain a feature map of a third preset size, and then the feature map of the third preset size is input into an inverse residual combination layer and reduced in size to obtain a feature map of a fourth preset size, and then the feature maps are sequentially input into other different inverse residual combination layers to obtain classification feature maps of glyphs represented by different oracle bone script glyphs; The specific calculation methods of activation functions Relu6 and hard-swish are as follows: Relu6:f(z)=min(max(0,z),6) (2) Where z is the input feature map vector; Step 2-5: Each detection branch extracts feature maps of different steps and sends them to the feature fusion module. After performing the nearest neighbor interpolation and superposition processing on each feature map, the corresponding feature maps are output to their respective context units. Step 2-6: Use the cross entropy loss function to calculate the loss function of the feature map, and use the back propagation algorithm to derive the model parameters according to the loss value of the current classification of the model, calculate the contribution of each parameter to the loss, and use this to calculate the gradient of each parameter to adjust the back propagation rate. The calculation formula of the back propagation algorithm is as follows: Where α is the learning rate, J(W,b) is the loss function, and W ij is the value of the jth weight parameter of the i-th layer, b i is the update formula of the bias of the i-th layer, is the value of the jth updated weight parameter in the i-th layer and is the update formula of the bias of the i-th layer after updating, W in J represents the weight parameters of all layers in the neural network, and b represents the bias parameters of all layers in the neural network; Determine the cross entropy loss function obtained by the back propagation algorithm during training Whether it converges to 0.03 bits or less, if not, proceed to the next step; if yes, but the accuracy is less than 90%, then repeat the data enhancement method of steps 2-1 to 2-2 on the data set, and repeat steps 2-3 to 2-6; If yes, and the accuracy is above 90%, output the deep reinforcement learning model with the highest accuracy and clear weight parameters; The calculation formula of the cross entropy loss function is as follows, where N is the number of images, C is the number of categories, and Loss is the loss: where p n,c is the model prediction distribution, y n,c is the true distribution of the sample; Step 2-6-1: Update the training weight parameters according to the convergence result of the loss function, and continuously iterate to complete the optimization of the weight parameters; Step 2-6-2: Initialize the model, re-extract the image, and go to steps 2-3 to 2-6.
4. The oracle bone inscription determination method based on a lightweight network model according to claim 1, Features: The specific method of step 3 is to identify the oracle bone script image to be measured through the deep reinforcement learning model to obtain the corresponding Chinese character of the oracle bone script: Step 3-1: Put the oracle bone script image to be recognized into the prediction folder; Step 3-2: Using the language image processing function, the oracle bone script image to be recognized is converted into grayscale values, and then the oracle bone script image to be recognized is cropped into an image of the fifth preset size, and finally the image tensor of the oracle bone script image to be recognized is expanded through the expansion function; Step 3-3: For each oracle bone script image, adjust the lightweight network model to the evaluation mode; Step 3-4: Through forward propagation, the oracle bone script image vector to be recognized is input into the lightweight network model for layer-by-layer calculation and conversion. Through the depth-separable convolution, linear bottleneck, and inverted residual lightweight network structure, the input oracle bone script image vector data to be recognized is subjected to feature extraction; the depth-separable convolution is divided into depth-wise convolution and point-wise convolution, where the depth-wise convolution uses a small-size convolution kernel to extract the image feature X of the oracle bone script image to be recognized, and the point-by-point convolution then linearly combines the results of the depth-wise convolution to obtain the convolution layer output feature X of the oracle bone script image to be recognized. p1 ; Linear bottleneck: First, use 1*1 convolution to transform the input feature X of the oracle bone script image to be recognized. p Dimensionality reduction, and then adjust the input depth separable convolutional layer output feature X through the nonlinear activation function H-Swish p1 , and continue to enter the depth-separable stacked convolution training to obtain the output feature X with 128 dimensional subdivisions p2 ; Inverse residual: For the obtained X p2 , using the bottleneck layer, the 1*1 convolution kernel is used to reduce the computational complexity and dimension. After the depth-separable convolution kernel, the spatial resolution of the feature map is restored by upsampling. Finally, the upsampled oracle bone script image detail features to be recognized are compared with the bottleneck layer output feature X output by the bottleneck layer. p3 Multiply them together, and finally get the complete output feature X' of the oracle bone script image to be recognized, completing feature recognition and extraction; Step 3-5: Perform global average pooling or global maximum pooling on the feature vector of the oracle bone script image to be recognized obtained by forward propagation, and convert the feature vector into a fixed-length representation. The fixed-length representation will be mapped to the final output space through a fully connected layer or a convolutional layer; Step 3-6: Use the softmax function to perform the final classification on the output feature X' of the oracle bone script image to be recognized, map the classification result of the output feature X' of the oracle bone script image to be recognized to the representation vector of the different Chinese character categories represented by each oracle bone script, select the top five categories with the output probability as the final classification result, and return the type number and confidence corresponding to the final classification result. If the highest confidence is lower than the threshold, return an error result and add the new data obtained after the oracle bone script image data enhancement to repeat steps 3-1 to 3-6 for training; if the highest confidence is higher than the threshold, perform boundary processing on the original image according to the obtained image type number to correspond to the oracle bone script library, and return the final detection result. The output category accurately obtains the correct Chinese character corresponding to the oracle bone script.
5. The oracle bone inscription determination method based on a lightweight network model according to claim 1, Features: The specific method of step 4 matching the existing oracle bone script dictionary with the oracle bone script dictionary to obtain the key information of each oracle bone script in the existing oracle bone script dictionary is: The oracle bone script dictionary and the oracle bone script dictionary are matched one-to-one through modern Chinese characters. The Chinese characters in the oracle bone script dictionary can be found in the corresponding specific page numbers in the oracle bone script dictionary. At the same time, the complete word order relationship of the existing oracle bone script can be found in the oracle bone script dictionary, and the key information of the oracle bone script words can be obtained.
6. The oracle bone inscription determination method based on a lightweight network model according to claim 1, Features: The specific method of step 5, establishing an oracle bone word database through the key information of oracle bone words, and identifying the corresponding Chinese characters of the oracle bone words through the deep reinforcement learning model, and putting them into the oracle bone word database to obtain complete oracle bone information is as follows: Step 5-1: Establish an oracle database through the key information of the word found, wherein the word information includes the character category to which the character belongs and the character number itself, the page number of the oracle dictionary, the page number of the oracle dictionary, and the page number of the character category entry; Step 5-2: Through the modern Chinese language system architecture, add the pinyin and tones of Chinese characters into the database to complete the information search method; Step 5-3: Pinyin recognition and Chinese character recognition are performed through corresponding database entries to obtain complete oracle bone inscription information; Step 5-4: Photo recognition uses the trained lightweight network model to build an API interface, identify the oracle bone script image under different input conditions, and return the oracle bone script database constraint primary key to obtain complete oracle bone script information based on the primary key.
7. An oracle bone determination system based on a lightweight network model, Features: It includes a glyph file extraction module, a deep reinforcement learning model training module, an oracle glyph image recognition module, an oracle word key information matching module, and an oracle information query module: The glyph file extraction module is used to extract glyph files from existing oracle bone script library files and convert the glyph files into recognizable pictures to obtain an oracle bone script font picture library; The deep reinforcement learning model training module is used to obtain a deep reinforcement learning model based on a lightweight network model training by using an oracle bone inscription font image library; The oracle bone script image recognition module is used to identify the oracle bone script image to be measured through a deep reinforcement learning model to obtain the corresponding Chinese character corresponding to the oracle bone script; The oracle word key information matching module is used to match the existing oracle word dictionary with the oracle word dictionary to obtain the key word information of each oracle word in the existing oracle word dictionary; The oracle bone script information query module is used to establish an oracle bone script word database through the key information of the oracle bone script words, and to identify the corresponding Chinese characters of the corresponding oracle bone script shapes through the deep reinforcement learning model, and put them into the oracle bone script word database to obtain complete oracle bone script information.
8. A computer-readable storage medium storing a computer program, Features: When the computer program is executed by a processor, the steps of the method according to claim 1 are implemented.
9. An electronic device, It is characterized in that include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the steps of the method as claimed in claim 1 by executing the computer instructions.
10. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method described in claim 1 are implemented.
Citation Information
Cited By
Training method and device for oracle single-character image reasoning task
CN120997850A
